| 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 | 7 |
| 8 #ifndef SkPictureData_DEFINED | 8 #ifndef SkPictureData_DEFINED |
| 9 #define SkPictureData_DEFINED | 9 #define SkPictureData_DEFINED |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 explicit SkPictureData(const SkPictInfo& info); | 79 explicit SkPictureData(const SkPictInfo& info); |
| 80 | 80 |
| 81 bool parseStream(SkStream*, SkPicture::InstallPixelRefProc); | 81 bool parseStream(SkStream*, SkPicture::InstallPixelRefProc); |
| 82 bool parseBuffer(SkReadBuffer& buffer); | 82 bool parseBuffer(SkReadBuffer& buffer); |
| 83 | 83 |
| 84 public: | 84 public: |
| 85 const SkBitmap& getBitmap(SkReader32* reader) const { | 85 const SkBitmap& getBitmap(SkReader32* reader) const { |
| 86 const int index = reader->readInt(); | 86 const int index = reader->readInt(); |
| 87 return (*fBitmaps)[index]; | 87 return fBitmaps[index]; |
| 88 } | 88 } |
| 89 | 89 |
| 90 const SkPath& getPath(SkReader32* reader) const { | 90 const SkPath& getPath(SkReader32* reader) const { |
| 91 int index = reader->readInt() - 1; | 91 int index = reader->readInt() - 1; |
| 92 return (*fPaths)[index]; | 92 return fPaths[index]; |
| 93 } | 93 } |
| 94 | 94 |
| 95 const SkPicture* getPicture(SkReader32* reader) const { | 95 const SkPicture* getPicture(SkReader32* reader) const { |
| 96 int index = reader->readInt(); | 96 int index = reader->readInt(); |
| 97 SkASSERT(index > 0 && index <= fPictureCount); | 97 SkASSERT(index > 0 && index <= fPictureCount); |
| 98 return fPictureRefs[index - 1]; | 98 return fPictureRefs[index - 1]; |
| 99 } | 99 } |
| 100 | 100 |
| 101 const SkPaint* getPaint(SkReader32* reader) const { | 101 const SkPaint* getPaint(SkReader32* reader) const { |
| 102 int index = reader->readInt(); | 102 int index = reader->readInt(); |
| 103 if (index == 0) { | 103 if (index == 0) { |
| 104 return NULL; | 104 return NULL; |
| 105 } | 105 } |
| 106 return &(*fPaints)[index - 1]; | 106 return &fPaints[index - 1]; |
| 107 } | 107 } |
| 108 | 108 |
| 109 const SkTextBlob* getTextBlob(SkReader32* reader) const { | 109 const SkTextBlob* getTextBlob(SkReader32* reader) const { |
| 110 int index = reader->readInt(); | 110 int index = reader->readInt(); |
| 111 SkASSERT(index > 0 && index <= fTextBlobCount); | 111 SkASSERT(index > 0 && index <= fTextBlobCount); |
| 112 return fTextBlobRefs[index - 1]; | 112 return fTextBlobRefs[index - 1]; |
| 113 } | 113 } |
| 114 | 114 |
| 115 #if SK_SUPPORT_GPU | 115 #if SK_SUPPORT_GPU |
| 116 /** | 116 /** |
| (...skipping 18 matching lines...) Expand all Loading... |
| 135 | 135 |
| 136 // these help us with reading/writing | 136 // these help us with reading/writing |
| 137 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); | 137 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); |
| 138 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); | 138 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); |
| 139 void flattenToBuffer(SkWriteBuffer&) const; | 139 void flattenToBuffer(SkWriteBuffer&) const; |
| 140 | 140 |
| 141 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty | 141 // Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_
SLOT. This empty |
| 142 // bitmap allows playback to draw nothing and move on. | 142 // bitmap allows playback to draw nothing and move on. |
| 143 SkBitmap fBadBitmap; | 143 SkBitmap fBadBitmap; |
| 144 | 144 |
| 145 SkTRefArray<SkBitmap>* fBitmaps; | 145 SkTArray<SkBitmap> fBitmaps; |
| 146 SkTRefArray<SkPaint>* fPaints; | 146 SkTArray<SkPaint> fPaints; |
| 147 SkTRefArray<SkPath>* fPaths; | 147 SkTArray<SkPath> fPaths; |
| 148 | 148 |
| 149 SkData* fOpData; // opcodes and parameters | 149 SkData* fOpData; // opcodes and parameters |
| 150 | 150 |
| 151 const SkPicture** fPictureRefs; | 151 const SkPicture** fPictureRefs; |
| 152 int fPictureCount; | 152 int fPictureCount; |
| 153 const SkTextBlob** fTextBlobRefs; | 153 const SkTextBlob** fTextBlobRefs; |
| 154 int fTextBlobCount; | 154 int fTextBlobCount; |
| 155 | 155 |
| 156 SkPictureContentInfo fContentInfo; | 156 SkPictureContentInfo fContentInfo; |
| 157 | 157 |
| 158 SkTypefacePlayback fTFPlayback; | 158 SkTypefacePlayback fTFPlayback; |
| 159 SkFactoryPlayback* fFactoryPlayback; | 159 SkFactoryPlayback* fFactoryPlayback; |
| 160 | 160 |
| 161 const SkPictInfo fInfo; | 161 const SkPictInfo fInfo; |
| 162 | 162 |
| 163 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); | 163 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); |
| 164 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); | 164 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); |
| 165 | 165 |
| 166 void initForPlayback() const; | 166 void initForPlayback() const; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 #endif | 169 #endif |
| OLD | NEW |