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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 bool isOpaque() const override; | 73 bool isOpaque() const override; |
74 | 74 |
75 #if SK_SUPPORT_GPU | 75 #if SK_SUPPORT_GPU |
76 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 76 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
77 const SkMatrix& viewM, | 77 const SkMatrix& viewM, |
78 const SkMatrix* localMatrix, | 78 const SkMatrix* localMatrix, |
79 SkFilterQuality) const overri
de; | 79 SkFilterQuality) const overri
de; |
80 #endif | 80 #endif |
81 | 81 |
82 size_t contextSize() const override; | 82 size_t contextSize(const ContextRec&) const override; |
83 | 83 |
84 class LightingShaderContext : public SkShader::Context { | 84 class LightingShaderContext : public SkShader::Context { |
85 public: | 85 public: |
86 // The context takes ownership of the states. It will call their destruc
tors | 86 // The context takes ownership of the states. It will call their destruc
tors |
87 // but will NOT free the memory. | 87 // but will NOT free the memory. |
88 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&, | 88 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&, |
89 SkBitmapProcState* diffuseState, SkBitmapProcState
* normalState); | 89 SkBitmapProcState* diffuseState, SkBitmapProcState
* normalState); |
90 ~LightingShaderContext() override; | 90 ~LightingShaderContext() override; |
91 | 91 |
92 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 92 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 | 410 |
411 #endif | 411 #endif |
412 | 412 |
413 //////////////////////////////////////////////////////////////////////////// | 413 //////////////////////////////////////////////////////////////////////////// |
414 | 414 |
415 bool SkLightingShaderImpl::isOpaque() const { | 415 bool SkLightingShaderImpl::isOpaque() const { |
416 return fDiffuseMap.isOpaque(); | 416 return fDiffuseMap.isOpaque(); |
417 } | 417 } |
418 | 418 |
419 size_t SkLightingShaderImpl::contextSize() const { | 419 size_t SkLightingShaderImpl::contextSize(const ContextRec&) const { |
420 return 2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext); | 420 return 2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext); |
421 } | 421 } |
422 | 422 |
423 SkLightingShaderImpl::LightingShaderContext::LightingShaderContext(const SkLight
ingShaderImpl& shader, | 423 SkLightingShaderImpl::LightingShaderContext::LightingShaderContext(const SkLight
ingShaderImpl& shader, |
424 const Context
Rec& rec, | 424 const Context
Rec& rec, |
425 SkBitmapProcS
tate* diffuseState, | 425 SkBitmapProcS
tate* diffuseState, |
426 SkBitmapProcS
tate* normalState) | 426 SkBitmapProcS
tate* normalState) |
427 : INHERITED(shader, rec) | 427 : INHERITED(shader, rec) |
428 , fDiffuseState(diffuseState) | 428 , fDiffuseState(diffuseState) |
429 , fNormalState(normalState) | 429 , fNormalState(normalState) |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 normLocalM); | 718 normLocalM); |
719 } | 719 } |
720 | 720 |
721 /////////////////////////////////////////////////////////////////////////////// | 721 /////////////////////////////////////////////////////////////////////////////// |
722 | 722 |
723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
726 | 726 |
727 /////////////////////////////////////////////////////////////////////////////// | 727 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |