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; | 305 #ifdef SK_DRAWBITMAPRECT_FAST_OFFSET |
306 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height()); | 306 SkRect extractedBitmapBounds = SkRect::MakeXYWH(dx, dy, |
307 SkIntToScalar(bitmapPtr- >width()), | |
308 SkIntToScalar(bitmapPtr- >height())); | |
309 #else | |
310 SkRect extractedBitmapBounds = SkRect::MakeIWH(bitmapPtr->width(), bitma pPtr->height()); | |
caryclark
2017/04/05 16:59:47
Can you change this back to
SkRect extractedBitma
| |
311 #endif | |
307 if (extractedBitmapBounds == tmpSrc) { | 312 if (extractedBitmapBounds == tmpSrc) { |
308 // no fractional part in src, we can just call drawBitmap | 313 // no fractional part in src, we can just call drawBitmap |
309 goto USE_DRAWBITMAP; | 314 goto USE_DRAWBITMAP; |
310 } | 315 } |
311 } else { | 316 } else { |
312 USE_DRAWBITMAP: | 317 USE_DRAWBITMAP: |
313 // We can go faster by just calling drawBitmap, which will concat the | 318 // We can go faster by just calling drawBitmap, which will concat the |
314 // matrix with the CTM, and try to call drawSprite if it can. If not, | 319 // matrix with the CTM, and try to call drawSprite if it can. If not, |
315 // it will make a shader and call drawRect, as we do below. | 320 // it will make a shader and call drawRect, as we do below. |
316 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); | 321 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 paint.getRasterizer() || | 386 paint.getRasterizer() || |
382 paint.getPathEffect() || | 387 paint.getPathEffect() || |
383 paint.isFakeBoldText() || | 388 paint.isFakeBoldText() || |
384 paint.getStyle() != SkPaint::kFill_Style || | 389 paint.getStyle() != SkPaint::kFill_Style || |
385 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 390 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
386 { | 391 { |
387 return true; | 392 return true; |
388 } | 393 } |
389 return false; | 394 return false; |
390 } | 395 } |
OLD | NEW |