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 "SkDeviceProperties.h" | 10 #include "SkDeviceProperties.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (!tmpSrc.intersect(bitmapBounds)) { | 253 if (!tmpSrc.intersect(bitmapBounds)) { |
254 return; // nothing to draw | 254 return; // nothing to draw |
255 } | 255 } |
256 // recompute dst, based on the smaller tmpSrc | 256 // recompute dst, based on the smaller tmpSrc |
257 matrix.mapRect(&tmpDst, tmpSrc); | 257 matrix.mapRect(&tmpDst, tmpSrc); |
258 dstPtr = &tmpDst; | 258 dstPtr = &tmpDst; |
259 } | 259 } |
260 | 260 |
261 // since we may need to clamp to the borders of the src rect within | 261 // since we may need to clamp to the borders of the src rect within |
262 // the bitmap, we extract a subset. | 262 // the bitmap, we extract a subset. |
263 SkIRect srcIR; | 263 const SkIRect srcIR = tmpSrc.roundOut(); |
264 tmpSrc.roundOut(&srcIR); | |
265 if(bitmap.pixelRef()->getTexture()) { | 264 if(bitmap.pixelRef()->getTexture()) { |
266 // Accelerated source canvas, don't use extractSubset but readPixels
to get the subset. | 265 // Accelerated source canvas, don't use extractSubset but readPixels
to get the subset. |
267 // This way, the pixels are copied in CPU memory instead of GPU memo
ry. | 266 // This way, the pixels are copied in CPU memory instead of GPU memo
ry. |
268 bitmap.pixelRef()->readPixels(&tmpBitmap, &srcIR); | 267 bitmap.pixelRef()->readPixels(&tmpBitmap, &srcIR); |
269 } else { | 268 } else { |
270 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) { | 269 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) { |
271 return; | 270 return; |
272 } | 271 } |
273 } | 272 } |
274 bitmapPtr = &tmpBitmap; | 273 bitmapPtr = &tmpBitmap; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 paint.getRasterizer() || | 387 paint.getRasterizer() || |
389 paint.getPathEffect() || | 388 paint.getPathEffect() || |
390 paint.isFakeBoldText() || | 389 paint.isFakeBoldText() || |
391 paint.getStyle() != SkPaint::kFill_Style || | 390 paint.getStyle() != SkPaint::kFill_Style || |
392 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
393 { | 392 { |
394 return true; | 393 return true; |
395 } | 394 } |
396 return false; | 395 return false; |
397 } | 396 } |
OLD | NEW |