OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 | 8 |
9 #include "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 GrTextureParams::FilterMode normFilterMode = GrSkFilterQualityToGrFilterMode
( | 375 GrTextureParams::FilterMode normFilterMode = GrSkFilterQualityToGrFilterMode
( |
376 SkTMin(filterQuality, kMedium_SkFilterQu
ality), | 376 SkTMin(filterQuality, kMedium_SkFilterQu
ality), |
377 viewM, | 377 viewM, |
378 fNormLocalMatrix, | 378 fNormLocalMatrix, |
379 &doBicubic); | 379 &doBicubic); |
380 SkASSERT(!doBicubic); | 380 SkASSERT(!doBicubic); |
381 | 381 |
382 // TODO: support other tile modes | 382 // TODO: support other tile modes |
383 GrTextureParams diffParams(kClamp_TileMode, diffFilterMode); | 383 GrTextureParams diffParams(kClamp_TileMode, diffFilterMode); |
384 SkAutoTUnref<GrTexture> diffuseTexture(GrRefCachedBitmapTexture(context, | 384 SkAutoTUnref<GrTexture> diffuseTexture(GrRefCachedBitmapTexture(context, |
385 fDiffuseMap,
&diffParams)); | 385 fDiffuseMap,
diffParams)); |
386 if (!diffuseTexture) { | 386 if (!diffuseTexture) { |
387 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit
map to texture."); | 387 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit
map to texture."); |
388 return nullptr; | 388 return nullptr; |
389 } | 389 } |
390 | 390 |
391 GrTextureParams normParams(kClamp_TileMode, normFilterMode); | 391 GrTextureParams normParams(kClamp_TileMode, normFilterMode); |
392 SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context, | 392 SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context, |
393 fNormalMap, &
normParams)); | 393 fNormalMap, n
ormParams)); |
394 if (!normalTexture) { | 394 if (!normalTexture) { |
395 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit
map to texture."); | 395 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit
map to texture."); |
396 return nullptr; | 396 return nullptr; |
397 } | 397 } |
398 | 398 |
399 SkAutoTUnref<const GrFragmentProcessor> inner ( | 399 SkAutoTUnref<const GrFragmentProcessor> inner ( |
400 new LightingFP(diffuseTexture, normalTexture, diffM, normM, diffParams,
normParams, fLights, | 400 new LightingFP(diffuseTexture, normalTexture, diffM, normM, diffParams,
normParams, fLights, |
401 fInvNormRotation)); | 401 fInvNormRotation)); |
402 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 402 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
403 } | 403 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 normLocalM); | 712 normLocalM); |
713 } | 713 } |
714 | 714 |
715 /////////////////////////////////////////////////////////////////////////////// | 715 /////////////////////////////////////////////////////////////////////////////// |
716 | 716 |
717 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 717 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
718 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 718 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
719 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 719 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
720 | 720 |
721 /////////////////////////////////////////////////////////////////////////////// | 721 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |