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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkTileGridFactory::TileGridInfo tileGridInfo = { {100,100}, {0,0}, {0,0}
}; |
111 SkTileGridFactory factory(tileGridInfo); | 111 SkTileGridFactory factory(tileGridInfo); |
112 SkPictureRecorder recorder; | 112 SkPictureRecorder recorder; |
113 SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fWidth),SkIntToScalar(fHe
ight))); | 113 SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fWidth),SkIntToScalar(fHe
ight))); |
114 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(fWidth), | 114 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(fWidth), |
115 SkIntToScalar(fHeight), | 115 SkIntToScalar(fHeight), |
116 &factory); | 116 &factory); |
117 drawer.draw(canvas, canvasRect, mode); | 117 drawer.draw(canvas, canvasRect, mode); |
118 SkAutoTDelete<SkPicture> picture(recorder.endRecording()); | 118 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
119 | 119 |
120 SkCanvas replayCanvas(fBitmap); | 120 SkCanvas replayCanvas(fBitmap); |
121 replayCanvas.clear(0xffffffff); | 121 replayCanvas.clear(0xffffffff); |
122 replayCanvas.clipRect(intoClip); | 122 replayCanvas.clipRect(intoClip); |
123 picture->playback(&replayCanvas); | 123 picture->playback(&replayCanvas); |
124 return fBitmap; | 124 return fBitmap; |
125 } | 125 } |
126 | 126 |
127 private: | 127 private: |
128 SkBitmap fBitmap; | 128 SkBitmap fBitmap; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 errors.appendf("For SkXfermode %d %s: SkPictureRecorder bitmap is
wrong\n", | 165 errors.appendf("For SkXfermode %d %s: SkPictureRecorder bitmap is
wrong\n", |
166 iMode, SkXfermode::ModeName(mode)); | 166 iMode, SkXfermode::ModeName(mode)); |
167 } | 167 } |
168 #endif | 168 #endif |
169 } | 169 } |
170 | 170 |
171 #if !FINEGRAIN | 171 #if !FINEGRAIN |
172 REPORTER_ASSERT_MESSAGE(reporter, 0 == numErrors, errors.c_str()); | 172 REPORTER_ASSERT_MESSAGE(reporter, 0 == numErrors, errors.c_str()); |
173 #endif | 173 #endif |
174 } | 174 } |
OLD | NEW |