aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFShader.cpp66
1 files changed, 1 insertions, 65 deletions
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index cf4188123a..c2f0bc4677 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -290,58 +290,6 @@ static SkString radialCode(const SkShader::GradientInfo& info,
return function;
}
-/* The math here is all based on the description in Two_Point_Radial_Gradient,
- with one simplification, the coordinate space has been scaled so that
- Dr = 1. This means we don't need to scale the entire equation by 1/Dr^2.
- */
-static SkString twoPointRadialCode(const SkShader::GradientInfo& info,
- const SkMatrix& perspectiveRemover) {
- SkScalar dx = info.fPoint[0].fX - info.fPoint[1].fX;
- SkScalar dy = info.fPoint[0].fY - info.fPoint[1].fY;
- SkScalar sr = info.fRadius[0];
- SkScalar a = SkScalarMul(dx, dx) + SkScalarMul(dy, dy) - SK_Scalar1;
- bool posRoot = info.fRadius[1] > info.fRadius[0];
-
- // We start with a stack of (x y), copy it and then consume one copy in
- // order to calculate b and the other to calculate c.
- SkString function("{");
-
- function.append(apply_perspective_to_coordinates(perspectiveRemover));
-
- function.append("2 copy ");
-
- // Calculate -b and b^2.
- function.appendScalar(dy);
- function.append(" mul exch ");
- function.appendScalar(dx);
- function.append(" mul add ");
- function.appendScalar(sr);
- function.append(" sub 2 mul neg dup dup mul\n");
-
- // Calculate c
- function.append("4 2 roll dup mul exch dup mul add ");
- function.appendScalar(SkScalarMul(sr, sr));
- function.append(" sub\n");
-
- // Calculate the determinate
- function.appendScalar(SkScalarMul(SkIntToScalar(4), a));
- function.append(" mul sub abs sqrt\n");
-
- // And then the final value of t.
- if (posRoot) {
- function.append("sub ");
- } else {
- function.append("add ");
- }
- function.appendScalar(SkScalarMul(SkIntToScalar(2), a));
- function.append(" div\n");
-
- tileModeCode(info.fTileMode, &function);
- gradientFunctionCode(info, &function);
- function.append("}");
- return function;
-}
-
/* Conical gradient shader, based on the Canvas spec for radial gradients
See: http://www.w3.org/TR/2dcontext/#dom-context-2d-createradialgradient
*/
@@ -782,17 +730,6 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
transformPoints[1].fX += info->fRadius[0];
codeFunction = &radialCode;
break;
- case SkShader::kRadial2_GradientType: {
- // Bail out if the radii are the same.
- if (info->fRadius[0] == info->fRadius[1]) {
- return NULL;
- }
- transformPoints[1] = transformPoints[0];
- SkScalar dr = info->fRadius[1] - info->fRadius[0];
- transformPoints[1].fX += dr;
- codeFunction = &twoPointRadialCode;
- break;
- }
case SkShader::kConical_GradientType: {
transformPoints[1] = transformPoints[0];
transformPoints[1].fX += SK_Scalar1;
@@ -852,7 +789,7 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
// state.fInfo
// in translating from x, y coordinates to the t parameter. So, we have
// to transform the points and radii according to the calculated matrix.
- if (state.fType == SkShader::kRadial2_GradientType) {
+ if (state.fType == SkShader::kConical_GradientType) {
SkShader::GradientInfo twoPointRadialInfo = *info;
SkMatrix inverseMapperMatrix;
if (!mapperMatrix.invert(&inverseMapperMatrix)) {
@@ -1143,7 +1080,6 @@ bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const {
return false;
}
break;
- case SkShader::kRadial2_GradientType:
case SkShader::kConical_GradientType:
if (fInfo.fPoint[1] != b.fInfo.fPoint[1] ||
fInfo.fRadius[0] != b.fInfo.fRadius[0] ||