OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkColorCubeFilter.h" | 8 #include "SkColorCubeFilter.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 : fCubeData(std::move(cubeData)) | 60 : fCubeData(std::move(cubeData)) |
61 , fUniqueID(SkNextColorCubeUniqueID()) | 61 , fUniqueID(SkNextColorCubeUniqueID()) |
62 , fCache(cubeDimension) | 62 , fCache(cubeDimension) |
63 {} | 63 {} |
64 | 64 |
65 uint32_t SkColorCubeFilter::getFlags() const { | 65 uint32_t SkColorCubeFilter::getFlags() const { |
66 return this->INHERITED::getFlags() | kAlphaUnchanged_Flag; | 66 return this->INHERITED::getFlags() | kAlphaUnchanged_Flag; |
67 } | 67 } |
68 | 68 |
69 SkColorCubeFilter::ColorCubeProcesingCache::ColorCubeProcesingCache(int cubeDime
nsion) | 69 SkColorCubeFilter::ColorCubeProcesingCache::ColorCubeProcesingCache(int cubeDime
nsion) |
70 : fCubeDimension(cubeDimension) | 70 : fCubeDimension(cubeDimension) { |
71 , fLutsInited(false) { | |
72 fColorToIndex[0] = fColorToIndex[1] = nullptr; | 71 fColorToIndex[0] = fColorToIndex[1] = nullptr; |
73 fColorToFactors[0] = fColorToFactors[1] = nullptr; | 72 fColorToFactors[0] = fColorToFactors[1] = nullptr; |
74 fColorToScalar = nullptr; | 73 fColorToScalar = nullptr; |
75 } | 74 } |
76 | 75 |
77 void SkColorCubeFilter::ColorCubeProcesingCache::getProcessingLuts( | 76 void SkColorCubeFilter::ColorCubeProcesingCache::getProcessingLuts( |
78 const int* (*colorToIndex)[2], const SkScalar* (*colorToFactors)[2], | 77 const int* (*colorToIndex)[2], const SkScalar* (*colorToFactors)[2], |
79 const SkScalar** colorToScalar) { | 78 const SkScalar** colorToScalar) { |
80 SkOnce(&fLutsInited, &fLutsMutex, | 79 fLutsInitOnce(SkColorCubeFilter::ColorCubeProcesingCache::initProcessingLuts
, this); |
81 SkColorCubeFilter::ColorCubeProcesingCache::initProcessingLuts, this)
; | 80 |
82 SkASSERT((fColorToIndex[0] != nullptr) && | 81 SkASSERT((fColorToIndex[0] != nullptr) && |
83 (fColorToIndex[1] != nullptr) && | 82 (fColorToIndex[1] != nullptr) && |
84 (fColorToFactors[0] != nullptr) && | 83 (fColorToFactors[0] != nullptr) && |
85 (fColorToFactors[1] != nullptr) && | 84 (fColorToFactors[1] != nullptr) && |
86 (fColorToScalar != nullptr)); | 85 (fColorToScalar != nullptr)); |
87 (*colorToIndex)[0] = fColorToIndex[0]; | 86 (*colorToIndex)[0] = fColorToIndex[0]; |
88 (*colorToIndex)[1] = fColorToIndex[1]; | 87 (*colorToIndex)[1] = fColorToIndex[1]; |
89 (*colorToFactors)[0] = fColorToFactors[0]; | 88 (*colorToFactors)[0] = fColorToFactors[0]; |
90 (*colorToFactors)[1] = fColorToFactors[1]; | 89 (*colorToFactors)[1] = fColorToFactors[1]; |
91 (*colorToScalar) = fColorToScalar; | 90 (*colorToScalar) = fColorToScalar; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 if (textureCube) { | 319 if (textureCube) { |
321 context->textureProvider()->assignUniqueKeyToTexture(key, textureCub
e); | 320 context->textureProvider()->assignUniqueKeyToTexture(key, textureCub
e); |
322 } else { | 321 } else { |
323 return nullptr; | 322 return nullptr; |
324 } | 323 } |
325 } | 324 } |
326 | 325 |
327 return GrColorCubeEffect::Create(textureCube); | 326 return GrColorCubeEffect::Create(textureCube); |
328 } | 327 } |
329 #endif | 328 #endif |
OLD | NEW |