More clang warning fixes.
Mostly unused functions and variables removed. BUG=None TEST=ninja -C out/Debug most ninja -C out/Release most R=bsalomon@google.com, caryclark@google.com, robertphillips@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/27933002 git-svn-id: http://skia.googlecode.com/svn/trunk@11884 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
f642f8cf90
commit
4b7d673089
@ -147,21 +147,11 @@ private:
|
||||
typedef SkBenchmark INHERITED;
|
||||
};
|
||||
|
||||
static inline SkIRect make_simple_rect(SkRandom&, int index, int numRects) {
|
||||
SkIRect out = {0, 0, GENERATE_EXTENTS, GENERATE_EXTENTS};
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) {
|
||||
SkIRect out = {0, 0, index + 1, index + 1};
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_concentric_rects_decreasing(SkRandom&, int index, int numRects) {
|
||||
SkIRect out = {0, 0, numRects - index, numRects - index};
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_XYordered_rects(SkRandom& rand, int index, int numRects) {
|
||||
SkIRect out;
|
||||
out.fLeft = index % GRID_WIDTH;
|
||||
@ -179,15 +169,6 @@ static inline SkIRect make_YXordered_rects(SkRandom& rand, int index, int numRec
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_point_rects(SkRandom& rand, int index, int numRects) {
|
||||
SkIRect out;
|
||||
out.fLeft = rand.nextU() % GENERATE_EXTENTS;
|
||||
out.fTop = rand.nextU() % GENERATE_EXTENTS;
|
||||
out.fRight = out.fLeft + (GENERATE_EXTENTS / 200);
|
||||
out.fBottom = out.fTop + (GENERATE_EXTENTS / 200);
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) {
|
||||
SkIRect out;
|
||||
out.fLeft = rand.nextS() % GENERATE_EXTENTS;
|
||||
@ -197,15 +178,6 @@ static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects)
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline SkIRect make_large_rects(SkRandom& rand, int index, int numRects) {
|
||||
SkIRect out;
|
||||
out.fLeft = rand.nextU() % GENERATE_EXTENTS;
|
||||
out.fTop = rand.nextU() % GENERATE_EXTENTS;
|
||||
out.fRight = out.fLeft + (GENERATE_EXTENTS / 3);
|
||||
out.fBottom = out.fTop + (GENERATE_EXTENTS / 3);
|
||||
return out;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_BENCH(
|
||||
|
@ -206,8 +206,6 @@ typedef GrContextFactory::GLContextType GLContextType;
|
||||
static const GLContextType kNative = GrContextFactory::kNative_GLContextType;
|
||||
#if SK_ANGLE
|
||||
static const GLContextType kANGLE = GrContextFactory::kANGLE_GLContextType;
|
||||
#else
|
||||
static const GLContextType kANGLE = kNative;
|
||||
#endif
|
||||
static const GLContextType kDebug = GrContextFactory::kDebug_GLContextType;
|
||||
static const GLContextType kNull = GrContextFactory::kNull_GLContextType;
|
||||
|
@ -36,9 +36,11 @@ private:
|
||||
|
||||
#define kMaxInt32 0x7FFFFFFF
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
static inline bool x_in_rect(int x, const SkIRect& rect) {
|
||||
return (unsigned)(x - rect.fLeft) < (unsigned)rect.width();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool y_in_rect(int y, const SkIRect& rect) {
|
||||
return (unsigned)(y - rect.fTop) < (unsigned)rect.height();
|
||||
|
@ -230,9 +230,12 @@ static inline void add_line_to_segment(const SkPoint& pt,
|
||||
devBounds->growToInclude(pt.fX, pt.fY);
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
static inline bool contains_inclusive(const SkRect& rect, const SkPoint& p) {
|
||||
return p.fX >= rect.fLeft && p.fX <= rect.fRight && p.fY >= rect.fTop && p.fY <= rect.fBottom;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void add_quad_segment(const SkPoint pts[3],
|
||||
SegmentArray* segments,
|
||||
SkRect* devBounds) {
|
||||
|
@ -1691,16 +1691,6 @@ bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
|
||||
return fGpu->caps()->isConfigRenderable(config, withMSAA);
|
||||
}
|
||||
|
||||
static inline intptr_t setOrClear(intptr_t bits, int shift, intptr_t pred) {
|
||||
intptr_t mask = 1 << shift;
|
||||
if (pred) {
|
||||
bits |= mask;
|
||||
} else {
|
||||
bits &= ~mask;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
void GrContext::setupDrawBuffer() {
|
||||
SkASSERT(NULL == fDrawBuffer);
|
||||
SkASSERT(NULL == fDrawBufferVBAllocPool);
|
||||
|
@ -15,13 +15,9 @@
|
||||
#include "SkStrokeRec.h"
|
||||
#include "SkTemplates.h"
|
||||
|
||||
static const GrGLuint GR_MAX_GLUINT = ~0U;
|
||||
static const GrGLint GR_INVAL_GLINT = ~0;
|
||||
|
||||
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
|
||||
#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
|
||||
|
||||
|
||||
#define SKIP_CACHE_CHECK true
|
||||
|
||||
#if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
|
||||
|
@ -12,10 +12,6 @@
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkRect.h"
|
||||
|
||||
static inline const char* boolStr(bool value) {
|
||||
return value ? "true" : "false";
|
||||
}
|
||||
|
||||
// these are in the same order as the SkBitmap::Config enum
|
||||
static const char* gConfigName[] = {
|
||||
"None", "A1", "A8", "Index8", "565", "4444", "8888", "RLE_Index8"
|
||||
|
@ -94,8 +94,6 @@ static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
|
||||
|
||||
static const int kWidth = 2;
|
||||
static const int kHeight = 2;
|
||||
// Maximum stream length for picture serialization
|
||||
static const size_t kMaxPictureBufferSize = 1024;
|
||||
|
||||
// Format strings that describe the test context. The %s token is where
|
||||
// the name of the test step is inserted. The context is required for
|
||||
@ -109,28 +107,18 @@ static const char* const kPictureDrawAssertMessageFormat =
|
||||
"Drawing test step %s with SkPicture";
|
||||
static const char* const kPictureSecondDrawAssertMessageFormat =
|
||||
"Duplicate draw of test step %s with SkPicture";
|
||||
static const char* const kPictureReDrawAssertMessageFormat =
|
||||
"Playing back test step %s from an SkPicture to another SkPicture";
|
||||
static const char* const kDeferredDrawAssertMessageFormat =
|
||||
"Drawing test step %s with SkDeferredCanvas";
|
||||
static const char* const kProxyDrawAssertMessageFormat =
|
||||
"Drawing test step %s with SkProxyCanvas";
|
||||
static const char* const kNWayDrawAssertMessageFormat =
|
||||
"Drawing test step %s with SkNWayCanvas";
|
||||
static const char* const kRoundTripAssertMessageFormat =
|
||||
"test step %s, SkPicture consistency after round trip";
|
||||
static const char* const kPictureRecoringAssertMessageFormat =
|
||||
"test step %s, SkPicture state consistency after recording";
|
||||
static const char* const kPicturePlaybackAssertMessageFormat =
|
||||
"test step %s, SkPicture state consistency in playback canvas";
|
||||
static const char* const kDeferredPreFlushAssertMessageFormat =
|
||||
"test step %s, SkDeferredCanvas state consistency before flush";
|
||||
static const char* const kDeferredPostFlushPlaybackAssertMessageFormat =
|
||||
"test step %s, SkDeferredCanvas playback canvas state consistency after flush";
|
||||
static const char* const kDeferredPostSilentFlushPlaybackAssertMessageFormat =
|
||||
"test step %s, SkDeferredCanvas playback canvas state consistency after silent flush";
|
||||
static const char* const kDeferredPostFlushAssertMessageFormat =
|
||||
"test step %s, SkDeferredCanvas state consistency after flush";
|
||||
static const char* const kPictureResourceReuseMessageFormat =
|
||||
"test step %s, SkPicture duplicate flattened object test";
|
||||
static const char* const kProxyStateAssertMessageFormat =
|
||||
|
@ -858,29 +858,6 @@ static void add_elem_to_region(const SkClipStack::Element& element,
|
||||
region->op(elemRegion, element.getOp());
|
||||
}
|
||||
|
||||
// This can assist with debugging the clip stack reduction code when the test below fails.
|
||||
static inline void print_clip(const SkClipStack::Element& element) {
|
||||
static const char* kOpStrs[] = {
|
||||
"DF",
|
||||
"IS",
|
||||
"UN",
|
||||
"XR",
|
||||
"RD",
|
||||
"RP",
|
||||
};
|
||||
if (SkClipStack::Element::kEmpty_Type != element.getType()) {
|
||||
const SkRect& bounds = element.getBounds();
|
||||
bool isRect = SkClipStack::Element::kRect_Type == element.getType();
|
||||
SkDebugf("%s %s %s [%f %f] x [%f %f]\n",
|
||||
kOpStrs[element.getOp()],
|
||||
(isRect ? "R" : "P"),
|
||||
(element.isInverseFilled() ? "I" : " "),
|
||||
bounds.fLeft, bounds.fRight, bounds.fTop, bounds.fBottom);
|
||||
} else {
|
||||
SkDebugf("EM\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void test_reduced_clip_stack(skiatest::Reporter* reporter) {
|
||||
// We construct random clip stacks, reduce them, and then rasterize both versions to verify that
|
||||
// they are equal.
|
||||
|
@ -16,108 +16,6 @@
|
||||
#define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS))
|
||||
#define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS))
|
||||
|
||||
static inline bool S32A_D565_Blend_0(SkPMColor sc, uint16_t dc, U8CPU alpha) {
|
||||
unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
|
||||
unsigned dr = SkMulS16(SkPacked32ToR16(sc), alpha) + SkMulS16(SkGetPackedR16(dc), dst_scale);
|
||||
unsigned dg = SkMulS16(SkPacked32ToG16(sc), alpha) + SkMulS16(SkGetPackedG16(dc), dst_scale);
|
||||
|
||||
unsigned rr = SkDiv255Round(dr);
|
||||
unsigned rg = SkDiv255Round(dg);
|
||||
|
||||
if (rr <= 31 && rg <= 63) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool S32A_D565_Blend_01(SkPMColor sc, uint16_t dc, U8CPU alpha) {
|
||||
unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
|
||||
unsigned dr = SkMulS16(SkGetPackedR32(sc), alpha) + SkMulS16(SkGetPackedR16(dc) << 3, dst_scale);
|
||||
unsigned dg = SkMulS16(SkGetPackedG32(sc), alpha) + SkMulS16(SkGetPackedG16(dc) << 2, dst_scale);
|
||||
|
||||
unsigned rr = SkDiv255Round(dr) >> 3;
|
||||
unsigned rg = SkDiv255Round(dg) >> 2;
|
||||
|
||||
if (rr <= 31 && rg <= 63) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool S32A_D565_Blend_02(SkPMColor sc, uint16_t dc, U8CPU alpha) {
|
||||
unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
|
||||
unsigned dr = SkMulS16(SkGetPackedR32(sc), alpha) + SkMulS16(GetPackedR16As32(dc), dst_scale);
|
||||
unsigned dg = SkMulS16(SkGetPackedG32(sc), alpha) + SkMulS16(GetPackedG16As32(dc), dst_scale);
|
||||
unsigned db = SkMulS16(SkGetPackedB32(sc), alpha) + SkMulS16(GetPackedB16As32(dc), dst_scale);
|
||||
int rc = SkPack888ToRGB16(SkDiv255Round(dr),
|
||||
SkDiv255Round(dg),
|
||||
SkDiv255Round(db));
|
||||
|
||||
unsigned rr = SkGetPackedR16(rc);
|
||||
unsigned rg = SkGetPackedG16(rc);
|
||||
|
||||
if (rr <= 31 && rg <= 63) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool S32A_D565_Blend_1(SkPMColor sc, uint16_t dc, U8CPU alpha) {
|
||||
unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
|
||||
unsigned dr = (SkMulS16(SkGetPackedR32(sc), alpha) >> 3) + SkMulS16(SkGetPackedR16(dc), dst_scale);
|
||||
unsigned dg = (SkMulS16(SkGetPackedG32(sc), alpha) >> 2) + SkMulS16(SkGetPackedG16(dc), dst_scale);
|
||||
|
||||
unsigned rr = SkDiv255Round(dr);
|
||||
unsigned rg = SkDiv255Round(dg);
|
||||
|
||||
if (rr <= 31 && rg <= 63) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int SkDiv65025Round(int x) {
|
||||
return (x + 65025/2) / 65025;
|
||||
// return x / 65025;
|
||||
}
|
||||
static inline bool S32A_D565_Blend_2(SkPMColor sc, uint16_t dc, U8CPU alpha) {
|
||||
unsigned dst_scale = 255*255 - SkGetPackedA32(sc) * alpha;
|
||||
alpha *= 255;
|
||||
unsigned dr = (SkGetPackedR32(sc) >> 3) * alpha + SkGetPackedR16(dc) * dst_scale;
|
||||
unsigned dg = (SkGetPackedG32(sc) >> 2) * alpha + SkGetPackedG16(dc) * dst_scale;
|
||||
|
||||
unsigned rr = SkDiv65025Round(dr);
|
||||
unsigned rg = SkDiv65025Round(dg);
|
||||
|
||||
if (rr <= 31 && rg <= 63) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void test_565blend() {
|
||||
int total_failures = 0;
|
||||
for (int global_alpha = 0; global_alpha <= 255; ++global_alpha) {
|
||||
int failures = 0;
|
||||
int total = 0;
|
||||
for (int src_a = 0; src_a <= 255; ++src_a) {
|
||||
for (int src_c = 0; src_c <= src_a; ++src_c) {
|
||||
SkPMColor sc = SkPackARGB32(src_a, src_c, src_c, src_c);
|
||||
for (int dst_r = 0; dst_r <= 31; ++dst_r) {
|
||||
for (int dst_g = 0; dst_g <= 63; ++dst_g) {
|
||||
uint16_t dc = SkPackRGB16(dst_r, dst_g, dst_r);
|
||||
failures += !S32A_D565_Blend_0(sc, dc, global_alpha);
|
||||
total += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SkDebugf("global_alpha=%d failures=%d total=%d %g\n", global_alpha, failures, total, failures * 100.0 / total);
|
||||
total_failures += failures;
|
||||
}
|
||||
SkDebugf("total failures %d\n", total_failures);
|
||||
}
|
||||
|
||||
static inline void test_premul(skiatest::Reporter* reporter) {
|
||||
for (int a = 0; a <= 255; a++) {
|
||||
for (int x = 0; x <= 255; x++) {
|
||||
|
@ -62,7 +62,7 @@ struct SortSet {
|
||||
SkPoint endPt;
|
||||
};
|
||||
|
||||
static const SortSet set1[] = {
|
||||
/*static const SortSet set1[] = {
|
||||
{cubics[0], 4, 0.66666987081928919, 0.875, {0, 0}},
|
||||
{lines[0], 2, 0.574070336, 0.388888889, {0, 0}},
|
||||
{cubics[0], 4, 0.66666987081928919, 0.4050371120499307, {0, 0}},
|
||||
@ -72,7 +72,7 @@ static const SortSet set1[] = {
|
||||
static const SortSet set1a[] = {
|
||||
{cubics[0], 4, 0.666666667, 0.405037112, {4.58007812f,2.83203125f}},
|
||||
{lines[0], 2, 0.574074074, 0.9140625, {4.44444466f,2.77777767f}},
|
||||
};
|
||||
};*/
|
||||
|
||||
static const SortSet set2[] = {
|
||||
{cubics[0], 4, 0.666666667, 0.875, {0, 0}},
|
||||
@ -86,10 +86,10 @@ static const SortSet set3[] = {
|
||||
{quads[0], 3, 1, 0, {0, 0}},
|
||||
};
|
||||
|
||||
static const SortSet set4[] = {
|
||||
/*static const SortSet set4[] = {
|
||||
{cubics[2], 4, 0.812114222, 1, {0, 0}},
|
||||
{cubics[3], 4, 0.0684734759, 0, {0, 0}},
|
||||
};
|
||||
};*/
|
||||
|
||||
static const SortSet set5[] = {
|
||||
{lines[1], 2, 0.777777778, 1, {0, 0}},
|
||||
@ -183,11 +183,11 @@ static const SortSet set14[] = {
|
||||
{quads[2], 3, 0.5, 0.7, {0, 0}},
|
||||
};
|
||||
|
||||
static const SortSet set15[] = {
|
||||
/*static const SortSet set15[] = {
|
||||
{cubics[14], 4, 0.93081374, 1, {0, 0}},
|
||||
{cubics[15], 4, 0.188518131, 0, {0, 0}},
|
||||
{cubics[14], 4, 0.93081374, 0, {0, 0}},
|
||||
};
|
||||
};*/
|
||||
|
||||
static const SortSet set16[] = {
|
||||
{cubics[17], 4, 0.0682619216, 0, {130.042755f,11417.4131f}},
|
||||
|
Loading…
Reference in New Issue
Block a user