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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual void onDraw(SkCanvas* canvas) { | 70 virtual void onDraw(SkCanvas* canvas) { |
71 if (!fInitialized) { | 71 if (!fInitialized) { |
72 make_bitmap(); | 72 make_bitmap(); |
73 | 73 |
74 fCheckerboard.allocN32Pixels(80, 80); | 74 fCheckerboard.allocN32Pixels(80, 80); |
75 SkCanvas checkerboardCanvas(fCheckerboard); | 75 SkCanvas checkerboardCanvas(fCheckerboard); |
76 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); | 76 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); |
77 | 77 |
78 fInitialized = true; | 78 fInitialized = true; |
79 } | 79 } |
80 canvas->clear(0x00000000); | 80 canvas->clear(SK_ColorBLACK); |
81 SkPaint paint; | 81 SkPaint paint; |
82 | 82 |
83 for (int i = 0; i < 4; i++) { | 83 for (int i = 0; i < 4; i++) { |
84 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; | 84 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; |
85 SkIRect cropRect = SkIRect::MakeXYWH(i * 12, | 85 SkIRect cropRect = SkIRect::MakeXYWH(i * 12, |
86 i * 8, | 86 i * 8, |
87 bitmap->width() - i * 8, | 87 bitmap->width() - i * 8, |
88 bitmap->height() - i * 12); | 88 bitmap->height() - i * 12); |
89 SkImageFilter::CropRect rect(SkRect::Make(cropRect)); | 89 SkImageFilter::CropRect rect(SkRect::Make(cropRect)); |
90 SkAutoTUnref<SkImageFilter> tileInput(SkBitmapSource::Create(*bitmap
)); | 90 SkAutoTUnref<SkImageFilter> tileInput(SkBitmapSource::Create(*bitmap
)); |
(...skipping 18 matching lines...) Expand all Loading... |
109 SkBitmap fBitmap, fCheckerboard; | 109 SkBitmap fBitmap, fCheckerboard; |
110 bool fInitialized; | 110 bool fInitialized; |
111 }; | 111 }; |
112 | 112 |
113 ////////////////////////////////////////////////////////////////////////////// | 113 ////////////////////////////////////////////////////////////////////////////// |
114 | 114 |
115 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } | 115 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } |
116 static GMRegistry reg(MyFactory); | 116 static GMRegistry reg(MyFactory); |
117 | 117 |
118 } | 118 } |
OLD | NEW |