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

Side by Side Diff: src/gpu/effects/GrBicubicEffect.cpp

Issue 2185533005: Simplify color space xform storage and usage (float[] vs. SkMatrix44) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment Created 4 years, 4 months 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/gpu/GrColorSpaceXform.cpp ('k') | no next file » | 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 "GrBicubicEffect.h" 8 #include "GrBicubicEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "glsl/GrGLSLColorSpaceXformHelper.h" 10 #include "glsl/GrGLSLColorSpaceXformHelper.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 const GrProcessor& processor) { 125 const GrProcessor& processor) {
126 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>(); 126 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
127 const GrTexture& texture = *processor.texture(0); 127 const GrTexture& texture = *processor.texture(0);
128 float imageIncrement[2]; 128 float imageIncrement[2];
129 imageIncrement[0] = 1.0f / texture.width(); 129 imageIncrement[0] = 1.0f / texture.width();
130 imageIncrement[1] = 1.0f / texture.height(); 130 imageIncrement[1] = 1.0f / texture.height();
131 pdman.set2fv(fImageIncrementUni, 1, imageIncrement); 131 pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
132 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients()); 132 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients());
133 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin()); 133 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin());
134 if (SkToBool(bicubicEffect.colorSpaceXform())) { 134 if (SkToBool(bicubicEffect.colorSpaceXform())) {
135 float xformMatrix[16]; 135 pdman.setMatrix4f(fColorSpaceXformUni, bicubicEffect.colorSpaceXform()-> srcToDst());
136 bicubicEffect.colorSpaceXform()->srcToDst().asColMajorf(xformMatrix);
137 pdman.setMatrix4f(fColorSpaceXformUni, xformMatrix);
138 } 136 }
139 } 137 }
140 138
141 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float dst[16], 139 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float dst[16],
142 const SkScalar src[16]) { 140 const SkScalar src[16]) {
143 for (int y = 0; y < 4; y++) { 141 for (int y = 0; y < 4; y++) {
144 for (int x = 0; x < 4; x++) { 142 for (int x = 0; x < 4; x++) {
145 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]); 143 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]);
146 } 144 }
147 } 145 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Use bilerp to handle rotation or fractional translation. 231 // Use bilerp to handle rotation or fractional translation.
234 *filterMode = GrTextureParams::kBilerp_FilterMode; 232 *filterMode = GrTextureParams::kBilerp_FilterMode;
235 } 233 }
236 return false; 234 return false;
237 } 235 }
238 // When we use the bicubic filtering effect each sample is read from the tex ture using 236 // When we use the bicubic filtering effect each sample is read from the tex ture using
239 // nearest neighbor sampling. 237 // nearest neighbor sampling.
240 *filterMode = GrTextureParams::kNone_FilterMode; 238 *filterMode = GrTextureParams::kNone_FilterMode;
241 return true; 239 return true;
242 } 240 }
OLDNEW
« no previous file with comments | « src/gpu/GrColorSpaceXform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698