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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 virtual bool clipRect(const SkRect&, SkRegion::Op op, bool doAntiAlias = fal
se) SK_OVERRIDE; | 217 virtual bool clipRect(const SkRect&, SkRegion::Op op, bool doAntiAlias = fal
se) SK_OVERRIDE; |
218 virtual bool clipRRect(const SkRRect&, SkRegion::Op op, bool doAntiAlias = f
alse) SK_OVERRIDE; | 218 virtual bool clipRRect(const SkRRect&, SkRegion::Op op, bool doAntiAlias = f
alse) SK_OVERRIDE; |
219 virtual bool clipPath(const SkPath& path, SkRegion::Op op, | 219 virtual bool clipPath(const SkPath& path, SkRegion::Op op, |
220 bool doAntiAlias = false) SK_OVERRIDE; | 220 bool doAntiAlias = false) SK_OVERRIDE; |
221 virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE
; | 221 virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE
; |
222 virtual void clear(SkColor) SK_OVERRIDE; | 222 virtual void clear(SkColor) SK_OVERRIDE; |
223 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 223 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
224 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], | 224 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
225 const SkPaint&) SK_OVERRIDE; | 225 const SkPaint&) SK_OVERRIDE; |
226 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 226 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
227 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; | |
228 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 227 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
229 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; | |
230 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, | 228 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
231 const SkPaint*) SK_OVERRIDE; | 229 const SkPaint*) SK_OVERRIDE; |
232 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 230 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
233 const SkRect& dst, const SkPaint* paint, | 231 const SkRect& dst, const SkPaint* paint, |
234 DrawBitmapRectFlags flags) SK_OVERRIDE; | 232 DrawBitmapRectFlags flags) SK_OVERRIDE; |
235 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, | 233 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, |
236 const SkPaint*) SK_OVERRIDE; | 234 const SkPaint*) SK_OVERRIDE; |
237 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 235 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
238 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; | 236 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; |
239 virtual void drawSprite(const SkBitmap&, int left, int top, | 237 virtual void drawSprite(const SkBitmap&, int left, int top, |
(...skipping 17 matching lines...) Expand all Loading... |
257 virtual void drawData(const void*, size_t) SK_OVERRIDE; | 255 virtual void drawData(const void*, size_t) SK_OVERRIDE; |
258 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 256 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
259 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 257 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
260 virtual void endCommentGroup() SK_OVERRIDE; | 258 virtual void endCommentGroup() SK_OVERRIDE; |
261 | 259 |
262 /** | 260 /** |
263 * Flatten an SkBitmap to send to the reader, where it will be referenced | 261 * Flatten an SkBitmap to send to the reader, where it will be referenced |
264 * according to slot. | 262 * according to slot. |
265 */ | 263 */ |
266 bool shuttleBitmap(const SkBitmap&, int32_t slot); | 264 bool shuttleBitmap(const SkBitmap&, int32_t slot); |
| 265 |
| 266 protected: |
| 267 virtual void onDrawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; |
| 268 virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
| 269 |
267 private: | 270 private: |
268 enum { | 271 enum { |
269 kNoSaveLayer = -1, | 272 kNoSaveLayer = -1, |
270 }; | 273 }; |
271 SkNamedFactorySet* fFactorySet; | 274 SkNamedFactorySet* fFactorySet; |
272 int fFirstSaveLayerStackLevel; | 275 int fFirstSaveLayerStackLevel; |
273 SkBitmapHeap* fBitmapHeap; | 276 SkBitmapHeap* fBitmapHeap; |
274 SkGPipeController* fController; | 277 SkGPipeController* fController; |
275 SkWriter32& fWriter; | 278 SkWriter32& fWriter; |
276 size_t fBlockSize; // amount allocated for writer | 279 size_t fBlockSize; // amount allocated for writer |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 711 |
709 void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { | 712 void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { |
710 NOTIFY_SETUP(this); | 713 NOTIFY_SETUP(this); |
711 this->writePaint(paint); | 714 this->writePaint(paint); |
712 if (this->needOpBytes(sizeof(SkRect))) { | 715 if (this->needOpBytes(sizeof(SkRect))) { |
713 this->writeOp(kDrawOval_DrawOp); | 716 this->writeOp(kDrawOval_DrawOp); |
714 fWriter.writeRect(rect); | 717 fWriter.writeRect(rect); |
715 } | 718 } |
716 } | 719 } |
717 | 720 |
718 void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { | 721 void SkGPipeCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { |
719 NOTIFY_SETUP(this); | 722 NOTIFY_SETUP(this); |
720 this->writePaint(paint); | 723 this->writePaint(paint); |
721 if (this->needOpBytes(sizeof(SkRect))) { | 724 if (this->needOpBytes(sizeof(SkRect))) { |
722 this->writeOp(kDrawRect_DrawOp); | 725 this->writeOp(kDrawRect_DrawOp); |
723 fWriter.writeRect(rect); | 726 fWriter.writeRect(rect); |
724 } | 727 } |
725 } | 728 } |
726 | 729 |
727 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 730 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
728 NOTIFY_SETUP(this); | 731 NOTIFY_SETUP(this); |
729 this->writePaint(paint); | 732 this->writePaint(paint); |
730 if (this->needOpBytes(kSizeOfFlatRRect)) { | 733 if (this->needOpBytes(kSizeOfFlatRRect)) { |
731 this->writeOp(kDrawRRect_DrawOp); | 734 this->writeOp(kDrawRRect_DrawOp); |
732 fWriter.writeRRect(rrect); | 735 fWriter.writeRRect(rrect); |
733 } | 736 } |
734 } | 737 } |
735 | 738 |
736 void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 739 void SkGPipeCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { |
737 NOTIFY_SETUP(this); | 740 NOTIFY_SETUP(this); |
738 this->writePaint(paint); | 741 this->writePaint(paint); |
739 if (this->needOpBytes(path.writeToMemory(NULL))) { | 742 if (this->needOpBytes(path.writeToMemory(NULL))) { |
740 this->writeOp(kDrawPath_DrawOp); | 743 this->writeOp(kDrawPath_DrawOp); |
741 fWriter.writePath(path); | 744 fWriter.writePath(path); |
742 } | 745 } |
743 } | 746 } |
744 | 747 |
745 bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op, | 748 bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op, |
746 unsigned flags, | 749 unsigned flags, |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 fCanvas->ref(); | 1213 fCanvas->ref(); |
1211 } | 1214 } |
1212 | 1215 |
1213 BitmapShuttle::~BitmapShuttle() { | 1216 BitmapShuttle::~BitmapShuttle() { |
1214 fCanvas->unref(); | 1217 fCanvas->unref(); |
1215 } | 1218 } |
1216 | 1219 |
1217 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { | 1220 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { |
1218 return fCanvas->shuttleBitmap(bitmap, slot); | 1221 return fCanvas->shuttleBitmap(bitmap, slot); |
1219 } | 1222 } |
OLD | NEW |