diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:19:56 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:19:56 +0000 |
commit | ae933ce0ea5fd9d21cb6ef2cee7e729d32690aac (patch) | |
tree | 62d80e33b16679d01454cf814977a7030d3a5462 /gm | |
parent | d6176b0dcacb124539e0cfd051e6d93a9782f020 (diff) |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6475053
git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/arithmode.cpp | 4 | ||||
-rw-r--r-- | gm/blend.cpp | 4 | ||||
-rw-r--r-- | gm/complexclip2.cpp | 14 | ||||
-rw-r--r-- | gm/dashcubics.cpp | 2 | ||||
-rw-r--r-- | gm/dashing.cpp | 22 | ||||
-rw-r--r-- | gm/drawbitmaprect.cpp | 4 | ||||
-rw-r--r-- | gm/emptypath.cpp | 6 | ||||
-rw-r--r-- | gm/extractbitmap.cpp | 8 | ||||
-rw-r--r-- | gm/giantbitmap.cpp | 8 | ||||
-rw-r--r-- | gm/gradtext.cpp | 4 | ||||
-rw-r--r-- | gm/hairmodes.cpp | 28 | ||||
-rw-r--r-- | gm/image.cpp | 20 | ||||
-rw-r--r-- | gm/imagefiltersgraph.cpp | 2 | ||||
-rw-r--r-- | gm/lighting.cpp | 4 | ||||
-rw-r--r-- | gm/morphology.cpp | 4 | ||||
-rw-r--r-- | gm/patheffects.cpp | 4 | ||||
-rw-r--r-- | gm/points.cpp | 4 | ||||
-rw-r--r-- | gm/samplerstress.cpp | 6 | ||||
-rw-r--r-- | gm/shadertext.cpp | 8 | ||||
-rw-r--r-- | gm/strokefill.cpp | 8 | ||||
-rw-r--r-- | gm/strokes.cpp | 54 | ||||
-rw-r--r-- | gm/texteffects.cpp | 80 | ||||
-rw-r--r-- | gm/tilemodes.cpp | 32 | ||||
-rw-r--r-- | gm/tinybitmap.cpp | 6 | ||||
-rw-r--r-- | gm/twopointradial.cpp | 16 | ||||
-rw-r--r-- | gm/typeface.cpp | 2 | ||||
-rw-r--r-- | gm/verttext.cpp | 4 | ||||
-rw-r--r-- | gm/verttext2.cpp | 4 | ||||
-rw-r--r-- | gm/verylargebitmap.cpp | 2 | ||||
-rw-r--r-- | gm/xfermodes.cpp | 2 |
30 files changed, 183 insertions, 183 deletions
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp index 8212acb77f..6f10dd6beb 100644 --- a/gm/arithmode.cpp +++ b/gm/arithmode.cpp @@ -94,7 +94,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkBitmap src = make_src(); SkBitmap dst = make_dst(); - + const SkScalar one = SK_Scalar1; static const SkScalar K[] = { 0, 0, 0, 0, @@ -109,7 +109,7 @@ protected: one/4, one/2, one/2, 0, -one/4, one/2, one/2, 0, }; - + const SkScalar* k = K; const SkScalar* stop = k + SK_ARRAY_COUNT(K); SkScalar y = 0; diff --git a/gm/blend.cpp b/gm/blend.cpp index d766a186d2..f1f47b3444 100644 --- a/gm/blend.cpp +++ b/gm/blend.cpp @@ -16,7 +16,7 @@ public: ImageBlendGM() : fInitialized(false) { this->setBGColor(0xFF000000); } - + protected: virtual SkString onShortName() { return SkString("blend"); @@ -83,7 +83,7 @@ protected: paint.setImageFilter(SkNEW_ARGS(SkBlendImageFilter, (SkBlendImageFilter::kLighten_Mode, background)))->unref(); canvas->drawSprite(fBitmap, 400, 0, &paint); } - + private: typedef GM INHERITED; SkBitmap fBitmap, fCheckerboard; diff --git a/gm/complexclip2.cpp b/gm/complexclip2.cpp index e72227ac31..ce1f0e0746 100644 --- a/gm/complexclip2.cpp +++ b/gm/complexclip2.cpp @@ -19,7 +19,7 @@ public: : fDoPaths(doPaths) , fAntiAlias(antiAlias) { this->setBGColor(SkColorSetRGB(0xDD,0xA0,0xDD)); - + // offset the rects a bit so we get antialiasing even in the rect case SkScalar xA = SkFloatToScalar(0.65f); SkScalar xB = SkFloatToScalar(10.65f); @@ -93,7 +93,7 @@ protected: } SkString str; - str.printf("complexclip2_%s_%s", + str.printf("complexclip2_%s_%s", fDoPaths ? "path" : "rect", fAntiAlias ? "aa" : "bw"); return str; @@ -119,7 +119,7 @@ protected: canvas->translate(kPadX * SK_Scalar1 + (fWidth + kPadX * SK_Scalar1)*j, kPadY * SK_Scalar1 + (fHeight + kPadY * SK_Scalar1)*i); - // draw the original shapes first so we can see the + // draw the original shapes first so we can see the // antialiasing on the clipped draw for (int k = 0; k < 5; ++k) { rectPaint.setColor(fRectColors[k]); @@ -132,12 +132,12 @@ protected: for (int k = 0; k < 5; ++k) { if (fDoPaths) { - canvas->clipPath(fPaths[k], - fOps[j*kRows+i][k], + canvas->clipPath(fPaths[k], + fOps[j*kRows+i][k], fAntiAlias); } else { - canvas->clipRect(fRects[k], - fOps[j*kRows+i][k], + canvas->clipRect(fRects[k], + fOps[j*kRows+i][k], fAntiAlias); } } diff --git a/gm/dashcubics.cpp b/gm/dashcubics.cpp index d245070007..bbce9be66e 100644 --- a/gm/dashcubics.cpp +++ b/gm/dashcubics.cpp @@ -41,7 +41,7 @@ protected: "C 283,231 344,195 338,98"; SkParsePath::FromSVGString(d, &path); - + SkScalar intervals[] = { 5, 10 }; SkPathEffect* pe = new SkDashPathEffect(intervals, 2, 0); diff --git a/gm/dashing.cpp b/gm/dashing.cpp index 196b401495..2f1f0260c9 100644 --- a/gm/dashing.cpp +++ b/gm/dashing.cpp @@ -51,7 +51,7 @@ protected: { 1, 1 }, { 4, 1 }, }; - + SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); @@ -64,7 +64,7 @@ protected: int w = width * width * width; paint.setAntiAlias(SkToBool(aa)); paint.setStrokeWidth(SkIntToScalar(w)); - + int scale = w ? w : 1; drawline(canvas, gData[data].fOnInterval * scale, @@ -74,7 +74,7 @@ protected: } } } - + show_giant_dash(canvas); } }; @@ -84,7 +84,7 @@ protected: static void make_unit_star(SkPath* path, int n) { SkScalar rad = -SK_ScalarPI / 2; const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; - + path->moveTo(0, -SK_Scalar1); for (int i = 1; i < n; i++) { rad += drad; @@ -117,14 +117,14 @@ static void make_path_star(SkPath* path, const SkRect& bounds) { class Dashing2GM : public skiagm::GM { public: Dashing2GM() {} - + protected: SkString onShortName() { return SkString("dashing2"); } - + SkISize onISize() { return skiagm::make_isize(640, 480); } - + virtual void onDraw(SkCanvas* canvas) { static const int gIntervals[] = { 3, // 3 dashes: each count [0] followed by intervals [1..count] @@ -136,12 +136,12 @@ protected: void (*gProc[])(SkPath*, const SkRect&) = { make_path_line, make_path_rect, make_path_oval, make_path_star, }; - + SkPaint paint; paint.setAntiAlias(true); paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(SkIntToScalar(6)); - + SkRect bounds = SkRect::MakeWH(SkIntToScalar(120), SkIntToScalar(120)); bounds.offset(SkIntToScalar(20), SkIntToScalar(20)); SkScalar dx = bounds.width() * 4 / 3; @@ -156,13 +156,13 @@ protected: } SkScalar phase = vals[0] / 2; paint.setPathEffect(new SkDashPathEffect(vals, count, phase))->unref(); - + for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) { SkPath path; SkRect r = bounds; r.offset(x * dx, y * dy); gProc[x](&path, r); - + canvas->drawPath(path, paint); } } diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp index fdd0726382..f9b348faf9 100644 --- a/gm/drawbitmaprect.cpp +++ b/gm/drawbitmaprect.cpp @@ -87,9 +87,9 @@ protected: SkString onShortName() { return SkString("drawbitmaprect"); } - + SkISize onISize() { return make_isize(gSize, gSize); } - + virtual void onDraw(SkCanvas* canvas) { static const int kBmpSize = 2048; if (fLargeBitmap.isNull()) { diff --git a/gm/emptypath.cpp b/gm/emptypath.cpp index c52932efee..df314a356d 100644 --- a/gm/emptypath.cpp +++ b/gm/emptypath.cpp @@ -20,7 +20,7 @@ protected: SkString onShortName() { return SkString("emptypath"); } - + SkISize onISize() { return make_isize(600, 280); } void drawEmpty(SkCanvas* canvas, @@ -38,7 +38,7 @@ protected: canvas->drawPath(path, paint); canvas->restore(); } - + virtual void onDraw(SkCanvas* canvas) { struct FillAndName { SkPath::FillType fFill; @@ -120,7 +120,7 @@ protected: canvas->restore(); canvas->restore(); } - + private: typedef GM INHERITED; }; diff --git a/gm/extractbitmap.cpp b/gm/extractbitmap.cpp index 68f6d44e24..59f8a93cb7 100644 --- a/gm/extractbitmap.cpp +++ b/gm/extractbitmap.cpp @@ -29,7 +29,7 @@ static void create_bitmap(SkBitmap* bitmap) { class ExtractBitmapGM : public GM { public: ExtractBitmapGM() {} - + protected: // overrides from SkEventSink virtual SkString onShortName() SK_OVERRIDE { @@ -75,14 +75,14 @@ protected: // Now do the same but with a device bitmap as source image SkAutoTUnref<SkDevice> secondDevice(canvas->createCompatibleDevice( - SkBitmap::kARGB_8888_Config, bitmap.width(), + SkBitmap::kARGB_8888_Config, bitmap.width(), bitmap.height(), true)); SkCanvas secondCanvas(secondDevice.get()); secondCanvas.writePixels(bitmap, 0, 0); SkBitmap deviceBitmap = secondDevice->accessBitmap(false); SkBitmap deviceSubset; - deviceBitmap.extractSubset(&deviceSubset, + deviceBitmap.extractSubset(&deviceSubset, SkIRect::MakeXYWH(x, y, x, y)); canvas->translate(SkIntToScalar(120), SkIntToScalar(0)); @@ -91,7 +91,7 @@ protected: canvas->drawBitmap(deviceSubset, 0, 0); } - + private: typedef GM INHERITED; }; diff --git a/gm/giantbitmap.cpp b/gm/giantbitmap.cpp index 2ac7727470..16c01d7f0e 100644 --- a/gm/giantbitmap.cpp +++ b/gm/giantbitmap.cpp @@ -23,7 +23,7 @@ class GiantBitmapGM : public skiagm::GM { SkShader::TileMode fMode; bool fDoFilter; bool fDoRotate; - + const SkBitmap& getBitmap() { if (NULL == fBM) { fBM = new SkBitmap; @@ -39,7 +39,7 @@ class GiantBitmapGM : public skiagm::GM { SkPaint paint; paint.setAntiAlias(true); paint.setStrokeWidth(SkIntToScalar(20)); - + #if 0 for (int y = -H*2; y < H; y += 50) { SkScalar yy = SkIntToScalar(y); @@ -108,12 +108,12 @@ protected: m.setScale(scale, scale); } s->setLocalMatrix(m); - + paint.setShader(s)->unref(); paint.setFilterBitmap(fDoFilter); canvas->translate(SkIntToScalar(50), SkIntToScalar(50)); - + SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16); // canvas->drawRect(r, paint); return; canvas->drawPaint(paint); diff --git a/gm/gradtext.cpp b/gm/gradtext.cpp index c155cb76b4..f26222af0b 100644 --- a/gm/gradtext.cpp +++ b/gm/gradtext.cpp @@ -36,7 +36,7 @@ static SkShader* make_chrome_solid() { } namespace skiagm { - + // Replicate chrome layout test - clipped pathed gradient-shaded text class ChromeGradTextGM1 : public GM { public: @@ -149,7 +149,7 @@ protected: paint.setShader(make_grad2(SkIntToScalar(80)))->unref(); draw_text3(canvas, paint); - + canvas->translate(0, paint.getTextSize() * 2); } } diff --git a/gm/hairmodes.cpp b/gm/hairmodes.cpp index 8ede95c66f..67f1fa370d 100644 --- a/gm/hairmodes.cpp +++ b/gm/hairmodes.cpp @@ -54,7 +54,7 @@ static SkScalar drawCell(SkCanvas* canvas, SkXfermode* mode, SkAlpha a0, SkAlpha paint.setStrokeWidth(SK_Scalar1 * angle * 2 / 24); canvas->drawLine(W/2, H/2, W/2 + x, H/2 + y, paint); } - + return H; } @@ -68,7 +68,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); @@ -76,28 +76,28 @@ static SkShader* make_bg_shader() { } namespace skiagm { - + class HairModesGM : public GM { SkPaint fBGPaint; public: HairModesGM() { fBGPaint.setShader(make_bg_shader())->unref(); } - + protected: - + virtual SkString onShortName() { return SkString("hairmodes"); } - + virtual SkISize onISize() { return make_isize(640, 480); } - + virtual void onDraw(SkCanvas* canvas) { const SkRect bounds = SkRect::MakeWH(W, H); static const SkAlpha gAlphaValue[] = { 0xFF, 0x88, 0x88 }; - + canvas->translate(SkIntToScalar(4), SkIntToScalar(4)); - + for (int alpha = 0; alpha < 4; ++alpha) { canvas->save(); canvas->save(); @@ -108,14 +108,14 @@ namespace skiagm { canvas->save(); } SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); - + canvas->drawRect(bounds, fBGPaint); canvas->saveLayer(&bounds, NULL); SkScalar dy = drawCell(canvas, mode, gAlphaValue[alpha & 1], gAlphaValue[alpha & 2]); canvas->restore(); - + canvas->translate(0, dy * 5 / 4); SkSafeUnref(mode); } @@ -131,10 +131,10 @@ namespace skiagm { private: typedef GM INHERITED; }; - + ////////////////////////////////////////////////////////////////////////////// - + static GM* MyFactory(void*) { return new HairModesGM; } static GMRegistry reg(MyFactory); - + } diff --git a/gm/image.cpp b/gm/image.cpp index 3b83c02aa9..4ee90a4fc6 100644 --- a/gm/image.cpp +++ b/gm/image.cpp @@ -42,11 +42,11 @@ static void drawContents(SkSurface* surface, SkColor fillC) { SkScalar radius = (size.fWidth - stroke) / 2; SkPaint paint; - + paint.setAntiAlias(true); paint.setColor(fillC); canvas->drawCircle(size.fWidth/2, size.fHeight/2, radius, paint); - + paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(stroke); paint.setColor(SK_ColorBLACK); @@ -89,21 +89,21 @@ public: fBuffer = sk_malloc_throw(fBufferSize); fSize.set(SkIntToScalar(W), SkIntToScalar(H)); } - + virtual ~ImageGM() { sk_free(fBuffer); } - - + + protected: virtual SkString onShortName() { return SkString("image"); } - + virtual SkISize onISize() { return SkISize::Make(640, 480); } - + virtual void onDraw(SkCanvas* canvas) { drawJpeg(canvas, this->getISize()); @@ -129,13 +129,13 @@ protected: canvas->translate(80, 0); test_surface(canvas, surf2); } - + private: typedef skiagm::GM INHERITED; }; - + ////////////////////////////////////////////////////////////////////////////// static skiagm::GM* MyFactory(void*) { return new ImageGM; } static skiagm::GMRegistry reg(MyFactory); - + diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp index a10e3a499a..f805b44ec6 100644 --- a/gm/imagefiltersgraph.cpp +++ b/gm/imagefiltersgraph.cpp @@ -55,7 +55,7 @@ protected: fInitialized = true; } canvas->clear(0x00000000); - + SkAutoTUnref<SkImageFilter> bitmapSource(new SkBitmapSource(fBitmap)); SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, diff --git a/gm/lighting.cpp b/gm/lighting.cpp index 2b41528a38..46474abc35 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -18,7 +18,7 @@ public: ImageLightingGM() : fInitialized(false) { this->setBGColor(0xFF000000); } - + protected: virtual SkString onShortName() { return SkString("lighting"); @@ -76,7 +76,7 @@ protected: paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, spotTarget, spotExponent, cutoffAngle, white, surfaceScale, ks, shininess))->unref(); canvas->drawSprite(fBitmap, 220, 110, &paint); } - + private: typedef GM INHERITED; SkBitmap fBitmap; diff --git a/gm/morphology.cpp b/gm/morphology.cpp index 29d29d0cb6..83de758a9b 100644 --- a/gm/morphology.cpp +++ b/gm/morphology.cpp @@ -19,7 +19,7 @@ public: this->setBGColor(0xFF000000); fOnce = false; } - + protected: virtual SkString onShortName() { return SkString("morphology"); @@ -83,7 +83,7 @@ protected: } } } - + private: typedef GM INHERITED; SkBitmap fBitmap; diff --git a/gm/patheffects.cpp b/gm/patheffects.cpp index bf89e0d454..a1fb675a3c 100644 --- a/gm/patheffects.cpp +++ b/gm/patheffects.cpp @@ -68,7 +68,7 @@ static void one_d_pe(SkPaint* paint) { path.close(); path.offset(SkIntToScalar(-6), 0); scale(&path, 1.5f); - + paint->setPathEffect(new SkPath1DPathEffect(path, SkIntToScalar(21), 0, SkPath1DPathEffect::kRotate_Style))->unref(); compose_pe(paint); @@ -92,7 +92,7 @@ static SkPathEffect* MakeTileEffect() { SkPath path; path.addCircle(0, 0, SkIntToScalar(5)); - + return new SkPath2DPathEffect(m, path); } diff --git a/gm/points.cpp b/gm/points.cpp index e4f3c2e027..0646d61c29 100644 --- a/gm/points.cpp +++ b/gm/points.cpp @@ -12,14 +12,14 @@ namespace skiagm { class PointsGM : public GM { public: - PointsGM() {} + PointsGM() {} protected: virtual SkString onShortName() { return SkString("points"); } - virtual SkISize onISize() { + virtual SkISize onISize() { return make_isize(640, 490); } diff --git a/gm/samplerstress.cpp b/gm/samplerstress.cpp index 4329f12470..93a26dd49c 100644 --- a/gm/samplerstress.cpp +++ b/gm/samplerstress.cpp @@ -12,13 +12,13 @@ namespace skiagm { -/** +/** * Stress test the samplers by rendering a textured glyph with a mask and * an AA clip */ class SamplerStressGM : public GM { public: - SamplerStressGM() + SamplerStressGM() : fTextureCreated(false) , fShader(NULL) , fMaskFilter(NULL) { @@ -47,7 +47,7 @@ protected: static const int xSize = 16; static const int ySize = 16; - fTexture.setConfig(SkBitmap::kARGB_8888_Config, + fTexture.setConfig(SkBitmap::kARGB_8888_Config, xSize, ySize, xSize*sizeof(SkColor)); diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp index 0eb7b34938..d8641db1c2 100644 --- a/gm/shadertext.cpp +++ b/gm/shadertext.cpp @@ -109,7 +109,7 @@ static const GradMaker gGradMakers[] = { class ShaderTextGM : public GM { public: - ShaderTextGM() { + ShaderTextGM() { this->setBGColor(0xFFDDDDDD); } @@ -119,7 +119,7 @@ protected: return SkString("shadertext"); } - SkISize onISize() { return make_isize(1450, 500); } + SkISize onISize() { return make_isize(1450, 500); } virtual void onDraw(SkCanvas* canvas) { const char text[] = "Shaded Text"; @@ -174,8 +174,8 @@ protected: SkPath path; path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15), - SkIntToScalar(300), SkIntToScalar(90)), - SkIntToScalar(225), SkIntToScalar(90), + SkIntToScalar(300), SkIntToScalar(90)), + SkIntToScalar(225), SkIntToScalar(90), false); path.close(); diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp index e1a07eb939..445de811ec 100644 --- a/gm/strokefill.cpp +++ b/gm/strokefill.cpp @@ -43,7 +43,7 @@ protected: paint.setAntiAlias(true); paint.setTextSize(SkIntToScalar(100)); paint.setStrokeWidth(SkIntToScalar(5)); - + SkTypeface* face = SkTypeface::CreateFromName("Papyrus", SkTypeface::kNormal); SkSafeUnref(paint.setTypeface(face)); show_bold(canvas, "Hello", 5, x, y, paint); @@ -60,18 +60,18 @@ protected: path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction); path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCCW_Direction); canvas->drawPath(path, paint); - + SkPath path2; path2.setFillType(SkPath::kWinding_FillType); path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCCW_Direction); path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCW_Direction); canvas->drawPath(path2, paint); - + path2.reset(); path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCCW_Direction); canvas->drawPath(path2, paint); SkASSERT(path2.cheapIsDirection(SkPath::kCCW_Direction)); - + path2.reset(); SkASSERT(!path2.cheapComputeDirection(NULL)); path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction); diff --git a/gm/strokes.cpp b/gm/strokes.cpp index d4532f3b90..c479d69fff 100644 --- a/gm/strokes.cpp +++ b/gm/strokes.cpp @@ -25,33 +25,33 @@ static void rnd_rect(SkRect* r, SkPaint* paint, SkRandom& rand) { 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); - + paint->setColor(rand.nextU()); paint->setAlpha(0xFF); } - + class StrokesGM : public skiagm::GM { public: StrokesGM() {} - + protected: virtual SkString onShortName() { return SkString("strokes_round"); } - + virtual SkISize onISize() { return SkISize::Make(W, H*2); } - - virtual void onDraw(SkCanvas* canvas) { + + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(SkIntToScalar(9)/2); - + for (int y = 0; y < 2; y++) { paint.setAntiAlias(!!y); SkAutoCanvasRestore acr(canvas, true); @@ -60,7 +60,7 @@ protected: SkIntToScalar(2), SkIntToScalar(2) , SW - SkIntToScalar(2), SH - SkIntToScalar(2) )); - + SkRandom rand; for (int i = 0; i < N; i++) { SkRect r; @@ -72,7 +72,7 @@ protected: } } } - + private: typedef skiagm::GM INHERITED; }; @@ -89,16 +89,16 @@ public: fPath.lineTo(x, y); } } - + protected: virtual SkString onShortName() { return SkString("strokes_poly"); } - + virtual SkISize onISize() { return SkISize::Make(W, H*2); } - + static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canvas) { SkMatrix matrix; matrix.setRotate(angle, px, py); @@ -107,11 +107,11 @@ protected: virtual void onDraw(SkCanvas* canvas) { canvas->drawColor(SK_ColorWHITE); - + SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(SkIntToScalar(9)/2); - + for (int y = 0; y < 2; y++) { paint.setAntiAlias(!!y); SkAutoCanvasRestore acr(canvas, true); @@ -120,7 +120,7 @@ protected: SkIntToScalar(2), SW - SkIntToScalar(2), SH - SkIntToScalar(2))); - + SkRandom rand; for (int i = 0; i < N/2; i++) { SkRect r; @@ -130,7 +130,7 @@ protected: } } } - + private: typedef skiagm::GM INHERITED; }; @@ -149,25 +149,25 @@ class Strokes3GM : public skiagm::GM { path->addRect(inset(bounds), SkPath::kCW_Direction); title->set("CW CW"); } - + static void make1(SkPath* path, const SkRect& bounds, SkString* title) { path->addRect(bounds, SkPath::kCW_Direction); path->addRect(inset(bounds), SkPath::kCCW_Direction); title->set("CW CCW"); } - + static void make2(SkPath* path, const SkRect& bounds, SkString* title) { path->addOval(bounds, SkPath::kCW_Direction); path->addOval(inset(bounds), SkPath::kCW_Direction); title->set("CW CW"); } - + static void make3(SkPath* path, const SkRect& bounds, SkString* title) { path->addOval(bounds, SkPath::kCW_Direction); path->addOval(inset(bounds), SkPath::kCCW_Direction); title->set("CW CCW"); } - + static void make4(SkPath* path, const SkRect& bounds, SkString* title) { path->addRect(bounds, SkPath::kCW_Direction); SkRect r = bounds; @@ -175,7 +175,7 @@ class Strokes3GM : public skiagm::GM { path->addOval(r, SkPath::kCW_Direction); title->set("CW CW"); } - + static void make5(SkPath* path, const SkRect& bounds, SkString* title) { path->addRect(bounds, SkPath::kCW_Direction); SkRect r = bounds; @@ -186,16 +186,16 @@ class Strokes3GM : public skiagm::GM { public: Strokes3GM() {} - + protected: virtual SkString onShortName() { return SkString("strokes3"); } - + virtual SkISize onISize() { return SkISize::Make(W, H*2); } - + virtual void onDraw(SkCanvas* canvas) { SkPaint origPaint; origPaint.setAntiAlias(true); @@ -219,7 +219,7 @@ protected: SkPath orig; SkString str; procs[i](&orig, bounds, &str); - + canvas->save(); for (int j = 0; j < 13; ++j) { strokePaint.setStrokeWidth(SK_Scalar1 * j * j); @@ -234,7 +234,7 @@ protected: canvas->translate(0, dy); } } - + private: typedef skiagm::GM INHERITED; }; diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp index fddfadf4f4..18cae70155 100644 --- a/gm/texteffects.cpp +++ b/gm/texteffects.cpp @@ -14,12 +14,12 @@ static void r0(SkLayerRasterizer* rast, SkPaint& p) { p.setMaskFilter(SkBlurMaskFilter::Create(SkIntToScalar(3), SkBlurMaskFilter::kNormal_BlurStyle))->unref(); rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); - + p.setMaskFilter(NULL); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1); rast->addLayer(p); - + p.setAlpha(0x11); p.setStyle(SkPaint::kFill_Style); p.setXfermodeMode(SkXfermode::kSrc_Mode); @@ -28,7 +28,7 @@ static void r0(SkLayerRasterizer* rast, SkPaint& p) { static void r1(SkLayerRasterizer* rast, SkPaint& p) { rast->addLayer(p); - + p.setAlpha(0x40); p.setXfermodeMode(SkXfermode::kSrc_Mode); p.setStyle(SkPaint::kStroke_Style); @@ -40,7 +40,7 @@ static void r2(SkLayerRasterizer* rast, SkPaint& p) { p.setStyle(SkPaint::kStrokeAndFill_Style); p.setStrokeWidth(SK_Scalar1*4); rast->addLayer(p); - + p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1*3/2); p.setXfermodeMode(SkXfermode::kClear_Mode); @@ -51,7 +51,7 @@ static void r3(SkLayerRasterizer* rast, SkPaint& p) { p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(SK_Scalar1*3); rast->addLayer(p); - + p.setAlpha(0x20); p.setStyle(SkPaint::kFill_Style); p.setXfermodeMode(SkXfermode::kSrc_Mode); @@ -61,11 +61,11 @@ static void r3(SkLayerRasterizer* rast, SkPaint& p) { static void r4(SkLayerRasterizer* rast, SkPaint& p) { p.setAlpha(0x60); rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); - + p.setAlpha(0xFF); p.setXfermodeMode(SkXfermode::kClear_Mode); rast->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2); - + p.setXfermode(NULL); rast->addLayer(p); } @@ -74,7 +74,7 @@ static void r4(SkLayerRasterizer* rast, SkPaint& p) { static void r5(SkLayerRasterizer* rast, SkPaint& p) { rast->addLayer(p); - + p.setPathEffect(new SkDiscretePathEffect(SK_Scalar1*4, SK_Scalar1*3))->unref(); p.setXfermodeMode(SkXfermode::kSrcOut_Mode); rast->addLayer(p); @@ -82,7 +82,7 @@ static void r5(SkLayerRasterizer* rast, SkPaint& p) { static void r6(SkLayerRasterizer* rast, SkPaint& p) { rast->addLayer(p); - + p.setAntiAlias(false); SkLayerRasterizer* rast2 = new SkLayerRasterizer; r5(rast2, p); @@ -109,14 +109,14 @@ static void r7(SkLayerRasterizer* rast, SkPaint& p) { static void r8(SkLayerRasterizer* rast, SkPaint& p) { rast->addLayer(p); - + SkMatrix lattice; lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); lattice.postSkew(SK_Scalar1/3, 0, 0, 0); p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref(); p.setXfermodeMode(SkXfermode::kClear_Mode); rast->addLayer(p); - + p.setPathEffect(NULL); p.setXfermode(NULL); p.setStyle(SkPaint::kStroke_Style); @@ -128,33 +128,33 @@ class Line2DPathEffect : public Sk2DPathEffect { public: Line2DPathEffect(SkScalar width, const SkMatrix& matrix) : Sk2DPathEffect(matrix), fWidth(width) {} - - virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec) SK_OVERRIDE { + + virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec) SK_OVERRIDE { if (this->INHERITED::filterPath(dst, src, rec)) { rec->setStrokeStyle(fWidth); return true; } return false; } - + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Line2DPathEffect) - + protected: - virtual void nextSpan(int u, int v, int ucount, SkPath* dst) { + virtual void nextSpan(int u, int v, int ucount, SkPath* dst) { if (ucount > 1) { - SkPoint src[2], dstP[2]; - + SkPoint src[2], dstP[2]; + src[0].set(SkIntToScalar(u) + SK_ScalarHalf, SkIntToScalar(v) + SK_ScalarHalf); src[1].set(SkIntToScalar(u+ucount) + SK_ScalarHalf, SkIntToScalar(v) + SK_ScalarHalf); this->getMatrix().mapPoints(dstP, src, 2); - + dst->moveTo(dstP[0]); dst->lineTo(dstP[1]); } } - + Line2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { fWidth = buffer.readScalar(); } @@ -162,23 +162,23 @@ protected: this->INHERITED::flatten(buffer); buffer.writeScalar(fWidth); } - + private: SkScalar fWidth; - + typedef Sk2DPathEffect INHERITED; }; static void r9(SkLayerRasterizer* rast, SkPaint& p) { rast->addLayer(p); - + SkMatrix lattice; lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); lattice.postRotate(SkIntToScalar(30), 0, 0); p.setPathEffect(new Line2DPathEffect(SK_Scalar1*2, lattice))->unref(); p.setXfermodeMode(SkXfermode::kClear_Mode); rast->addLayer(p); - + p.setPathEffect(NULL); p.setXfermode(NULL); p.setStyle(SkPaint::kStroke_Style); @@ -210,12 +210,12 @@ static void apply_shader(SkPaint* paint, int index) { { SkPaint p; SkLayerRasterizer* rast = new SkLayerRasterizer; - + p.setAntiAlias(true); proc(rast, p); paint->setRasterizer(rast)->unref(); } - + #if 0 SkScalar dir[] = { SK_Scalar1, SK_Scalar1, SK_Scalar1 }; paint->setMaskFilter(SkBlurMaskFilter::CreateEmboss(dir, SK_Scalar1/4, SkIntToScalar(4), SkIntToScalar(3)))->unref(); @@ -225,40 +225,40 @@ static void apply_shader(SkPaint* paint, int index) { class TextEffectsGM : public skiagm::GM { public: - TextEffectsGM() {} - + TextEffectsGM() {} + protected: virtual SkString onShortName() SK_OVERRIDE { return SkString("texteffects"); } - + virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(460, 680); } - + virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { canvas->save(); - + SkPaint paint; paint.setAntiAlias(true); paint.setTextSize(SkIntToScalar(56)); - + SkScalar x = SkIntToScalar(20); SkScalar y = paint.getTextSize(); - + SkString str("Hamburgefons"); - + for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) { apply_shader(&paint, i); - + // paint.setMaskFilter(NULL); // paint.setColor(SK_ColorBLACK); - + canvas->drawText(str.c_str(), str.size(), x, y, paint); - + y += paint.getFontSpacing(); } - + canvas->restore(); } @@ -270,9 +270,9 @@ protected: private: typedef skiagm::GM INHERITED; }; - + ////////////////////////////////////////////////////////////////////////////// static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } static skiagm::GMRegistry reg(MyFactory); - + diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp index 289caae831..08bcb79f65 100644 --- a/gm/tilemodes.cpp +++ b/gm/tilemodes.cpp @@ -25,14 +25,14 @@ static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { bm->setConfig(config, w, h); bm->allocPixels(); bm->eraseColor(0); - + SkCanvas canvas(*bm); SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; SkPaint paint; - - SkUnitMapper* um = NULL; + + SkUnitMapper* um = NULL; um = new SkCosineMapper; // um = new SkDiscreteMapper(12); @@ -63,7 +63,7 @@ static const int gHeight = 32; class TilingGM : public GM { SkBlurDrawLooper fLooper; public: - TilingGM() + TilingGM() : fLooper(SkIntToScalar(1), SkIntToScalar(2), SkIntToScalar(2), 0x88000000) { for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) { @@ -72,23 +72,23 @@ public: } SkBitmap fTexture[SK_ARRAY_COUNT(gConfigs)]; - + protected: SkString onShortName() { return SkString("tilemodes"); } - - SkISize onISize() { return make_isize(880, 560); } - + + SkISize onISize() { return make_isize(880, 560); } + virtual void onDraw(SkCanvas* canvas) { - + SkRect r = { 0, 0, SkIntToScalar(gWidth*2), SkIntToScalar(gHeight*2) }; static const char* gConfigNames[] = { "8888", "565", "4444" }; - + static const bool gFilters[] = { false, true }; static const char* gFilterNames[] = { "point", "bilinear" }; - + static const SkShader::TileMode gModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode }; static const char* gModeNames[] = { "C", "R", "M" }; @@ -106,11 +106,11 @@ protected: p.setTextAlign(SkPaint::kCenter_Align); canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p); - + x += r.width() * 4 / 3; } } - + y += SkIntToScalar(16); for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) { @@ -121,12 +121,12 @@ protected: SkPaint paint; setup(&paint, fTexture[i], gFilters[j], gModes[kx], gModes[ky]); paint.setDither(true); - + canvas->save(); canvas->translate(x, y); canvas->drawRect(r, paint); canvas->restore(); - + x += r.width() * 4 / 3; } } @@ -143,7 +143,7 @@ protected: } } } - + private: typedef GM INHERITED; }; diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp index d532b5b499..3b1006c189 100644 --- a/gm/tinybitmap.cpp +++ b/gm/tinybitmap.cpp @@ -38,7 +38,7 @@ public: this->setBGColor(0xFFDDDDDD); fBM = make_bitmap(); } - + protected: SkString onShortName() { return SkString("tinybitmap"); @@ -47,7 +47,7 @@ protected: virtual SkISize onISize() { return make_isize(100, 100); } virtual void onDraw(SkCanvas* canvas) { - SkShader* s = + SkShader* s = SkShader::CreateBitmapShader(fBM, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode); SkPaint paint; @@ -55,7 +55,7 @@ protected: paint.setShader(s)->unref(); canvas->drawPaint(paint); } - + private: typedef GM INHERITED; }; diff --git a/gm/twopointradial.cpp b/gm/twopointradial.cpp index 2d508145c8..40712e8341 100644 --- a/gm/twopointradial.cpp +++ b/gm/twopointradial.cpp @@ -30,19 +30,19 @@ static void drawGrad(SkCanvas* canvas, const SkScalar d0[], const SkScalar d1[]) SkColor colors[] = { SK_ColorGREEN, SK_ColorRED }; SkPaint paint; paint.setAntiAlias(true); - + SkString str; str.printf("%g,%g,%g %g,%g,%g", SkScalarToFloat(c0.fX), SkScalarToFloat(c0.fY), SkScalarToFloat(r0), SkScalarToFloat(c1.fX), SkScalarToFloat(c1.fY), SkScalarToFloat(r1)); canvas->drawText(str.c_str(), str.size(), bounds.fLeft, bounds.fTop - paint.getTextSize()/2, paint); - + paint.setShader(SkGradientShader::CreateTwoPointConical(c0, r0, c1, r1, colors, NULL, 2, SkShader::kClamp_TileMode))->unref(); canvas->drawRect(bounds, paint); - + paint.setShader(NULL); paint.setColor(0x66000000); paint.setStyle(SkPaint::kStroke_Style); @@ -67,14 +67,14 @@ protected: SkPaint paint; paint.setColor(SK_ColorBLUE); canvas->drawRect( - SkRect::MakeWH(SkIntToScalar(this->getISize().fWidth), - SkIntToScalar(this->getISize().fHeight)), + SkRect::MakeWH(SkIntToScalar(this->getISize().fWidth), + SkIntToScalar(this->getISize().fHeight)), paint); } SkPaint paint; const int R0 = 20; const int R1 = 40; - + const SkScalar DX = SkIntToScalar(250); const SkScalar DY = SkIntToScalar(130); @@ -88,12 +88,12 @@ protected: 0, 0, R0, 25, 0, R0, 0, 0, R0, 100, 0, R0, }; - + int count = SK_ARRAY_COUNT(gData) / 6; for (int i = 0; i < count; ++i) { SkScalar data[6]; intToScalars(data, &gData[i * 6], 6); - + int n = canvas->save(); drawGrad(canvas, &data[0], &data[3]); canvas->translate(DX, 0); diff --git a/gm/typeface.cpp b/gm/typeface.cpp index 9c7363091c..2217863816 100644 --- a/gm/typeface.cpp +++ b/gm/typeface.cpp @@ -71,7 +71,7 @@ private: } SkTypeface** fFaces; - + typedef GM INHERITED; }; diff --git a/gm/verttext.cpp b/gm/verttext.cpp index 0f3cb3bd92..67a2da59c6 100644 --- a/gm/verttext.cpp +++ b/gm/verttext.cpp @@ -56,7 +56,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkScalar x = SkIntToScalar(100); SkScalar y = SkIntToScalar(50); - + for (int i = 0; i < 4; ++i) { SkPaint paint; paint.setAntiAlias(true); @@ -70,7 +70,7 @@ protected: paint.setVerticalText(true); drawBaseline(canvas, paint, x, y); canvas->drawText(gText, gLen, x, y, paint); - + x += SkIntToScalar(40); y += SkIntToScalar(120); diff --git a/gm/verttext2.cpp b/gm/verttext2.cpp index 8491dc342b..33380e067c 100644 --- a/gm/verttext2.cpp +++ b/gm/verttext2.cpp @@ -39,7 +39,7 @@ protected: SkISize onISize() { return make_isize(640, 480); } virtual void onDraw(SkCanvas* canvas) { - + for (int i = 0; i < 3; ++i) { SkPaint paint; paint.setColor(SK_ColorRED); @@ -77,7 +77,7 @@ protected: paint.setTypeface(family); paint.setTextSize(textHeight); - canvas->drawText(string.c_str(), string.size(), y, + canvas->drawText(string.c_str(), string.size(), y, SkIntToScalar(alignment == SkPaint::kLeft_Align ? 10 : 240), paint); y += textHeight; diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp index b0fdf27e61..4704a86f6e 100644 --- a/gm/verylargebitmap.cpp +++ b/gm/verylargebitmap.cpp @@ -70,7 +70,7 @@ protected: show_bm(canvas, big, small, SK_ColorBLUE); canvas->translate(0, SkIntToScalar(150)); - + // as of this writing, the raster code will fail to draw the scaled version // since it has a 64K limit on x,y coordinates... (but gpu should succeed) show_bm(canvas, veryBig, small, SK_ColorGREEN); diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp index 42b8a6a8ab..25100d29dc 100644 --- a/gm/xfermodes.cpp +++ b/gm/xfermodes.cpp @@ -62,7 +62,7 @@ class XfermodesGM : public GM { scratchBitmap.setPixels(localData); scratchBitmap.setIsOpaque(true); scratchBitmap.copyTo(&fBG, SkBitmap::kARGB_4444_Config); - + make_bitmaps(W, H, &fSrcB, &fDstB); fOnce = true; } |