| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #ifndef SkNormalSource_DEFINED | 8 #ifndef SkNormalSource_DEFINED |
| 9 #define SkNormalSource_DEFINED | 9 #define SkNormalSource_DEFINED |
| 10 | 10 |
| 11 #include "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
| 12 | 12 |
| 13 /** Abstract class that generates or reads in normals for use by SkLightingShade
r. | 13 /** Abstract class that generates or reads in normals for use by SkLightingShade
r. |
| 14 */ | 14 */ |
| 15 class SK_API SkNormalSource : public SkFlattenable { | 15 class SK_API SkNormalSource : public SkFlattenable { |
| 16 public: | 16 public: |
| 17 virtual ~SkNormalSource() override; | 17 virtual ~SkNormalSource() override; |
| 18 | 18 |
| 19 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
| 20 /** Returns a fragment processor that takes no input and outputs a normal (a
lready rotated) | 20 /** Returns a fragment processor that takes no input and outputs a normal (a
lready rotated) |
| 21 as its output color. To be used as a child fragment processor. | 21 as its output color. To be used as a child fragment processor. |
| 22 */ | 22 */ |
| 23 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor( | 23 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(const SkShader::AsFPA
rgs&) const = 0; |
| 24 GrContext* context, | |
| 25 const SkMatrix& viewM, | |
| 26 const SkMatrix* localMatrix, | |
| 27 SkFilterQuality filterQuality, | |
| 28 SkSourceGammaTreatment gammaTreatment) const = 0; | |
| 29 #endif | 24 #endif |
| 30 | 25 |
| 31 class Provider { | 26 class Provider { |
| 32 public: | 27 public: |
| 33 virtual ~Provider() {}; | 28 virtual ~Provider() {}; |
| 34 | 29 |
| 35 /** Called for each span of the object being drawn on the CPU. Your subc
lass should set | 30 /** Called for each span of the object being drawn on the CPU. Your subc
lass should set |
| 36 the appropriate normals that correspond to the specified device coor
dinates. | 31 the appropriate normals that correspond to the specified device coor
dinates. |
| 37 */ | 32 */ |
| 38 virtual void fillScanLine(int x, int y, SkPoint3 output[], int count) co
nst = 0; | 33 virtual void fillScanLine(int x, int y, SkPoint3 output[], int count) co
nst = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 | 62 |
| 68 /** Returns a normal source that provides straight-up normals only (0, 0, 1)
. | 63 /** Returns a normal source that provides straight-up normals only (0, 0, 1)
. |
| 69 */ | 64 */ |
| 70 static sk_sp<SkNormalSource> MakeFlat(); | 65 static sk_sp<SkNormalSource> MakeFlat(); |
| 71 | 66 |
| 72 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) | 67 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) |
| 73 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 68 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 74 }; | 69 }; |
| 75 | 70 |
| 76 #endif | 71 #endif |
| OLD | NEW |