OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 fPicture.reset(recorder.endRecording()); | 35 fPicture.reset(recorder.endRecording()); |
36 | 36 |
37 // Build a reference bitmap. | 37 // Build a reference bitmap. |
38 fBitmap.allocN32Pixels(SkScalarCeilToInt(tileSize), SkScalarCeilToInt(ti
leSize)); | 38 fBitmap.allocN32Pixels(SkScalarCeilToInt(tileSize), SkScalarCeilToInt(ti
leSize)); |
39 fBitmap.eraseColor(SK_ColorTRANSPARENT); | 39 fBitmap.eraseColor(SK_ColorTRANSPARENT); |
40 SkCanvas bitmapCanvas(fBitmap); | 40 SkCanvas bitmapCanvas(fBitmap); |
41 this->drawTile(&bitmapCanvas); | 41 this->drawTile(&bitmapCanvas); |
42 } | 42 } |
43 | 43 |
44 protected: | 44 protected: |
45 uint32_t onGetFlags() const SK_OVERRIDE { | |
46 return kSkipTiled_Flag; | |
47 } | |
48 | 45 |
49 SkString onShortName() SK_OVERRIDE { | 46 SkString onShortName() SK_OVERRIDE { |
50 return SkString("pictureshader"); | 47 return SkString("pictureshader"); |
51 } | 48 } |
52 | 49 |
53 SkISize onISize() SK_OVERRIDE { | 50 SkISize onISize() SK_OVERRIDE { |
54 return SkISize::Make(1400, 1450); | 51 return SkISize::Make(1400, 1450); |
55 } | 52 } |
56 | 53 |
57 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 54 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 SkScalar fTileSize; | 173 SkScalar fTileSize; |
177 SkScalar fSceneSize; | 174 SkScalar fSceneSize; |
178 | 175 |
179 SkAutoTUnref<SkPicture> fPicture; | 176 SkAutoTUnref<SkPicture> fPicture; |
180 SkBitmap fBitmap; | 177 SkBitmap fBitmap; |
181 | 178 |
182 typedef GM INHERITED; | 179 typedef GM INHERITED; |
183 }; | 180 }; |
184 | 181 |
185 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); ) | 182 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); ) |
OLD | NEW |