| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |