| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 #include "SkRecord.h" | 40 #include "SkRecord.h" |
| 41 #include "SkRecordDraw.h" | 41 #include "SkRecordDraw.h" |
| 42 #include "SkRecorder.h" | 42 #include "SkRecorder.h" |
| 43 | 43 |
| 44 template <typename T> int SafeCount(const T* obj) { | 44 template <typename T> int SafeCount(const T* obj) { |
| 45 return obj ? obj->count() : 0; | 45 return obj ? obj->count() : 0; |
| 46 } | 46 } |
| 47 | 47 |
| 48 #define DUMP_BUFFER_SIZE 65536 | |
| 49 | |
| 50 #ifdef SK_DEBUG | |
| 51 // enable SK_DEBUG_TRACE to trace DrawType elements when | |
| 52 // recorded and played back | |
| 53 // #define SK_DEBUG_TRACE | |
| 54 // enable SK_DEBUG_SIZE to see the size of picture components | |
| 55 // #define SK_DEBUG_SIZE | |
| 56 // enable SK_DEBUG_DUMP to see the contents of recorded elements | |
| 57 // #define SK_DEBUG_DUMP | |
| 58 // enable SK_DEBUG_VALIDATE to check internal structures for consistency | |
| 59 // #define SK_DEBUG_VALIDATE | |
| 60 #endif | |
| 61 | |
| 62 #if defined SK_DEBUG_TRACE || defined SK_DEBUG_DUMP | |
| 63 const char* DrawTypeToString(DrawType drawType) { | |
| 64 switch (drawType) { | |
| 65 case UNUSED: SkDebugf("DrawType UNUSED\n"); SkASSERT(0); break; | |
| 66 case CLIP_PATH: return "CLIP_PATH"; | |
| 67 case CLIP_REGION: return "CLIP_REGION"; | |
| 68 case CLIP_RECT: return "CLIP_RECT"; | |
| 69 case CLIP_RRECT: return "CLIP_RRECT"; | |
| 70 case CONCAT: return "CONCAT"; | |
| 71 case DRAW_BITMAP: return "DRAW_BITMAP"; | |
| 72 case DRAW_BITMAP_MATRIX: return "DRAW_BITMAP_MATRIX"; | |
| 73 case DRAW_BITMAP_NINE: return "DRAW_BITMAP_NINE"; | |
| 74 case DRAW_BITMAP_RECT_TO_RECT: return "DRAW_BITMAP_RECT_TO_RECT"; | |
| 75 case DRAW_CLEAR: return "DRAW_CLEAR"; | |
| 76 case DRAW_DATA: return "DRAW_DATA"; | |
| 77 case DRAW_OVAL: return "DRAW_OVAL"; | |
| 78 case DRAW_PAINT: return "DRAW_PAINT"; | |
| 79 case DRAW_PATH: return "DRAW_PATH"; | |
| 80 case DRAW_PICTURE: return "DRAW_PICTURE"; | |
| 81 case DRAW_POINTS: return "DRAW_POINTS"; | |
| 82 case DRAW_POS_TEXT: return "DRAW_POS_TEXT"; | |
| 83 case DRAW_POS_TEXT_TOP_BOTTOM: return "DRAW_POS_TEXT_TOP_BOTTOM"; | |
| 84 case DRAW_POS_TEXT_H: return "DRAW_POS_TEXT_H"; | |
| 85 case DRAW_POS_TEXT_H_TOP_BOTTOM: return "DRAW_POS_TEXT_H_TOP_BOTTOM"; | |
| 86 case DRAW_RECT: return "DRAW_RECT"; | |
| 87 case DRAW_RRECT: return "DRAW_RRECT"; | |
| 88 case DRAW_SPRITE: return "DRAW_SPRITE"; | |
| 89 case DRAW_TEXT: return "DRAW_TEXT"; | |
| 90 case DRAW_TEXT_ON_PATH: return "DRAW_TEXT_ON_PATH"; | |
| 91 case DRAW_TEXT_TOP_BOTTOM: return "DRAW_TEXT_TOP_BOTTOM"; | |
| 92 case DRAW_VERTICES: return "DRAW_VERTICES"; | |
| 93 case RESTORE: return "RESTORE"; | |
| 94 case ROTATE: return "ROTATE"; | |
| 95 case SAVE: return "SAVE"; | |
| 96 case SAVE_LAYER: return "SAVE_LAYER"; | |
| 97 case SCALE: return "SCALE"; | |
| 98 case SET_MATRIX: return "SET_MATRIX"; | |
| 99 case SKEW: return "SKEW"; | |
| 100 case TRANSLATE: return "TRANSLATE"; | |
| 101 case NOOP: return "NOOP"; | |
| 102 default: | |
| 103 SkDebugf("DrawType error 0x%08x\n", drawType); | |
| 104 SkASSERT(0); | |
| 105 break; | |
| 106 } | |
| 107 SkASSERT(0); | |
| 108 return NULL; | |
| 109 } | |
| 110 #endif | |
| 111 | |
| 112 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
| 113 | 49 |
| 114 #ifdef SK_SUPPORT_LEGACY_DEFAULT_PICTURE_CTOR | 50 #ifdef SK_SUPPORT_LEGACY_DEFAULT_PICTURE_CTOR |
| 115 // fRecord OK | 51 // fRecord OK |
| 116 SkPicture::SkPicture() | 52 SkPicture::SkPicture() |
| 117 : fWidth(0) | 53 : fWidth(0) |
| 118 , fHeight(0) | 54 , fHeight(0) |
| 119 , fRecordWillPlayBackBitmaps(false) { | 55 , fRecordWillPlayBackBitmaps(false) { |
| 120 this->needsNewGenID(); | 56 this->needsNewGenID(); |
| 121 } | 57 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 *fDeletionListeners.append() = SkRef(listener); | 444 *fDeletionListeners.append() = SkRef(listener); |
| 509 } | 445 } |
| 510 | 446 |
| 511 void SkPicture::callDeletionListeners() { | 447 void SkPicture::callDeletionListeners() { |
| 512 for (int i = 0; i < fDeletionListeners.count(); ++i) { | 448 for (int i = 0; i < fDeletionListeners.count(); ++i) { |
| 513 fDeletionListeners[i]->onDeletion(this->uniqueID()); | 449 fDeletionListeners[i]->onDeletion(this->uniqueID()); |
| 514 } | 450 } |
| 515 | 451 |
| 516 fDeletionListeners.unrefAll(); | 452 fDeletionListeners.unrefAll(); |
| 517 } | 453 } |
| OLD | NEW |