OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 SkASSERT((isCrossProcess && fset != NULL) || (!isCrossProcess && NULL ==
fset)); | 79 SkASSERT((isCrossProcess && fset != NULL) || (!isCrossProcess && NULL ==
fset)); |
80 if (isCrossProcess) { | 80 if (isCrossProcess) { |
81 this->setNamedFactorySet(fset); | 81 this->setNamedFactorySet(fset); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 ~FlattenableHeap() { | 85 ~FlattenableHeap() { |
86 fPointers.freeAll(); | 86 fPointers.freeAll(); |
87 } | 87 } |
88 | 88 |
89 virtual void* allocThrow(size_t bytes) SK_OVERRIDE; | 89 void* allocThrow(size_t bytes) SK_OVERRIDE; |
90 | 90 |
91 virtual void unalloc(void* ptr) SK_OVERRIDE; | 91 void unalloc(void* ptr) SK_OVERRIDE; |
92 | 92 |
93 void setBitmapStorage(SkBitmapHeap* heap) { | 93 void setBitmapStorage(SkBitmapHeap* heap) { |
94 this->setBitmapHeap(heap); | 94 this->setBitmapHeap(heap); |
95 } | 95 } |
96 | 96 |
97 const SkFlatData* flatToReplace() const; | 97 const SkFlatData* flatToReplace() const; |
98 | 98 |
99 // Mark an SkFlatData as one that should not be returned by flatToReplace. | 99 // Mark an SkFlatData as one that should not be returned by flatToReplace. |
100 // Takes the result of SkFlatData::index() as its parameter. | 100 // Takes the result of SkFlatData::index() as its parameter. |
101 void markFlatForKeeping(int index) { | 101 void markFlatForKeeping(int index) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 /** | 168 /** |
169 * If SkBitmaps are to be flattened to send to the reader, this class is | 169 * If SkBitmaps are to be flattened to send to the reader, this class is |
170 * provided to the SkBitmapHeap to tell the SkGPipeCanvas to do so. | 170 * provided to the SkBitmapHeap to tell the SkGPipeCanvas to do so. |
171 */ | 171 */ |
172 class BitmapShuttle : public SkBitmapHeap::ExternalStorage { | 172 class BitmapShuttle : public SkBitmapHeap::ExternalStorage { |
173 public: | 173 public: |
174 BitmapShuttle(SkGPipeCanvas*); | 174 BitmapShuttle(SkGPipeCanvas*); |
175 | 175 |
176 ~BitmapShuttle(); | 176 ~BitmapShuttle(); |
177 | 177 |
178 virtual bool insert(const SkBitmap& bitmap, int32_t slot) SK_OVERRIDE; | 178 bool insert(const SkBitmap& bitmap, int32_t slot) SK_OVERRIDE; |
179 | 179 |
180 /** | 180 /** |
181 * Remove the SkGPipeCanvas used for insertion. After this, calls to | 181 * Remove the SkGPipeCanvas used for insertion. After this, calls to |
182 * insert will crash. | 182 * insert will crash. |
183 */ | 183 */ |
184 void removeCanvas(); | 184 void removeCanvas(); |
185 | 185 |
186 private: | 186 private: |
187 SkGPipeCanvas* fCanvas; | 187 SkGPipeCanvas* fCanvas; |
188 }; | 188 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 fDone = true; | 224 fDone = true; |
225 } | 225 } |
226 | 226 |
227 void flushRecording(bool detachCurrentBlock); | 227 void flushRecording(bool detachCurrentBlock); |
228 size_t freeMemoryIfPossible(size_t bytesToFree); | 228 size_t freeMemoryIfPossible(size_t bytesToFree); |
229 | 229 |
230 size_t storageAllocatedForRecording() { | 230 size_t storageAllocatedForRecording() { |
231 return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->bytesAllocated(); | 231 return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->bytesAllocated(); |
232 } | 232 } |
233 | 233 |
234 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 234 void beginCommentGroup(const char* description) SK_OVERRIDE; |
235 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 235 void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
236 virtual void endCommentGroup() SK_OVERRIDE; | 236 void endCommentGroup() SK_OVERRIDE; |
237 | 237 |
238 /** | 238 /** |
239 * Flatten an SkBitmap to send to the reader, where it will be referenced | 239 * Flatten an SkBitmap to send to the reader, where it will be referenced |
240 * according to slot. | 240 * according to slot. |
241 */ | 241 */ |
242 bool shuttleBitmap(const SkBitmap&, int32_t slot); | 242 bool shuttleBitmap(const SkBitmap&, int32_t slot); |
243 | 243 |
244 protected: | 244 protected: |
245 virtual void willSave() SK_OVERRIDE; | 245 void willSave() SK_OVERRIDE; |
246 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; | 246 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; |
247 virtual void willRestore() SK_OVERRIDE; | 247 void willRestore() SK_OVERRIDE; |
248 | 248 |
249 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; | 249 void didConcat(const SkMatrix&) SK_OVERRIDE; |
250 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 250 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
251 | 251 |
252 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; | 252 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
253 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 253 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
254 const SkPaint&) SK_OVERRIDE; | 254 const SkPaint&) SK_OVERRIDE; |
255 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 255 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
256 const SkPaint&) SK_OVERRIDE; | 256 const SkPaint&) SK_OVERRIDE; |
257 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 257 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
258 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 258 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
259 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 259 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
260 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 260 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
261 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 261 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
262 const SkPaint& paint) SK_OVERRIDE; | 262 const SkPaint& paint) SK_OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... |
279 const SkPaint*) SK_OVERRIDE; | 279 const SkPaint*) SK_OVERRIDE; |
280 #endif | 280 #endif |
281 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 281 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
282 const SkPaint*) SK_OVERRIDE; | 282 const SkPaint*) SK_OVERRIDE; |
283 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 283 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; |
284 void onDrawVertices(VertexMode vmode, int vertexCount, | 284 void onDrawVertices(VertexMode vmode, int vertexCount, |
285 const SkPoint vertices[], const SkPoint texs[], | 285 const SkPoint vertices[], const SkPoint texs[], |
286 const SkColor colors[], SkXfermode* xmode, | 286 const SkColor colors[], SkXfermode* xmode, |
287 const uint16_t indices[], int indexCount, | 287 const uint16_t indices[], int indexCount, |
288 const SkPaint&) SK_OVERRIDE; | 288 const SkPaint&) SK_OVERRIDE; |
289 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 289 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
290 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 290 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
291 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 291 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
292 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 292 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
293 | 293 |
294 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; | 294 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; |
295 | 295 |
296 private: | 296 private: |
297 void recordTranslate(const SkMatrix&); | 297 void recordTranslate(const SkMatrix&); |
298 void recordScale(const SkMatrix&); | 298 void recordScale(const SkMatrix&); |
299 void recordConcat(const SkMatrix&); | 299 void recordConcat(const SkMatrix&); |
300 | 300 |
301 SkNamedFactorySet* fFactorySet; | 301 SkNamedFactorySet* fFactorySet; |
302 SkBitmapHeap* fBitmapHeap; | 302 SkBitmapHeap* fBitmapHeap; |
303 SkGPipeController* fController; | 303 SkGPipeController* fController; |
304 SkWriter32& fWriter; | 304 SkWriter32& fWriter; |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 return fCanvas->shuttleBitmap(bitmap, slot); | 1330 return fCanvas->shuttleBitmap(bitmap, slot); |
1331 } | 1331 } |
1332 | 1332 |
1333 void BitmapShuttle::removeCanvas() { | 1333 void BitmapShuttle::removeCanvas() { |
1334 if (NULL == fCanvas) { | 1334 if (NULL == fCanvas) { |
1335 return; | 1335 return; |
1336 } | 1336 } |
1337 fCanvas->unref(); | 1337 fCanvas->unref(); |
1338 fCanvas = NULL; | 1338 fCanvas = NULL; |
1339 } | 1339 } |
OLD | NEW |