| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 "SkDeferredCanvas.h" | 9 #include "SkDeferredCanvas.h" |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_
OVERRIDE; | 164 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_
OVERRIDE; |
| 165 | 165 |
| 166 protected: | 166 protected: |
| 167 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 167 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; |
| 168 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; | 168 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; |
| 169 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; | 169 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; |
| 170 | 170 |
| 171 // None of the following drawing methods should ever get called on the | 171 // None of the following drawing methods should ever get called on the |
| 172 // deferred device | 172 // deferred device |
| 173 virtual void clear(SkColor color) SK_OVERRIDE |
| 174 {SkASSERT(0);} |
| 173 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE | 175 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE |
| 174 {SkASSERT(0);} | 176 {SkASSERT(0);} |
| 175 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, | 177 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, |
| 176 size_t count, const SkPoint[], | 178 size_t count, const SkPoint[], |
| 177 const SkPaint& paint) SK_OVERRIDE | 179 const SkPaint& paint) SK_OVERRIDE |
| 178 {SkASSERT(0);} | 180 {SkASSERT(0);} |
| 179 virtual void drawRect(const SkDraw&, const SkRect& r, | 181 virtual void drawRect(const SkDraw&, const SkRect& r, |
| 180 const SkPaint& paint) SK_OVERRIDE | 182 const SkPaint& paint) SK_OVERRIDE |
| 181 {SkASSERT(0);} | 183 {SkASSERT(0);} |
| 182 virtual void drawOval(const SkDraw&, const SkRect&, const SkPaint&) SK_OVERR
IDE | 184 virtual void drawOval(const SkDraw&, const SkRect&, const SkPaint&) SK_OVERR
IDE |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 this->INHERITED::onClipPath(path, op, edgeStyle); | 734 this->INHERITED::onClipPath(path, op, edgeStyle); |
| 733 this->recordedDrawCommand(); | 735 this->recordedDrawCommand(); |
| 734 } | 736 } |
| 735 | 737 |
| 736 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op)
{ | 738 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op)
{ |
| 737 this->drawingCanvas()->clipRegion(deviceRgn, op); | 739 this->drawingCanvas()->clipRegion(deviceRgn, op); |
| 738 this->INHERITED::onClipRegion(deviceRgn, op); | 740 this->INHERITED::onClipRegion(deviceRgn, op); |
| 739 this->recordedDrawCommand(); | 741 this->recordedDrawCommand(); |
| 740 } | 742 } |
| 741 | 743 |
| 744 void SkDeferredCanvas::clear(SkColor color) { |
| 745 // purge pending commands |
| 746 if (fDeferredDrawing) { |
| 747 this->getDeferredDevice()->skipPendingCommands(); |
| 748 } |
| 749 |
| 750 this->drawingCanvas()->clear(color); |
| 751 this->recordedDrawCommand(); |
| 752 } |
| 753 |
| 742 void SkDeferredCanvas::drawPaint(const SkPaint& paint) { | 754 void SkDeferredCanvas::drawPaint(const SkPaint& paint) { |
| 743 if (fDeferredDrawing && this->isFullFrame(NULL, &paint) && | 755 if (fDeferredDrawing && this->isFullFrame(NULL, &paint) && |
| 744 isPaintOpaque(&paint)) { | 756 isPaintOpaque(&paint)) { |
| 745 this->getDeferredDevice()->skipPendingCommands(); | 757 this->getDeferredDevice()->skipPendingCommands(); |
| 746 } | 758 } |
| 747 AutoImmediateDrawIfNeeded autoDraw(*this, &paint); | 759 AutoImmediateDrawIfNeeded autoDraw(*this, &paint); |
| 748 this->drawingCanvas()->drawPaint(paint); | 760 this->drawingCanvas()->drawPaint(paint); |
| 749 this->recordedDrawCommand(); | 761 this->recordedDrawCommand(); |
| 750 } | 762 } |
| 751 | 763 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 944 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 933 this->drawingCanvas()->setDrawFilter(filter); | 945 this->drawingCanvas()->setDrawFilter(filter); |
| 934 this->INHERITED::setDrawFilter(filter); | 946 this->INHERITED::setDrawFilter(filter); |
| 935 this->recordedDrawCommand(); | 947 this->recordedDrawCommand(); |
| 936 return filter; | 948 return filter; |
| 937 } | 949 } |
| 938 | 950 |
| 939 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 951 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
| 940 return this->drawingCanvas(); | 952 return this->drawingCanvas(); |
| 941 } | 953 } |
| OLD | NEW |