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

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

Issue 1211583003: add drawImageNine (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #9 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
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | no next file » | 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 SkCanvas::DrawBitmapRectFlags) override 222 SkCanvas::DrawBitmapRectFlags) 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&) override
231 {SkASSERT(0);} 231 {SkASSERT(0);}
232 void drawImageNine(const SkDraw&, const SkImage*, const SkIRect&, const SkRe ct&,
233 const SkPaint&) override
234 {SkASSERT(0);}
232 void drawText(const SkDraw&, const void* text, size_t len, 235 void drawText(const SkDraw&, const void* text, size_t len,
233 SkScalar x, SkScalar y, const SkPaint& paint) override 236 SkScalar x, SkScalar y, const SkPaint& paint) override
234 {SkASSERT(0);} 237 {SkASSERT(0);}
235 void drawPosText(const SkDraw&, const void* text, size_t len, 238 void drawPosText(const SkDraw&, const void* text, size_t len,
236 const SkScalar pos[], int scalarsPerPos, 239 const SkScalar pos[], int scalarsPerPos,
237 const SkPoint& offset, const SkPaint& paint) override 240 const SkPoint& offset, const SkPaint& paint) override
238 {SkASSERT(0);} 241 {SkASSERT(0);}
239 void drawTextOnPath(const SkDraw&, const void* text, 242 void drawTextOnPath(const SkDraw&, const void* text,
240 size_t len, const SkPath& path, 243 size_t len, const SkPath& path,
241 const SkMatrix* matrix, 244 const SkMatrix* matrix,
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 this->isFullFrame(&dst, paint) && 899 this->isFullFrame(&dst, paint) &&
897 isPaintOpaque(paint, image)) { 900 isPaintOpaque(paint, image)) {
898 this->getDeferredDevice()->skipPendingCommands(); 901 this->getDeferredDevice()->skipPendingCommands();
899 } 902 }
900 903
901 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint); 904 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
902 this->drawingCanvas()->drawImageRect(image, src, dst, paint); 905 this->drawingCanvas()->drawImageRect(image, src, dst, paint);
903 this->recordedDrawCommand(); 906 this->recordedDrawCommand();
904 } 907 }
905 908
909 void SkDeferredCanvas::onDrawImageNine(const SkImage* image, const SkIRect& cent er,
910 const SkRect& dst, const SkPaint* paint) {
911 if (fDeferredDrawing &&
912 this->isFullFrame(&dst, paint) &&
913 isPaintOpaque(paint, image)) {
914 this->getDeferredDevice()->skipPendingCommands();
915 }
916
917 AutoImmediateDrawIfNeeded autoDraw(*this, image, paint);
918 this->drawingCanvas()->drawImageNine(image, center, dst, paint);
919 this->recordedDrawCommand();
920 }
921
906 void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap, 922 void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap,
907 const SkIRect& center, const SkRect& dst , 923 const SkIRect& center, const SkRect& dst ,
908 const SkPaint* paint) { 924 const SkPaint* paint) {
909 // TODO: reset recording canvas if paint+bitmap is opaque and clip rect 925 // TODO: reset recording canvas if paint+bitmap is opaque and clip rect
910 // covers canvas entirely and dst covers canvas entirely 926 // covers canvas entirely and dst covers canvas entirely
911 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); 927 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint);
912 this->drawingCanvas()->drawBitmapNine(bitmap, center, dst, paint); 928 this->drawingCanvas()->drawBitmapNine(bitmap, center, dst, paint);
913 this->recordedDrawCommand(); 929 this->recordedDrawCommand();
914 } 930 }
915 931
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 1020 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
1005 this->drawingCanvas()->setDrawFilter(filter); 1021 this->drawingCanvas()->setDrawFilter(filter);
1006 this->INHERITED::setDrawFilter(filter); 1022 this->INHERITED::setDrawFilter(filter);
1007 this->recordedDrawCommand(); 1023 this->recordedDrawCommand();
1008 return filter; 1024 return filter;
1009 } 1025 }
1010 1026
1011 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 1027 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
1012 return this->drawingCanvas(); 1028 return this->drawingCanvas();
1013 } 1029 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698