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

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

Issue 196323003: Revert of Revert "De-virtualize SkCanvas save/restore." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/utils/SkDumpCanvas.cpp » ('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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 transformedRect.fRight < SkIntToScalar(canvasSize.fWidth) || 732 transformedRect.fRight < SkIntToScalar(canvasSize.fWidth) ||
733 transformedRect.fBottom < SkIntToScalar(canvasSize.fHeight)) { 733 transformedRect.fBottom < SkIntToScalar(canvasSize.fHeight)) {
734 return false; 734 return false;
735 } 735 }
736 } 736 }
737 737
738 return this->getClipStack()->quickContains(SkRect::MakeXYWH(0, 0, 738 return this->getClipStack()->quickContains(SkRect::MakeXYWH(0, 0,
739 SkIntToScalar(canvasSize.fWidth), SkIntToScalar(canvasSize.fHeight))); 739 SkIntToScalar(canvasSize.fWidth), SkIntToScalar(canvasSize.fHeight)));
740 } 740 }
741 741
742 int SkDeferredCanvas::save(SaveFlags flags) { 742 void SkDeferredCanvas::onSave(SaveFlags flags) {
743 this->drawingCanvas()->save(flags); 743 this->drawingCanvas()->save(flags);
744 int val = this->INHERITED::save(flags);
745 this->recordedDrawCommand(); 744 this->recordedDrawCommand();
746 745 this->INHERITED::onSave(flags);
747 return val;
748 } 746 }
749 747
750 int SkDeferredCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 748 bool SkDeferredCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
751 SaveFlags flags) { 749 SaveFlags flags) {
752 this->drawingCanvas()->saveLayer(bounds, paint, flags); 750 this->drawingCanvas()->saveLayer(bounds, paint, flags);
753 int count = this->INHERITED::save(flags);
754 this->clipRectBounds(bounds, flags, NULL);
755 this->recordedDrawCommand(); 751 this->recordedDrawCommand();
756 752 this->INHERITED::onSaveLayer(bounds, paint, flags);
757 return count; 753 // No need for a full layer.
754 return false;
758 } 755 }
759 756
760 void SkDeferredCanvas::restore() { 757 void SkDeferredCanvas::onRestore() {
761 this->drawingCanvas()->restore(); 758 this->drawingCanvas()->restore();
762 this->INHERITED::restore();
763 this->recordedDrawCommand(); 759 this->recordedDrawCommand();
760 this->INHERITED::onRestore();
764 } 761 }
765 762
766 bool SkDeferredCanvas::isDrawingToLayer() const { 763 bool SkDeferredCanvas::isDrawingToLayer() const {
767 return this->drawingCanvas()->isDrawingToLayer(); 764 return this->drawingCanvas()->isDrawingToLayer();
768 } 765 }
769 766
770 bool SkDeferredCanvas::translate(SkScalar dx, SkScalar dy) { 767 bool SkDeferredCanvas::translate(SkScalar dx, SkScalar dy) {
771 this->drawingCanvas()->translate(dx, dy); 768 this->drawingCanvas()->translate(dx, dy);
772 bool val = this->INHERITED::translate(dx, dy); 769 bool val = this->INHERITED::translate(dx, dy);
773 this->recordedDrawCommand(); 770 this->recordedDrawCommand();
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 1032 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
1036 this->drawingCanvas()->setDrawFilter(filter); 1033 this->drawingCanvas()->setDrawFilter(filter);
1037 this->INHERITED::setDrawFilter(filter); 1034 this->INHERITED::setDrawFilter(filter);
1038 this->recordedDrawCommand(); 1035 this->recordedDrawCommand();
1039 return filter; 1036 return filter;
1040 } 1037 }
1041 1038
1042 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 1039 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
1043 return this->drawingCanvas(); 1040 return this->drawingCanvas();
1044 } 1041 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | src/utils/SkDumpCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698