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

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

Issue 2329553002: Cleanup GPU gamut transformation code (Closed)
Patch Set: Switch from float[16] to SkMatrix44 Created 4 years, 3 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/SkGpuDevice.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.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 "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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const GrProcessor& processor) { 127 const GrProcessor& processor) {
128 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>(); 128 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
129 const GrTexture& texture = *processor.texture(0); 129 const GrTexture& texture = *processor.texture(0);
130 float imageIncrement[2]; 130 float imageIncrement[2];
131 imageIncrement[0] = 1.0f / texture.width(); 131 imageIncrement[0] = 1.0f / texture.width();
132 imageIncrement[1] = 1.0f / texture.height(); 132 imageIncrement[1] = 1.0f / texture.height();
133 pdman.set2fv(fImageIncrementUni, 1, imageIncrement); 133 pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
134 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients()); 134 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients());
135 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin()); 135 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin());
136 if (SkToBool(bicubicEffect.colorSpaceXform())) { 136 if (SkToBool(bicubicEffect.colorSpaceXform())) {
137 pdman.setMatrix4f(fColorSpaceXformUni, bicubicEffect.colorSpaceXform()-> srcToDst()); 137 pdman.setSkMatrix44(fColorSpaceXformUni, bicubicEffect.colorSpaceXform() ->srcToDst());
138 } 138 }
139 } 139 }
140 140
141 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float dst[16], 141 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float dst[16],
142 const SkScalar src[16]) { 142 const SkScalar src[16]) {
143 for (int y = 0; y < 4; y++) { 143 for (int y = 0; y < 4; y++) {
144 for (int x = 0; x < 4; x++) { 144 for (int x = 0; x < 4; x++) {
145 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]); 145 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]);
146 } 146 }
147 } 147 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Use bilerp to handle rotation or fractional translation. 233 // Use bilerp to handle rotation or fractional translation.
234 *filterMode = GrTextureParams::kBilerp_FilterMode; 234 *filterMode = GrTextureParams::kBilerp_FilterMode;
235 } 235 }
236 return false; 236 return false;
237 } 237 }
238 // When we use the bicubic filtering effect each sample is read from the tex ture using 238 // When we use the bicubic filtering effect each sample is read from the tex ture using
239 // nearest neighbor sampling. 239 // nearest neighbor sampling.
240 *filterMode = GrTextureParams::kNone_FilterMode; 240 *filterMode = GrTextureParams::kNone_FilterMode;
241 return true; 241 return true;
242 } 242 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698