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 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 | 2258 |
2259 LOOPER_BEGIN_DRAWBITMAP(*paint, drawAsSprite, &bounds) | 2259 LOOPER_BEGIN_DRAWBITMAP(*paint, drawAsSprite, &bounds) |
2260 | 2260 |
2261 while (iter.next()) { | 2261 while (iter.next()) { |
2262 const SkPaint& pnt = looper.paint(); | 2262 const SkPaint& pnt = looper.paint(); |
2263 if (drawAsSprite && pnt.getImageFilter()) { | 2263 if (drawAsSprite && pnt.getImageFilter()) { |
2264 SkBitmap bitmap; | 2264 SkBitmap bitmap; |
2265 if (as_IB(image)->asBitmapForImageFilters(&bitmap)) { | 2265 if (as_IB(image)->asBitmapForImageFilters(&bitmap)) { |
2266 SkPoint pt; | 2266 SkPoint pt; |
2267 iter.fMatrix->mapXY(x, y, &pt); | 2267 iter.fMatrix->mapXY(x, y, &pt); |
2268 iter.fDevice->drawBitmapAsSpriteWithImageFilter(iter, bitmap, | 2268 iter.fDevice->drawBitmapAsSprite(iter, bitmap, |
2269 SkScalarRoundToI
nt(pt.fX), | 2269 SkScalarRoundToInt(pt.fX), |
2270 SkScalarRoundToI
nt(pt.fY), pnt); | 2270 SkScalarRoundToInt(pt.fY), pnt)
; |
2271 } | 2271 } |
2272 } else { | 2272 } else { |
2273 iter.fDevice->drawImage(iter, image, x, y, pnt); | 2273 iter.fDevice->drawImage(iter, image, x, y, pnt); |
2274 } | 2274 } |
2275 } | 2275 } |
2276 | 2276 |
2277 LOOPER_END | 2277 LOOPER_END |
2278 } | 2278 } |
2279 | 2279 |
2280 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
Rect& dst, | 2280 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
Rect& dst, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2340 } | 2340 } |
2341 } | 2341 } |
2342 | 2342 |
2343 LOOPER_BEGIN_DRAWBITMAP(*paint, drawAsSprite, bounds) | 2343 LOOPER_BEGIN_DRAWBITMAP(*paint, drawAsSprite, bounds) |
2344 | 2344 |
2345 while (iter.next()) { | 2345 while (iter.next()) { |
2346 const SkPaint& pnt = looper.paint(); | 2346 const SkPaint& pnt = looper.paint(); |
2347 if (drawAsSprite && pnt.getImageFilter()) { | 2347 if (drawAsSprite && pnt.getImageFilter()) { |
2348 SkPoint pt; | 2348 SkPoint pt; |
2349 iter.fMatrix->mapXY(x, y, &pt); | 2349 iter.fMatrix->mapXY(x, y, &pt); |
2350 iter.fDevice->drawBitmapAsSpriteWithImageFilter(iter, bitmap, | 2350 iter.fDevice->drawBitmapAsSprite(iter, bitmap, |
2351 SkScalarRoundToInt(p
t.fX), | 2351 SkScalarRoundToInt(pt.fX), |
2352 SkScalarRoundToInt(p
t.fY), pnt); | 2352 SkScalarRoundToInt(pt.fY), pnt); |
2353 } else { | 2353 } else { |
2354 iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint()); | 2354 iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint()); |
2355 } | 2355 } |
2356 } | 2356 } |
2357 | 2357 |
2358 LOOPER_END | 2358 LOOPER_END |
2359 } | 2359 } |
2360 | 2360 |
2361 // this one is non-virtual, so it can be called safely by other canvas apis | 2361 // this one is non-virtual, so it can be called safely by other canvas apis |
2362 void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 2362 void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 } | 3036 } |
3037 | 3037 |
3038 if (matrix) { | 3038 if (matrix) { |
3039 canvas->concat(*matrix); | 3039 canvas->concat(*matrix); |
3040 } | 3040 } |
3041 } | 3041 } |
3042 | 3042 |
3043 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3043 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3044 fCanvas->restoreToCount(fSaveCount); | 3044 fCanvas->restoreToCount(fSaveCount); |
3045 } | 3045 } |
OLD | NEW |