| 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 "SkOffsetImageFilter.h" | 9 #include "SkOffsetImageFilter.h" |
| 10 #include "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); | 53 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
| 54 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); | 54 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); |
| 55 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); | 55 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); |
| 56 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); | 56 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
| 57 canvas.restore(); | 57 canvas.restore(); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual SkISize onISize() { | 62 virtual SkISize onISize() { |
| 63 return make_isize(WIDTH, HEIGHT); | 63 return SkISize::Make(WIDTH, HEIGHT); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPai
nt& paint, SkScalar scale, const SkIRect& cropRect) { | 66 void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPai
nt& paint, SkScalar scale, const SkIRect& cropRect) { |
| 67 canvas->save(); | 67 canvas->save(); |
| 68 SkRect clipRect = SkRect::MakeWH( | 68 SkRect clipRect = SkRect::MakeWH( |
| 69 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())); | 69 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())); |
| 70 canvas->clipRect(clipRect); | 70 canvas->clipRect(clipRect); |
| 71 canvas->scale(scale, scale); | 71 canvas->scale(scale, scale); |
| 72 canvas->drawBitmap(bitmap, 0, 0, &paint); | 72 canvas->drawBitmap(bitmap, 0, 0, &paint); |
| 73 canvas->restore(); | 73 canvas->restore(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 SkBitmap fBitmap, fCheckerboard; | 123 SkBitmap fBitmap, fCheckerboard; |
| 124 bool fInitialized; | 124 bool fInitialized; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 ////////////////////////////////////////////////////////////////////////////// | 127 ////////////////////////////////////////////////////////////////////////////// |
| 128 | 128 |
| 129 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } | 129 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } |
| 130 static GMRegistry reg(MyFactory); | 130 static GMRegistry reg(MyFactory); |
| 131 | 131 |
| 132 } | 132 } |
| OLD | NEW |