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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 constraint); | 1979 constraint); |
1980 } | 1980 } |
1981 | 1981 |
1982 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst, | 1982 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst, |
1983 const SkPaint* paint) { | 1983 const SkPaint* paint) { |
1984 RETURN_ON_NULL(image); | 1984 RETURN_ON_NULL(image); |
1985 if (dst.isEmpty()) { | 1985 if (dst.isEmpty()) { |
1986 return; | 1986 return; |
1987 } | 1987 } |
1988 if (!SkLatticeIter::Valid(image->width(), image->height(), center)) { | 1988 if (!SkLatticeIter::Valid(image->width(), image->height(), center)) { |
1989 this->drawImageRect(image, dst, paint); | 1989 return this->drawImageRect(image, dst, paint); |
msarett
2016/08/02 21:47:48
I think this is a bug?
reed1
2016/08/03 13:13:05
return void is odd. How about
if (Valid) {
th
msarett
2016/08/03 13:20:52
Done.
| |
1990 } | 1990 } |
1991 this->onDrawImageNine(image, center, dst, paint); | 1991 this->onDrawImageNine(image, center, dst, paint); |
1992 } | 1992 } |
1993 | 1993 |
1994 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons t SkPaint* paint) { | 1994 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons t SkPaint* paint) { |
1995 if (bitmap.drawsNothing()) { | 1995 if (bitmap.drawsNothing()) { |
1996 return; | 1996 return; |
1997 } | 1997 } |
1998 this->onDrawBitmap(bitmap, dx, dy, paint); | 1998 this->onDrawBitmap(bitmap, dx, dy, paint); |
1999 } | 1999 } |
(...skipping 16 matching lines...) Expand all Loading... | |
2016 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height() ), dst, paint, | 2016 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height() ), dst, paint, |
2017 constraint); | 2017 constraint); |
2018 } | 2018 } |
2019 | 2019 |
2020 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con st SkRect& dst, | 2020 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con st SkRect& dst, |
2021 const SkPaint* paint) { | 2021 const SkPaint* paint) { |
2022 if (bitmap.drawsNothing() || dst.isEmpty()) { | 2022 if (bitmap.drawsNothing() || dst.isEmpty()) { |
2023 return; | 2023 return; |
2024 } | 2024 } |
2025 if (!SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) { | 2025 if (!SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) { |
2026 this->drawBitmapRect(bitmap, dst, paint); | 2026 return this->drawBitmapRect(bitmap, dst, paint); |
msarett
2016/08/02 21:47:48
Ditto
reed1
2016/08/03 13:13:05
ditto
msarett
2016/08/03 13:20:52
Done.
| |
2027 } | 2027 } |
2028 this->onDrawBitmapNine(bitmap, center, dst, paint); | 2028 this->onDrawBitmapNine(bitmap, center, dst, paint); |
2029 } | 2029 } |
2030 | 2030 |
2031 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst, | 2031 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst, |
2032 const SkPaint* paint) { | 2032 const SkPaint* paint) { |
2033 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); | 2033 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); |
2034 this->drawImageLattice(image.get(), lattice, dst, paint); | 2034 this->drawImageLattice(image.get(), lattice, dst, paint); |
2035 } | 2035 } |
2036 | 2036 |
2037 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co nst SkRect& dst, | 2037 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co nst SkRect& dst, |
2038 const SkPaint* paint) { | 2038 const SkPaint* paint) { |
2039 RETURN_ON_NULL(image); | 2039 RETURN_ON_NULL(image); |
2040 if (dst.isEmpty()) { | 2040 if (dst.isEmpty()) { |
2041 return; | 2041 return; |
2042 } | 2042 } |
2043 if (!SkLatticeIter::Valid(image->width(), image->height(), lattice)) { | 2043 if (!SkLatticeIter::Valid(image->width(), image->height(), lattice)) { |
2044 this->drawImageRect(image, dst, paint); | 2044 return this->drawImageRect(image, dst, paint); |
msarett
2016/08/02 21:47:48
Pretty sure this is a bug, since I wrote it...
msarett
2016/08/03 13:20:52
Done.
| |
2045 } | 2045 } |
2046 this->onDrawImageLattice(image, lattice, dst, paint); | 2046 this->onDrawImageLattice(image, lattice, dst, paint); |
2047 } | 2047 } |
2048 | 2048 |
2049 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk Rect tex[], | 2049 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk Rect tex[], |
2050 const SkColor colors[], int count, SkXfermode::Mode mod e, | 2050 const SkColor colors[], int count, SkXfermode::Mode mod e, |
2051 const SkRect* cull, const SkPaint* paint) { | 2051 const SkRect* cull, const SkPaint* paint) { |
2052 RETURN_ON_NULL(atlas); | 2052 RETURN_ON_NULL(atlas); |
2053 if (count <= 0) { | 2053 if (count <= 0) { |
2054 return; | 2054 return; |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3164 | 3164 |
3165 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3165 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3166 fCanvas->restoreToCount(fSaveCount); | 3166 fCanvas->restoreToCount(fSaveCount); |
3167 } | 3167 } |
3168 | 3168 |
3169 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3169 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3170 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { | 3170 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { |
3171 return this->makeSurface(info, props).release(); | 3171 return this->makeSurface(info, props).release(); |
3172 } | 3172 } |
3173 #endif | 3173 #endif |
OLD | NEW |