diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
commit | d6176b0dcacb124539e0cfd051e6d93a9782f020 (patch) | |
tree | 9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /gm | |
parent | fbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff) |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/aaclip.cpp | 2 | ||||
-rw-r--r-- | gm/aarectmodes.cpp | 16 | ||||
-rw-r--r-- | gm/bitmapfilters.cpp | 4 | ||||
-rw-r--r-- | gm/colormatrix.cpp | 6 | ||||
-rw-r--r-- | gm/complexclip.cpp | 6 | ||||
-rw-r--r-- | gm/convexpaths.cpp | 12 | ||||
-rw-r--r-- | gm/cubicpaths.cpp | 28 | ||||
-rw-r--r-- | gm/degeneratesegments.cpp | 10 | ||||
-rw-r--r-- | gm/drawlooper.cpp | 10 | ||||
-rw-r--r-- | gm/filltypes.cpp | 12 | ||||
-rw-r--r-- | gm/filltypespersp.cpp | 6 | ||||
-rw-r--r-- | gm/gammatext.cpp | 16 | ||||
-rw-r--r-- | gm/getpostextpath.cpp | 8 | ||||
-rw-r--r-- | gm/gm.h | 10 | ||||
-rw-r--r-- | gm/gradients.cpp | 60 | ||||
-rw-r--r-- | gm/hittestpath.cpp | 22 | ||||
-rw-r--r-- | gm/imageblur.cpp | 4 | ||||
-rw-r--r-- | gm/imagefiltersbase.cpp | 18 | ||||
-rw-r--r-- | gm/lcdtext.cpp | 2 | ||||
-rw-r--r-- | gm/linepaths.cpp | 28 | ||||
-rw-r--r-- | gm/ninepatchstretch.cpp | 32 | ||||
-rw-r--r-- | gm/pathfill.cpp | 32 | ||||
-rw-r--r-- | gm/pathreverse.cpp | 12 | ||||
-rw-r--r-- | gm/poly2poly.cpp | 32 | ||||
-rw-r--r-- | gm/quadpaths.cpp | 28 | ||||
-rw-r--r-- | gm/simpleaaclip.cpp | 20 | ||||
-rw-r--r-- | gm/strokerects.cpp | 6 | ||||
-rw-r--r-- | gm/tablecolorfilter.cpp | 20 | ||||
-rw-r--r-- | gm/testimagefilters.cpp | 14 | ||||
-rw-r--r-- | gm/texdata.cpp | 4 |
30 files changed, 240 insertions, 240 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index 2988cf3a38..f67ac17a9f 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -38,7 +38,7 @@ static void compare_canvas(const SkCanvas* a, const SkCanvas* b) { const SkPMColor* rowa = bma.getAddr32(0, y); const SkPMColor* rowb = bmb.getAddr32(0, y); SkASSERT(!memcmp(rowa, rowb, bma.width() << 2)); - + for (int x = 1; x < bma.width() - 1; ++x) { SkASSERT(0xFF000000 == rowa[x]); SkASSERT(0xFF000000 == rowb[x]); diff --git a/gm/aarectmodes.cpp b/gm/aarectmodes.cpp index ed3d3c6c3e..07cfa121f2 100644 --- a/gm/aarectmodes.cpp +++ b/gm/aarectmodes.cpp @@ -16,18 +16,18 @@ static void test4(SkCanvas* canvas) { SkPoint pts[] = { {10, 160}, {610, 160}, {610, 160}, {10, 160}, - + {610, 160}, {610, 160}, {610, 199}, {610, 199}, - + {10, 198}, {610, 198}, {610, 199}, {10, 199}, - + {10, 160}, {10, 160}, {10, 199}, {10, 199} }; char verbs[] = { - 0, 1, 1, 1, 4, + 0, 1, 1, 1, 4, 0, 1, 1, 1, 4, 0, 1, 1, 1, 4, 0, 1, 1, 1, 4 @@ -102,7 +102,7 @@ static SkScalar drawCell(SkCanvas* canvas, SkXfermode* mode, H / 4 + offset, W / 2, H / 2); canvas->drawRect(rect, paint); - + return H; } @@ -117,7 +117,7 @@ static SkShader* make_bg_shader() { SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); - + SkMatrix m; m.setScale(SkIntToScalar(6), SkIntToScalar(6)); s->setLocalMatrix(m); @@ -125,7 +125,7 @@ static SkShader* make_bg_shader() { } namespace skiagm { - + class AARectModesGM : public GM { SkPaint fBGPaint; public: @@ -160,7 +160,7 @@ namespace skiagm { canvas->save(); } SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); - + canvas->drawRect(bounds, fBGPaint); canvas->saveLayer(&bounds, NULL); SkScalar dy = drawCell(canvas, mode, diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index 92c7b43dbb..64192966e6 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -92,7 +92,7 @@ class FilterGM : public GM { public: SkBitmap fBM8, fBM4444, fBM16, fBM32; - FilterGM() : fOnce(false) { + FilterGM() : fOnce(false) { this->setBGColor(0xFFDDDDDD); } @@ -101,7 +101,7 @@ protected: return SkString("bitmapfilters"); } - virtual SkISize onISize() { + virtual SkISize onISize() { return make_isize(540, 330); } diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index 518ccd0f50..af305ee04f 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -22,7 +22,7 @@ public: fOnce = true; return true; } - + private: mutable bool fOnce; }; @@ -49,7 +49,7 @@ public: ColorMatrixGM() { this->setBGColor(0xFF808080); } - + protected: virtual SkString onShortName() { return SkString("colormatrix"); @@ -134,7 +134,7 @@ protected: setArray(&paint, data); canvas->drawBitmap(fBitmap, 160, 160, &paint); } - + private: SkBitmap fBitmap; typedef GM INHERITED; diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp index 7f91b58c89..86386b3d49 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -21,7 +21,7 @@ class ComplexClipGM : public GM { bool fDoAAClip; bool fDoSaveLayer; public: - ComplexClipGM(bool aaclip, bool saveLayer) + ComplexClipGM(bool aaclip, bool saveLayer) : fDoAAClip(aaclip) , fDoSaveLayer(saveLayer) { this->setBGColor(0xFFDDDDDD); @@ -32,7 +32,7 @@ protected: SkString onShortName() { SkString str; - str.printf("complexclip_%s%s", + str.printf("complexclip_%s%s", fDoAAClip ? "aa" : "bw", fDoSaveLayer ? "_layer" : ""); return str; @@ -168,7 +168,7 @@ private: // draw path in hairline paint.setColor(gPathColor); paint.setAlpha(fade); canvas->drawPath(path, paint); - + // draw clips in hair line paint.setColor(gClipAColor); paint.setAlpha(fade); canvas->drawPath(clipA, paint); diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp index f6c3383396..5af843f016 100644 --- a/gm/convexpaths.cpp +++ b/gm/convexpaths.cpp @@ -12,7 +12,7 @@ class SkOnce : SkNoncopyable { public: SkOnce() { fDidOnce = false; } - + bool needToDo() const { return !fDidOnce; } bool alreadyDone() const { return fDidOnce; } void accomplished() { @@ -125,14 +125,14 @@ protected: fPaths.back().lineTo(98 * SK_Scalar1, 100 * SK_Scalar1); fPaths.back().lineTo(3 * SK_Scalar1, 96 * SK_Scalar1); - + //It turns out arcTos are not automatically marked as convex and they //may in fact be ever so slightly concave. //fPaths.push_back().arcTo(SkRect::MakeXYWH(0, 0, // 50 * SK_Scalar1, // 100 * SK_Scalar1), // 25 * SK_Scalar1, 130 * SK_Scalar1, false); - + // cubics fPaths.push_back().cubicTo( 1 * SK_Scalar1, 1 * SK_Scalar1, 10 * SK_Scalar1, 90 * SK_Scalar1, @@ -140,7 +140,7 @@ protected: fPaths.push_back().cubicTo(100 * SK_Scalar1, 50 * SK_Scalar1, 20 * SK_Scalar1, 100 * SK_Scalar1, 0 * SK_Scalar1, 0 * SK_Scalar1); - + // path that has a cubic with a repeated first control point and // a repeated last control point. fPaths.push_back().moveTo(SK_Scalar1 * 10, SK_Scalar1 * 10); @@ -196,7 +196,7 @@ protected: // point degenerate fPaths.push_back().moveTo(50 * SK_Scalar1, 50 * SK_Scalar1); fPaths.back().lineTo(50 * SK_Scalar1, 50 * SK_Scalar1); - + fPaths.push_back().moveTo(50 * SK_Scalar1, 50 * SK_Scalar1); fPaths.back().quadTo(50 * SK_Scalar1, 50 * SK_Scalar1, 50 * SK_Scalar1, 50 * SK_Scalar1); @@ -251,7 +251,7 @@ protected: canvas->restore(); } } - + private: typedef GM INHERITED; SkTArray<SkPath> fPaths; diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp index 7cd3df159e..1fc13c06cf 100644 --- a/gm/cubicpaths.cpp +++ b/gm/cubicpaths.cpp @@ -19,9 +19,9 @@ protected: SkString onShortName() { return SkString("cubicpath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -38,7 +38,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -111,19 +111,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -149,7 +149,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; @@ -162,9 +162,9 @@ protected: SkString onShortName() { return SkString("cubicclosepath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -181,7 +181,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -255,19 +255,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -293,7 +293,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/degeneratesegments.cpp b/gm/degeneratesegments.cpp index 63d9dba651..2e19d05f7d 100644 --- a/gm/degeneratesegments.cpp +++ b/gm/degeneratesegments.cpp @@ -25,11 +25,11 @@ protected: SkString onShortName() { return SkString("degeneratesegments"); } - + SkISize onISize() { return make_isize(896, 930); } typedef SkPoint (*AddSegmentFunc)(SkPath&, SkPoint&); - + // We need to use explicit commands here, instead of addPath, because we // do not want the moveTo that is added at the beginning of a path to // appear in the appended path. @@ -205,7 +205,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { static const AddSegmentFunc gSegmentFunctions[] = { AddMove, @@ -315,7 +315,7 @@ protected: if (0 < column) { canvas->translate(rect.width() + 4*SK_Scalar1, 0); } - + SkColor color = 0xff007000; StyleAndName style = gStyles[(rand.nextU() >> 16) % numStyles]; CapAndName cap = gCaps[(rand.nextU() >> 16) % numCaps]; @@ -387,7 +387,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp index b4d6a18527..fa92393213 100644 --- a/gm/drawlooper.cpp +++ b/gm/drawlooper.cpp @@ -17,7 +17,7 @@ class DrawLooperGM : public skiagm::GM { public: - DrawLooperGM() : fLooper(NULL) { + DrawLooperGM() : fLooper(NULL) { this->setBGColor(0xFFDDDDDD); } @@ -29,7 +29,7 @@ protected: virtual SkISize onISize() { return SkISize::Make(520, 160); } - + virtual SkString onShortName() SK_OVERRIDE { return SkString("drawlooper"); } @@ -69,14 +69,14 @@ private: { SK_ColorBLUE, SkPaint::kFill_Style, 0, 0, 0 }, { 0x88000000, SkPaint::kFill_Style, 0, SkIntToScalar(10), 3 } }; - + fLooper = new SkLayerDrawLooper; - + SkLayerDrawLooper::LayerInfo info; info.fFlagsMask = SkPaint::kAntiAlias_Flag; info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMaskFilter_Bit; info.fColorMode = SkXfermode::kSrc_Mode; - + for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) { info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset); SkPaint* paint = fLooper->addLayer(info); diff --git a/gm/filltypes.cpp b/gm/filltypes.cpp index e096a6b1fc..86f1fbc9e1 100644 --- a/gm/filltypes.cpp +++ b/gm/filltypes.cpp @@ -12,10 +12,10 @@ namespace skiagm { class FillTypeGM : public GM { SkPath fPath; public: - FillTypeGM() { + FillTypeGM() { this->setBGColor(0xFFDDDDDD); } - + void makePath() { if (fPath.isEmpty()) { const SkScalar radius = SkIntToScalar(45); @@ -23,13 +23,13 @@ public: fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius); } } - + protected: virtual SkString onShortName() { return SkString("filltypes"); } - virtual SkISize onISize() { + virtual SkISize onISize() { return make_isize(835, 840); } @@ -65,7 +65,7 @@ protected: this->makePath(); canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); - + SkPaint paint; const SkScalar scale = SkIntToScalar(5)/4; @@ -82,7 +82,7 @@ protected: canvas->translate(SkIntToScalar(450), 0); showFour(canvas, scale, paint); } - + private: typedef GM INHERITED; }; diff --git a/gm/filltypespersp.cpp b/gm/filltypespersp.cpp index e675990631..bdd14a73aa 100644 --- a/gm/filltypespersp.cpp +++ b/gm/filltypespersp.cpp @@ -14,7 +14,7 @@ class FillTypePerspGM : public GM { SkPath fPath; public: FillTypePerspGM() {} - + void makePath() { if (fPath.isEmpty()) { const SkScalar radius = SkIntToScalar(45); @@ -22,7 +22,7 @@ public: fPath.addCircle(SkIntToScalar(100), SkIntToScalar(100), radius); } } - + protected: virtual SkString onShortName() { return SkString("filltypespersp"); @@ -120,7 +120,7 @@ protected: canvas->translate(SkIntToScalar(450), 0); showFour(canvas, scale, true); } - + private: typedef GM INHERITED; }; diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp index 3e3163ca4a..99642f6e3e 100644 --- a/gm/gammatext.cpp +++ b/gm/gammatext.cpp @@ -50,7 +50,7 @@ static CGContextRef makeCG(const SkBitmap& bm) { CGContextSetAllowsFontSubpixelQuantization(cg, false); CGContextSetShouldSubpixelQuantizeFonts(cg, false); - + return cg; } @@ -81,7 +81,7 @@ static void cgSetPaintForText(CGContextRef cg, const SkPaint& paint) { CGContextSetAllowsFontSubpixelPositioning(cg, paint.isSubpixelText()); CGContextSetShouldSubpixelPositionFonts(cg, paint.isSubpixelText()); - + CGContextSetShouldAntialias(cg, paint.isAntiAlias()); CGContextSetShouldSmoothFonts(cg, paint.isLCDRenderText()); } @@ -107,7 +107,7 @@ namespace skiagm { Each region should show as a blue center surrounded by a 2px green border, with no red. */ - + #define HEIGHT 480 class GammaTextGM : public GM { @@ -133,7 +133,7 @@ protected: #else SkShader* s = make_heatGradient(pts); #endif - + canvas->clear(SK_ColorRED); SkPaint paint; paint.setShader(s)->unref(); @@ -145,7 +145,7 @@ protected: #ifdef SK_BUILD_FOR_MAC CGContextRef cg = makeCG(canvas->getDevice()->accessBitmap(false)); #endif - + drawGrad(canvas); const SkColor fg[] = { @@ -154,7 +154,7 @@ protected: 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF000000, }; - + const char* text = "Hamburgefons"; size_t len = strlen(text); @@ -167,13 +167,13 @@ protected: SkScalar x = SkIntToScalar(10); for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { paint.setColor(fg[i]); - + SkScalar y = SkIntToScalar(40); SkScalar stopy = SkIntToScalar(HEIGHT); while (y < stopy) { if (true) { canvas->drawText(text, len, x, y, paint); - } + } #ifdef SK_BUILD_FOR_MAC else { cgDrawText(cg, text, len, SkScalarToFloat(x), diff --git a/gm/getpostextpath.cpp b/gm/getpostextpath.cpp index 4f32a41927..aa65173512 100644 --- a/gm/getpostextpath.cpp +++ b/gm/getpostextpath.cpp @@ -46,11 +46,11 @@ protected: paint.getTextPath(text, len, 0, 0, &path); strokePath(canvas, path); path.reset(); - + SkAutoTArray<SkPoint> pos(len); SkAutoTArray<SkScalar> widths(len); paint.getTextWidths(text, len, &widths[0]); - + SkRandom rand; SkScalar x = SkIntToScalar(20); SkScalar y = SkIntToScalar(100); @@ -58,9 +58,9 @@ protected: pos[i].set(x, y + rand.nextSScalar1() * 24); x += widths[i]; } - + canvas->translate(0, SkIntToScalar(64)); - + canvas->drawPosText(text, len, &pos[0], paint); paint.getPosTextPath(text, len, &pos[0], &path); strokePath(canvas, path); @@ -17,7 +17,7 @@ #include "SkTRegistry.h" namespace skiagm { - + static inline SkISize make_isize(int w, int h) { SkISize sz; sz.set(w, h); @@ -28,7 +28,7 @@ namespace skiagm { public: GM(); virtual ~GM(); - + enum Flags { kSkipPDF_Flag = 1 << 0, kSkipPicture_Flag = 1 << 1, @@ -39,7 +39,7 @@ namespace skiagm { void draw(SkCanvas*); void drawBackground(SkCanvas*); void drawContent(SkCanvas*); - + SkISize getISize() { return this->onISize(); } const char* shortName(); @@ -62,8 +62,8 @@ namespace skiagm { // GM's getISize bounds. void drawSizeBounds(SkCanvas*, SkColor); - static void SetResourcePath(const char* resourcePath) { - gResourcePath = resourcePath; + static void SetResourcePath(const char* resourcePath) { + gResourcePath = resourcePath; } protected: diff --git a/gm/gradients.cpp b/gm/gradients.cpp index 8e8bb13ee9..a2d1de24d7 100644 --- a/gm/gradients.cpp +++ b/gm/gradients.cpp @@ -77,9 +77,9 @@ static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data, SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3); center0.set(pts[0].fX + radius0, pts[0].fY + radius0); center1.set(pts[1].fX - radius1, pts[1].fY - radius1); - return SkGradientShader::CreateTwoPointConical(center1, radius1, - center0, radius0, - data.fColors, data.fPos, + return SkGradientShader::CreateTwoPointConical(center1, radius1, + center0, radius0, + data.fColors, data.fPos, data.fCount, tm, mapper); } @@ -93,19 +93,19 @@ static const GradMaker gGradMakers[] = { class GradientsGM : public GM { public: - GradientsGM() { + GradientsGM() { this->setBGColor(0xFFDDDDDD); } - + protected: SkString onShortName() { return SkString("gradients"); } - + virtual SkISize onISize() { return make_isize(640, 615); } - + virtual void onDraw(SkCanvas* canvas) { - + SkPoint pts[2] = { { 0, 0 }, { SkIntToScalar(100), SkIntToScalar(100) } @@ -114,7 +114,7 @@ protected: SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) }; SkPaint paint; paint.setAntiAlias(true); - + canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) { canvas->save(); @@ -129,7 +129,7 @@ protected: canvas->translate(SkIntToScalar(120), 0); } } - + private: typedef GM INHERITED; }; @@ -138,19 +138,19 @@ private: // gradient shaders' local matrices class GradientsLocalPerspectiveGM : public GM { public: - GradientsLocalPerspectiveGM() { + GradientsLocalPerspectiveGM() { this->setBGColor(0xFFDDDDDD); } - + protected: SkString onShortName() { return SkString("gradients_local_perspective"); } - + virtual SkISize onISize() { return make_isize(640, 615); } - + virtual void onDraw(SkCanvas* canvas) { - + SkPoint pts[2] = { { 0, 0 }, { SkIntToScalar(100), SkIntToScalar(100) } @@ -159,13 +159,13 @@ protected: SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) }; SkPaint paint; paint.setAntiAlias(true); - + canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); i++) { canvas->save(); for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) { SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, NULL); - + // apply an increasing y perspective as we move to the right SkMatrix perspective; perspective.setIdentity(); @@ -184,7 +184,7 @@ protected: canvas->translate(SkIntToScalar(120), 0); } } - + private: typedef GM INHERITED; }; @@ -196,9 +196,9 @@ protected: SkString onShortName() { return SkString("gradients_view_perspective"); } - + virtual SkISize onISize() { return make_isize(640, 400); } - + virtual void onDraw(SkCanvas* canvas) { SkMatrix perspective; perspective.setIdentity(); @@ -207,7 +207,7 @@ protected: canvas->concat(perspective); INHERITED::onDraw(canvas); } - + private: typedef GradientsGM INHERITED; }; @@ -219,7 +219,7 @@ private: ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - + var g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150); g.addColorStop(0, '#f00'); g.addColorStop(0.01, '#0f0'); @@ -231,21 +231,21 @@ private: class GradientsDegenrate2PointGM : public GM { public: GradientsDegenrate2PointGM() {} - + protected: SkString onShortName() { return SkString("gradients_degenerate_2pt"); } - - virtual SkISize onISize() { return make_isize(320, 320); } - + + virtual SkISize onISize() { return make_isize(320, 320); } + void drawBG(SkCanvas* canvas) { canvas->drawColor(SK_ColorBLUE); } - + virtual void onDraw(SkCanvas* canvas) { this->drawBG(canvas); - + SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorGREEN, SK_ColorRED }; SkScalar pos[] = { 0, SkFloatToScalar(0.01f), SkFloatToScalar(0.99f), SK_Scalar1 }; SkPoint c0; @@ -261,7 +261,7 @@ protected: paint.setShader(s)->unref(); canvas->drawPaint(paint); } - + private: typedef GM INHERITED; }; @@ -321,7 +321,7 @@ protected: const SkISize dim = this->getISize(); this->drawBG(canvas); - + SkPaint paint; paint.setDither(true); SkPoint center; diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp index 83f3507da1..4347c9b22f 100644 --- a/gm/hittestpath.cpp +++ b/gm/hittestpath.cpp @@ -13,12 +13,12 @@ static void test_hittest(SkCanvas* canvas, const SkPath& path) { SkPaint paint; SkRect r = path.getBounds(); - + paint.setColor(SK_ColorRED); canvas->drawPath(path, paint); - + const SkScalar MARGIN = SkIntToScalar(4); - + paint.setColor(0x800000FF); for (SkScalar y = r.fTop + SK_ScalarHalf - MARGIN; y < r.fBottom + MARGIN; y += SK_Scalar1) { for (SkScalar x = r.fLeft + SK_ScalarHalf - MARGIN; x < r.fRight + MARGIN; x += SK_Scalar1) { @@ -32,18 +32,18 @@ static void test_hittest(SkCanvas* canvas, const SkPath& path) { class HitTestPathGM : public skiagm::GM { public: HitTestPathGM () {} - + protected: virtual SkString onShortName() { return SkString("hittestpath"); } - + virtual SkISize onISize() { return SkISize::Make(700, 460); } - + virtual void onDraw(SkCanvas* canvas) { SkPath path; SkRandom rand; - + int scale = 300; for (int i = 0; i < 4; ++i) { path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale); @@ -53,18 +53,18 @@ protected: rand.nextUScalar1() * scale, rand.nextUScalar1() * scale, rand.nextUScalar1() * scale, rand.nextUScalar1() * scale); } - + path.setFillType(SkPath::kEvenOdd_FillType); path.offset(SkIntToScalar(20), SkIntToScalar(20)); - + test_hittest(canvas, path); canvas->translate(SkIntToScalar(scale), 0); path.setFillType(SkPath::kWinding_FillType); - + test_hittest(canvas, path); } - + private: typedef GM INHERITED; }; diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp index f326f4598b..406f9ef973 100644 --- a/gm/imageblur.cpp +++ b/gm/imageblur.cpp @@ -18,7 +18,7 @@ public: ImageBlurGM() { this->setBGColor(0xFF000000); } - + protected: virtual SkString onShortName() { return SkString("imageblur"); @@ -46,7 +46,7 @@ protected: } canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp index 31af2c85ac..73ce806e5d 100644 --- a/gm/imagefiltersbase.cpp +++ b/gm/imagefiltersbase.cpp @@ -25,7 +25,7 @@ protected: SkBitmap* result, SkIPoint* offset) { return false; } - + FailImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} private: @@ -109,27 +109,27 @@ static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { SkPaint paint; paint.setImageFilter(imf); - + SkIRect bounds; r.roundOut(&bounds); - + SkBitmap bm; bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height()); bm.allocPixels(); bm.eraseColor(0); SkCanvas c(bm); draw_path(&c, r, NULL); - + canvas->drawBitmap(bm, 0, 0, &paint); } static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { SkPaint paint; paint.setImageFilter(imf); - + SkIRect bounds; r.roundOut(&bounds); - + SkBitmap bm; bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height()); bm.allocPixels(); @@ -172,7 +172,7 @@ protected: draw_bitmap, draw_sprite }; - + SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode); SkImageFilter* filters[] = { @@ -196,14 +196,14 @@ protected: canvas->save(); for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { drawProc[i](canvas, r, filters[j]); - + draw_frame(canvas, r); canvas->translate(0, DY); } canvas->restore(); canvas->translate(DX, 0); } - + for(size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { SkSafeUnref(filters[j]); } diff --git a/gm/lcdtext.cpp b/gm/lcdtext.cpp index ab8b8e4b84..706d4fdc79 100644 --- a/gm/lcdtext.cpp +++ b/gm/lcdtext.cpp @@ -31,7 +31,7 @@ protected: SkISize onISize() { return make_isize(640, 480); } virtual void onDraw(SkCanvas* canvas) { - + y = textHeight; drawText(canvas, SkString("TEXT: SubpixelTrue LCDRenderTrue"), true, true); diff --git a/gm/linepaths.cpp b/gm/linepaths.cpp index 3d84c379d7..fbf3faf947 100644 --- a/gm/linepaths.cpp +++ b/gm/linepaths.cpp @@ -19,9 +19,9 @@ protected: SkString onShortName() { return SkString("linepath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -38,7 +38,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -109,19 +109,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -147,7 +147,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; @@ -160,9 +160,9 @@ protected: SkString onShortName() { return SkString("lineclosepath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -179,7 +179,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -251,19 +251,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -289,7 +289,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp index 226649dc15..fde5b6c3ae 100644 --- a/gm/ninepatchstretch.cpp +++ b/gm/ninepatchstretch.cpp @@ -16,7 +16,7 @@ class GrContext; static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { SkDevice* dev; SkCanvas canvas; - + const int kFixed = 28; const int kStretchy = 8; const int kSize = 2*kFixed + kStretchy; @@ -32,19 +32,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { bitmap->allocPixels(); dev = new SkDevice(*bitmap); } - + canvas.setDevice(dev)->unref(); canvas.clear(0); - + SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize)); const SkScalar strokeWidth = SkIntToScalar(6); const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2; - + center->setXYWH(kFixed, kFixed, kStretchy, kStretchy); - + SkPaint paint; paint.setAntiAlias(true); - + paint.setColor(0xFFFF0000); canvas.drawRoundRect(r, radius, radius, paint); r.setXYWH(SkIntToScalar(kFixed), 0, SkIntToScalar(kStretchy), SkIntToScalar(kSize)); @@ -56,19 +56,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { } namespace skiagm { - + class NinePatchStretchGM : public GM { public: SkBitmap fBM; - NinePatchStretchGM() {} + NinePatchStretchGM() {} protected: virtual SkString onShortName() { return SkString("ninepatch-stretch"); } - virtual SkISize onISize() { + virtual SkISize onISize() { return make_isize(400, 400); } @@ -76,25 +76,25 @@ protected: SkBitmap bm; SkIRect center; make_bitmap(&bm, NULL /*SampleCode::GetGr()*/, ¢er); - + // amount of bm that should not be stretched (unless we have to) const SkScalar fixed = SkIntToScalar(bm.width() - center.width()); - + const SkTSize<SkScalar> size[] = { { fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes { fixed * 4 / 5, fixed * 4 }, // shrink in X { fixed * 4, fixed * 4 / 5 }, // shrink in Y { fixed * 4, fixed * 4 } }; - + canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL); - + SkScalar x = SkIntToScalar(100); SkScalar y = SkIntToScalar(100); - + SkPaint paint; paint.setFilterBitmap(true); - + for (int iy = 0; iy < 2; ++iy) { for (int ix = 0; ix < 2; ++ix) { int i = ix * 2 + iy; @@ -104,7 +104,7 @@ protected: } } } - + private: typedef GM INHERITED; }; diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp index fc864198b4..bfaabc924a 100644 --- a/gm/pathfill.cpp +++ b/gm/pathfill.cpp @@ -13,7 +13,7 @@ static SkScalar make_frame(SkPath* path) { SkRect r = { SkIntToScalar(10), SkIntToScalar(10), SkIntToScalar(630), SkIntToScalar(470) }; path->addRoundRect(r, SkIntToScalar(15), SkIntToScalar(15)); - + SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(SkIntToScalar(5)); @@ -55,7 +55,7 @@ static SkScalar make_sawtooth(SkPath* path) { const SkScalar x0 = x; const SkScalar dx = SK_Scalar1 * 5; const SkScalar dy = SK_Scalar1 * 10; - + path->moveTo(x, y); for (int i = 0; i < 32; i++) { x += dx; @@ -72,10 +72,10 @@ static SkScalar make_sawtooth(SkPath* path) { static SkScalar make_star(SkPath* path, int n) { const SkScalar c = SkIntToScalar(45); const SkScalar r = SkIntToScalar(20); - + SkScalar rad = -SK_ScalarPI / 2; const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; - + path->moveTo(c, c - r); for (int i = 1; i < n; i++) { rad += drad; @@ -123,26 +123,26 @@ public: fDY[i] = gProcs[i](&fPath[i]); } } - + protected: virtual SkString onShortName() { return SkString("pathfill"); } - + virtual SkISize onISize() { return SkISize::Make(640, 480); } - + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; paint.setAntiAlias(true); - + for (size_t i = 0; i < N; i++) { canvas->drawPath(fPath[i], paint); canvas->translate(SkIntToScalar(0), fDY[i]); } } - + private: typedef skiagm::GM INHERITED; }; @@ -157,16 +157,16 @@ public: fDY[i] = gProcs[i](&fPath[i]); } } - + protected: virtual SkString onShortName() { return SkString("pathinvfill"); } - + virtual SkISize onISize() { return SkISize::Make(450, 220); } - + static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint, const SkRect* clip, SkScalar top, const SkScalar bottom) { canvas->save(); @@ -182,7 +182,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkPath path; - + path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40)); path.toggleInverseFillType(); @@ -197,18 +197,18 @@ protected: canvas->save(); canvas->clipRect(clipR); - + const SkRect* clipPtr = doclip ? &clipR : NULL; show(canvas, path, paint, clipPtr, clipR.fTop, clipR.centerY()); show(canvas, path, paint, clipPtr, clipR.centerY(), clipR.fBottom); - + canvas->restore(); canvas->translate(SkIntToScalar(110), 0); } } } - + private: typedef skiagm::GM INHERITED; }; diff --git a/gm/pathreverse.cpp b/gm/pathreverse.cpp index 3f860d5a91..b605a4c647 100644 --- a/gm/pathreverse.cpp +++ b/gm/pathreverse.cpp @@ -14,7 +14,7 @@ static void test_path(SkCanvas* canvas, const SkPath& path) { SkPaint paint; paint.setAntiAlias(true); canvas->drawPath(path, paint); - + paint.setStyle(SkPaint::kStroke_Style); paint.setColor(SK_ColorRED); canvas->drawPath(path, paint); @@ -80,15 +80,15 @@ protected: virtual void onDraw(SkCanvas* canvas) { if (false) test_rev(canvas); // avoid bit rot, suppress warning SkRect r = { 10, 10, 100, 60 }; - + SkPath path; - + path.addRect(r); test_rev(canvas, path); - + canvas->translate(0, 100); path.offset(20, 20); path.addRect(r); test_rev(canvas, path); - + canvas->translate(0, 100); path.reset(); path.moveTo(10, 10); path.lineTo(30, 30); @@ -96,7 +96,7 @@ protected: r.offset(50, 20); path.addOval(r); test_rev(canvas, path); - + SkPaint paint; paint.setTextSize(SkIntToScalar(100)); SkTypeface* hira = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface::kNormal); diff --git a/gm/poly2poly.cpp b/gm/poly2poly.cpp index df824b5c11..9ad5bdcaae 100644 --- a/gm/poly2poly.cpp +++ b/gm/poly2poly.cpp @@ -11,38 +11,38 @@ namespace skiagm { class Poly2PolyGM : public GM { public: - Poly2PolyGM() {} - + Poly2PolyGM() {} + protected: virtual SkString onShortName() { return SkString("poly2poly"); } - virtual SkISize onISize() { + virtual SkISize onISize() { return make_isize(835, 840); } - + static void doDraw(SkCanvas* canvas, SkPaint* paint, const int isrc[], const int idst[], int count) { SkMatrix matrix; SkPoint src[4], dst[4]; - + for (int i = 0; i < count; i++) { src[i].set(SkIntToScalar(isrc[2*i+0]), SkIntToScalar(isrc[2*i+1])); dst[i].set(SkIntToScalar(idst[2*i+0]), SkIntToScalar(idst[2*i+1])); } - + canvas->save(); matrix.setPolyToPoly(src, dst, count); canvas->concat(matrix); - + paint->setColor(SK_ColorGRAY); paint->setStyle(SkPaint::kStroke_Style); const SkScalar D = SkIntToScalar(64); canvas->drawRectCoords(0, 0, D, D, *paint); canvas->drawLine(0, 0, D, D, *paint); canvas->drawLine(0, D, D, 0, *paint); - + SkPaint::FontMetrics fm; paint->getFontMetrics(&fm); paint->setColor(SK_ColorRED); @@ -52,17 +52,17 @@ protected: SkString str; str.appendS32(count); canvas->drawText(str.c_str(), str.size(), x, y, *paint); - + canvas->restore(); } - - virtual void onDraw(SkCanvas* canvas) { + + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; paint.setAntiAlias(true); paint.setStrokeWidth(SkIntToScalar(4)); paint.setTextSize(SkIntToScalar(40)); paint.setTextAlign(SkPaint::kCenter_Align); - + canvas->save(); canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); // translate (1 point) @@ -70,7 +70,7 @@ protected: const int dst1[] = { 5, 5 }; doDraw(canvas, &paint, src1, dst1, 1); canvas->restore(); - + canvas->save(); canvas->translate(SkIntToScalar(160), SkIntToScalar(10)); // rotate/uniform-scale (2 points) @@ -78,7 +78,7 @@ protected: const int dst2[] = { 32, 32, 64, 48 }; doDraw(canvas, &paint, src2, dst2, 2); canvas->restore(); - + canvas->save(); canvas->translate(SkIntToScalar(10), SkIntToScalar(110)); // rotate/skew (3 points) @@ -86,7 +86,7 @@ protected: const int dst3[] = { 0, 0, 96, 0, 24, 64 }; doDraw(canvas, &paint, src3, dst3, 3); canvas->restore(); - + canvas->save(); canvas->translate(SkIntToScalar(160), SkIntToScalar(110)); // perspective (4 points) @@ -95,7 +95,7 @@ protected: doDraw(canvas, &paint, src4, dst4, 4); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/quadpaths.cpp b/gm/quadpaths.cpp index f8b172bc6c..ac91c62df3 100644 --- a/gm/quadpaths.cpp +++ b/gm/quadpaths.cpp @@ -19,9 +19,9 @@ protected: SkString onShortName() { return SkString("quadpath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -38,7 +38,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -110,19 +110,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -148,7 +148,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; @@ -161,9 +161,9 @@ protected: SkString onShortName() { return SkString("quadclosepath"); } - + SkISize onISize() { return make_isize(1240, 390); } - + void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPath::FillType fill, @@ -180,7 +180,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -253,19 +253,19 @@ protected: if (0 < style) { canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - + SkColor color = 0xff007000; this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); - + SkPaint rectPaint; rectPaint.setColor(SK_ColorBLACK); rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); rectPaint.setAntiAlias(true); canvas->drawRect(rect, rectPaint); - + SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); @@ -291,7 +291,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp index 1539cfa64e..c6e8ba9b5c 100644 --- a/gm/simpleaaclip.cpp +++ b/gm/simpleaaclip.cpp @@ -38,7 +38,7 @@ static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip, ////////////////////////////////////////////////////////////////////////////// /* - * This GM tests anti aliased single operation booleans with SkAAClips, + * This GM tests anti aliased single operation booleans with SkAAClips, * SkRect and SkPaths. */ class SimpleClipGM : public GM { @@ -53,9 +53,9 @@ public: : fGeomType(geomType) { // offset the rects a bit so we get anti-aliasing in the rect case - fBase.set(SkFloatToScalar(100.65f), - SkFloatToScalar(100.65f), - SkFloatToScalar(150.65f), + fBase.set(SkFloatToScalar(100.65f), + SkFloatToScalar(100.65f), + SkFloatToScalar(150.65f), SkFloatToScalar(150.65f)); fRect = fBase; fRect.inset(5, 5); @@ -77,14 +77,14 @@ protected: void drawOrig(SkCanvas* canvas) { SkPaint paint; - + paint.setStyle(SkPaint::kStroke_Style); paint.setColor(SK_ColorBLACK); - + canvas->drawRect(fBase, paint); canvas->drawRect(fRect, paint); } - + void drawRgnOped(SkCanvas* canvas, SkRegion::Op op, SkColor color) { SkAAClip clip; @@ -128,9 +128,9 @@ protected: virtual SkString onShortName() { SkString str; - str.printf("simpleaaclip_%s", + str.printf("simpleaaclip_%s", kRect_GeomType == fGeomType ? "rect" : - (kPath_GeomType == fGeomType ? "path" : + (kPath_GeomType == fGeomType ? "path" : "aaclip")); return str; } @@ -161,7 +161,7 @@ protected: for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) { canvas->drawText(gOps[op].fName, strlen(gOps[op].fName), - SkIntToScalar(75), SkIntToScalar(50), + SkIntToScalar(75), SkIntToScalar(50), textPaint); if (kAAClip_GeomType == fGeomType) { diff --git a/gm/strokerects.cpp b/gm/strokerects.cpp index 92f2a187bd..62a9639c2b 100644 --- a/gm/strokerects.cpp +++ b/gm/strokerects.cpp @@ -23,7 +23,7 @@ static const SkScalar SH = SkIntToScalar(H); class StrokeRectGM : public GM { public: StrokeRectGM() {} - + protected: virtual SkString onShortName() { return SkString("strokerects"); @@ -40,7 +40,7 @@ protected: SkScalar h = rand.nextUScalar1() * (H >> 2); SkScalar hoffset = rand.nextSScalar1(); SkScalar woffset = rand.nextSScalar1(); - + r->set(x, y, x + w, y + h); r->offset(-w/2 + woffset, -h/2 + hoffset); } @@ -70,7 +70,7 @@ protected: } } } - + private: typedef GM INHERITED; }; diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp index 6e2b943ce7..c8806f904d 100644 --- a/gm/tablecolorfilter.cpp +++ b/gm/tablecolorfilter.cpp @@ -16,7 +16,7 @@ static void make_bm0(SkBitmap* bm) { bm->setConfig(SkBitmap::kARGB_8888_Config, W, H); bm->allocPixels(); bm->eraseColor(0); - + SkCanvas canvas(*bm); SkPaint paint; SkPoint pts[] = { {0, 0}, {SkIntToScalar(W), SkIntToScalar(H)} }; @@ -35,7 +35,7 @@ static void make_bm1(SkBitmap* bm) { bm->setConfig(SkBitmap::kARGB_8888_Config, W, H); bm->allocPixels(); bm->eraseColor(0); - + SkCanvas canvas(*bm); SkPaint paint; SkScalar cx = SkIntToScalar(W)/2; @@ -92,27 +92,27 @@ static SkColorFilter* make_cf3() { class TableColorFilterGM : public skiagm::GM { public: TableColorFilterGM() {} - + protected: virtual SkString onShortName() { return SkString("tablecolorfilter"); } - + virtual SkISize onISize() { return SkISize::Make(700, 300); } - + virtual void onDraw(SkCanvas* canvas) { canvas->drawColor(0xFFDDDDDD); canvas->translate(20, 20); - + SkScalar x = 0, y = 0; - + static void (*gMakers[])(SkBitmap*) = { make_bm0, make_bm1 }; for (size_t maker = 0; maker < SK_ARRAY_COUNT(gMakers); ++maker) { SkBitmap bm; gMakers[maker](&bm); - + SkPaint paint; x = 0; canvas->drawBitmap(bm, x, y, &paint); @@ -124,11 +124,11 @@ protected: canvas->drawBitmap(bm, x, y, &paint); paint.setColorFilter(make_cf3())->unref(); x += bm.width() * 9 / 8; canvas->drawBitmap(bm, x, y, &paint); - + y += bm.height() * 9 / 8; } } - + private: typedef GM INHERITED; }; diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp index 113cdfa217..39b974b296 100644 --- a/gm/testimagefilters.cpp +++ b/gm/testimagefilters.cpp @@ -52,13 +52,13 @@ static SkImageFilter* make6() { SkAutoUnref aur1(inner); SkImageFilter* compose = new SkComposeImageFilter(outer, inner); SkAutoUnref aur2(compose); - + SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode); SkAutoUnref aur3(cf); SkImageFilter* blue = new SkColorFilterImageFilter(cf); SkAutoUnref aur4(blue); - + return new SkMergeImageFilter(compose, blue); } @@ -69,13 +69,13 @@ static SkImageFilter* make7() { SkAutoUnref aur1(inner); SkImageFilter* compose = new SkComposeImageFilter(outer, inner); SkAutoUnref aur2(compose); - + SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode); SkAutoUnref aur3(cf); SkImageFilter* blue = new SkColorFilterImageFilter(cf); SkAutoUnref aur4(blue); - + return new SkMergeImageFilter(compose, blue); } @@ -106,9 +106,9 @@ protected: static SkImageFilter* (*gFilterProc[])() = { make0, make1, make2, make3, make4, make5, make6, make7 }; - + const SkRect bounds = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT); - + const SkScalar dx = bounds.width() * 8 / 7; const SkScalar dy = bounds.height() * 8 / 7; @@ -124,7 +124,7 @@ protected: SkPaint p; p.setStyle(SkPaint::kStroke_Style); canvas->drawRect(bounds, p); - + SkPaint paint; paint.setImageFilter(gFilterProc[i]())->unref(); canvas->saveLayer(&bounds, &paint); diff --git a/gm/texdata.cpp b/gm/texdata.cpp index 927ee170c3..cf1a701cef 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -87,7 +87,7 @@ protected: desc.fConfig = kSkia8888_PM_GrPixelConfig; desc.fWidth = 2 * S; desc.fHeight = 2 * S; - GrTexture* texture = + GrTexture* texture = ctx->createUncachedTexture(desc, gTextureData, 0); if (!texture) { @@ -129,7 +129,7 @@ protected: offset = 0; for (int y = 0; y < S; ++y) { for (int x = 0; x < S; ++x) { - gTextureData[offset + y * stride + x] = + gTextureData[offset + y * stride + x] = ((x + y) % 2) ? (i ? green : red) : blue; } } |