OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 , fLights(std::move(lights)) {} | 51 , fLights(std::move(lights)) {} |
52 | 52 |
53 bool isOpaque() const override; | 53 bool isOpaque() const override; |
54 | 54 |
55 #if SK_SUPPORT_GPU | 55 #if SK_SUPPORT_GPU |
56 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const overri
de; | 56 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const overri
de; |
57 #endif | 57 #endif |
58 | 58 |
59 class LightingShaderContext : public SkShader::Context { | 59 class LightingShaderContext : public SkShader::Context { |
60 public: | 60 public: |
61 // The context takes ownership of the states. It will call their destruc
tors | 61 // The context takes ownership of the context and provider. It will call
their destructors |
62 // but will NOT free the memory. | 62 // and then indirectly free their memory by calling free() on heapAlloca
ted |
63 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&, | 63 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&, |
64 SkShader::Context* diffuseContext, SkNormalSource:
:Provider*, | 64 SkShader::Context* diffuseContext, SkNormalSource:
:Provider*, |
65 void* heapAllocated); | 65 void* heapAllocated); |
66 | 66 |
67 ~LightingShaderContext() override; | 67 ~LightingShaderContext() override; |
68 | 68 |
69 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 69 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
70 | 70 |
71 uint32_t getFlags() const override { return fFlags; } | 71 uint32_t getFlags() const override { return fFlags; } |
72 | 72 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 std::move(lights)); | 524 std::move(lights)); |
525 } | 525 } |
526 | 526 |
527 /////////////////////////////////////////////////////////////////////////////// | 527 /////////////////////////////////////////////////////////////////////////////// |
528 | 528 |
529 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 529 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
530 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 530 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
531 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 531 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
532 | 532 |
533 /////////////////////////////////////////////////////////////////////////////// | 533 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |