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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 } | 155 } |
156 const SkScalar aOut = SkIntToScalar(a); | 156 const SkScalar aOut = SkIntToScalar(a); |
157 dst[i] = SkPackARGB32(a, | 157 dst[i] = SkPackARGB32(a, |
158 SkScalarRoundToInt(rOut * aOut), | 158 SkScalarRoundToInt(rOut * aOut), |
159 SkScalarRoundToInt(gOut * aOut), | 159 SkScalarRoundToInt(gOut * aOut), |
160 SkScalarRoundToInt(bOut * aOut)); | 160 SkScalarRoundToInt(bOut * aOut)); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
| 164 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 165 SkColorCubeFilter::SkColorCubeFilter(SkReadBuffer& buffer) |
| 166 : fCache(buffer.readInt()) { |
| 167 fCubeData.reset(buffer.readByteArrayAsData()); |
| 168 buffer.validate(is_valid_3D_lut(fCubeData, fCache.cubeDimension())); |
| 169 fUniqueID = SkNextColorCubeUniqueID(); |
| 170 } |
| 171 #endif |
| 172 |
164 SkFlattenable* SkColorCubeFilter::CreateProc(SkReadBuffer& buffer) { | 173 SkFlattenable* SkColorCubeFilter::CreateProc(SkReadBuffer& buffer) { |
165 int cubeDimension = buffer.readInt(); | 174 int cubeDimension = buffer.readInt(); |
166 SkAutoDataUnref cubeData(buffer.readByteArrayAsData()); | 175 SkAutoDataUnref cubeData(buffer.readByteArrayAsData()); |
167 if (!buffer.validate(is_valid_3D_lut(cubeData, cubeDimension))) { | 176 if (!buffer.validate(is_valid_3D_lut(cubeData, cubeDimension))) { |
168 return NULL; | 177 return NULL; |
169 } | 178 } |
170 return Create(cubeData, cubeDimension); | 179 return Create(cubeData, cubeDimension); |
171 } | 180 } |
172 | 181 |
173 void SkColorCubeFilter::flatten(SkWriteBuffer& buffer) const { | 182 void SkColorCubeFilter::flatten(SkWriteBuffer& buffer) const { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 SkAutoTUnref<GrTexture> textureCube; | 361 SkAutoTUnref<GrTexture> textureCube; |
353 if (surface) { | 362 if (surface) { |
354 textureCube.reset(surface->asTexture()); | 363 textureCube.reset(surface->asTexture()); |
355 } else { | 364 } else { |
356 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); | 365 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); |
357 } | 366 } |
358 | 367 |
359 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; | 368 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; |
360 } | 369 } |
361 #endif | 370 #endif |
OLD | NEW |