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