diff options
30 files changed, 94 insertions, 168 deletions
diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index 818b9e367b..31160c7ad0 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp @@ -33,7 +33,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { for (int i = 0; i < N; i++) { - volatile uint32_t result = SkChecksum::Compute(fData, sizeof(fData)); + (void) SkChecksum::Compute(fData, sizeof(fData)); } } diff --git a/bench/ChromeBench.cpp b/bench/ChromeBench.cpp index f045573bea..ea5cb00878 100644 --- a/bench/ChromeBench.cpp +++ b/bench/ChromeBench.cpp @@ -491,7 +491,7 @@ private: typedef SkBenchmark INHERITED; }; -static SkBenchmark* ScrollGmailFactory(void* p) { +static inline SkBenchmark* ScrollGmailFactory(void* p) { return SkNEW_ARGS(ScrollGmailBench, (p)); } diff --git a/bench/Matrix44Bench.cpp b/bench/Matrix44Bench.cpp index 31525d265f..ce5d99de7b 100644 --- a/bench/Matrix44Bench.cpp +++ b/bench/Matrix44Bench.cpp @@ -48,9 +48,9 @@ public: protected: virtual void performTest() { for (int i = 0; i < 10; ++i) { - fM0 == fM1; - fM1 == fM2; - fM2 == fM0; + (void) (fM0 == fM1); + (void) (fM1 == fM2); + (void) (fM2 == fM0); } } private: diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp index e1885c3620..06853bbd2c 100644 --- a/bench/RTreeBench.cpp +++ b/bench/RTreeBench.cpp @@ -145,22 +145,22 @@ private: typedef SkBenchmark INHERITED; }; -static SkIRect make_simple_rect(SkRandom&, int index, int numRects) { +static inline SkIRect make_simple_rect(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, GENERATE_EXTENTS, GENERATE_EXTENTS}; return out; } -static SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { +static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, index + 1, index + 1}; return out; } -static SkIRect make_concentric_rects_decreasing(SkRandom&, int index, int numRects) { +static inline SkIRect make_concentric_rects_decreasing(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, numRects - index, numRects - index}; return out; } -static SkIRect make_point_rects(SkRandom& rand, int index, int numRects) { +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; @@ -169,7 +169,7 @@ static SkIRect make_point_rects(SkRandom& rand, int index, int numRects) { return out; } -static SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { +static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = rand.nextS() % GENERATE_EXTENTS; out.fTop = rand.nextS() % GENERATE_EXTENTS; @@ -178,7 +178,7 @@ static SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { return out; } -static SkIRect make_large_rects(SkRandom& rand, int index, int numRects) { +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; @@ -189,23 +189,23 @@ static SkIRect make_large_rects(SkRandom& rand, int index, int numRects) { /////////////////////////////////////////////////////////////////////////////// -static SkBenchmark* Fact0(void* p) { +static inline SkBenchmark* Fact0(void* p) { return SkNEW_ARGS(BBoxBuildBench, (p, "random", &make_random_rects, true, SkRTree::Create(5, 16))); } -static SkBenchmark* Fact1(void* p) { +static inline SkBenchmark* Fact1(void* p) { return SkNEW_ARGS(BBoxBuildBench, (p, "random", &make_random_rects, false, SkRTree::Create(5, 16))); } -static SkBenchmark* Fact2(void* p) { +static inline SkBenchmark* Fact2(void* p) { return SkNEW_ARGS(BBoxBuildBench, (p, "concentric", &make_concentric_rects_increasing, true, SkRTree::Create(5, 16))); } -static SkBenchmark* Fact3(void* p) { +static inline SkBenchmark* Fact3(void* p) { return SkNEW_ARGS(BBoxQueryBench, (p, "random", &make_random_rects, true, BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16))); } -static SkBenchmark* Fact4(void* p) { +static inline SkBenchmark* Fact4(void* p) { return SkNEW_ARGS(BBoxQueryBench, (p, "random", &make_random_rects, false, BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16))); } diff --git a/experimental/AndroidPathRenderer/AndroidPathRenderer.cpp b/experimental/AndroidPathRenderer/AndroidPathRenderer.cpp index 5d927e1006..3ade9e6fb0 100644 --- a/experimental/AndroidPathRenderer/AndroidPathRenderer.cpp +++ b/experimental/AndroidPathRenderer/AndroidPathRenderer.cpp @@ -46,7 +46,7 @@ SkRect PathRenderer::ComputePathBounds(const SkPath& path, const SkPaint* paint) return bounds; } -void computeInverseScales(const SkMatrix* transform, float &inverseScaleX, float& inverseScaleY) { +inline void computeInverseScales(const SkMatrix* transform, float &inverseScaleX, float& inverseScaleY) { if (transform && transform->getType() & (SkMatrix::kScale_Mask|SkMatrix::kAffine_Mask|SkMatrix::kPerspective_Mask)) { float m00 = transform->getScaleX(); float m01 = transform->getSkewY(); @@ -97,7 +97,7 @@ inline void scaleOffsetForStrokeWidth(SkVector& offset, float halfStrokeWidth, } } -void getFillVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, VertexBuffer* vertexBuffer) { +static void getFillVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, VertexBuffer* vertexBuffer) { Vertex* buffer = vertexBuffer->alloc<Vertex>(perimeter.count()); int currentIndex = 0; @@ -114,7 +114,7 @@ void getFillVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, Verte } } -void getStrokeVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, float halfStrokeWidth, +static void getStrokeVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, float halfStrokeWidth, VertexBuffer* vertexBuffer, float inverseScaleX, float inverseScaleY) { Vertex* buffer = vertexBuffer->alloc<Vertex>(perimeter.count() * 2 + 2); @@ -153,7 +153,7 @@ void getStrokeVerticesFromPerimeter(const SkTArray<Vertex, true>& perimeter, flo copyVertex(&buffer[currentIndex++], &buffer[1]); } -void getStrokeVerticesFromUnclosedVertices(const SkTArray<Vertex, true>& vertices, float halfStrokeWidth, +static void getStrokeVerticesFromUnclosedVertices(const SkTArray<Vertex, true>& vertices, float halfStrokeWidth, VertexBuffer* vertexBuffer, float inverseScaleX, float inverseScaleY) { Vertex* buffer = vertexBuffer->alloc<Vertex>(vertices.count() * 2); @@ -203,7 +203,7 @@ void getStrokeVerticesFromUnclosedVertices(const SkTArray<Vertex, true>& vertice #endif } -void getFillVerticesFromPerimeterAA(const SkTArray<Vertex, true>& perimeter, VertexBuffer* vertexBuffer, +static void getFillVerticesFromPerimeterAA(const SkTArray<Vertex, true>& perimeter, VertexBuffer* vertexBuffer, float inverseScaleX, float inverseScaleY) { AlphaVertex* buffer = vertexBuffer->alloc<AlphaVertex>(perimeter.count() * 3 + 2); @@ -268,7 +268,7 @@ void getFillVerticesFromPerimeterAA(const SkTArray<Vertex, true>& perimeter, Ver } -void getStrokeVerticesFromUnclosedVerticesAA(const SkTArray<Vertex, true>& vertices, float halfStrokeWidth, +static void getStrokeVerticesFromUnclosedVerticesAA(const SkTArray<Vertex, true>& vertices, float halfStrokeWidth, VertexBuffer* vertexBuffer, float inverseScaleX, float inverseScaleY) { AlphaVertex* buffer = vertexBuffer->alloc<AlphaVertex>(6 * vertices.count() + 2); @@ -427,7 +427,7 @@ void getStrokeVerticesFromUnclosedVerticesAA(const SkTArray<Vertex, true>& verti } -void getStrokeVerticesFromPerimeterAA(const SkTArray<Vertex, true>& perimeter, float halfStrokeWidth, +static void getStrokeVerticesFromPerimeterAA(const SkTArray<Vertex, true>& perimeter, float halfStrokeWidth, VertexBuffer* vertexBuffer, float inverseScaleX, float inverseScaleY) { AlphaVertex* buffer = vertexBuffer->alloc<AlphaVertex>(6 * perimeter.count() + 8); @@ -590,7 +590,7 @@ void PathRenderer::ConvexPathVertices(const SkPath &path, const SkPaint* paint, } -void pushToVector(SkTArray<Vertex, true>* vertices, float x, float y) { +static void pushToVector(SkTArray<Vertex, true>* vertices, float x, float y) { // TODO: make this not yuck vertices->push_back(); Vertex* newVertex = &((*vertices)[vertices->count() - 1]); @@ -607,7 +607,7 @@ bool PathRenderer::ConvexPathPerimeterVertices(const SkPath& path, bool forceClo SkPath::Iter iter(path, forceClose); SkPoint pts[4]; SkPath::Verb v; - Vertex* newVertex = 0; + while (SkPath::kDone_Verb != (v = iter.next(pts))) { switch (v) { case SkPath::kMove_Verb: diff --git a/experimental/Debugger/DebuggerViews.h b/experimental/Debugger/DebuggerViews.h index c63283f895..926881e3bb 100644 --- a/experimental/Debugger/DebuggerViews.h +++ b/experimental/Debugger/DebuggerViews.h @@ -85,7 +85,7 @@ private: }; -static void* PaintProc(void* ptr, bool doRef) { +static inline void* PaintProc(void* ptr, bool doRef) { SkPaint* p = (SkPaint*) ptr; if (doRef) { diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp index ae2e5ea019..a7598fe2d3 100644 --- a/gm/blurrect.cpp +++ b/gm/blurrect.cpp @@ -19,13 +19,6 @@ static void fill_rect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) { canvas->drawRect(r, p); } -static void stroke_rect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) { - SkPaint paint(p); - paint.setStyle(SkPaint::kStroke_Style); - paint.setStrokeWidth(STROKE_WIDTH); - canvas->drawRect(r, paint); -} - static void draw_donut(SkCanvas* canvas, const SkRect& r, const SkPaint& p) { SkRect rect; SkPath path; @@ -64,14 +57,6 @@ static void draw_donut_skewed(SkCanvas* canvas, const SkRect& r, const SkPaint& typedef void (*PaintProc)(SkPaint*, SkScalar width); -static void setgrad(SkPaint* paint, SkScalar width) { - SkPoint pts[] = { { 0, 0 }, { width, 0 } }; - SkColor colors[] = { SK_ColorRED, SK_ColorGREEN }; - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, - SkShader::kClamp_TileMode); - paint->setShader(s)->unref(); -} - static const char* gBlurStyle2Name[] = { "normal", "solid", diff --git a/gm/giantbitmap.cpp b/gm/giantbitmap.cpp index 16c01d7f0e..1857a1f84b 100644 --- a/gm/giantbitmap.cpp +++ b/gm/giantbitmap.cpp @@ -114,7 +114,7 @@ protected: canvas->translate(SkIntToScalar(50), SkIntToScalar(50)); - SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16); +// SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16); // canvas->drawRect(r, paint); return; canvas->drawPaint(paint); } diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp index d51fce2cf6..79b6104183 100644 --- a/gm/tilemodes.cpp +++ b/gm/tilemodes.cpp @@ -174,14 +174,6 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { return NULL; } -static SkShader* make_radial(SkShader::TileMode tx, SkShader::TileMode ty) { - SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 }; - SkScalar rad = SkIntToScalar(gWidth)/2; - SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; - - return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_ARRAY_COUNT(colors), tx); -} - typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); class Tiling2GM : public skiagm::GM { diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index 332d342be2..c15ee47f1f 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -222,6 +222,7 @@ 'GCC_WARN_UNUSED_VALUE': 'YES', 'GCC_WARN_UNUSED_VARIABLE': 'YES', 'OTHER_CPLUSPLUSFLAGS': [ + '-Werror', '-mssse3', '-fvisibility=hidden', '-fvisibility-inlines-hidden', diff --git a/gyp/utils.gyp b/gyp/utils.gyp index 4e3f6d45e5..8d87d15116 100644 --- a/gyp/utils.gyp +++ b/gyp/utils.gyp @@ -211,6 +211,11 @@ '../src/utils/cityhash', '../third_party/externals/cityhash/src', ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS!': [ + '-Werror', + ] + }, 'sources': [ '../third_party/externals/cityhash/src/city.cc', ], diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index 9fa3cd6d0f..d1de750e31 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -96,10 +96,10 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; #endif #define MAKENAME(suffix) GeneralXY ## suffix -#define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; \ - SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; \ - SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX = (state).fTileLowBitsProcX; \ - SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY = (state).fTileLowBitsProcY +#define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; (void) tileProcX; \ + SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; (void) tileProcY; \ + SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX = (state).fTileLowBitsProcX; (void) tileLowBitsProcX; \ + SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY = (state).fTileLowBitsProcY; (void) tileLowBitsProcY #define PREAMBLE_PARAM_X , SkBitmapProcState::FixedTileProc tileProcX, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX #define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY #define PREAMBLE_ARG_X , tileProcX, tileLowBitsProcX diff --git a/src/core/SkConfig8888.h b/src/core/SkConfig8888.h index a8913702d6..96eaef2447 100644 --- a/src/core/SkConfig8888.h +++ b/src/core/SkConfig8888.h @@ -31,34 +31,17 @@ uint32_t SkPackConfig8888(SkCanvas::Config8888 config, uint32_t g, uint32_t b); +/////////////////////////////////////////////////////////////////////////////// +// Implementation + namespace { /** Copies all pixels from a bitmap to a dst ptr with a given rowBytes and Config8888. The bitmap must have kARGB_8888_Config. */ -inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels, - size_t dstRowBytes, - SkCanvas::Config8888 dstConfig8888, - const SkBitmap& srcBmp); - -/** - Copies over all pixels in a bitmap from a src ptr with a given rowBytes and - Config8888. The bitmap must have pixels and be kARGB_8888_Config. - */ -inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp, - const uint32_t* srcPixels, - size_t srcRowBytes, - SkCanvas::Config8888 srcConfig8888); -} - -/////////////////////////////////////////////////////////////////////////////// -// Implementation - -namespace { - -inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels, +static inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels, size_t dstRowBytes, SkCanvas::Config8888 dstConfig8888, const SkBitmap& srcBmp) { @@ -72,7 +55,11 @@ inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels, SkConvertConfig8888Pixels(dstPixels, dstRowBytes, dstConfig8888, srcPixels, srcRowBytes, SkCanvas::kNative_Premul_Config8888, w, h); } -inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp, +/** + Copies over all pixels in a bitmap from a src ptr with a given rowBytes and + Config8888. The bitmap must have pixels and be kARGB_8888_Config. + */ +static inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp, const uint32_t* srcPixels, size_t srcRowBytes, SkCanvas::Config8888 srcConfig8888) { diff --git a/src/core/SkUtilsArm.h b/src/core/SkUtilsArm.h index 9ae648a437..b9a26143ee 100644 --- a/src/core/SkUtilsArm.h +++ b/src/core/SkUtilsArm.h @@ -39,11 +39,11 @@ // probes the CPU at runtime (and caches the result). #if SK_ARM_NEON_IS_NONE -static bool sk_cpu_arm_has_neon(void) { +static inline bool sk_cpu_arm_has_neon(void) { return false; } #elif SK_ARM_NEON_IS_ALWAYS -static bool sk_cpu_arm_has_neon(void) { +static inline bool sk_cpu_arm_has_neon(void) { return true; } #else // SK_ARM_NEON_IS_DYNAMIC diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 829d153d77..1662188d05 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -24,7 +24,7 @@ #define USE_DITHER_32BIT_GRADIENT #endif -static void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1, +static inline void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1, int count) { if (count > 0) { if (v0 == v1) { @@ -44,13 +44,13 @@ static void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1, // Clamp -static SkFixed clamp_tileproc(SkFixed x) { +static inline SkFixed clamp_tileproc(SkFixed x) { return SkClampMax(x, 0xFFFF); } // Repeat -static SkFixed repeat_tileproc(SkFixed x) { +static inline SkFixed repeat_tileproc(SkFixed x) { return x & 0xFFFF; } diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 71614505a1..2e80351cb6 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -120,23 +120,6 @@ typedef void (*LinearShadeProc)(TileProc proc, SkFixed dx, SkFixed fx, SkPMColor* dstC, const SkPMColor* cache, int toggle, int count); -// This function is deprecated, and will be replaced by -// shadeSpan_linear_vertical_lerp() once Chrome has been weaned off of it. -void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx, - SkPMColor* SK_RESTRICT dstC, - const SkPMColor* SK_RESTRICT cache, - int toggle, int count) { - // We're a vertical gradient, so no change in a span. - // If colors change sharply across the gradient, dithering is - // insufficient (it subsamples the color space) and we need to lerp. - unsigned fullIndex = proc(fx); - unsigned fi = fullIndex >> (16 - SkGradientShaderBase::kCache32Bits); - sk_memset32_dither(dstC, - cache[toggle + fi], - cache[(toggle ^ SkGradientShaderBase::kDitherStride32) + fi], - count); -} - // Linear interpolation (lerp) is unnecessary if there are no sharp // discontinuities in the gradient - which must be true if there are // only 2 colors - but it's cheap. @@ -256,15 +239,7 @@ void SkLinearGradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, LinearShadeProc shadeProc = shadeSpan_linear_repeat; if (SkFixedNearlyZero(dx)) { -#ifdef SK_SIMPLE_TWOCOLOR_VERTICAL_GRADIENTS - if (fColorCount > 2) { - shadeProc = shadeSpan_linear_vertical_lerp; - } else { - shadeProc = shadeSpan_linear_vertical; - } -#else shadeProc = shadeSpan_linear_vertical_lerp; -#endif } else if (SkShader::kClamp_TileMode == fTileMode) { shadeProc = shadeSpan_linear_clamp; } else if (SkShader::kMirror_TileMode == fTileMode) { diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 7eab0ce68f..f3f773d536 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -260,31 +260,6 @@ void setup_boolean_blendcoeffs(GrDrawState* drawState, SkRegion::Op op) { } } -//////////////////////////////////////////////////////////////////////////////// -bool draw_path_in_software(GrContext* context, - GrGpu* gpu, - const SkPath& path, - bool doAA, - const GrIRect& resultBounds) { - SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); - - SkAutoTUnref<GrTexture> texture( - GrSWMaskHelper::DrawPathMaskToTexture(context, path, - rec, - resultBounds, - doAA, NULL)); - if (NULL == texture) { - return false; - } - - // The ClipMaskManager accumulates the clip mask in the UL corner - GrIRect rect = GrIRect::MakeWH(resultBounds.width(), resultBounds.height()); - - GrSWMaskHelper::DrawToTargetWithPathMask(texture, gpu, rect); - - GrAssert(!path.isInverseFillType()); - return true; -} } //////////////////////////////////////////////////////////////////////////////// @@ -632,8 +607,6 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState, SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers"); clipBit = (1 << (clipBit-1)); - GrIRect devRTRect = GrIRect::MakeWH(rt->width(), rt->height()); - fGpu->clearStencilClip(stencilSpaceIBounds, kAllIn_InitialState == initialState); // walk through each clip element and perform its set op diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index f80a4416f3..976448d699 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -46,8 +46,13 @@ void gen_mask_arrays(GrVertexLayout* stageTexCoordMasks, } /** - * Run this function to generate the code that declares the global masks. + * Uncomment and run the gen_globals function to generate + * the code that declares the global masks. + * + * #if 0'ed out to avoid unused function warning. */ + +#if 0 void gen_globals() { GrVertexLayout stageTexCoordMasks[GrDrawState::kNumStages]; GrVertexLayout texCoordMasks[GrDrawState::kMaxTexCoords]; @@ -66,6 +71,7 @@ void gen_globals() { GrPrintf("};\n"); GrPrintf("GR_STATIC_ASSERT(GrDrawState::kMaxTexCoords == GR_ARRAY_COUNT(gTexCoordMasks));\n"); } +#endif /* These values were generated by the above function */ diff --git a/src/gpu/GrTDArray.h b/src/gpu/GrTDArray.h index 0e5b6bb987..33b7a632ed 100644 --- a/src/gpu/GrTDArray.h +++ b/src/gpu/GrTDArray.h @@ -14,11 +14,11 @@ #include "GrTypes.h" #include "GrRefCnt.h" -static int GrInitialArrayAllocationCount() { +static inline int GrInitialArrayAllocationCount() { return 4; } -static int GrNextArrayAllocationCount(int count) { +static inline int GrNextArrayAllocationCount(int count) { return count + ((count + 1) >> 1); } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index f4c4cf60aa..6a312f3f3b 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -347,8 +347,7 @@ void SkGpuDevice::writePixels(const SkBitmap& bitmap, int x, int y, } namespace { -void purgeClipCB(int genID, void* data) { - GrContext* context = (GrContext*) data; +void purgeClipCB(int genID, void* ) { if (SkClipStack::kInvalidGenID == genID || SkClipStack::kEmptyGenID == genID || @@ -1340,8 +1339,6 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, return; } - GrEffectStage* stage = grPaint->colorStage(kBitmapTextureIdx); - GrTexture* texture; SkAutoCachedTexture act(this, bitmap, ¶ms, &texture); if (NULL == texture) { diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index c0d3d5e596..4559fddd36 100644 --- a/src/gpu/gl/GrGLSL.h +++ b/src/gpu/gl/GrGLSL.h @@ -57,7 +57,7 @@ enum GrSLConstantVec { }; namespace { -inline int GrSLTypeToVecLength(GrSLType type) { +static inline int GrSLTypeToVecLength(GrSLType type) { static const int kVecLengths[] = { 0, // kVoid_GrSLType 1, // kFloat_GrSLType @@ -72,14 +72,14 @@ inline int GrSLTypeToVecLength(GrSLType type) { return kVecLengths[type]; } -const char* GrGLSLOnesVecf(int count) { +static inline const char* GrGLSLOnesVecf(int count) { static const char* kONESVEC[] = {"ERROR", "1.0", "vec2(1,1)", "vec3(1,1,1)", "vec4(1,1,1,1)"}; GrAssert(count >= 1 && count < (int)GR_ARRAY_COUNT(kONESVEC)); return kONESVEC[count]; } -const char* GrGLSLZerosVecf(int count) { +static inline const char* GrGLSLZerosVecf(int count) { static const char* kZEROSVEC[] = {"ERROR", "0.0", "vec2(0,0)", "vec3(0,0,0)", "vec4(0,0,0,0)"}; GrAssert(count >= 1 && count < (int)GR_ARRAY_COUNT(kZEROSVEC)); diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp index 1e2dc93fc4..c2de2591d4 100644 --- a/src/opts/SkBitmapProcState_opts_SSE2.cpp +++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp @@ -678,8 +678,6 @@ void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, // ( 0, 0, 0, 0, 0, 0, 0, 0) __m128i zero = _mm_setzero_si128(); - __m128i _m_shift_5 = _mm_set1_epi32((1<<5)-1); - __m128i _m_shift_6 = _mm_set1_epi32((1<<6)-1); do { uint32_t XX = *xy++; // x0:14 | 4 | x1:14 unsigned x0 = XX >> 18; diff --git a/src/views/mac/SkOptionsTableView.mm b/src/views/mac/SkOptionsTableView.mm index 302e66efa3..eaa3e4cdd5 100644 --- a/src/views/mac/SkOptionsTableView.mm +++ b/src/views/mac/SkOptionsTableView.mm @@ -55,10 +55,15 @@ } } -- (void)updateMenu:(SkOSMenu*)menu { +- (void)updateMenu:(const SkOSMenu*)menu { // the first menu is always assumed to be the static, the second is // repopulated every time over and over again - int menuIndex = fMenus->find(menu); + + // seems pretty weird that we have to get rid of the const'ness here, + // but trying to propagate the const'ness through all the way to the fMenus + // vector was a non-starter. + + int menuIndex = fMenus->find(const_cast<SkOSMenu *>(menu)); if (menuIndex >= 0 && menuIndex < fMenus->count()) { NSUInteger first = 0; for (NSInteger i = 0; i < menuIndex; ++i) { diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index d4391d7af6..4709d22871 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -758,7 +758,7 @@ static void add_elem_to_region(const SkClipStack::Element& element, } // This can assist with debugging the clip stack reduction code when the test below fails. -static void print_clip(const SkClipStack::Element& element) { +static inline void print_clip(const SkClipStack::Element& element) { static const char* kOpStrs[] = { "DF", "IS", diff --git a/tests/ColorTest.cpp b/tests/ColorTest.cpp index a038a060bd..8985dbddbc 100644 --- a/tests/ColorTest.cpp +++ b/tests/ColorTest.cpp @@ -16,7 +16,7 @@ #define GetPackedG16As32(packed) (SkGetPackedG16(dc) << (8 - SK_G16_BITS)) #define GetPackedB16As32(packed) (SkGetPackedB16(dc) << (8 - SK_B16_BITS)) -static bool S32A_D565_Blend_0(SkPMColor sc, uint16_t dc, U8CPU alpha) { +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); @@ -30,7 +30,7 @@ static bool S32A_D565_Blend_0(SkPMColor sc, uint16_t dc, U8CPU alpha) { return false; } -static bool S32A_D565_Blend_01(SkPMColor sc, uint16_t dc, U8CPU alpha) { +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); @@ -44,7 +44,7 @@ static bool S32A_D565_Blend_01(SkPMColor sc, uint16_t dc, U8CPU alpha) { return false; } -static bool S32A_D565_Blend_02(SkPMColor sc, uint16_t dc, U8CPU alpha) { +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); @@ -62,7 +62,7 @@ static bool S32A_D565_Blend_02(SkPMColor sc, uint16_t dc, U8CPU alpha) { return false; } -static bool S32A_D565_Blend_1(SkPMColor sc, uint16_t dc, U8CPU alpha) { +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); @@ -76,11 +76,11 @@ static bool S32A_D565_Blend_1(SkPMColor sc, uint16_t dc, U8CPU alpha) { return false; } -static int SkDiv65025Round(int x) { +static inline int SkDiv65025Round(int x) { return (x + 65025/2) / 65025; // return x / 65025; } -static bool S32A_D565_Blend_2(SkPMColor sc, uint16_t dc, U8CPU alpha) { +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; @@ -95,7 +95,7 @@ static bool S32A_D565_Blend_2(SkPMColor sc, uint16_t dc, U8CPU alpha) { return false; } -static void test_565blend(skiatest::Reporter* reporter) { +static inline void test_565blend(skiatest::Reporter* reporter) { int total_failures = 0; for (int global_alpha = 0; global_alpha <= 255; ++global_alpha) { int failures = 0; @@ -118,7 +118,7 @@ static void test_565blend(skiatest::Reporter* reporter) { SkDebugf("total failures %d\n", total_failures); } -static void test_premul(skiatest::Reporter* reporter) { +static inline void test_premul(skiatest::Reporter* reporter) { for (int a = 0; a <= 255; a++) { for (int x = 0; x <= 255; x++) { SkColor c0 = SkColorSetARGB(a, x, x, x); @@ -162,7 +162,7 @@ static void test_interp(skiatest::Reporter* reporter) { } */ -static void test_fast_interp(skiatest::Reporter* reporter) { +static inline void test_fast_interp(skiatest::Reporter* reporter) { SkRandom r; U8CPU a0 = 0; diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index d6ba775ccd..8c002c80c0 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -54,8 +54,8 @@ static void test_dataset(skiatest::Reporter* reporter, const SkDataSet& ds, SkDataSet::Iter iter(ds); int index = 0; for (; !iter.done(); iter.next()) { - const char* name = iter.key(); - SkData* data = iter.value(); +// const char* name = iter.key(); +// SkData* data = iter.value(); // SkDebugf("[%d] %s:%s\n", index, name, (const char*)data->bytes()); index += 1; } diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp index e8cfa54d36..370559e25b 100644 --- a/tests/DrawPathTest.cpp +++ b/tests/DrawPathTest.cpp @@ -46,6 +46,9 @@ static void cubicToH(SkPath* path, const uint32_t raw[]) { // // http://code.google.com/p/chromium/issues/detail?id=131181 // + +// we're not calling this test anymore; is that for a reason? + static void test_crbug131181(skiatest::Reporter*) { /* fX = 18.8943768, @@ -269,7 +272,8 @@ static void TestDrawPath(skiatest::Reporter* reporter) { test_crbug_140642(reporter); test_crbug_140803(reporter); test_inversepathwithclip(reporter); -// test_crbug131181(reporter); + // why? + if (false) test_crbug131181(reporter); test_infinite_dash(reporter); test_crbug_165432(reporter); } diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index c0babeecea..7fc53a9285 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -591,7 +591,7 @@ static void TestMath(skiatest::Reporter* reporter) { test_blend(reporter); #endif -// test_floor(reporter); + if (false) test_floor(reporter); // disable for now if (false) test_blend31(); // avoid bit rot, suppress warning diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp index 17f7dcba25..38eb32215a 100644 --- a/tests/TLSTest.cpp +++ b/tests/TLSTest.cpp @@ -71,7 +71,7 @@ static void TestTLS(skiatest::Reporter* reporter) { // TODO: Disabled for now to work around // http://code.google.com/p/skia/issues/detail?id=619 // ('flaky segfault in TLS test on Shuttle_Ubuntu12 buildbots') - //test_threads(&thread_main); + if( false ) test_threads(&thread_main); // Test to ensure that at thread destruction, TLS destructors // have been called. diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp index c1b2040fd0..ab20e3f9ed 100644 --- a/tools/filtermain.cpp +++ b/tools/filtermain.cpp @@ -136,11 +136,7 @@ private: typedef SkPicture INHERITED; }; -static bool PNGEncodeBitmapToStream(SkWStream* stream, const SkBitmap& bitmap) { - return SkImageEncoder::EncodeStream(stream, bitmap, SkImageEncoder::kPNG_Type, 100); -} - -int filter_picture(const SkString& inFile, const SkString& outFile, +static int filter_picture(const SkString& inFile, const SkString& outFile, const SkString& textureDir, SkFILEWStream *pathStream) { SkPicture* inPicture = NULL; @@ -183,6 +179,8 @@ int filter_picture(const SkString& inFile, const SkString& outFile, // This function is not marked as 'static' so it can be referenced externally // in the iOS build. +int tool_main(int argc, char** argv); // suppress a warning on mac + int tool_main(int argc, char** argv) { SkGraphics::Init(); @@ -279,7 +277,7 @@ int tool_main(int argc, char** argv) { } SkOSFile::Iter iter(inDir.c_str(), "skp"); - int failures = 0; + SkString inputFilename, outputFilename; if (iter.next(&inputFilename)) { |