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

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

Issue 1239193002: remove all guards for changes to drawBitmapRect / drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 4 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
« no previous file with comments | « src/svg/SkSVGDevice.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 {SkASSERT(0);} 211 {SkASSERT(0);}
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&, SkCanvas::SrcRectConstrai nt) override
222 SK_VIRTUAL_CONSTRAINT_TYPE) override
223 {SkASSERT(0);} 222 {SkASSERT(0);}
224 void drawSprite(const SkDraw&, const SkBitmap& bitmap, 223 void drawSprite(const SkDraw&, const SkBitmap& bitmap,
225 int x, int y, const SkPaint& paint) override 224 int x, int y, const SkPaint& paint) override
226 {SkASSERT(0);} 225 {SkASSERT(0);}
227 void drawImage(const SkDraw&, const SkImage*, SkScalar, SkScalar, const SkPa int&) override 226 void drawImage(const SkDraw&, const SkImage*, SkScalar, SkScalar, const SkPa int&) override
228 {SkASSERT(0);} 227 {SkASSERT(0);}
229 void drawImageRect(const SkDraw&, const SkImage*, const SkRect*, const SkRec t&, 228 void drawImageRect(const SkDraw&, const SkImage*, const SkRect*, const SkRec t&,
230 const SkPaint&, SkCanvas::SrcRectConstraint) override 229 const SkPaint&, SkCanvas::SrcRectConstraint) override
231 {SkASSERT(0);} 230 {SkASSERT(0);}
232 void drawImageNine(const SkDraw&, const SkImage*, const SkIRect&, const SkRe ct&, 231 void drawImageNine(const SkDraw&, const SkImage*, const SkIRect&, const SkRe ct&,
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 this->getDeferredDevice()->skipPendingCommands(); 856 this->getDeferredDevice()->skipPendingCommands();
858 } 857 }
859 858
860 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); 859 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint);
861 this->drawingCanvas()->drawBitmap(bitmap, left, top, paint); 860 this->drawingCanvas()->drawBitmap(bitmap, left, top, paint);
862 this->recordedDrawCommand(); 861 this->recordedDrawCommand();
863 } 862 }
864 863
865 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr c, 864 void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr c,
866 const SkRect& dst, const SkPaint* paint, 865 const SkRect& dst, const SkPaint* paint,
867 SK_VIRTUAL_CONSTRAINT_TYPE constraint) { 866 SrcRectConstraint constraint) {
868 if (fDeferredDrawing && 867 if (fDeferredDrawing &&
869 this->isFullFrame(&dst, paint) && 868 this->isFullFrame(&dst, paint) &&
870 SkPaintPriv::Overwrites(bitmap, paint)) { 869 SkPaintPriv::Overwrites(bitmap, paint)) {
871 this->getDeferredDevice()->skipPendingCommands(); 870 this->getDeferredDevice()->skipPendingCommands();
872 } 871 }
873 872
874 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); 873 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint);
875 this->drawingCanvas()->drawBitmapRect(bitmap, src, dst, paint, (SrcRectConst raint)constraint); 874 this->drawingCanvas()->drawBitmapRect(bitmap, src, dst, paint, (SrcRectConst raint)constraint);
876 this->recordedDrawCommand(); 875 this->recordedDrawCommand();
877 } 876 }
878 877
879 878
880 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, 879 void SkDeferredCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
881 const SkPaint* paint) { 880 const SkPaint* paint) {
882 SkRect bounds = SkRect::MakeXYWH(x, y, 881 SkRect bounds = SkRect::MakeXYWH(x, y,
883 SkIntToScalar(image->width()), SkIntToScala r(image->height())); 882 SkIntToScalar(image->width()), SkIntToScala r(image->height()));
884 if (fDeferredDrawing && 883 if (fDeferredDrawing &&
885 this->isFullFrame(&bounds, paint) && 884 this->isFullFrame(&bounds, paint) &&
886 SkPaintPriv::Overwrites(image, paint)) { 885 SkPaintPriv::Overwrites(image, paint)) {
887 this->getDeferredDevice()->skipPendingCommands(); 886 this->getDeferredDevice()->skipPendingCommands();
888 } 887 }
889 888
890 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); 889 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
891 this->drawingCanvas()->drawImage(image, x, y, paint); 890 this->drawingCanvas()->drawImage(image, x, y, paint);
892 this->recordedDrawCommand(); 891 this->recordedDrawCommand();
893 } 892 }
894 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, 893 void SkDeferredCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
895 const SkPaint* paint SRC_RECT_CONSTRAINT_ PARAM(constraint)) { 894 const SkPaint* paint, SrcRectConstraint c onstraint) {
896 if (fDeferredDrawing && 895 if (fDeferredDrawing &&
897 this->isFullFrame(&dst, paint) && 896 this->isFullFrame(&dst, paint) &&
898 SkPaintPriv::Overwrites(image, paint)) { 897 SkPaintPriv::Overwrites(image, paint)) {
899 this->getDeferredDevice()->skipPendingCommands(); 898 this->getDeferredDevice()->skipPendingCommands();
900 } 899 }
901 900
902 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); 901 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
903 this->drawingCanvas()->drawImageRect(image, src, dst, paint 902 this->drawingCanvas()->drawImageRect(image, src, dst, paint, constraint);
904 SRC_RECT_CONSTRAINT_ARG(constraint));
905 this->recordedDrawCommand(); 903 this->recordedDrawCommand();
906 } 904 }
907 905
908 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent er, 906 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent er,
909 const SkRect& dst, const SkPaint* paint) { 907 const SkRect& dst, const SkPaint* paint) {
910 if (fDeferredDrawing && 908 if (fDeferredDrawing &&
911 this->isFullFrame(&dst, paint) && 909 this->isFullFrame(&dst, paint) &&
912 SkPaintPriv::Overwrites(image, paint)) { 910 SkPaintPriv::Overwrites(image, paint)) {
913 this->getDeferredDevice()->skipPendingCommands(); 911 this->getDeferredDevice()->skipPendingCommands();
914 } 912 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 1017 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
1020 this->drawingCanvas()->setDrawFilter(filter); 1018 this->drawingCanvas()->setDrawFilter(filter);
1021 this->INHERITED::setDrawFilter(filter); 1019 this->INHERITED::setDrawFilter(filter);
1022 this->recordedDrawCommand(); 1020 this->recordedDrawCommand();
1023 return filter; 1021 return filter;
1024 } 1022 }
1025 1023
1026 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 1024 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
1027 return this->drawingCanvas(); 1025 return this->drawingCanvas();
1028 } 1026 }
OLDNEW
« no previous file with comments | « src/svg/SkSVGDevice.cpp ('k') | src/utils/SkDumpCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698