| 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 "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkDrawable.h" | 9 #include "SkDrawable.h" |
| 10 #include "SkLayerInfo.h" | 10 #include "SkLayerInfo.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* d
rawableList, | 108 SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* d
rawableList, |
| 109 const SkRect& bounds, bool doSaveLayerInfo) | 109 const SkRect& bounds, bool doSaveLayerInfo) |
| 110 : fRecord(SkRef(record)) | 110 : fRecord(SkRef(record)) |
| 111 , fBBH(SkSafeRef(bbh)) | 111 , fBBH(SkSafeRef(bbh)) |
| 112 , fDrawableList(drawableList) // we take ownership | 112 , fDrawableList(drawableList) // we take ownership |
| 113 , fBounds(bounds) | 113 , fBounds(bounds) |
| 114 , fDoSaveLayerInfo(doSaveLayerInfo) | 114 , fDoSaveLayerInfo(doSaveLayerInfo) |
| 115 {} | 115 {} |
| 116 | 116 |
| 117 protected: | 117 protected: |
| 118 SkRect onGetBounds() SK_OVERRIDE { return fBounds; } | 118 SkRect onGetBounds() override { return fBounds; } |
| 119 | 119 |
| 120 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 120 void onDraw(SkCanvas* canvas) override { |
| 121 SkDrawable* const* drawables = NULL; | 121 SkDrawable* const* drawables = NULL; |
| 122 int drawableCount = 0; | 122 int drawableCount = 0; |
| 123 if (fDrawableList) { | 123 if (fDrawableList) { |
| 124 drawables = fDrawableList->begin(); | 124 drawables = fDrawableList->begin(); |
| 125 drawableCount = fDrawableList->count(); | 125 drawableCount = fDrawableList->count(); |
| 126 } | 126 } |
| 127 SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, fBBH, NUL
L/*callback*/); | 127 SkRecordDraw(*fRecord, canvas, NULL, drawables, drawableCount, fBBH, NUL
L/*callback*/); |
| 128 } | 128 } |
| 129 | 129 |
| 130 SkPicture* onNewPictureSnapshot() SK_OVERRIDE { | 130 SkPicture* onNewPictureSnapshot() override { |
| 131 SkPicture::SnapshotArray* pictList = NULL; | 131 SkPicture::SnapshotArray* pictList = NULL; |
| 132 if (fDrawableList) { | 132 if (fDrawableList) { |
| 133 // TODO: should we plumb-down the BBHFactory and recordFlags from ou
r host | 133 // TODO: should we plumb-down the BBHFactory and recordFlags from ou
r host |
| 134 // PictureRecorder? | 134 // PictureRecorder? |
| 135 pictList = fDrawableList->newDrawableSnapshot(); | 135 pictList = fDrawableList->newDrawableSnapshot(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 SkAutoTUnref<SkLayerInfo> saveLayerData; | 138 SkAutoTUnref<SkLayerInfo> saveLayerData; |
| 139 | 139 |
| 140 if (fBBH && fDoSaveLayerInfo) { | 140 if (fBBH && fDoSaveLayerInfo) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 170 fCullRect, | 170 fCullRect, |
| 171 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); | 171 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); |
| 172 | 172 |
| 173 // release our refs now, so only the drawable will be the owner. | 173 // release our refs now, so only the drawable will be the owner. |
| 174 fRecorder.reset(NULL); | 174 fRecorder.reset(NULL); |
| 175 fRecord.reset(NULL); | 175 fRecord.reset(NULL); |
| 176 fBBH.reset(NULL); | 176 fBBH.reset(NULL); |
| 177 | 177 |
| 178 return drawable; | 178 return drawable; |
| 179 } | 179 } |
| OLD | NEW |