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

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

Issue 262803005: SkBitmapProcShader: if the bitmap already has a texture, just use it. Base URL: https://skia.googlecode.com/svn/trunk
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 | Annotate | Revision Log
« 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 default: 469 default:
470 SkErrorInternals::SetError( kInvalidPaint_SkError, 470 SkErrorInternals::SetError( kInvalidPaint_SkError,
471 "Sorry, I don't understand the filtering " 471 "Sorry, I don't understand the filtering "
472 "mode you asked for. Falling back to " 472 "mode you asked for. Falling back to "
473 "MIPMaps."); 473 "MIPMaps.");
474 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 474 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
475 break; 475 break;
476 476
477 } 477 }
478 GrTextureParams params(tm, textureFilterMode); 478 GrTextureParams params(tm, textureFilterMode);
479 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); 479 GrTexture* texture = fRawBitmap.getTexture();
480 bool didLockTexture = false;
481
482 if (!texture) {
483 texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &params);
484 didLockTexture = true;
485 }
480 486
481 if (NULL == texture) { 487 if (NULL == texture) {
482 SkErrorInternals::SetError( kInternalError_SkError, 488 SkErrorInternals::SetError( kInternalError_SkError,
483 "Couldn't convert bitmap to texture."); 489 "Couldn't convert bitmap to texture.");
484 return NULL; 490 return NULL;
485 } 491 }
486 492
487 GrEffectRef* effect = NULL; 493 GrEffectRef* effect = NULL;
488 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { 494 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) {
489 effect = GrBicubicEffect::Create(texture, matrix, tm); 495 effect = GrBicubicEffect::Create(texture, matrix, tm);
490 } else { 496 } else {
491 effect = GrSimpleTextureEffect::Create(texture, matrix, params); 497 effect = GrSimpleTextureEffect::Create(texture, matrix, params);
492 } 498 }
493 GrUnlockAndUnrefCachedBitmapTexture(texture); 499 if (didLockTexture) {
500 GrUnlockAndUnrefCachedBitmapTexture(texture);
501 }
494 return effect; 502 return effect;
495 } 503 }
496 #endif 504 #endif
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