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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 /////////////////////////////////////////////////////////////////////////////// | 354 /////////////////////////////////////////////////////////////////////////////// |
355 | 355 |
356 #if SK_SUPPORT_GPU | 356 #if SK_SUPPORT_GPU |
357 | 357 |
358 #include "GrTextureAccess.h" | 358 #include "GrTextureAccess.h" |
359 #include "SkGr.h" | 359 #include "SkGr.h" |
360 #include "effects/GrSimpleTextureEffect.h" | 360 #include "effects/GrSimpleTextureEffect.h" |
361 | 361 |
362 const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* co
ntext, | 362 const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* co
ntext, |
363 const SkMatrix& viewM, const SkMatr
ix* localMatrix, | 363 const SkMatrix& viewM, const SkMatr
ix* localMatrix, |
364 SkFilterQuality filterQuality) cons
t { | 364 SkFilterQuality filterQuality, |
| 365 GrRenderTarget* dst) const { |
365 SkMatrix matrix; | 366 SkMatrix matrix; |
366 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); | 367 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
367 | 368 |
368 SkMatrix lmInverse; | 369 SkMatrix lmInverse; |
369 if (!this->getLocalMatrix().invert(&lmInverse)) { | 370 if (!this->getLocalMatrix().invert(&lmInverse)) { |
370 return nullptr; | 371 return nullptr; |
371 } | 372 } |
372 if (localMatrix) { | 373 if (localMatrix) { |
373 SkMatrix inv; | 374 SkMatrix inv; |
374 if (!localMatrix->invert(&inv)) { | 375 if (!localMatrix->invert(&inv)) { |
(...skipping 20 matching lines...) Expand all Loading... |
395 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap
, params)); | 396 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap
, params)); |
396 | 397 |
397 if (!texture) { | 398 if (!texture) { |
398 SkErrorInternals::SetError( kInternalError_SkError, | 399 SkErrorInternals::SetError( kInternalError_SkError, |
399 "Couldn't convert bitmap to texture."); | 400 "Couldn't convert bitmap to texture."); |
400 return nullptr; | 401 return nullptr; |
401 } | 402 } |
402 | 403 |
403 SkAutoTUnref<const GrFragmentProcessor> inner; | 404 SkAutoTUnref<const GrFragmentProcessor> inner; |
404 if (doBicubic) { | 405 if (doBicubic) { |
405 inner.reset(GrBicubicEffect::Create(texture, matrix, tm)); | 406 inner.reset(GrBicubicEffect::Create(texture, matrix, tm, dst)); |
406 } else { | 407 } else { |
407 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); | 408 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params, kLoca
l_GrCoordSet, dst)); |
408 } | 409 } |
409 | 410 |
410 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 411 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
411 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); | 412 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); |
412 } | 413 } |
413 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 414 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
414 } | 415 } |
415 | 416 |
416 #endif | 417 #endif |
OLD | NEW |