Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1548)

Side by Side Diff: src/core/SkBitmapDevice.cpp

Issue 1576983002: Make SkBitmap::CopyTo respect requested dst color type when bitmap is texture backed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix size_t warnings Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/core/SkPixelRef.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698