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

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

Issue 608883003: GrResourceCache2 manages scratch texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@surfimpl
Patch Set: remove todo Created 6 years, 2 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/gpu/SkGrPixelRef.h ('k') | src/core/SkImageFilter.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 /* 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 default: 452 default:
453 SkErrorInternals::SetError( kInvalidPaint_SkError, 453 SkErrorInternals::SetError( kInvalidPaint_SkError,
454 "Sorry, I don't understand the filtering " 454 "Sorry, I don't understand the filtering "
455 "mode you asked for. Falling back to " 455 "mode you asked for. Falling back to "
456 "MIPMaps."); 456 "MIPMaps.");
457 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 457 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
458 break; 458 break;
459 459
460 } 460 }
461 GrTextureParams params(tm, textureFilterMode); 461 GrTextureParams params(tm, textureFilterMode);
462 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &p arams); 462 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap , &params));
463 463
464 if (NULL == texture) { 464 if (!texture) {
465 SkErrorInternals::SetError( kInternalError_SkError, 465 SkErrorInternals::SetError( kInternalError_SkError,
466 "Couldn't convert bitmap to texture."); 466 "Couldn't convert bitmap to texture.");
467 return false; 467 return false;
468 } 468 }
469 469
470 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? 470 *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ?
471 SkColor2GrColor(paint.getColor() ) : 471 SkColor2GrColor(paint.getColor() ) :
472 SkColor2GrColorJustAlpha(paint.g etColor()); 472 SkColor2GrColorJustAlpha(paint.g etColor());
473 473
474 if (useBicubic) { 474 if (useBicubic) {
475 *fp = GrBicubicEffect::Create(texture, matrix, tm); 475 *fp = GrBicubicEffect::Create(texture, matrix, tm);
476 } else { 476 } else {
477 *fp = GrSimpleTextureEffect::Create(texture, matrix, params); 477 *fp = GrSimpleTextureEffect::Create(texture, matrix, params);
478 } 478 }
479 GrUnlockAndUnrefCachedBitmapTexture(texture);
480 479
481 return true; 480 return true;
482 } 481 }
483 482
484 #else 483 #else
485 484
486 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S kMatrix*, GrColor*, 485 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S kMatrix*, GrColor*,
487 GrFragmentProcessor**) const { 486 GrFragmentProcessor**) const {
488 SkDEBUGFAIL("Should not call in GPU-less build"); 487 SkDEBUGFAIL("Should not call in GPU-less build");
489 return false; 488 return false;
490 } 489 }
491 490
492 #endif 491 #endif
OLDNEW
« no previous file with comments | « include/gpu/SkGrPixelRef.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698