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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 SkColor3f fLightColor; | 274 SkColor3f fLightColor; |
275 GrGLSLProgramDataManager::UniformHandle fLightColorUni; | 275 GrGLSLProgramDataManager::UniformHandle fLightColorUni; |
276 | 276 |
277 SkColor3f fAmbientColor; | 277 SkColor3f fAmbientColor; |
278 GrGLSLProgramDataManager::UniformHandle fAmbientColorUni; | 278 GrGLSLProgramDataManager::UniformHandle fAmbientColorUni; |
279 | 279 |
280 SkVector fInvNormRotation; | 280 SkVector fInvNormRotation; |
281 GrGLSLProgramDataManager::UniformHandle fXformUni; | 281 GrGLSLProgramDataManager::UniformHandle fXformUni; |
282 }; | 282 }; |
283 | 283 |
284 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { | 284 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override { |
285 LightingGLFP::GenKey(*this, caps, b); | 285 LightingGLFP::GenKey(*this, caps, b); |
286 } | 286 } |
287 | 287 |
288 const char* name() const override { return "LightingFP"; } | 288 const char* name() const override { return "LightingFP"; } |
289 | 289 |
290 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 290 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
291 inout->mulByUnknownFourComponents(); | 291 inout->mulByUnknownFourComponents(); |
292 } | 292 } |
293 | 293 |
294 const SkVector3& lightDir() const { return fLightDir; } | 294 const SkVector3& lightDir() const { return fLightDir; } |
295 const SkColor3f& lightColor() const { return fLightColor; } | 295 const SkColor3f& lightColor() const { return fLightColor; } |
296 const SkColor3f& ambientColor() const { return fAmbientColor; } | 296 const SkColor3f& ambientColor() const { return fAmbientColor; } |
297 const SkVector& invNormRotation() const { return fInvNormRotation; } | 297 const SkVector& invNormRotation() const { return fInvNormRotation; } |
298 | 298 |
299 private: | 299 private: |
300 GrGLSLFragmentProcessor* onCreateGLInstance() const override { return new Li
ghtingGLFP; } | 300 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new
LightingGLFP; } |
301 | 301 |
302 bool onIsEqual(const GrFragmentProcessor& proc) const override { | 302 bool onIsEqual(const GrFragmentProcessor& proc) const override { |
303 const LightingFP& lightingFP = proc.cast<LightingFP>(); | 303 const LightingFP& lightingFP = proc.cast<LightingFP>(); |
304 return fDiffDeviceTransform == lightingFP.fDiffDeviceTransform && | 304 return fDiffDeviceTransform == lightingFP.fDiffDeviceTransform && |
305 fNormDeviceTransform == lightingFP.fNormDeviceTransform && | 305 fNormDeviceTransform == lightingFP.fNormDeviceTransform && |
306 fDiffuseTextureAccess == lightingFP.fDiffuseTextureAccess && | 306 fDiffuseTextureAccess == lightingFP.fDiffuseTextureAccess && |
307 fNormalTextureAccess == lightingFP.fNormalTextureAccess && | 307 fNormalTextureAccess == lightingFP.fNormalTextureAccess && |
308 fLightDir == lightingFP.fLightDir && | 308 fLightDir == lightingFP.fLightDir && |
309 fLightColor == lightingFP.fLightColor && | 309 fLightColor == lightingFP.fLightColor && |
310 fAmbientColor == lightingFP.fAmbientColor && | 310 fAmbientColor == lightingFP.fAmbientColor && |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 normLocalM); | 714 normLocalM); |
715 } | 715 } |
716 | 716 |
717 /////////////////////////////////////////////////////////////////////////////// | 717 /////////////////////////////////////////////////////////////////////////////// |
718 | 718 |
719 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 719 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
720 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 720 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
721 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 721 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
722 | 722 |
723 /////////////////////////////////////////////////////////////////////////////// | 723 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |