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 #ifdef SK_BUILD_FOR_ANDROID | 8 #ifdef SK_BUILD_FOR_ANDROID |
9 #include "SkPicturePlayback.h" | 9 #include "SkPicturePlayback.h" |
10 #endif | 10 #endif |
11 #include "SkPictureRecorder.h" | 11 #include "SkPictureRecorder.h" |
12 | 12 |
13 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, | 13 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, |
14 SkBBHFactory* bbhFactory /* = NULL *
/, | 14 SkBBHFactory* bbhFactory /* = NULL *
/, |
15 uint32_t recordFlags /* = 0 */) { | 15 uint32_t recordFlags /* = 0 */) { |
16 fPicture.reset(SkNEW(SkPicture)); | 16 fPicture.reset(SkNEW(SkPicture)); |
17 return fPicture->beginRecording(width, height, bbhFactory, recordFlags); | 17 return fPicture->beginRecording(width, height, bbhFactory, recordFlags); |
18 } | 18 } |
19 | 19 |
20 #ifdef SK_BUILD_FOR_ANDROID | 20 #ifdef SK_BUILD_FOR_ANDROID |
21 void SkPictureRecorder::partialReplay(SkCanvas* canvas) { | 21 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { |
22 if (NULL == fPicture.get() || NULL == canvas) { | 22 if (NULL == fPicture.get() || NULL == canvas) { |
23 // Not recording or nothing to replay into | 23 // Not recording or nothing to replay into |
24 return; | 24 return; |
25 } | 25 } |
26 | 26 |
27 SkASSERT(NULL != fPicture->fRecord); | 27 SkASSERT(NULL != fPicture->fRecord); |
28 | 28 |
29 SkAutoTDelete<SkPicturePlayback> playback(SkPicture::FakeEndRecording(fPictu
re, | 29 SkAutoTDelete<SkPicturePlayback> playback(SkPicture::FakeEndRecording(fPictu
re.get(), |
30 *fPict
ure->fRecord, | 30 *fPict
ure->fRecord, |
31 false)
); | 31 false)
); |
32 playback->draw(*canvas, NULL); | 32 playback->draw(*canvas, NULL); |
33 } | 33 } |
34 #endif | 34 #endif |
OLD | NEW |