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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 is retrieved by: | 58 is retrieved by: |
59 N.x = R-127; | 59 N.x = R-127; |
60 N.y = G-127; | 60 N.y = G-127; |
61 N.z = B-127; | 61 N.z = B-127; |
62 N.normalize(); | 62 N.normalize(); |
63 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis
is | 63 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis
is |
64 (127, 127, 0). | 64 (127, 127, 0). |
65 */ | 65 */ |
66 static sk_sp<SkNormalSource> MakeFromNormalMap(sk_sp<SkShader> map, const Sk
Matrix& ctm); | 66 static sk_sp<SkNormalSource> MakeFromNormalMap(sk_sp<SkShader> map, const Sk
Matrix& ctm); |
67 | 67 |
| 68 /** Returns a normal source that provides straight-up normals only (0, 0, 1)
. |
| 69 */ |
| 70 static sk_sp<SkNormalSource> MakeFlat(); |
| 71 |
68 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) | 72 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) |
69 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 73 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
70 }; | 74 }; |
71 | 75 |
72 #endif | 76 #endif |
OLD | NEW |