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