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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()),
dst, paint, | 1978 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()),
dst, paint, |
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->onDrawImageNine(image, center, dst, paint); |
| 1990 } else { |
1989 this->drawImageRect(image, dst, paint); | 1991 this->drawImageRect(image, dst, paint); |
1990 } | 1992 } |
1991 this->onDrawImageNine(image, center, dst, paint); | |
1992 } | 1993 } |
1993 | 1994 |
1994 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { | 1995 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { |
1995 if (bitmap.drawsNothing()) { | 1996 if (bitmap.drawsNothing()) { |
1996 return; | 1997 return; |
1997 } | 1998 } |
1998 this->onDrawBitmap(bitmap, dx, dy, paint); | 1999 this->onDrawBitmap(bitmap, dx, dy, paint); |
1999 } | 2000 } |
2000 | 2001 |
2001 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const S
kRect& dst, | 2002 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const S
kRect& dst, |
(...skipping 13 matching lines...) Expand all Loading... |
2015 SrcRectConstraint constraint) { | 2016 SrcRectConstraint constraint) { |
2016 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height()
), dst, paint, | 2017 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height()
), dst, paint, |
2017 constraint); | 2018 constraint); |
2018 } | 2019 } |
2019 | 2020 |
2020 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, | 2021 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, |
2021 const SkPaint* paint) { | 2022 const SkPaint* paint) { |
2022 if (bitmap.drawsNothing() || dst.isEmpty()) { | 2023 if (bitmap.drawsNothing() || dst.isEmpty()) { |
2023 return; | 2024 return; |
2024 } | 2025 } |
2025 if (!SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) { | 2026 if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) { |
| 2027 this->onDrawBitmapNine(bitmap, center, dst, paint); |
| 2028 } else { |
2026 this->drawBitmapRect(bitmap, dst, paint); | 2029 this->drawBitmapRect(bitmap, dst, paint); |
2027 } | 2030 } |
2028 this->onDrawBitmapNine(bitmap, center, dst, paint); | 2031 |
2029 } | 2032 } |
2030 | 2033 |
2031 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
const SkRect& dst, | 2034 void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
const SkRect& dst, |
2032 const SkPaint* paint) { | 2035 const SkPaint* paint) { |
2033 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); | 2036 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); |
2034 this->drawImageLattice(image.get(), lattice, dst, paint); | 2037 this->drawImageLattice(image.get(), lattice, dst, paint); |
2035 } | 2038 } |
2036 | 2039 |
2037 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co
nst SkRect& dst, | 2040 void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co
nst SkRect& dst, |
2038 const SkPaint* paint) { | 2041 const SkPaint* paint) { |
2039 RETURN_ON_NULL(image); | 2042 RETURN_ON_NULL(image); |
2040 if (dst.isEmpty()) { | 2043 if (dst.isEmpty()) { |
2041 return; | 2044 return; |
2042 } | 2045 } |
2043 if (!SkLatticeIter::Valid(image->width(), image->height(), lattice)) { | 2046 if (SkLatticeIter::Valid(image->width(), image->height(), lattice)) { |
| 2047 this->onDrawImageLattice(image, lattice, dst, paint); |
| 2048 } else { |
2044 this->drawImageRect(image, dst, paint); | 2049 this->drawImageRect(image, dst, paint); |
2045 } | 2050 } |
2046 this->onDrawImageLattice(image, lattice, dst, paint); | |
2047 } | 2051 } |
2048 | 2052 |
2049 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk
Rect tex[], | 2053 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk
Rect tex[], |
2050 const SkColor colors[], int count, SkXfermode::Mode mod
e, | 2054 const SkColor colors[], int count, SkXfermode::Mode mod
e, |
2051 const SkRect* cull, const SkPaint* paint) { | 2055 const SkRect* cull, const SkPaint* paint) { |
2052 RETURN_ON_NULL(atlas); | 2056 RETURN_ON_NULL(atlas); |
2053 if (count <= 0) { | 2057 if (count <= 0) { |
2054 return; | 2058 return; |
2055 } | 2059 } |
2056 SkASSERT(atlas); | 2060 SkASSERT(atlas); |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 | 3168 |
3165 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3169 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3166 fCanvas->restoreToCount(fSaveCount); | 3170 fCanvas->restoreToCount(fSaveCount); |
3167 } | 3171 } |
3168 | 3172 |
3169 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3173 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3170 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3174 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3171 return this->makeSurface(info, props).release(); | 3175 return this->makeSurface(info, props).release(); |
3172 } | 3176 } |
3173 #endif | 3177 #endif |
OLD | NEW |