| OLD | NEW |
| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 this->getLocalMatrix(), &doBicubic); | 450 this->getLocalMatrix(), &doBicubic); |
| 451 GrTextureParams params(tm, textureFilterMode); | 451 GrTextureParams params(tm, textureFilterMode); |
| 452 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(args.fContext, fRaw
Bitmap, params, | 452 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(args.fContext, fRaw
Bitmap, params, |
| 453 args.fGammaTreatmen
t)); | 453 args.fGammaTreatmen
t)); |
| 454 | 454 |
| 455 if (!texture) { | 455 if (!texture) { |
| 456 SkErrorInternals::SetError( kInternalError_SkError, | 456 SkErrorInternals::SetError( kInternalError_SkError, |
| 457 "Couldn't convert bitmap to texture."); | 457 "Couldn't convert bitmap to texture."); |
| 458 return nullptr; | 458 return nullptr; |
| 459 } | 459 } |
| 460 SkColorSpace* dstColorSpace = nullptr; // XFORMTODO | |
| 461 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fRawBitma
p.colorSpace(), | 460 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fRawBitma
p.colorSpace(), |
| 462 dstColorS
pace); | 461 args.fDst
ColorSpace); |
| 463 sk_sp<GrFragmentProcessor> inner; | 462 sk_sp<GrFragmentProcessor> inner; |
| 464 if (doBicubic) { | 463 if (doBicubic) { |
| 465 inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matri
x, tm); | 464 inner = GrBicubicEffect::Make(texture, std::move(colorSpaceXform), matri
x, tm); |
| 466 } else { | 465 } else { |
| 467 inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform),
matrix, params); | 466 inner = GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform),
matrix, params); |
| 468 } | 467 } |
| 469 | 468 |
| 470 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 469 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
| 471 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); | 470 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); |
| 472 } | 471 } |
| 473 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); | 472 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); |
| 474 } | 473 } |
| 475 | 474 |
| 476 #endif | 475 #endif |
| OLD | NEW |