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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 265763005: Fix image decode thrashing when drawing a very large source image to a GPU canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 // Break 'bitmap' into several tiles to draw it since it has already 1282 // Break 'bitmap' into several tiles to draw it since it has already
1283 // been determined to be too large to fit in VRAM 1283 // been determined to be too large to fit in VRAM
1284 void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, 1284 void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
1285 const SkRect& srcRect, 1285 const SkRect& srcRect,
1286 const SkIRect& clippedSrcIRect, 1286 const SkIRect& clippedSrcIRect,
1287 const GrTextureParams& params, 1287 const GrTextureParams& params,
1288 const SkPaint& paint, 1288 const SkPaint& paint,
1289 SkCanvas::DrawBitmapRectFlags flags, 1289 SkCanvas::DrawBitmapRectFlags flags,
1290 int tileSize, 1290 int tileSize,
1291 bool bicubic) { 1291 bool bicubic) {
1292 // The following pixel lock is technically redundant, but it is desirable
1293 // to lock outside of the tile loop to prevent redecoding the whole image
1294 // at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that
1295 // is larger than the limit of the discardable memory pool.
1296 SkAutoLockPixels alp(bitmap);
1292 SkRect clippedSrcRect = SkRect::Make(clippedSrcIRect); 1297 SkRect clippedSrcRect = SkRect::Make(clippedSrcIRect);
1293 1298
1294 int nx = bitmap.width() / tileSize; 1299 int nx = bitmap.width() / tileSize;
1295 int ny = bitmap.height() / tileSize; 1300 int ny = bitmap.height() / tileSize;
1296 for (int x = 0; x <= nx; x++) { 1301 for (int x = 0; x <= nx; x++) {
1297 for (int y = 0; y <= ny; y++) { 1302 for (int y = 0; y <= ny; y++) {
1298 SkRect tileR; 1303 SkRect tileR;
1299 tileR.set(SkIntToScalar(x * tileSize), 1304 tileR.set(SkIntToScalar(x * tileSize),
1300 SkIntToScalar(y * tileSize), 1305 SkIntToScalar(y * tileSize),
1301 SkIntToScalar((x + 1) * tileSize), 1306 SkIntToScalar((x + 1) * tileSize),
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 const GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrC reate(picture, i); 2003 const GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrC reate(picture, i);
1999 2004
2000 SkDebugf("%d (%d), ", i, layer->layerID()); 2005 SkDebugf("%d (%d), ", i, layer->layerID());
2001 } 2006 }
2002 } 2007 }
2003 SkDebugf("\n"); 2008 SkDebugf("\n");
2004 #endif 2009 #endif
2005 2010
2006 return false; 2011 return false;
2007 } 2012 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698