| 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 "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 { 0, 0, 1, 0.5f, 0, 0 }, | 55 { 0, 0, 1, 0.5f, 0, 0 }, |
| 56 { -0.25f, -0.25f, 1, 0.5f, 0, 0 }, | 56 { -0.25f, -0.25f, 1, 0.5f, 0, 0 }, |
| 57 { 0.25f, 0.25f, 1, 0.5f, 0, 0 }, | 57 { 0.25f, 0.25f, 1, 0.5f, 0, 0 }, |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class PictureShaderTileGM : public skiagm::GM { | 60 class PictureShaderTileGM : public skiagm::GM { |
| 61 public: | 61 public: |
| 62 PictureShaderTileGM() { | 62 PictureShaderTileGM() { |
| 63 SkPictureRecorder recorder; | 63 SkPictureRecorder recorder; |
| 64 SkCanvas* pictureCanvas = recorder.beginRecording(SkScalarCeilToInt(kPic
tureSize), | 64 SkCanvas* pictureCanvas = recorder.beginRecording(kPictureSize, kPicture
Size, NULL, 0); |
| 65 SkScalarCeilToInt(kPic
tureSize), | |
| 66 NULL, 0); | |
| 67 drawScene(pictureCanvas, kPictureSize); | 65 drawScene(pictureCanvas, kPictureSize); |
| 68 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 66 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 69 | 67 |
| 70 for (unsigned i = 0; i < SK_ARRAY_COUNT(tiles); ++i) { | 68 for (unsigned i = 0; i < SK_ARRAY_COUNT(tiles); ++i) { |
| 71 SkRect tile = SkRect::MakeXYWH(tiles[i].x * kPictureSize, | 69 SkRect tile = SkRect::MakeXYWH(tiles[i].x * kPictureSize, |
| 72 tiles[i].y * kPictureSize, | 70 tiles[i].y * kPictureSize, |
| 73 tiles[i].w * kPictureSize, | 71 tiles[i].w * kPictureSize, |
| 74 tiles[i].h * kPictureSize); | 72 tiles[i].h * kPictureSize); |
| 75 SkMatrix localMatrix; | 73 SkMatrix localMatrix; |
| 76 localMatrix.setTranslate(tiles[i].offsetX * kPictureSize, | 74 localMatrix.setTranslate(tiles[i].offsetX * kPictureSize, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 paint.setStyle(SkPaint::kStroke_Style); | 136 paint.setStyle(SkPaint::kStroke_Style); |
| 139 canvas->drawRect(SkRect::MakeWH(pictureSize, pictureSize), paint); | 137 canvas->drawRect(SkRect::MakeWH(pictureSize, pictureSize), paint); |
| 140 } | 138 } |
| 141 | 139 |
| 142 SkAutoTUnref<SkShader> fShaders[SK_ARRAY_COUNT(tiles)]; | 140 SkAutoTUnref<SkShader> fShaders[SK_ARRAY_COUNT(tiles)]; |
| 143 | 141 |
| 144 typedef GM INHERITED; | 142 typedef GM INHERITED; |
| 145 }; | 143 }; |
| 146 | 144 |
| 147 DEF_GM( return SkNEW(PictureShaderTileGM); ) | 145 DEF_GM( return SkNEW(PictureShaderTileGM); ) |
| OLD | NEW |