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 int SkDeferredCanvas::save(SaveFlags flags) { | 742 void SkDeferredCanvas::willSave(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::willSave(flags); |
747 return val; | |
748 } | 746 } |
749 | 747 |
750 int SkDeferredCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, | 748 SkCanvas::SaveLayerStrategy SkDeferredCanvas::willSaveLayer(const SkRect* bounds
, |
751 SaveFlags flags) { | 749 const SkPaint* paint
, 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::willSaveLayer(bounds, paint, flags); |
757 return count; | 753 // No need for a full layer. |
| 754 return kNoLayer_SaveLayerStrategy; |
758 } | 755 } |
759 | 756 |
760 void SkDeferredCanvas::restore() { | 757 void SkDeferredCanvas::willRestore() { |
761 this->drawingCanvas()->restore(); | 758 this->drawingCanvas()->restore(); |
762 this->INHERITED::restore(); | |
763 this->recordedDrawCommand(); | 759 this->recordedDrawCommand(); |
| 760 this->INHERITED::willRestore(); |
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 Loading... |
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 } |
OLD | NEW |