| 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 "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 224 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
| 225 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], | 225 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
| 226 const SkPaint&) SK_OVERRIDE; | 226 const SkPaint&) SK_OVERRIDE; |
| 227 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 227 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
| 228 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; | 228 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; |
| 229 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 229 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
| 230 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; | 230 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
| 231 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, | 231 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
| 232 const SkPaint*) SK_OVERRIDE; | 232 const SkPaint*) SK_OVERRIDE; |
| 233 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 233 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
| 234 const SkRect& dst, const SkPaint*) SK_OVERRIDE; | 234 const SkRect& dst, const SkPaint* paint, |
| 235 DrawBitmapRectFlags flags) SK_OVERRIDE; |
| 235 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, | 236 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, |
| 236 const SkPaint*) SK_OVERRIDE; | 237 const SkPaint*) SK_OVERRIDE; |
| 237 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 238 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| 238 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; | 239 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; |
| 239 virtual void drawSprite(const SkBitmap&, int left, int top, | 240 virtual void drawSprite(const SkBitmap&, int left, int top, |
| 240 const SkPaint*) SK_OVERRIDE; | 241 const SkPaint*) SK_OVERRIDE; |
| 241 virtual void drawText(const void* text, size_t byteLength, SkScalar x, | 242 virtual void drawText(const void* text, size_t byteLength, SkScalar x, |
| 242 SkScalar y, const SkPaint&) SK_OVERRIDE; | 243 SkScalar y, const SkPaint&) SK_OVERRIDE; |
| 243 virtual void drawPosText(const void* text, size_t byteLength, | 244 virtual void drawPosText(const void* text, size_t byteLength, |
| 244 const SkPoint pos[], const SkPaint&) SK_OVERRIDE; | 245 const SkPoint pos[], const SkPaint&) SK_OVERRIDE; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 NOTIFY_SETUP(this); | 768 NOTIFY_SETUP(this); |
| 768 size_t opBytesNeeded = sizeof(SkScalar) * 2; | 769 size_t opBytesNeeded = sizeof(SkScalar) * 2; |
| 769 | 770 |
| 770 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint))
{ | 771 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint))
{ |
| 771 fWriter.writeScalar(left); | 772 fWriter.writeScalar(left); |
| 772 fWriter.writeScalar(top); | 773 fWriter.writeScalar(top); |
| 773 } | 774 } |
| 774 } | 775 } |
| 775 | 776 |
| 776 void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src, | 777 void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src, |
| 777 const SkRect& dst, const SkPaint* paint) { | 778 const SkRect& dst, const SkPaint* paint
, |
| 779 DrawBitmapRectFlags dbmrFlags) { |
| 778 NOTIFY_SETUP(this); | 780 NOTIFY_SETUP(this); |
| 779 size_t opBytesNeeded = sizeof(SkRect); | 781 size_t opBytesNeeded = sizeof(SkRect); |
| 780 bool hasSrc = src != NULL; | 782 bool hasSrc = src != NULL; |
| 781 unsigned flags; | 783 unsigned flags; |
| 782 if (hasSrc) { | 784 if (hasSrc) { |
| 783 flags = kDrawBitmap_HasSrcRect_DrawOpFlag; | 785 flags = kDrawBitmap_HasSrcRect_DrawOpFlag; |
| 784 opBytesNeeded += sizeof(int32_t) * 4; | 786 opBytesNeeded += sizeof(int32_t) * 4; |
| 785 } else { | 787 } else { |
| 786 flags = 0; | 788 flags = 0; |
| 787 } | 789 } |
| 790 if (dbmrFlags & kBleed_DrawBitmapRectFlag) { |
| 791 flags |= kDrawBitmap_Bleed_DrawOpFlag; |
| 792 } |
| 788 | 793 |
| 789 if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesN
eeded, paint)) { | 794 if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesN
eeded, paint)) { |
| 790 if (hasSrc) { | 795 if (hasSrc) { |
| 791 fWriter.writeRect(*src); | 796 fWriter.writeRect(*src); |
| 792 } | 797 } |
| 793 fWriter.writeRect(dst); | 798 fWriter.writeRect(dst); |
| 794 } | 799 } |
| 795 } | 800 } |
| 796 | 801 |
| 797 void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix, | 802 void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix, |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 fCanvas->ref(); | 1191 fCanvas->ref(); |
| 1187 } | 1192 } |
| 1188 | 1193 |
| 1189 BitmapShuttle::~BitmapShuttle() { | 1194 BitmapShuttle::~BitmapShuttle() { |
| 1190 fCanvas->unref(); | 1195 fCanvas->unref(); |
| 1191 } | 1196 } |
| 1192 | 1197 |
| 1193 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { | 1198 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { |
| 1194 return fCanvas->shuttleBitmap(bitmap, slot); | 1199 return fCanvas->shuttleBitmap(bitmap, slot); |
| 1195 } | 1200 } |
| OLD | NEW |