Chromium Code Reviews| Index: src/core/SkPicture.cpp |
| =================================================================== |
| --- src/core/SkPicture.cpp (revision 13762) |
| +++ src/core/SkPicture.cpp (working copy) |
| @@ -117,9 +117,12 @@ |
| fRecord = NULL; |
| fPlayback = NULL; |
| fWidth = fHeight = 0; |
| + fAccelData = NULL; |
| } |
| -SkPicture::SkPicture(const SkPicture& src) : INHERITED() { |
| +SkPicture::SkPicture(const SkPicture& src) |
| + : INHERITED() |
| + , fAccelData(NULL) { |
| fWidth = src.fWidth; |
| fHeight = src.fHeight; |
| fRecord = NULL; |
| @@ -141,6 +144,7 @@ |
| SkPicture::~SkPicture() { |
| SkSafeUnref(fRecord); |
| SkDELETE(fPlayback); |
| + SkSafeUnref(fAccelData); |
| } |
| void SkPicture::internalOnly_EnableOpts(bool enableOpts) { |
| @@ -152,6 +156,7 @@ |
| void SkPicture::swap(SkPicture& other) { |
| SkTSwap(fRecord, other.fRecord); |
| SkTSwap(fPlayback, other.fPlayback); |
| + SkTSwap(fAccelData, other.fAccelData); |
| SkTSwap(fWidth, other.fWidth); |
| SkTSwap(fHeight, other.fHeight); |
| } |
| @@ -188,6 +193,17 @@ |
| } |
| } |
| +SkPicture::AccelData::Domain SkPicture::AccelData::GenerateDomain() { |
| + static int32_t gNextID = 0; |
| + |
| + int32_t id = sk_atomic_inc(&gNextID); |
| + if (id >= 1 << (8 * sizeof(Domain))) { |
|
bsalomon
2014/03/14 13:59:43
Ben will be so unhappy with you for making these b
|
| + SK_CRASH(); |
| + } |
| + |
| + return static_cast<Domain>(id); |
| +} |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| SkCanvas* SkPicture::beginRecording(int width, int height, |
| @@ -196,7 +212,7 @@ |
| SkDELETE(fPlayback); |
| fPlayback = NULL; |
| } |
| - |
| + SkSafeUnref(fAccelData); |
| SkSafeSetNull(fRecord); |
| // Must be set before calling createBBoxHierarchy |
| @@ -250,7 +266,7 @@ |
| void SkPicture::draw(SkCanvas* surface, SkDrawPictureCallback* callback) { |
| this->endRecording(); |
| - if (fPlayback) { |
| + if (NULL != fPlayback) { |
| fPlayback->draw(*surface, callback); |
| } |
| } |
| @@ -316,6 +332,7 @@ |
| SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height) |
| : fPlayback(playback) |
| , fRecord(NULL) |
| + , fAccelData(NULL) |
| , fWidth(width) |
| , fHeight(height) {} |
| @@ -425,7 +442,9 @@ |
| } |
| bool SkPicture::willPlayBackBitmaps() const { |
| - if (!fPlayback) return false; |
| + if (!fPlayback) { |
| + return false; |
| + } |
| return fPlayback->containsBitmaps(); |
| } |