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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 2382893002: Add a src rect to drawImageLattice() API (Closed)
Patch Set: Simplify impl Created 4 years, 2 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 | « include/private/SkRecords.h ('k') | src/core/SkDevice.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 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 this->drawImageRect(image, dst, paint); 2003 this->drawImageRect(image, dst, paint);
2004 } 2004 }
2005 } 2005 }
2006 2006
2007 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co nst SkRect& dst, 2007 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co nst SkRect& dst,
2008 const SkPaint* paint) { 2008 const SkPaint* paint) {
2009 RETURN_ON_NULL(image); 2009 RETURN_ON_NULL(image);
2010 if (dst.isEmpty()) { 2010 if (dst.isEmpty()) {
2011 return; 2011 return;
2012 } 2012 }
2013 if (SkLatticeIter::Valid(image->width(), image->height(), lattice)) { 2013
2014 this->onDrawImageLattice(image, lattice, dst, paint); 2014 SkIRect bounds;
2015 Lattice latticePlusBounds = lattice;
2016 if (!latticePlusBounds.fBounds) {
2017 bounds = SkIRect::MakeWH(image->width(), image->height());
2018 latticePlusBounds.fBounds = &bounds;
2019 }
2020
2021 if (SkLatticeIter::Valid(image->width(), image->height(), latticePlusBounds) ) {
2022 this->onDrawImageLattice(image, latticePlusBounds, dst, paint);
2015 } else { 2023 } else {
2016 this->drawImageRect(image, dst, paint); 2024 this->drawImageRect(image, dst, paint);
2017 } 2025 }
2018 } 2026 }
2019 2027
2020 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons t SkPaint* paint) { 2028 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons t SkPaint* paint) {
2021 if (bitmap.drawsNothing()) { 2029 if (bitmap.drawsNothing()) {
2022 return; 2030 return;
2023 } 2031 }
2024 this->onDrawBitmap(bitmap, dx, dy, paint); 2032 this->onDrawBitmap(bitmap, dx, dy, paint);
(...skipping 28 matching lines...) Expand all
2053 } else { 2061 } else {
2054 this->drawBitmapRect(bitmap, dst, paint); 2062 this->drawBitmapRect(bitmap, dst, paint);
2055 } 2063 }
2056 } 2064 }
2057 2065
2058 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst, 2066 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst,
2059 const SkPaint* paint) { 2067 const SkPaint* paint) {
2060 if (bitmap.drawsNothing() || dst.isEmpty()) { 2068 if (bitmap.drawsNothing() || dst.isEmpty()) {
2061 return; 2069 return;
2062 } 2070 }
2063 if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), lattice)) { 2071
2064 this->onDrawBitmapLattice(bitmap, lattice, dst, paint); 2072 SkIRect bounds;
2073 Lattice latticePlusBounds = lattice;
2074 if (!latticePlusBounds.fBounds) {
2075 bounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
2076 latticePlusBounds.fBounds = &bounds;
2077 }
2078
2079 if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), latticePlusBounds) ) {
2080 this->onDrawBitmapLattice(bitmap, latticePlusBounds, dst, paint);
2065 } else { 2081 } else {
2066 this->drawBitmapRect(bitmap, dst, paint); 2082 this->drawBitmapRect(bitmap, dst, paint);
2067 } 2083 }
2068 } 2084 }
2069 2085
2070 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk Rect tex[], 2086 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk Rect tex[],
2071 const SkColor colors[], int count, SkXfermode::Mode mod e, 2087 const SkColor colors[], int count, SkXfermode::Mode mod e,
2072 const SkRect* cull, const SkPaint* paint) { 2088 const SkRect* cull, const SkPaint* paint) {
2073 RETURN_ON_NULL(atlas); 2089 RETURN_ON_NULL(atlas);
2074 if (count <= 0) { 2090 if (count <= 0) {
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3456 const SkCanvas::ClipOp SkCanvas::kXOR_Op; 3472 const SkCanvas::ClipOp SkCanvas::kXOR_Op;
3457 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; 3473 const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op;
3458 const SkCanvas::ClipOp SkCanvas::kReplace_Op; 3474 const SkCanvas::ClipOp SkCanvas::kReplace_Op;
3459 3475
3460 static_assert((int)SkRegion::kDifference_Op == (int)kDifference_SkClipOp , ""); 3476 static_assert((int)SkRegion::kDifference_Op == (int)kDifference_SkClipOp , "");
3461 static_assert((int)SkRegion::kIntersect_Op == (int)kIntersect_SkClipOp, ""); 3477 static_assert((int)SkRegion::kIntersect_Op == (int)kIntersect_SkClipOp, "");
3462 static_assert((int)SkRegion::kUnion_Op == (int)kUnion_SkClipOp, "") ; 3478 static_assert((int)SkRegion::kUnion_Op == (int)kUnion_SkClipOp, "") ;
3463 static_assert((int)SkRegion::kXOR_Op == (int)kXOR_SkClipOp, ""); 3479 static_assert((int)SkRegion::kXOR_Op == (int)kXOR_SkClipOp, "");
3464 static_assert((int)SkRegion::kReverseDifference_Op == (int)kReverseDifference_S kClipOp, ""); 3480 static_assert((int)SkRegion::kReverseDifference_Op == (int)kReverseDifference_S kClipOp, "");
3465 static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, " "); 3481 static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, " ");
OLDNEW
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698