| 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 } | 58 } |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual SkISize onISize() { | 62 virtual SkISize onISize() { |
| 63 return make_isize(500, 400); | 63 return make_isize(500, 400); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint)
{ | 66 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint)
{ |
| 67 canvas->save(); | 67 canvas->save(); |
| 68 canvas->translate(x, y); | 68 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
| 69 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS
calar(fBitmap.height()))); | 69 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS
calar(fBitmap.height()))); |
| 70 canvas->drawBitmap(fBitmap, 0, 0, &paint); | 70 canvas->drawBitmap(fBitmap, 0, 0, &paint); |
| 71 canvas->restore(); | 71 canvas->restore(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void onDraw(SkCanvas* canvas) { | 74 virtual void onDraw(SkCanvas* canvas) { |
| 75 if (!fInitialized) { | 75 if (!fInitialized) { |
| 76 make_bitmap(); | 76 make_bitmap(); |
| 77 make_checkerboard(); | 77 make_checkerboard(); |
| 78 fInitialized = true; | 78 fInitialized = true; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SkBitmap fBitmap, fCheckerboard; | 181 SkBitmap fBitmap, fCheckerboard; |
| 182 bool fInitialized; | 182 bool fInitialized; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 ////////////////////////////////////////////////////////////////////////////// | 185 ////////////////////////////////////////////////////////////////////////////// |
| 186 | 186 |
| 187 static GM* MyFactory(void*) { return new DisplacementMapGM; } | 187 static GM* MyFactory(void*) { return new DisplacementMapGM; } |
| 188 static GMRegistry reg(MyFactory); | 188 static GMRegistry reg(MyFactory); |
| 189 | 189 |
| 190 } | 190 } |
| OLD | NEW |