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

Side by Side Diff: src/gpu/batches/GrAnalyticRectBatch.cpp

Issue 2249973003: Add alternative ambient shadow method to Android shadow sample (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Nits (again) 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/GrOvalRenderer.cpp ('k') | src/gpu/glsl/GrGLSLProgramBuilder.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 2016 Google Inc. 2 * Copyright 2016 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 "GrAnalyticRectBatch.h" 8 #include "GrAnalyticRectBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 fragBuilder->codeAppend( "if (heightDistance < widthDistance) {" ); 176 fragBuilder->codeAppend( "if (heightDistance < widthDistance) {" );
177 fragBuilder->codeAppendf(" dvAxis = %s.zw;", rectEdgeVary.fsI n()); 177 fragBuilder->codeAppendf(" dvAxis = %s.zw;", rectEdgeVary.fsI n());
178 fragBuilder->codeAppend( " dvLength = heightDistance;"); 178 fragBuilder->codeAppend( " dvLength = heightDistance;");
179 fragBuilder->codeAppend( "} else {"); 179 fragBuilder->codeAppend( "} else {");
180 fragBuilder->codeAppendf(" dvAxis = vec2(-%s.w, %s.z);", 180 fragBuilder->codeAppendf(" dvAxis = vec2(-%s.w, %s.z);",
181 rectEdgeVary.fsIn(), rectEdgeVary.fsIn( )); 181 rectEdgeVary.fsIn(), rectEdgeVary.fsIn( ));
182 fragBuilder->codeAppend( " dvLength = widthDistance;"); 182 fragBuilder->codeAppend( " dvLength = widthDistance;");
183 fragBuilder->codeAppend( "}"); 183 fragBuilder->codeAppend( "}");
184 184
185 fragBuilder->codeAppend( "float dvSign = sign(dot(offset, dvAxis ));"); 185 fragBuilder->codeAppend( "float dvSign = sign(dot(offset, dvAxis ));");
186 fragBuilder->codeAppendf("%s = vec3(dvSign * dvAxis, dvLength);" , 186 fragBuilder->codeAppendf("%s = vec4(dvSign * dvAxis, dvLength, 0 .0);",
187 args.fDistanceVectorName); 187 args.fDistanceVectorName);
188 188
189 } 189 }
190 } 190 }
191 191
192 static void GenKey(const GrGeometryProcessor& gp, 192 static void GenKey(const GrGeometryProcessor& gp,
193 const GrGLSLCaps&, 193 const GrGLSLCaps&,
194 GrProcessorKeyBuilder* b) { 194 GrProcessorKeyBuilder* b) {
195 b->add32(0x0); 195 b->add32(0x0);
196 } 196 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 DRAW_BATCH_TEST_DEFINE(AnalyticRectBatch) { 405 DRAW_BATCH_TEST_DEFINE(AnalyticRectBatch) {
406 SkMatrix viewMatrix = GrTest::TestMatrix(random); 406 SkMatrix viewMatrix = GrTest::TestMatrix(random);
407 GrColor color = GrRandomColor(random); 407 GrColor color = GrRandomColor(random);
408 SkRect rect = GrTest::TestSquare(random); 408 SkRect rect = GrTest::TestSquare(random);
409 SkRect croppedRect = GrTest::TestSquare(random); 409 SkRect croppedRect = GrTest::TestSquare(random);
410 SkRect bounds = GrTest::TestSquare(random); 410 SkRect bounds = GrTest::TestSquare(random);
411 return new AnalyticRectBatch(color, viewMatrix, rect, croppedRect, bounds); 411 return new AnalyticRectBatch(color, viewMatrix, rect, croppedRect, bounds);
412 } 412 }
413 413
414 #endif 414 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/glsl/GrGLSLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698