OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 &fViewMatrixUniform); | 456 &fViewMatrixUniform); |
457 | 457 |
458 // emit transforms | 458 // emit transforms |
459 this->emitTransforms(vertBuilder, | 459 this->emitTransforms(vertBuilder, |
460 varyingHandler, | 460 varyingHandler, |
461 uniformHandler, | 461 uniformHandler, |
462 gpArgs->fPositionVar, | 462 gpArgs->fPositionVar, |
463 diegp.fInPosition->fName, | 463 diegp.fInPosition->fName, |
464 args.fFPCoordTransformHandler); | 464 args.fFPCoordTransformHandler); |
465 | 465 |
466 SkAssertResult(fragBuilder->enableFeature( | |
467 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur
e)); | |
468 // for outer curve | 466 // for outer curve |
469 fragBuilder->codeAppendf("vec2 scaledOffset = %s.xy;", offsets0.fsIn
()); | 467 fragBuilder->codeAppendf("vec2 scaledOffset = %s.xy;", offsets0.fsIn
()); |
470 fragBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset
) - 1.0;"); | 468 fragBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset
) - 1.0;"); |
471 fragBuilder->codeAppendf("vec2 duvdx = dFdx(%s);", offsets0.fsIn()); | 469 fragBuilder->codeAppendf("vec2 duvdx = dFdx(%s);", offsets0.fsIn()); |
472 fragBuilder->codeAppendf("vec2 duvdy = dFdy(%s);", offsets0.fsIn()); | 470 fragBuilder->codeAppendf("vec2 duvdy = dFdy(%s);", offsets0.fsIn()); |
473 fragBuilder->codeAppendf("vec2 grad = vec2(2.0*%s.x*duvdx.x + 2.0*%s
.y*duvdx.y," | 471 fragBuilder->codeAppendf("vec2 grad = vec2(2.0*%s.x*duvdx.x + 2.0*%s
.y*duvdx.y," |
474 " 2.0*%s.x*duvdy.x + 2.0*%s
.y*duvdy.y);", | 472 " 2.0*%s.x*duvdy.x + 2.0*%s
.y*duvdy.y);", |
475 offsets0.fsIn(), offsets0.fsIn(), offsets0.
fsIn(), | 473 offsets0.fsIn(), offsets0.fsIn(), offsets0.
fsIn(), |
476 offsets0.fsIn()); | 474 offsets0.fsIn()); |
477 | 475 |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 2446 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
2449 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2447 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2450 GrColor color = GrRandomColor(random); | 2448 GrColor color = GrRandomColor(random); |
2451 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2449 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2452 bool needsDistance = random->nextBool(); | 2450 bool needsDistance = random->nextBool(); |
2453 return create_rrect_batch(color, needsDistance, viewMatrix, rrect, | 2451 return create_rrect_batch(color, needsDistance, viewMatrix, rrect, |
2454 GrTest::TestStrokeRec(random)); | 2452 GrTest::TestStrokeRec(random)); |
2455 } | 2453 } |
2456 | 2454 |
2457 #endif | 2455 #endif |
OLD | NEW |