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

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

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: propogate Constraint into SkDevice Created 5 years, 5 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
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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkCanvas::SrcRectConstraint) 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698