OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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, "
"); |
OLD | NEW |