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