| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // overrides from SkCanvas | 234 // overrides from SkCanvas |
| 235 virtual bool isDrawingToLayer() const SK_OVERRIDE; | 235 virtual bool isDrawingToLayer() const SK_OVERRIDE; |
| 236 virtual void clear(SkColor) SK_OVERRIDE; |
| 236 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 237 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
| 237 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], | 238 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
| 238 const SkPaint&) SK_OVERRIDE; | 239 const SkPaint&) SK_OVERRIDE; |
| 239 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 240 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
| 240 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; | 241 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; |
| 241 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 242 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
| 242 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; | 243 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
| 243 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, | 244 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
| 244 const SkPaint*) SK_OVERRIDE; | 245 const SkPaint*) SK_OVERRIDE; |
| 245 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 246 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 NOTIFY_SETUP(this); | 683 NOTIFY_SETUP(this); |
| 683 if (this->needOpBytes(region.writeToMemory(NULL))) { | 684 if (this->needOpBytes(region.writeToMemory(NULL))) { |
| 684 this->writeOp(kClipRegion_DrawOp, 0, rgnOp); | 685 this->writeOp(kClipRegion_DrawOp, 0, rgnOp); |
| 685 fWriter.writeRegion(region); | 686 fWriter.writeRegion(region); |
| 686 } | 687 } |
| 687 this->INHERITED::onClipRegion(region, rgnOp); | 688 this->INHERITED::onClipRegion(region, rgnOp); |
| 688 } | 689 } |
| 689 | 690 |
| 690 /////////////////////////////////////////////////////////////////////////////// | 691 /////////////////////////////////////////////////////////////////////////////// |
| 691 | 692 |
| 693 void SkGPipeCanvas::clear(SkColor color) { |
| 694 NOTIFY_SETUP(this); |
| 695 unsigned flags = 0; |
| 696 if (color) { |
| 697 flags |= kClear_HasColor_DrawOpFlag; |
| 698 } |
| 699 if (this->needOpBytes(sizeof(SkColor))) { |
| 700 this->writeOp(kDrawClear_DrawOp, flags, 0); |
| 701 if (color) { |
| 702 fWriter.write32(color); |
| 703 } |
| 704 } |
| 705 } |
| 706 |
| 692 void SkGPipeCanvas::drawPaint(const SkPaint& paint) { | 707 void SkGPipeCanvas::drawPaint(const SkPaint& paint) { |
| 693 NOTIFY_SETUP(this); | 708 NOTIFY_SETUP(this); |
| 694 this->writePaint(paint); | 709 this->writePaint(paint); |
| 695 if (this->needOpBytes()) { | 710 if (this->needOpBytes()) { |
| 696 this->writeOp(kDrawPaint_DrawOp); | 711 this->writeOp(kDrawPaint_DrawOp); |
| 697 } | 712 } |
| 698 } | 713 } |
| 699 | 714 |
| 700 void SkGPipeCanvas::drawPoints(PointMode mode, size_t count, | 715 void SkGPipeCanvas::drawPoints(PointMode mode, size_t count, |
| 701 const SkPoint pts[], const SkPaint& paint) { | 716 const SkPoint pts[], const SkPaint& paint) { |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 return fCanvas->shuttleBitmap(bitmap, slot); | 1394 return fCanvas->shuttleBitmap(bitmap, slot); |
| 1380 } | 1395 } |
| 1381 | 1396 |
| 1382 void BitmapShuttle::removeCanvas() { | 1397 void BitmapShuttle::removeCanvas() { |
| 1383 if (NULL == fCanvas) { | 1398 if (NULL == fCanvas) { |
| 1384 return; | 1399 return; |
| 1385 } | 1400 } |
| 1386 fCanvas->unref(); | 1401 fCanvas->unref(); |
| 1387 fCanvas = NULL; | 1402 fCanvas = NULL; |
| 1388 } | 1403 } |
| OLD | NEW |