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