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

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

Issue 15035004: SkGpuDevice: Delay locking bitmap pixels until we have a known texture cache miss. (Closed) Base URL: http://skia.googlecode.com/svn/trunk
Patch Set: fix whitespace Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/SkGr.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 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/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 * and that non-texture portion of the GrPaint has already been setup. 1360 * and that non-texture portion of the GrPaint has already been setup.
1361 */ 1361 */
1362 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, 1362 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
1363 const SkRect& srcRect, 1363 const SkRect& srcRect,
1364 const SkMatrix& m, 1364 const SkMatrix& m,
1365 const GrTextureParams& params, 1365 const GrTextureParams& params,
1366 GrPaint* grPaint) { 1366 GrPaint* grPaint) {
1367 SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() && 1367 SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() &&
1368 bitmap.height() <= fContext->getMaxTextureSize()); 1368 bitmap.height() <= fContext->getMaxTextureSize());
1369 1369
1370 SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
1371 if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
1372 SkDebugf("nothing to draw\n");
1373 return;
1374 }
1375
1376 GrTexture* texture; 1370 GrTexture* texture;
1377 SkAutoCachedTexture act(this, bitmap, &params, &texture); 1371 SkAutoCachedTexture act(this, bitmap, &params, &texture);
1378 if (NULL == texture) { 1372 if (NULL == texture) {
1379 return; 1373 return;
1380 } 1374 }
1381 1375
1382 GrRect dstRect(srcRect); 1376 GrRect dstRect(srcRect);
1383 GrRect paintRect; 1377 GrRect paintRect;
1384 SkScalar wInv = SkScalarInvert(SkIntToScalar(bitmap.width())); 1378 SkScalar wInv = SkScalarInvert(SkIntToScalar(bitmap.width()));
1385 SkScalar hInv = SkScalarInvert(SkIntToScalar(bitmap.height())); 1379 SkScalar hInv = SkScalarInvert(SkIntToScalar(bitmap.height()));
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 GrTexture* texture, 1852 GrTexture* texture,
1859 bool needClear) 1853 bool needClear)
1860 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 1854 : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
1861 1855
1862 GrAssert(texture && texture->asRenderTarget()); 1856 GrAssert(texture && texture->asRenderTarget());
1863 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1857 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1864 // cache. We pass true for the third argument so that it will get unlocked. 1858 // cache. We pass true for the third argument so that it will get unlocked.
1865 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1859 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1866 fNeedClear = needClear; 1860 fNeedClear = needClear;
1867 } 1861 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698