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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr
c, | 865 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr
c, |
866 const SkRect& dst, const SkPaint* paint, | 866 const SkRect& dst, const SkPaint* paint, |
867 SrcRectConstraint constraint) { | 867 SrcRectConstraint constraint) { |
868 if (fDeferredDrawing && | 868 if (fDeferredDrawing && |
869 this->isFullFrame(&dst, paint) && | 869 this->isFullFrame(&dst, paint) && |
870 SkPaintPriv::Overwrites(bitmap, paint)) { | 870 SkPaintPriv::Overwrites(bitmap, paint)) { |
871 this->getDeferredDevice()->skipPendingCommands(); | 871 this->getDeferredDevice()->skipPendingCommands(); |
872 } | 872 } |
873 | 873 |
874 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); | 874 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); |
875 this->drawingCanvas()->drawBitmapRect(bitmap, src, dst, paint, (SrcRectConst
raint)constraint); | 875 this->drawingCanvas()->legacy_drawBitmapRect(bitmap, src, dst, paint, (SrcRe
ctConstraint)constraint); |
876 this->recordedDrawCommand(); | 876 this->recordedDrawCommand(); |
877 } | 877 } |
878 | 878 |
879 | 879 |
880 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, | 880 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, |
881 const SkPaint* paint) { | 881 const SkPaint* paint) { |
882 SkRect bounds = SkRect::MakeXYWH(x, y, | 882 SkRect bounds = SkRect::MakeXYWH(x, y, |
883 SkIntToScalar(image->width()), SkIntToScala
r(image->height())); | 883 SkIntToScalar(image->width()), SkIntToScala
r(image->height())); |
884 if (fDeferredDrawing && | 884 if (fDeferredDrawing && |
885 this->isFullFrame(&bounds, paint) && | 885 this->isFullFrame(&bounds, paint) && |
886 SkPaintPriv::Overwrites(image, paint)) { | 886 SkPaintPriv::Overwrites(image, paint)) { |
887 this->getDeferredDevice()->skipPendingCommands(); | 887 this->getDeferredDevice()->skipPendingCommands(); |
888 } | 888 } |
889 | 889 |
890 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); | 890 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); |
891 this->drawingCanvas()->drawImage(image, x, y, paint); | 891 this->drawingCanvas()->drawImage(image, x, y, paint); |
892 this->recordedDrawCommand(); | 892 this->recordedDrawCommand(); |
893 } | 893 } |
894 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src,
const SkRect& dst, | 894 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src,
const SkRect& dst, |
895 const SkPaint* paint, SrcRectConstraint c
onstraint) { | 895 const SkPaint* paint, SrcRectConstraint c
onstraint) { |
896 if (fDeferredDrawing && | 896 if (fDeferredDrawing && |
897 this->isFullFrame(&dst, paint) && | 897 this->isFullFrame(&dst, paint) && |
898 SkPaintPriv::Overwrites(image, paint)) { | 898 SkPaintPriv::Overwrites(image, paint)) { |
899 this->getDeferredDevice()->skipPendingCommands(); | 899 this->getDeferredDevice()->skipPendingCommands(); |
900 } | 900 } |
901 | 901 |
902 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); | 902 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); |
903 this->drawingCanvas()->drawImageRect(image, src, dst, paint, constraint); | 903 this->drawingCanvas()->legacy_drawImageRect(image, src, dst, paint, constrai
nt); |
904 this->recordedDrawCommand(); | 904 this->recordedDrawCommand(); |
905 } | 905 } |
906 | 906 |
907 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent
er, | 907 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent
er, |
908 const SkRect& dst, const SkPaint* paint)
{ | 908 const SkRect& dst, const SkPaint* paint)
{ |
909 if (fDeferredDrawing && | 909 if (fDeferredDrawing && |
910 this->isFullFrame(&dst, paint) && | 910 this->isFullFrame(&dst, paint) && |
911 SkPaintPriv::Overwrites(image, paint)) { | 911 SkPaintPriv::Overwrites(image, paint)) { |
912 this->getDeferredDevice()->skipPendingCommands(); | 912 this->getDeferredDevice()->skipPendingCommands(); |
913 } | 913 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 1018 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
1019 this->drawingCanvas()->setDrawFilter(filter); | 1019 this->drawingCanvas()->setDrawFilter(filter); |
1020 this->INHERITED::setDrawFilter(filter); | 1020 this->INHERITED::setDrawFilter(filter); |
1021 this->recordedDrawCommand(); | 1021 this->recordedDrawCommand(); |
1022 return filter; | 1022 return filter; |
1023 } | 1023 } |
1024 | 1024 |
1025 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 1025 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
1026 return this->drawingCanvas(); | 1026 return this->drawingCanvas(); |
1027 } | 1027 } |
OLD | NEW |