| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkDisplacementMapEffect.h" | 9 #include "SkDisplacementMapEffect.h" |
| 10 #include "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); | 58 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
| 59 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); | 59 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); |
| 60 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); | 60 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); |
| 61 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); | 61 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
| 62 canvas.restore(); | 62 canvas.restore(); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual SkISize onISize() { | 67 virtual SkISize onISize() { |
| 68 return make_isize(500, 500); | 68 return SkISize::Make(500, 500); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint)
{ | 71 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint)
{ |
| 72 canvas->save(); | 72 canvas->save(); |
| 73 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 73 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
| 74 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS
calar(fBitmap.height()))); | 74 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS
calar(fBitmap.height()))); |
| 75 canvas->drawBitmap(fBitmap, 0, 0, &paint); | 75 canvas->drawBitmap(fBitmap, 0, 0, &paint); |
| 76 canvas->restore(); | 76 canvas->restore(); |
| 77 } | 77 } |
| 78 | 78 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 SkBitmap fBitmap, fCheckerboard, fSmall, fLarge, fLargeW, fLargeH; | 220 SkBitmap fBitmap, fCheckerboard, fSmall, fLarge, fLargeW, fLargeH; |
| 221 bool fInitialized; | 221 bool fInitialized; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 ////////////////////////////////////////////////////////////////////////////// | 224 ////////////////////////////////////////////////////////////////////////////// |
| 225 | 225 |
| 226 static GM* MyFactory(void*) { return new DisplacementMapGM; } | 226 static GM* MyFactory(void*) { return new DisplacementMapGM; } |
| 227 static GMRegistry reg(MyFactory); | 227 static GMRegistry reg(MyFactory); |
| 228 | 228 |
| 229 } | 229 } |
| OLD | NEW |