OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (srcIR.fLeft > 0) { | 295 if (srcIR.fLeft > 0) { |
296 dx = SkIntToScalar(srcIR.fLeft); | 296 dx = SkIntToScalar(srcIR.fLeft); |
297 } | 297 } |
298 if (srcIR.fTop > 0) { | 298 if (srcIR.fTop > 0) { |
299 dy = SkIntToScalar(srcIR.fTop); | 299 dy = SkIntToScalar(srcIR.fTop); |
300 } | 300 } |
301 if (dx || dy) { | 301 if (dx || dy) { |
302 matrix.preTranslate(dx, dy); | 302 matrix.preTranslate(dx, dy); |
303 } | 303 } |
304 | 304 |
305 SkRect extractedBitmapBounds = SkRect::MakeXYWH(dx, dy, | 305 SkRect extractedBitmapBounds; |
306 SkIntToScalar(bitmapPtr-
>width()), | 306 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height()); |
307 SkIntToScalar(bitmapPtr-
>height())); | |
308 if (extractedBitmapBounds == tmpSrc) { | 307 if (extractedBitmapBounds == tmpSrc) { |
309 // no fractional part in src, we can just call drawBitmap | 308 // no fractional part in src, we can just call drawBitmap |
310 goto USE_DRAWBITMAP; | 309 goto USE_DRAWBITMAP; |
311 } | 310 } |
312 } else { | 311 } else { |
313 USE_DRAWBITMAP: | 312 USE_DRAWBITMAP: |
314 // We can go faster by just calling drawBitmap, which will concat the | 313 // We can go faster by just calling drawBitmap, which will concat the |
315 // matrix with the CTM, and try to call drawSprite if it can. If not, | 314 // matrix with the CTM, and try to call drawSprite if it can. If not, |
316 // it will make a shader and call drawRect, as we do below. | 315 // it will make a shader and call drawRect, as we do below. |
317 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); | 316 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 paint.getRasterizer() || | 381 paint.getRasterizer() || |
383 paint.getPathEffect() || | 382 paint.getPathEffect() || |
384 paint.isFakeBoldText() || | 383 paint.isFakeBoldText() || |
385 paint.getStyle() != SkPaint::kFill_Style || | 384 paint.getStyle() != SkPaint::kFill_Style || |
386 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 385 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
387 { | 386 { |
388 return true; | 387 return true; |
389 } | 388 } |
390 return false; | 389 return false; |
391 } | 390 } |
OLD | NEW |