Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: src/effects/SkColorCubeFilter.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698