| 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 #ifndef SkLights_DEFINED | 9 #ifndef SkLights_DEFINED |
| 10 #define SkLights_DEFINED | 10 #define SkLights_DEFINED |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class Builder { | 54 class Builder { |
| 55 public: | 55 public: |
| 56 Builder() : fLights(new SkLights) { } | 56 Builder() : fLights(new SkLights) { } |
| 57 | 57 |
| 58 void add(const Light& light) { | 58 void add(const Light& light) { |
| 59 if (fLights) { | 59 if (fLights) { |
| 60 *fLights->fLights.push() = light; | 60 *fLights->fLights.push() = light; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 const sk_sp<SkLights> finish() { | 64 sk_sp<SkLights> finish() { |
| 65 return fLights; | 65 return fLights; |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 sk_sp<SkLights> fLights; | 69 sk_sp<SkLights> fLights; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 int numLights() const { | 72 int numLights() const { |
| 73 return fLights.count(); | 73 return fLights.count(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 const Light& light(int index) const { | 76 const Light& light(int index) const { |
| 77 return fLights[index]; | 77 return fLights[index]; |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 SkLights() {} | 81 SkLights() {} |
| 82 | 82 |
| 83 SkTDArray<Light> fLights; | 83 SkTDArray<Light> fLights; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 #endif | 86 #endif |
| OLD | NEW |