| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
| 8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); | 184 fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); |
| 185 for (int i = 0; i < fPictureCount; i++) { | 185 for (int i = 0; i < fPictureCount; i++) { |
| 186 if (deepCopyInfo) { | 186 if (deepCopyInfo) { |
| 187 fPictureRefs[i] = src.fPictureRefs[i]->clone(); | 187 fPictureRefs[i] = src.fPictureRefs[i]->clone(); |
| 188 } else { | 188 } else { |
| 189 fPictureRefs[i] = src.fPictureRefs[i]; | 189 fPictureRefs[i] = src.fPictureRefs[i]; |
| 190 fPictureRefs[i]->ref(); | 190 fPictureRefs[i]->ref(); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 #else | |
| 195 SkPictureData::SkPictureData(const SkPictureData& src) : fInfo(src.fInfo) { | |
| 196 this->init(); | |
| 197 | |
| 198 fBitmapHeap.reset(SkSafeRef(src.fBitmapHeap.get())); | |
| 199 fPathHeap.reset(SkSafeRef(src.fPathHeap.get())); | |
| 200 | |
| 201 fOpData = SkSafeRef(src.fOpData); | |
| 202 | |
| 203 fBoundingHierarchy = src.fBoundingHierarchy; | |
| 204 fStateTree = src.fStateTree; | |
| 205 fContentInfo.set(src.fContentInfo); | |
| 206 | |
| 207 SkSafeRef(fBoundingHierarchy); | |
| 208 SkSafeRef(fStateTree); | |
| 209 | |
| 210 fBitmaps = SkSafeRef(src.fBitmaps); | |
| 211 fPaints = SkSafeRef(src.fPaints); | |
| 212 | |
| 213 fPictureCount = src.fPictureCount; | |
| 214 fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); | |
| 215 for (int i = 0; i < fPictureCount; i++) { | |
| 216 fPictureRefs[i] = SkRef(src.fPictureRefs[i]); | |
| 217 } | |
| 218 } | |
| 219 #endif//SK_SUPPORT_LEGACY_PICTURE_CLONE | 194 #endif//SK_SUPPORT_LEGACY_PICTURE_CLONE |
| 220 | 195 |
| 221 void SkPictureData::init() { | 196 void SkPictureData::init() { |
| 222 fBitmaps = NULL; | 197 fBitmaps = NULL; |
| 223 fPaints = NULL; | 198 fPaints = NULL; |
| 224 fPictureRefs = NULL; | 199 fPictureRefs = NULL; |
| 225 fPictureCount = 0; | 200 fPictureCount = 0; |
| 226 fOpData = NULL; | 201 fOpData = NULL; |
| 227 fFactoryPlayback = NULL; | 202 fFactoryPlayback = NULL; |
| 228 fBoundingHierarchy = NULL; | 203 fBoundingHierarchy = NULL; |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 for (index = 0; index < fPictureCount; index++) | 1219 for (index = 0; index < fPictureCount; index++) |
| 1245 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1220 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
| 1246 "picture%p, ", fPictureRefs[index]); | 1221 "picture%p, ", fPictureRefs[index]); |
| 1247 if (fPictureCount > 0) | 1222 if (fPictureCount > 0) |
| 1248 SkDebugf("%s0};\n", pBuffer); | 1223 SkDebugf("%s0};\n", pBuffer); |
| 1249 | 1224 |
| 1250 const_cast<SkPictureData*>(this)->dumpStream(); | 1225 const_cast<SkPictureData*>(this)->dumpStream(); |
| 1251 } | 1226 } |
| 1252 | 1227 |
| 1253 #endif | 1228 #endif |
| OLD | NEW |