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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Setup pass through color | 104 // Setup pass through color |
105 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC
olor, NULL, | 105 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC
olor, NULL, |
106 &fColorUniform); | 106 &fColorUniform); |
107 | 107 |
108 // Setup position | 108 // Setup position |
109 this->setupPosition(pb, gpArgs, ce.inPosition()->fName, ce.viewMatri
x()); | 109 this->setupPosition(pb, gpArgs, ce.inPosition()->fName, ce.viewMatri
x()); |
110 | 110 |
111 // emit transforms | 111 // emit transforms |
112 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition()
->fName, | 112 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition()
->fName, |
113 ce.localMatrix(), args.fTransformsIn, args.fTra
nsformsOut);; | 113 ce.localMatrix(), args.fTransformsIn, args.fTra
nsformsOut); |
114 | 114 |
115 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde
r(); | 115 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde
r(); |
116 fsBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn()); | 116 fsBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn()); |
117 fsBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0.
0, 1.0);", v.fsIn()); | 117 fsBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0.
0, 1.0);", v.fsIn()); |
118 if (ce.isStroked()) { | 118 if (ce.isStroked()) { |
119 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s.
w), 0.0, 1.0);", | 119 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s.
w), 0.0, 1.0);", |
120 v.fsIn(), v.fsIn()); | 120 v.fsIn(), v.fsIn()); |
121 fsBuilder->codeAppend("edgeAlpha *= innerAlpha;"); | 121 fsBuilder->codeAppend("edgeAlpha *= innerAlpha;"); |
122 } | 122 } |
123 | 123 |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 geometry.fInnerXRadius = innerXRadius; | 2222 geometry.fInnerXRadius = innerXRadius; |
2223 geometry.fInnerYRadius = innerYRadius; | 2223 geometry.fInnerYRadius = innerYRadius; |
2224 geometry.fStroke = isStrokeOnly; | 2224 geometry.fStroke = isStrokeOnly; |
2225 geometry.fDevBounds = bounds; | 2225 geometry.fDevBounds = bounds; |
2226 | 2226 |
2227 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); | 2227 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); |
2228 target->drawBatch(pipelineBuilder, batch, &bounds); | 2228 target->drawBatch(pipelineBuilder, batch, &bounds); |
2229 } | 2229 } |
2230 return true; | 2230 return true; |
2231 } | 2231 } |
OLD | NEW |