Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: src/utils/SkDeferredCanvas.cpp

Issue 783493002: Change clear() to respect the clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/utils/SkGatherPixelRefsAndRects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);}
175 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE 173 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE
176 {SkASSERT(0);} 174 {SkASSERT(0);}
177 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, 175 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
178 size_t count, const SkPoint[], 176 size_t count, const SkPoint[],
179 const SkPaint& paint) SK_OVERRIDE 177 const SkPaint& paint) SK_OVERRIDE
180 {SkASSERT(0);} 178 {SkASSERT(0);}
181 virtual void drawRect(const SkDraw&, const SkRect& r, 179 virtual void drawRect(const SkDraw&, const SkRect& r,
182 const SkPaint& paint) SK_OVERRIDE 180 const SkPaint& paint) SK_OVERRIDE
183 {SkASSERT(0);} 181 {SkASSERT(0);}
184 virtual void drawOval(const SkDraw&, const SkRect&, const SkPaint&) SK_OVERR IDE 182 virtual void drawOval(const SkDraw&, const SkRect&, const SkPaint&) SK_OVERR IDE
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 this->INHERITED::onClipPath(path, op, edgeStyle); 732 this->INHERITED::onClipPath(path, op, edgeStyle);
735 this->recordedDrawCommand(); 733 this->recordedDrawCommand();
736 } 734 }
737 735
738 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 736 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
739 this->drawingCanvas()->clipRegion(deviceRgn, op); 737 this->drawingCanvas()->clipRegion(deviceRgn, op);
740 this->INHERITED::onClipRegion(deviceRgn, op); 738 this->INHERITED::onClipRegion(deviceRgn, op);
741 this->recordedDrawCommand(); 739 this->recordedDrawCommand();
742 } 740 }
743 741
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
754 void SkDeferredCanvas::drawPaint(const SkPaint& paint) { 742 void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
755 if (fDeferredDrawing && this->isFullFrame(NULL, &paint) && 743 if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
756 isPaintOpaque(&paint)) { 744 isPaintOpaque(&paint)) {
757 this->getDeferredDevice()->skipPendingCommands(); 745 this->getDeferredDevice()->skipPendingCommands();
758 } 746 }
759 AutoImmediateDrawIfNeeded autoDraw(*this, &paint); 747 AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
760 this->drawingCanvas()->drawPaint(paint); 748 this->drawingCanvas()->drawPaint(paint);
761 this->recordedDrawCommand(); 749 this->recordedDrawCommand();
762 } 750 }
763 751
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 932 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
945 this->drawingCanvas()->setDrawFilter(filter); 933 this->drawingCanvas()->setDrawFilter(filter);
946 this->INHERITED::setDrawFilter(filter); 934 this->INHERITED::setDrawFilter(filter);
947 this->recordedDrawCommand(); 935 this->recordedDrawCommand();
948 return filter; 936 return filter;
949 } 937 }
950 938
951 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 939 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
952 return this->drawingCanvas(); 940 return this->drawingCanvas();
953 } 941 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/utils/SkGatherPixelRefsAndRects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698