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