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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 virtual void drawData(const void*, size_t) SK_OVERRIDE; | 283 virtual void drawData(const void*, size_t) SK_OVERRIDE; |
284 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 284 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
285 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 285 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
286 virtual void endCommentGroup() SK_OVERRIDE; | 286 virtual void endCommentGroup() SK_OVERRIDE; |
287 | 287 |
288 /** | 288 /** |
289 * Flatten an SkBitmap to send to the reader, where it will be referenced | 289 * Flatten an SkBitmap to send to the reader, where it will be referenced |
290 * according to slot. | 290 * according to slot. |
291 */ | 291 */ |
292 bool shuttleBitmap(const SkBitmap&, int32_t slot); | 292 bool shuttleBitmap(const SkBitmap&, int32_t slot); |
| 293 |
| 294 protected: |
| 295 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; |
| 296 |
293 private: | 297 private: |
294 enum { | 298 enum { |
295 kNoSaveLayer = -1, | 299 kNoSaveLayer = -1, |
296 }; | 300 }; |
297 SkNamedFactorySet* fFactorySet; | 301 SkNamedFactorySet* fFactorySet; |
298 int fFirstSaveLayerStackLevel; | 302 int fFirstSaveLayerStackLevel; |
299 SkBitmapHeap* fBitmapHeap; | 303 SkBitmapHeap* fBitmapHeap; |
300 SkGPipeController* fController; | 304 SkGPipeController* fController; |
301 SkWriter32& fWriter; | 305 SkWriter32& fWriter; |
302 size_t fBlockSize; // amount allocated for writer | 306 size_t fBlockSize; // amount allocated for writer |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 735 |
732 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 736 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
733 NOTIFY_SETUP(this); | 737 NOTIFY_SETUP(this); |
734 this->writePaint(paint); | 738 this->writePaint(paint); |
735 if (this->needOpBytes(kSizeOfFlatRRect)) { | 739 if (this->needOpBytes(kSizeOfFlatRRect)) { |
736 this->writeOp(kDrawRRect_DrawOp); | 740 this->writeOp(kDrawRRect_DrawOp); |
737 fWriter.writeRRect(rrect); | 741 fWriter.writeRRect(rrect); |
738 } | 742 } |
739 } | 743 } |
740 | 744 |
| 745 void SkGPipeCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, |
| 746 const SkPaint& paint) { |
| 747 NOTIFY_SETUP(this); |
| 748 this->writePaint(paint); |
| 749 if (this->needOpBytes(kSizeOfFlatRRect * 2)) { |
| 750 this->writeOp(kDrawDRRect_DrawOp); |
| 751 fWriter.writeRRect(outer); |
| 752 fWriter.writeRRect(inner); |
| 753 } |
| 754 } |
| 755 |
741 void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 756 void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
742 NOTIFY_SETUP(this); | 757 NOTIFY_SETUP(this); |
743 this->writePaint(paint); | 758 this->writePaint(paint); |
744 if (this->needOpBytes(path.writeToMemory(NULL))) { | 759 if (this->needOpBytes(path.writeToMemory(NULL))) { |
745 this->writeOp(kDrawPath_DrawOp); | 760 this->writeOp(kDrawPath_DrawOp); |
746 fWriter.writePath(path); | 761 fWriter.writePath(path); |
747 } | 762 } |
748 } | 763 } |
749 | 764 |
750 bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op, | 765 bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op, |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 return fCanvas->shuttleBitmap(bitmap, slot); | 1245 return fCanvas->shuttleBitmap(bitmap, slot); |
1231 } | 1246 } |
1232 | 1247 |
1233 void BitmapShuttle::removeCanvas() { | 1248 void BitmapShuttle::removeCanvas() { |
1234 if (NULL == fCanvas) { | 1249 if (NULL == fCanvas) { |
1235 return; | 1250 return; |
1236 } | 1251 } |
1237 fCanvas->unref(); | 1252 fCanvas->unref(); |
1238 fCanvas = NULL; | 1253 fCanvas = NULL; |
1239 } | 1254 } |
OLD | NEW |