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 | 9 |
10 #ifndef SkLightingShader_DEFINED | 10 #ifndef SkLightingShader_DEFINED |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // TODO: limit the number of lights here or just ignore those | 32 // TODO: limit the number of lights here or just ignore those |
33 // above some maximum? | 33 // above some maximum? |
34 void add(const SkLight& light) { | 34 void add(const SkLight& light) { |
35 if (fLights) { | 35 if (fLights) { |
36 *fLights->fLights.push() = light; | 36 *fLights->fLights.push() = light; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 const Lights* finish() { | 40 const Lights* finish() { |
41 return fLights.detach(); | 41 return fLights.release(); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 SkAutoTUnref<Lights> fLights; | 45 SkAutoTUnref<Lights> fLights; |
46 }; | 46 }; |
47 | 47 |
48 int numLights() const { | 48 int numLights() const { |
49 return fLights.count(); | 49 return fLights.count(); |
50 } | 50 } |
51 | 51 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 (127, 127, 0). | 91 (127, 127, 0). |
92 */ | 92 */ |
93 static SkShader* Create(const SkBitmap& diffuse, const SkBitmap& normal, | 93 static SkShader* Create(const SkBitmap& diffuse, const SkBitmap& normal, |
94 const Lights* lights, const SkVector& invNormRotatio
n, | 94 const Lights* lights, const SkVector& invNormRotatio
n, |
95 const SkMatrix* diffLocalMatrix, const SkMatrix* nor
mLocalMatrix); | 95 const SkMatrix* diffLocalMatrix, const SkMatrix* nor
mLocalMatrix); |
96 | 96 |
97 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 97 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
98 }; | 98 }; |
99 | 99 |
100 #endif | 100 #endif |
OLD | NEW |