| 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 void* allocThrow(size_t bytes) SK_OVERRIDE; | 89 void* allocThrow(size_t bytes) override; |
| 90 | 90 |
| 91 void unalloc(void* ptr) SK_OVERRIDE; | 91 void unalloc(void* ptr) 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 bool insert(const SkBitmap& bitmap, int32_t slot) SK_OVERRIDE; | 178 bool insert(const SkBitmap& bitmap, int32_t slot) 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 void beginCommentGroup(const char* description) SK_OVERRIDE; | 234 void beginCommentGroup(const char* description) override; |
| 235 void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 235 void addComment(const char* kywd, const char* value) override; |
| 236 void endCommentGroup() SK_OVERRIDE; | 236 void endCommentGroup() 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 void willSave() SK_OVERRIDE; | 245 void willSave() override; |
| 246 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; | 246 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) ov
erride; |
| 247 void willRestore() SK_OVERRIDE; | 247 void willRestore() override; |
| 248 | 248 |
| 249 void didConcat(const SkMatrix&) SK_OVERRIDE; | 249 void didConcat(const SkMatrix&) override; |
| 250 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 250 void didSetMatrix(const SkMatrix&) override; |
| 251 | 251 |
| 252 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 252 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 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&) 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&) 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&) 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&) overri
de; |
| 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) override; |
| 263 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 263 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 264 const SkPoint texCoords[4], SkXfermode* xmode, | 264 const SkPoint texCoords[4], SkXfermode* xmode, |
| 265 const SkPaint& paint) SK_OVERRIDE; | 265 const SkPaint& paint) override; |
| 266 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | 266 void onDrawPaint(const SkPaint&) override; |
| 267 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | 267 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
| 268 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | 268 void onDrawRect(const SkRect&, const SkPaint&) override; |
| 269 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 269 void onDrawOval(const SkRect&, const SkPaint&) override; |
| 270 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 270 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 271 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | 271 void onDrawPath(const SkPath&, const SkPaint&) override; |
| 272 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | 272 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
| 273 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 273 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| 274 DrawBitmapRectFlags flags) SK_OVERRIDE; | 274 DrawBitmapRectFlags flags) override; |
| 275 #if 0 | 275 #if 0 |
| 276 // rely on decomposition into bitmap (for now) | 276 // rely on decomposition into bitmap (for now) |
| 277 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | 277 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
| 278 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 278 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
| 279 const SkPaint*) SK_OVERRIDE; | 279 const SkPaint*) 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*) 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*) overri
de; |
| 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&) override; |
| 289 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 289 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 290 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 290 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 291 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 291 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 292 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 292 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
| 293 | 293 |
| 294 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; | 294 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
| 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 |