| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } else { | 263 } else { |
| 264 tmpSrc = bitmapBounds; | 264 tmpSrc = bitmapBounds; |
| 265 } | 265 } |
| 266 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); | 266 matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); |
| 267 | 267 |
| 268 const SkRect* dstPtr = &dst; | 268 const SkRect* dstPtr = &dst; |
| 269 const SkBitmap* bitmapPtr = &bitmap; | 269 const SkBitmap* bitmapPtr = &bitmap; |
| 270 | 270 |
| 271 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if | 271 // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if |
| 272 // needed (if the src was clipped). No check needed if src==null. | 272 // needed (if the src was clipped). No check needed if src==null. |
| 273 if (src) { | 273 // If bitmapBounds are the same as src, go faster path bellow. |
| 274 if (src && !(bitmapBounds == *src)) { |
| 274 if (!bitmapBounds.contains(*src)) { | 275 if (!bitmapBounds.contains(*src)) { |
| 275 if (!tmpSrc.intersect(bitmapBounds)) { | 276 if (!tmpSrc.intersect(bitmapBounds)) { |
| 276 return; // nothing to draw | 277 return; // nothing to draw |
| 277 } | 278 } |
| 278 // recompute dst, based on the smaller tmpSrc | 279 // recompute dst, based on the smaller tmpSrc |
| 279 matrix.mapRect(&tmpDst, tmpSrc); | 280 matrix.mapRect(&tmpDst, tmpSrc); |
| 280 dstPtr = &tmpDst; | 281 dstPtr = &tmpDst; |
| 281 } | 282 } |
| 282 | 283 |
| 283 // since we may need to clamp to the borders of the src rect within | 284 // since we may need to clamp to the borders of the src rect within |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 paint.getRasterizer() || | 388 paint.getRasterizer() || |
| 388 paint.getPathEffect() || | 389 paint.getPathEffect() || |
| 389 paint.isFakeBoldText() || | 390 paint.isFakeBoldText() || |
| 390 paint.getStyle() != SkPaint::kFill_Style || | 391 paint.getStyle() != SkPaint::kFill_Style || |
| 391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 392 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
| 392 { | 393 { |
| 393 return true; | 394 return true; |
| 394 } | 395 } |
| 395 return false; | 396 return false; |
| 396 } | 397 } |
| OLD | NEW |