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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void SkDeferredCanvas::onSave(SaveFlags flags) { | 742 int SkDeferredCanvas::save(SaveFlags flags) { |
743 this->drawingCanvas()->save(flags); | 743 this->drawingCanvas()->save(flags); |
| 744 int val = this->INHERITED::save(flags); |
744 this->recordedDrawCommand(); | 745 this->recordedDrawCommand(); |
745 this->INHERITED::onSave(flags); | 746 |
| 747 return val; |
746 } | 748 } |
747 | 749 |
748 bool SkDeferredCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint, | 750 int SkDeferredCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, |
749 SaveFlags flags) { | 751 SaveFlags flags) { |
750 this->drawingCanvas()->saveLayer(bounds, paint, flags); | 752 this->drawingCanvas()->saveLayer(bounds, paint, flags); |
| 753 int count = this->INHERITED::save(flags); |
| 754 this->clipRectBounds(bounds, flags, NULL); |
751 this->recordedDrawCommand(); | 755 this->recordedDrawCommand(); |
752 this->INHERITED::onSaveLayer(bounds, paint, flags); | 756 |
753 // No need for a full layer. | 757 return count; |
754 return false; | |
755 } | 758 } |
756 | 759 |
757 void SkDeferredCanvas::onRestore() { | 760 void SkDeferredCanvas::restore() { |
758 this->drawingCanvas()->restore(); | 761 this->drawingCanvas()->restore(); |
| 762 this->INHERITED::restore(); |
759 this->recordedDrawCommand(); | 763 this->recordedDrawCommand(); |
760 this->INHERITED::onRestore(); | |
761 } | 764 } |
762 | 765 |
763 bool SkDeferredCanvas::isDrawingToLayer() const { | 766 bool SkDeferredCanvas::isDrawingToLayer() const { |
764 return this->drawingCanvas()->isDrawingToLayer(); | 767 return this->drawingCanvas()->isDrawingToLayer(); |
765 } | 768 } |
766 | 769 |
767 bool SkDeferredCanvas::translate(SkScalar dx, SkScalar dy) { | 770 bool SkDeferredCanvas::translate(SkScalar dx, SkScalar dy) { |
768 this->drawingCanvas()->translate(dx, dy); | 771 this->drawingCanvas()->translate(dx, dy); |
769 bool val = this->INHERITED::translate(dx, dy); | 772 bool val = this->INHERITED::translate(dx, dy); |
770 this->recordedDrawCommand(); | 773 this->recordedDrawCommand(); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 1035 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
1033 this->drawingCanvas()->setDrawFilter(filter); | 1036 this->drawingCanvas()->setDrawFilter(filter); |
1034 this->INHERITED::setDrawFilter(filter); | 1037 this->INHERITED::setDrawFilter(filter); |
1035 this->recordedDrawCommand(); | 1038 this->recordedDrawCommand(); |
1036 return filter; | 1039 return filter; |
1037 } | 1040 } |
1038 | 1041 |
1039 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 1042 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
1040 return this->drawingCanvas(); | 1043 return this->drawingCanvas(); |
1041 } | 1044 } |
OLD | NEW |