Chromium Code Reviews| 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 #ifndef SkLightingShader_DEFINED | 8 #ifndef SkLightingShader_DEFINED |
| 9 #define SkLightingShader_DEFINED | 9 #define SkLightingShader_DEFINED |
| 10 | 10 |
| 11 #include "SkLights.h" | 11 #include "SkLights.h" |
| 12 #include "SkShader.h" | 12 #include "SkShader.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkMatrix; | 15 class SkMatrix; |
| 16 | 16 |
| 17 class SK_API SkLightingShader { | 17 class SK_API SkLightingShader { |
| 18 public: | 18 public: |
| 19 class NormalSource : public SkFlattenable { | |
| 20 public: | |
| 21 virtual ~NormalSource(); | |
| 22 | |
| 23 #if SK_SUPPORT_GPU | |
| 24 virtual sk_sp<GrFragmentProcessor> asFragmentProcessor( | |
|
reed1
2016/06/10 19:15:23
use override instead
dvonbeck
2016/06/10 21:00:16
This is not overriding anything, it's the NormalSo
| |
| 25 GrContext* context, | |
| 26 const SkMatrix& viewM, | |
| 27 const SkMatrix* localMatrix, | |
| 28 SkFilterQuality filterQuality, | |
| 29 SkSourceGammaTreatment gammaTreatment) const = 0; | |
| 30 #endif | |
| 31 | |
| 32 SK_DEFINE_FLATTENABLE_TYPE(NormalSource) | |
|
dvonbeck
2016/06/10 18:31:21
FLATTENABLE: Macro
| |
| 33 }; | |
| 34 | |
| 35 class SK_API NormalMapSource { | |
| 36 public: | |
| 37 static sk_sp<NormalSource> Make(const SkBitmap& normal, const SkVector& invNormRotation, | |
| 38 const SkMatrix* normLocalM); | |
| 39 | |
| 40 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | |
|
dvonbeck
2016/06/10 18:31:21
FLATTENABLE: Macro
| |
| 41 }; | |
| 42 | |
| 19 /** Returns a shader that lights the diffuse and normal maps with a set of l ights. | 43 /** Returns a shader that lights the diffuse and normal maps with a set of l ights. |
| 20 | 44 |
| 21 It returns a shader with a reference count of 1. | 45 It returns a shader with a reference count of 1. |
| 22 The caller should decrement the shader's reference count when done with the shader. | 46 The caller should decrement the shader's reference count when done with the shader. |
| 23 It is an error for count to be < 2. | 47 It is an error for count to be < 2. |
| 24 @param diffuse the diffuse bitmap | 48 @param diffuse the diffuse bitmap |
| 25 @param normal the normal map | 49 @param normal the normal map |
| 26 @param lights the lights applied to the normal map | 50 @param lights the lights applied to the normal map |
| 27 @param invNormRotation rotation applied to the normal map's normals | 51 @param invNormRotation rotation applied to the normal map's normals |
| 28 @param diffLocalMatrix the local matrix for the diffuse texture | 52 @param diffLocalMatrix the local matrix for the diffuse texture |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 46 (127, 127, 0). | 70 (127, 127, 0). |
| 47 */ | 71 */ |
| 48 static sk_sp<SkShader> Make(const SkBitmap& diffuse, const SkBitmap& normal, | 72 static sk_sp<SkShader> Make(const SkBitmap& diffuse, const SkBitmap& normal, |
| 49 sk_sp<SkLights> lights, const SkVector& invNormR otation, | 73 sk_sp<SkLights> lights, const SkVector& invNormR otation, |
| 50 const SkMatrix* diffLocalMatrix, const SkMatrix* normLocalMatrix); | 74 const SkMatrix* diffLocalMatrix, const SkMatrix* normLocalMatrix); |
| 51 | 75 |
| 52 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 76 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 53 }; | 77 }; |
| 54 | 78 |
| 55 #endif | 79 #endif |
| OLD | NEW |