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 "Test.h" | 8 #include "Test.h" |
9 | 9 |
10 #include "../include/core/SkCanvas.h" | 10 #include "../include/core/SkCanvas.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 public: | 100 public: |
101 PictureStrategy(const SkImageInfo& imageInfo) { | 101 PictureStrategy(const SkImageInfo& imageInfo) { |
102 fBitmap.allocPixels(imageInfo); | 102 fBitmap.allocPixels(imageInfo); |
103 fWidth = imageInfo.width(); | 103 fWidth = imageInfo.width(); |
104 fHeight = imageInfo.height(); | 104 fHeight = imageInfo.height(); |
105 } | 105 } |
106 | 106 |
107 virtual const SkBitmap& recordAndReplay(const Drawer& drawer, | 107 virtual const SkBitmap& recordAndReplay(const Drawer& drawer, |
108 const SkRect& intoClip, | 108 const SkRect& intoClip, |
109 SkXfermode::Mode mode) { | 109 SkXfermode::Mode mode) { |
110 SkTileGridFactory::TileGridInfo tileGridInfo = { {100,100}, {0,0}, {0,0}
}; | 110 SkRTreeFactory factory; |
111 SkTileGridFactory factory(tileGridInfo); | |
112 SkPictureRecorder recorder; | 111 SkPictureRecorder recorder; |
113 SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fWidth),SkIntToScalar(fHe
ight))); | 112 SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fWidth),SkIntToScalar(fHe
ight))); |
114 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(fWidth), | 113 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(fWidth), |
115 SkIntToScalar(fHeight), | 114 SkIntToScalar(fHeight), |
116 &factory); | 115 &factory); |
117 drawer.draw(canvas, canvasRect, mode); | 116 drawer.draw(canvas, canvasRect, mode); |
118 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 117 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
119 | 118 |
120 SkCanvas replayCanvas(fBitmap); | 119 SkCanvas replayCanvas(fBitmap); |
121 replayCanvas.clear(0xffffffff); | 120 replayCanvas.clear(0xffffffff); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 errors.appendf("For SkXfermode %d %s: SkPictureRecorder bitmap is
wrong\n", | 164 errors.appendf("For SkXfermode %d %s: SkPictureRecorder bitmap is
wrong\n", |
166 iMode, SkXfermode::ModeName(mode)); | 165 iMode, SkXfermode::ModeName(mode)); |
167 } | 166 } |
168 #endif | 167 #endif |
169 } | 168 } |
170 | 169 |
171 #if !FINEGRAIN | 170 #if !FINEGRAIN |
172 REPORTER_ASSERT_MESSAGE(reporter, 0 == numErrors, errors.c_str()); | 171 REPORTER_ASSERT_MESSAGE(reporter, 0 == numErrors, errors.c_str()); |
173 #endif | 172 #endif |
174 } | 173 } |
OLD | NEW |