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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 matrix.mapRect(&tmpDst, tmpSrc); | 279 matrix.mapRect(&tmpDst, tmpSrc); |
280 dstPtr = &tmpDst; | 280 dstPtr = &tmpDst; |
281 } | 281 } |
282 | 282 |
283 // since we may need to clamp to the borders of the src rect within | 283 // since we may need to clamp to the borders of the src rect within |
284 // the bitmap, we extract a subset. | 284 // the bitmap, we extract a subset. |
285 const SkIRect srcIR = tmpSrc.roundOut(); | 285 const SkIRect srcIR = tmpSrc.roundOut(); |
286 if(bitmap.pixelRef()->getTexture()) { | 286 if(bitmap.pixelRef()->getTexture()) { |
287 // Accelerated source canvas, don't use extractSubset but readPixels
to get the subset. | 287 // Accelerated source canvas, don't use extractSubset but readPixels
to get the subset. |
288 // This way, the pixels are copied in CPU memory instead of GPU memo
ry. | 288 // This way, the pixels are copied in CPU memory instead of GPU memo
ry. |
289 bitmap.pixelRef()->readPixels(&tmpBitmap, &srcIR); | 289 bitmap.pixelRef()->readPixels(&tmpBitmap, kN32_SkColorType, &srcIR); |
290 } else { | 290 } else { |
291 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) { | 291 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) { |
292 return; | 292 return; |
293 } | 293 } |
294 } | 294 } |
295 bitmapPtr = &tmpBitmap; | 295 bitmapPtr = &tmpBitmap; |
296 | 296 |
297 // Since we did an extract, we need to adjust the matrix accordingly | 297 // Since we did an extract, we need to adjust the matrix accordingly |
298 SkScalar dx = 0, dy = 0; | 298 SkScalar dx = 0, dy = 0; |
299 if (srcIR.fLeft > 0) { | 299 if (srcIR.fLeft > 0) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 paint.getRasterizer() || | 387 paint.getRasterizer() || |
388 paint.getPathEffect() || | 388 paint.getPathEffect() || |
389 paint.isFakeBoldText() || | 389 paint.isFakeBoldText() || |
390 paint.getStyle() != SkPaint::kFill_Style || | 390 paint.getStyle() != SkPaint::kFill_Style || |
391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) | 391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
392 { | 392 { |
393 return true; | 393 return true; |
394 } | 394 } |
395 return false; | 395 return false; |
396 } | 396 } |
OLD | NEW |