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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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 | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorFilter.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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkBitmapProvider.h" 10 #include "SkBitmapProvider.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 #endif 403 #endif
404 404
405 /////////////////////////////////////////////////////////////////////////////// 405 ///////////////////////////////////////////////////////////////////////////////
406 406
407 #if SK_SUPPORT_GPU 407 #if SK_SUPPORT_GPU
408 408
409 #include "GrTextureAccess.h" 409 #include "GrTextureAccess.h"
410 #include "SkGr.h" 410 #include "SkGr.h"
411 #include "effects/GrSimpleTextureEffect.h" 411 #include "effects/GrSimpleTextureEffect.h"
412 412
413 const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* co ntext, 413 sk_sp<GrFragmentProcessor> SkBitmapProcShader::asFragmentProcessor(GrContext* co ntext,
414 const SkMatrix& viewM, const SkMatr ix* localMatrix, 414 const SkMatrix& viewM, const SkMatr ix* localMatrix,
415 SkFilterQuality filterQuality, 415 SkFilterQuality filterQuality,
416 SkSourceGammaTreatment gammaTreatme nt) const { 416 SkSourceGammaTreatment gammaTreatme nt) const {
417 SkMatrix matrix; 417 SkMatrix matrix;
418 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); 418 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
419 419
420 SkMatrix lmInverse; 420 SkMatrix lmInverse;
421 if (!this->getLocalMatrix().invert(&lmInverse)) { 421 if (!this->getLocalMatrix().invert(&lmInverse)) {
422 return nullptr; 422 return nullptr;
423 } 423 }
(...skipping 22 matching lines...) Expand all
446 GrTextureParams params(tm, textureFilterMode); 446 GrTextureParams params(tm, textureFilterMode);
447 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap , params, 447 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap , params,
448 gammaTreatment)); 448 gammaTreatment));
449 449
450 if (!texture) { 450 if (!texture) {
451 SkErrorInternals::SetError( kInternalError_SkError, 451 SkErrorInternals::SetError( kInternalError_SkError,
452 "Couldn't convert bitmap to texture."); 452 "Couldn't convert bitmap to texture.");
453 return nullptr; 453 return nullptr;
454 } 454 }
455 455
456 SkAutoTUnref<const GrFragmentProcessor> inner; 456 sk_sp<GrFragmentProcessor> inner;
457 if (doBicubic) { 457 if (doBicubic) {
458 inner.reset(GrBicubicEffect::Create(texture, matrix, tm)); 458 inner = GrBicubicEffect::Make(texture, matrix, tm);
459 } else { 459 } else {
460 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); 460 inner = GrSimpleTextureEffect::Make(texture, matrix, params);
461 } 461 }
462 462
463 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 463 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
464 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); 464 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r));
465 } 465 }
466 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 466 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
467 } 467 }
468 468
469 #endif 469 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698