| 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 "SkBBoxHierarchyRecord.h" | 8 #include "SkBBoxHierarchyRecord.h" |
| 9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
| 10 #include "SkPictureRecorder.h" | 10 #include "SkPictureRecorder.h" |
| 11 #include "SkRecord.h" | 11 #include "SkRecord.h" |
| 12 #include "SkRecordDraw.h" | 12 #include "SkRecordDraw.h" |
| 13 #include "SkRecorder.h" | 13 #include "SkRecorder.h" |
| 14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
| 15 | 15 |
| 16 SkPictureRecorder::SkPictureRecorder() {} | 16 SkPictureRecorder::SkPictureRecorder() {} |
| 17 | 17 |
| 18 SkPictureRecorder::~SkPictureRecorder() {} | 18 SkPictureRecorder::~SkPictureRecorder() {} |
| 19 | 19 |
| 20 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, | 20 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, |
| 21 SkBBHFactory* bbhFactory /* = NULL *
/, | 21 SkBBHFactory* bbhFactory /* = NULL *
/, |
| 22 uint32_t recordFlags /* = 0 */) { | 22 uint32_t recordFlags /* = 0 */) { |
| 23 #ifdef SK_PICTURE_USE_SK_RECORD |
| 24 return EXPERIMENTAL_beginRecording(width, height, bbhFactory); |
| 25 #else |
| 26 return DEPRECATED_beginRecording(width, height, bbhFactory, recordFlags); |
| 27 #endif |
| 28 } |
| 29 |
| 30 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(int width, int height, |
| 31 SkBBHFactory* bbhFactory
/* = NULL */, |
| 32 uint32_t recordFlags /* =
0 */) { |
| 23 fWidth = width; | 33 fWidth = width; |
| 24 fHeight = height; | 34 fHeight = height; |
| 25 | 35 |
| 26 const SkISize size = SkISize::Make(width, height); | 36 const SkISize size = SkISize::Make(width, height); |
| 27 | 37 |
| 28 if (NULL != bbhFactory) { | 38 if (NULL != bbhFactory) { |
| 29 // We don't need to hold a ref on the BBH ourselves, but might as well f
or | 39 // We don't need to hold a ref on the BBH ourselves, but might as well f
or |
| 30 // consistency with EXPERIMENTAL_beginRecording(), which does need to. | 40 // consistency with EXPERIMENTAL_beginRecording(), which does need to. |
| 31 fBBH.reset((*bbhFactory)(width, height)); | 41 fBBH.reset((*bbhFactory)(width, height)); |
| 32 SkASSERT(NULL != fBBH.get()); | 42 SkASSERT(NULL != fBBH.get()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (NULL != fRecord.get()) { | 101 if (NULL != fRecord.get()) { |
| 92 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); | 102 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); |
| 93 } | 103 } |
| 94 | 104 |
| 95 if (NULL != fPictureRecord.get()) { | 105 if (NULL != fPictureRecord.get()) { |
| 96 const bool deepCopyOps = true; | 106 const bool deepCopyOps = true; |
| 97 SkPicture picture(fWidth, fHeight, *fPictureRecord.get(), deepCopyOps); | 107 SkPicture picture(fWidth, fHeight, *fPictureRecord.get(), deepCopyOps); |
| 98 picture.draw(canvas); | 108 picture.draw(canvas); |
| 99 } | 109 } |
| 100 } | 110 } |
| OLD | NEW |