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

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

Issue 2264293003: Remove SkPixelRef::getTexture() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 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 | « include/core/SkPixelRef.h ('k') | src/core/SkImagePriv.h » ('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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // src is smaller than the bounds of the bitmap, and we are filtering, s o we don't know 274 // src is smaller than the bounds of the bitmap, and we are filtering, s o we don't know
275 // how much more of the bitmap we need, so we can't use extractSubset or drawBitmap, 275 // how much more of the bitmap we need, so we can't use extractSubset or drawBitmap,
276 // but we must use a shader w/ dst bounds (which can access all of the b itmap needed). 276 // but we must use a shader w/ dst bounds (which can access all of the b itmap needed).
277 goto USE_SHADER; 277 goto USE_SHADER;
278 } 278 }
279 279
280 if (src) { 280 if (src) {
281 // since we may need to clamp to the borders of the src rect within 281 // since we may need to clamp to the borders of the src rect within
282 // the bitmap, we extract a subset. 282 // the bitmap, we extract a subset.
283 const SkIRect srcIR = tmpSrc.roundOut(); 283 const SkIRect srcIR = tmpSrc.roundOut();
284 if(bitmap.pixelRef()->getTexture()) { 284 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) {
285 // Accelerated source canvas, don't use extractSubset but readPixels to get the subset. 285 return;
286 // This way, the pixels are copied in CPU memory instead of GPU memo ry.
287 bitmap.pixelRef()->readPixels(&tmpBitmap, kN32_SkColorType, &srcIR);
288 } else {
289 if (!bitmap.extractSubset(&tmpBitmap, srcIR)) {
290 return;
291 }
292 } 286 }
293 bitmapPtr = &tmpBitmap; 287 bitmapPtr = &tmpBitmap;
294 288
295 // Since we did an extract, we need to adjust the matrix accordingly 289 // Since we did an extract, we need to adjust the matrix accordingly
296 SkScalar dx = 0, dy = 0; 290 SkScalar dx = 0, dy = 0;
297 if (srcIR.fLeft > 0) { 291 if (srcIR.fLeft > 0) {
298 dx = SkIntToScalar(srcIR.fLeft); 292 dx = SkIntToScalar(srcIR.fLeft);
299 } 293 }
300 if (srcIR.fTop > 0) { 294 if (srcIR.fTop > 0) {
301 dy = SkIntToScalar(srcIR.fTop); 295 dy = SkIntToScalar(srcIR.fTop);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 paint.getRasterizer() || 433 paint.getRasterizer() ||
440 paint.getPathEffect() || 434 paint.getPathEffect() ||
441 paint.isFakeBoldText() || 435 paint.isFakeBoldText() ||
442 paint.getStyle() != SkPaint::kFill_Style || 436 paint.getStyle() != SkPaint::kFill_Style ||
443 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) 437 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode))
444 { 438 {
445 return true; 439 return true;
446 } 440 }
447 return false; 441 return false;
448 } 442 }
OLDNEW
« no previous file with comments | « include/core/SkPixelRef.h ('k') | src/core/SkImagePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698