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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void drawPath(const SkDraw&, const SkPath& path, | 212 void drawPath(const SkDraw&, const SkPath& path, |
213 const SkPaint& paint, | 213 const SkPaint& paint, |
214 const SkMatrix* prePathMatrix = NULL, | 214 const SkMatrix* prePathMatrix = NULL, |
215 bool pathIsMutable = false) override | 215 bool pathIsMutable = false) override |
216 {SkASSERT(0);} | 216 {SkASSERT(0);} |
217 void drawBitmap(const SkDraw&, const SkBitmap& bitmap, | 217 void drawBitmap(const SkDraw&, const SkBitmap& bitmap, |
218 const SkMatrix& matrix, const SkPaint& paint) override | 218 const SkMatrix& matrix, const SkPaint& paint) override |
219 {SkASSERT(0);} | 219 {SkASSERT(0);} |
220 void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect*, | 220 void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect*, |
221 const SkRect&, const SkPaint&, | 221 const SkRect&, const SkPaint&, |
222 SkCanvas::DrawBitmapRectFlags) override | 222 SK_VIRTUAL_CONSTRAINT_TYPE) override |
223 {SkASSERT(0);} | 223 {SkASSERT(0);} |
224 void drawSprite(const SkDraw&, const SkBitmap& bitmap, | 224 void drawSprite(const SkDraw&, const SkBitmap& bitmap, |
225 int x, int y, const SkPaint& paint) override | 225 int x, int y, const SkPaint& paint) override |
226 {SkASSERT(0);} | 226 {SkASSERT(0);} |
227 void drawImage(const SkDraw&, const SkImage*, SkScalar, SkScalar, const SkPa
int&) override | 227 void drawImage(const SkDraw&, const SkImage*, SkScalar, SkScalar, const SkPa
int&) override |
228 {SkASSERT(0);} | 228 {SkASSERT(0);} |
229 void drawImageRect(const SkDraw&, const SkImage*, const SkRect*, const SkRec
t&, | 229 void drawImageRect(const SkDraw&, const SkImage*, const SkRect*, const SkRec
t&, |
230 const SkPaint&) override | 230 const SkPaint&, SkCanvas::SrcRectConstraint) override |
231 {SkASSERT(0);} | 231 {SkASSERT(0);} |
232 void drawImageNine(const SkDraw&, const SkImage*, const SkIRect&, const SkRe
ct&, | 232 void drawImageNine(const SkDraw&, const SkImage*, const SkIRect&, const SkRe
ct&, |
233 const SkPaint&) override | 233 const SkPaint&) override |
234 {SkASSERT(0);} | 234 {SkASSERT(0);} |
235 void drawText(const SkDraw&, const void* text, size_t len, | 235 void drawText(const SkDraw&, const void* text, size_t len, |
236 SkScalar x, SkScalar y, const SkPaint& paint) override | 236 SkScalar x, SkScalar y, const SkPaint& paint) override |
237 {SkASSERT(0);} | 237 {SkASSERT(0);} |
238 void drawPosText(const SkDraw&, const void* text, size_t len, | 238 void drawPosText(const SkDraw&, const void* text, size_t len, |
239 const SkScalar pos[], int scalarsPerPos, | 239 const SkScalar pos[], int scalarsPerPos, |
240 const SkPoint& offset, const SkPaint& paint) override | 240 const SkPoint& offset, const SkPaint& paint) override |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 isPaintOpaque(paint, &bitmap)) { | 858 isPaintOpaque(paint, &bitmap)) { |
859 this->getDeferredDevice()->skipPendingCommands(); | 859 this->getDeferredDevice()->skipPendingCommands(); |
860 } | 860 } |
861 | 861 |
862 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); | 862 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); |
863 this->drawingCanvas()->drawBitmap(bitmap, left, top, paint); | 863 this->drawingCanvas()->drawBitmap(bitmap, left, top, paint); |
864 this->recordedDrawCommand(); | 864 this->recordedDrawCommand(); |
865 } | 865 } |
866 | 866 |
867 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr
c, | 867 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr
c, |
868 const SkRect& dst, | 868 const SkRect& dst, const SkPaint* paint, |
869 const SkPaint* paint, DrawBitmapRectFlag
s flags) { | 869 SK_VIRTUAL_CONSTRAINT_TYPE constraint) { |
870 if (fDeferredDrawing && | 870 if (fDeferredDrawing && |
871 this->isFullFrame(&dst, paint) && | 871 this->isFullFrame(&dst, paint) && |
872 isPaintOpaque(paint, &bitmap)) { | 872 isPaintOpaque(paint, &bitmap)) { |
873 this->getDeferredDevice()->skipPendingCommands(); | 873 this->getDeferredDevice()->skipPendingCommands(); |
874 } | 874 } |
875 | 875 |
876 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); | 876 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); |
877 this->drawingCanvas()->drawBitmapRectToRect(bitmap, src, dst, paint, flags); | 877 this->drawingCanvas()->drawBitmapRect(bitmap, src, dst, paint, (SrcRectConst
raint)constraint); |
878 this->recordedDrawCommand(); | 878 this->recordedDrawCommand(); |
879 } | 879 } |
880 | 880 |
881 | 881 |
882 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, | 882 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, |
883 const SkPaint* paint) { | 883 const SkPaint* paint) { |
884 SkRect bounds = SkRect::MakeXYWH(x, y, | 884 SkRect bounds = SkRect::MakeXYWH(x, y, |
885 SkIntToScalar(image->width()), SkIntToScala
r(image->height())); | 885 SkIntToScalar(image->width()), SkIntToScala
r(image->height())); |
886 if (fDeferredDrawing && | 886 if (fDeferredDrawing && |
887 this->isFullFrame(&bounds, paint) && | 887 this->isFullFrame(&bounds, paint) && |
888 isPaintOpaque(paint, image)) { | 888 isPaintOpaque(paint, image)) { |
889 this->getDeferredDevice()->skipPendingCommands(); | 889 this->getDeferredDevice()->skipPendingCommands(); |
890 } | 890 } |
891 | 891 |
892 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); | 892 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); |
893 this->drawingCanvas()->drawImage(image, x, y, paint); | 893 this->drawingCanvas()->drawImage(image, x, y, paint); |
894 this->recordedDrawCommand(); | 894 this->recordedDrawCommand(); |
895 } | 895 } |
896 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src,
const SkRect& dst, | 896 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src,
const SkRect& dst, |
897 const SkPaint* paint) { | 897 const SkPaint* paint SRC_RECT_CONSTRAINT_
PARAM(constraint)) { |
898 if (fDeferredDrawing && | 898 if (fDeferredDrawing && |
899 this->isFullFrame(&dst, paint) && | 899 this->isFullFrame(&dst, paint) && |
900 isPaintOpaque(paint, image)) { | 900 isPaintOpaque(paint, image)) { |
901 this->getDeferredDevice()->skipPendingCommands(); | 901 this->getDeferredDevice()->skipPendingCommands(); |
902 } | 902 } |
903 | 903 |
904 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); | 904 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); |
905 this->drawingCanvas()->drawImageRect(image, src, dst, paint); | 905 this->drawingCanvas()->drawImageRect(image, src, dst, paint |
| 906 SRC_RECT_CONSTRAINT_ARG(constraint)); |
906 this->recordedDrawCommand(); | 907 this->recordedDrawCommand(); |
907 } | 908 } |
908 | 909 |
909 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent
er, | 910 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent
er, |
910 const SkRect& dst, const SkPaint* paint)
{ | 911 const SkRect& dst, const SkPaint* paint)
{ |
911 if (fDeferredDrawing && | 912 if (fDeferredDrawing && |
912 this->isFullFrame(&dst, paint) && | 913 this->isFullFrame(&dst, paint) && |
913 isPaintOpaque(paint, image)) { | 914 isPaintOpaque(paint, image)) { |
914 this->getDeferredDevice()->skipPendingCommands(); | 915 this->getDeferredDevice()->skipPendingCommands(); |
915 } | 916 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 1021 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
1021 this->drawingCanvas()->setDrawFilter(filter); | 1022 this->drawingCanvas()->setDrawFilter(filter); |
1022 this->INHERITED::setDrawFilter(filter); | 1023 this->INHERITED::setDrawFilter(filter); |
1023 this->recordedDrawCommand(); | 1024 this->recordedDrawCommand(); |
1024 return filter; | 1025 return filter; |
1025 } | 1026 } |
1026 | 1027 |
1027 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 1028 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
1028 return this->drawingCanvas(); | 1029 return this->drawingCanvas(); |
1029 } | 1030 } |
OLD | NEW |