GfxState.cc (xpdf-4.03) | : | GfxState.cc (xpdf-4.04) | ||
---|---|---|---|---|
skipping to change at line 2033 | skipping to change at line 2033 | |||
} | } | |||
GfxFunctionShading *GfxFunctionShading::parse(Dict *dict | GfxFunctionShading *GfxFunctionShading::parse(Dict *dict | |||
) { | ) { | |||
GfxFunctionShading *shading; | GfxFunctionShading *shading; | |||
double x0A, y0A, x1A, y1A; | double x0A, y0A, x1A, y1A; | |||
double matrixA[6]; | double matrixA[6]; | |||
Function *funcsA[gfxColorMaxComps]; | Function *funcsA[gfxColorMaxComps]; | |||
int nFuncsA; | int nFuncsA; | |||
Object obj1, obj2; | Object obj1, obj2; | |||
GBool ok; | ||||
int i; | int i; | |||
x0A = y0A = 0; | x0A = y0A = 0; | |||
x1A = y1A = 1; | x1A = y1A = 1; | |||
if (dict->lookup("Domain", &obj1)->isArray() && | if (dict->lookup("Domain", &obj1)->isArray() && | |||
obj1.arrayGetLength() == 4) { | obj1.arrayGetLength() == 4) { | |||
x0A = obj1.arrayGet(0, &obj2)->getNum(); | x0A = obj1.arrayGet(0, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
x1A = obj1.arrayGet(1, &obj2)->getNum(); | x1A = obj1.arrayGet(1, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
skipping to change at line 2101 | skipping to change at line 2102 | |||
obj1.free(); | obj1.free(); | |||
shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA, | shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA, | |||
funcsA, nFuncsA); | funcsA, nFuncsA); | |||
if (!shading->init(dict | if (!shading->init(dict | |||
)) { | )) { | |||
delete shading; | delete shading; | |||
return NULL; | return NULL; | |||
} | } | |||
for (i = 0; i < shading->nFuncs; ++i) { | ok = gFalse; | |||
if (shading->funcs[i]->getOutputSize() | if (shading->nFuncs == 1) { | |||
!= shading->getColorSpace()->getNComps()) { | ok = shading->funcs[0]->getOutputSize() | |||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | == shading->getColorSpace()->getNComps(); | |||
delete shading; | } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { | |||
return NULL; | ok = gTrue; | |||
for (i = 0; i < shading->nFuncs; ++i) { | ||||
ok = ok && shading->funcs[i]->getOutputSize() == 1; | ||||
} | } | |||
} | } | |||
if (!ok) { | ||||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | ||||
delete shading; | ||||
return NULL; | ||||
} | ||||
return shading; | return shading; | |||
err2: | err2: | |||
obj2.free(); | obj2.free(); | |||
err1: | err1: | |||
obj1.free(); | obj1.free(); | |||
return NULL; | return NULL; | |||
} | } | |||
skipping to change at line 2203 | skipping to change at line 2211 | |||
} | } | |||
} | } | |||
GfxAxialShading *GfxAxialShading::parse(Dict *dict | GfxAxialShading *GfxAxialShading::parse(Dict *dict | |||
) { | ) { | |||
GfxAxialShading *shading; | GfxAxialShading *shading; | |||
double x0A, y0A, x1A, y1A; | double x0A, y0A, x1A, y1A; | |||
double t0A, t1A; | double t0A, t1A; | |||
Function *funcsA[gfxColorMaxComps]; | Function *funcsA[gfxColorMaxComps]; | |||
int nFuncsA; | int nFuncsA; | |||
GBool extend0A, extend1A; | GBool extend0A, extend1A, ok; | |||
Object obj1, obj2; | Object obj1, obj2; | |||
int i; | int i; | |||
x0A = y0A = x1A = y1A = 0; | x0A = y0A = x1A = y1A = 0; | |||
if (dict->lookup("Coords", &obj1)->isArray() && | if (dict->lookup("Coords", &obj1)->isArray() && | |||
obj1.arrayGetLength() == 4) { | obj1.arrayGetLength() == 4) { | |||
x0A = obj1.arrayGet(0, &obj2)->getNum(); | x0A = obj1.arrayGet(0, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
y0A = obj1.arrayGet(1, &obj2)->getNum(); | y0A = obj1.arrayGet(1, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
skipping to change at line 2281 | skipping to change at line 2289 | |||
obj1.free(); | obj1.free(); | |||
shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A, | shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A, | |||
funcsA, nFuncsA, extend0A, extend1A); | funcsA, nFuncsA, extend0A, extend1A); | |||
if (!shading->init(dict | if (!shading->init(dict | |||
)) { | )) { | |||
delete shading; | delete shading; | |||
return NULL; | return NULL; | |||
} | } | |||
for (i = 0; i < shading->nFuncs; ++i) { | ok = gFalse; | |||
if (shading->funcs[i]->getOutputSize() | if (shading->nFuncs == 1) { | |||
!= shading->getColorSpace()->getNComps()) { | ok = shading->funcs[0]->getOutputSize() | |||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | == shading->getColorSpace()->getNComps(); | |||
delete shading; | } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { | |||
return NULL; | ok = gTrue; | |||
for (i = 0; i < shading->nFuncs; ++i) { | ||||
ok = ok && shading->funcs[i]->getOutputSize() == 1; | ||||
} | } | |||
} | } | |||
if (!ok) { | ||||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | ||||
delete shading; | ||||
return NULL; | ||||
} | ||||
return shading; | return shading; | |||
err1: | err1: | |||
return NULL; | return NULL; | |||
} | } | |||
GfxShading *GfxAxialShading::copy() { | GfxShading *GfxAxialShading::copy() { | |||
return new GfxAxialShading(this); | return new GfxAxialShading(this); | |||
} | } | |||
skipping to change at line 2382 | skipping to change at line 2397 | |||
} | } | |||
} | } | |||
GfxRadialShading *GfxRadialShading::parse(Dict *dict | GfxRadialShading *GfxRadialShading::parse(Dict *dict | |||
) { | ) { | |||
GfxRadialShading *shading; | GfxRadialShading *shading; | |||
double x0A, y0A, r0A, x1A, y1A, r1A; | double x0A, y0A, r0A, x1A, y1A, r1A; | |||
double t0A, t1A; | double t0A, t1A; | |||
Function *funcsA[gfxColorMaxComps]; | Function *funcsA[gfxColorMaxComps]; | |||
int nFuncsA; | int nFuncsA; | |||
GBool extend0A, extend1A; | GBool extend0A, extend1A, ok; | |||
Object obj1, obj2; | Object obj1, obj2; | |||
int i; | int i; | |||
x0A = y0A = r0A = x1A = y1A = r1A = 0; | x0A = y0A = r0A = x1A = y1A = r1A = 0; | |||
if (dict->lookup("Coords", &obj1)->isArray() && | if (dict->lookup("Coords", &obj1)->isArray() && | |||
obj1.arrayGetLength() == 6) { | obj1.arrayGetLength() == 6) { | |||
x0A = obj1.arrayGet(0, &obj2)->getNum(); | x0A = obj1.arrayGet(0, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
y0A = obj1.arrayGet(1, &obj2)->getNum(); | y0A = obj1.arrayGet(1, &obj2)->getNum(); | |||
obj2.free(); | obj2.free(); | |||
skipping to change at line 2463 | skipping to change at line 2478 | |||
obj1.free(); | obj1.free(); | |||
shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A, | shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A, | |||
funcsA, nFuncsA, extend0A, extend1A); | funcsA, nFuncsA, extend0A, extend1A); | |||
if (!shading->init(dict | if (!shading->init(dict | |||
)) { | )) { | |||
delete shading; | delete shading; | |||
return NULL; | return NULL; | |||
} | } | |||
for (i = 0; i < shading->nFuncs; ++i) { | ok = gFalse; | |||
if (shading->funcs[i]->getOutputSize() | if (shading->nFuncs == 1) { | |||
!= shading->getColorSpace()->getNComps()) { | ok = shading->funcs[0]->getOutputSize() | |||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | == shading->getColorSpace()->getNComps(); | |||
delete shading; | } else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { | |||
return NULL; | ok = gTrue; | |||
for (i = 0; i < shading->nFuncs; ++i) { | ||||
ok = ok && shading->funcs[i]->getOutputSize() == 1; | ||||
} | } | |||
} | } | |||
if (!ok) { | ||||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | ||||
delete shading; | ||||
return NULL; | ||||
} | ||||
return shading; | return shading; | |||
err1: | err1: | |||
return NULL; | return NULL; | |||
} | } | |||
GfxShading *GfxRadialShading::copy() { | GfxShading *GfxRadialShading::copy() { | |||
return new GfxRadialShading(this); | return new GfxRadialShading(this); | |||
} | } | |||
skipping to change at line 2637 | skipping to change at line 2659 | |||
double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps]; | double cMin[gfxColorMaxComps], cMax[gfxColorMaxComps]; | |||
double xMul, yMul; | double xMul, yMul; | |||
double cMul[gfxColorMaxComps]; | double cMul[gfxColorMaxComps]; | |||
GfxGouraudVertex *verticesA; | GfxGouraudVertex *verticesA; | |||
int (*trianglesA)[3]; | int (*trianglesA)[3]; | |||
int nCompsA, nVerticesA, nTrianglesA, vertSize, triSize; | int nCompsA, nVerticesA, nTrianglesA, vertSize, triSize; | |||
Guint x, y, flag; | Guint x, y, flag; | |||
Guint c[gfxColorMaxComps]; | Guint c[gfxColorMaxComps]; | |||
GfxShadingBitBuf *bitBuf; | GfxShadingBitBuf *bitBuf; | |||
Object obj1, obj2; | Object obj1, obj2; | |||
GBool ok; | ||||
int i, j, k, state; | int i, j, k, state; | |||
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) { | if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) { | |||
coordBits = obj1.getInt(); | coordBits = obj1.getInt(); | |||
} else { | } else { | |||
error(errSyntaxError, -1, | error(errSyntaxError, -1, | |||
"Missing or invalid BitsPerCoordinate in shading dictionary"); | "Missing or invalid BitsPerCoordinate in shading dictionary"); | |||
goto err2; | goto err2; | |||
} | } | |||
if (coordBits <= 0 || coordBits > 32) { | if (coordBits <= 0 || coordBits > 32) { | |||
skipping to change at line 2845 | skipping to change at line 2868 | |||
shading = new GfxGouraudTriangleShading(typeA, verticesA, nVerticesA, | shading = new GfxGouraudTriangleShading(typeA, verticesA, nVerticesA, | |||
trianglesA, nTrianglesA, | trianglesA, nTrianglesA, | |||
nCompsA, funcsA, nFuncsA); | nCompsA, funcsA, nFuncsA); | |||
if (!shading->init(dict | if (!shading->init(dict | |||
)) { | )) { | |||
delete shading; | delete shading; | |||
return NULL; | return NULL; | |||
} | } | |||
for (i = 0; i < shading->nFuncs; ++i) { | ok = gFalse; | |||
if (shading->funcs[i]->getOutputSize() | if (shading->nFuncs == 0) { | |||
!= shading->getColorSpace()->getNComps()) { | ok = shading->nComps == shading->getColorSpace()->getNComps(); | |||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | } else if (shading->nFuncs == 1) { | |||
delete shading; | ok = shading->funcs[0]->getOutputSize() | |||
return NULL; | == shading->getColorSpace()->getNComps(); | |||
} else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { | ||||
ok = gTrue; | ||||
for (i = 0; i < shading->nFuncs; ++i) { | ||||
ok = ok && shading->funcs[i]->getOutputSize() == 1; | ||||
} | } | |||
} | } | |||
if (!ok) { | ||||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | ||||
delete shading; | ||||
return NULL; | ||||
} | ||||
return shading; | return shading; | |||
err2: | err2: | |||
obj1.free(); | obj1.free(); | |||
err1: | err1: | |||
return NULL; | return NULL; | |||
} | } | |||
GfxShading *GfxGouraudTriangleShading::copy() { | GfxShading *GfxGouraudTriangleShading::copy() { | |||
skipping to change at line 3004 | skipping to change at line 3036 | |||
double cMul[gfxColorMaxComps]; | double cMul[gfxColorMaxComps]; | |||
GfxPatch *patchesA, *p; | GfxPatch *patchesA, *p; | |||
int nCompsA, nPatchesA, patchesSize, nPts, nColors; | int nCompsA, nPatchesA, patchesSize, nPts, nColors; | |||
Guint flag; | Guint flag; | |||
double x[16], y[16]; | double x[16], y[16]; | |||
Guint xi, yi; | Guint xi, yi; | |||
double c[4][gfxColorMaxComps]; | double c[4][gfxColorMaxComps]; | |||
Guint ci; | Guint ci; | |||
GfxShadingBitBuf *bitBuf; | GfxShadingBitBuf *bitBuf; | |||
Object obj1, obj2; | Object obj1, obj2; | |||
GBool ok; | ||||
int i, j; | int i, j; | |||
nPatchesA = 0; | nPatchesA = 0; | |||
patchesA = NULL; | patchesA = NULL; | |||
patchesSize = 0; | patchesSize = 0; | |||
if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) { | if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) { | |||
coordBits = obj1.getInt(); | coordBits = obj1.getInt(); | |||
} else { | } else { | |||
error(errSyntaxError, -1, | error(errSyntaxError, -1, | |||
skipping to change at line 3517 | skipping to change at line 3550 | |||
} | } | |||
shading = new GfxPatchMeshShading(typeA, patchesA, nPatchesA, | shading = new GfxPatchMeshShading(typeA, patchesA, nPatchesA, | |||
nCompsA, funcsA, nFuncsA); | nCompsA, funcsA, nFuncsA); | |||
if (!shading->init(dict | if (!shading->init(dict | |||
)) { | )) { | |||
delete shading; | delete shading; | |||
return NULL; | return NULL; | |||
} | } | |||
for (i = 0; i < shading->nFuncs; ++i) { | ok = gFalse; | |||
if (shading->funcs[i]->getOutputSize() | if (shading->nFuncs == 0) { | |||
!= shading->getColorSpace()->getNComps()) { | ok = shading->nComps == shading->getColorSpace()->getNComps(); | |||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | } else if (shading->nFuncs == 1) { | |||
delete shading; | ok = shading->funcs[0]->getOutputSize() | |||
return NULL; | == shading->getColorSpace()->getNComps(); | |||
} else if (shading->nFuncs == shading->getColorSpace()->getNComps()) { | ||||
ok = gTrue; | ||||
for (i = 0; i < shading->nFuncs; ++i) { | ||||
ok = ok && shading->funcs[i]->getOutputSize() == 1; | ||||
} | } | |||
} | } | |||
if (!ok) { | ||||
error(errSyntaxError, -1, "Invalid function in shading dictionary"); | ||||
delete shading; | ||||
return NULL; | ||||
} | ||||
return shading; | return shading; | |||
err2: | err2: | |||
obj1.free(); | obj1.free(); | |||
err1: | err1: | |||
if (patchesA) { | if (patchesA) { | |||
gfree(patchesA); | gfree(patchesA); | |||
} | } | |||
return NULL; | return NULL; | |||
skipping to change at line 4051 | skipping to change at line 4093 | |||
justMoved = justMoved1; | justMoved = justMoved1; | |||
firstX = firstX1; | firstX = firstX1; | |||
firstY = firstY1; | firstY = firstY1; | |||
size = size1; | size = size1; | |||
n = n1; | n = n1; | |||
subpaths = (GfxSubpath **)gmallocn(size, sizeof(GfxSubpath *)); | subpaths = (GfxSubpath **)gmallocn(size, sizeof(GfxSubpath *)); | |||
for (i = 0; i < n; ++i) | for (i = 0; i < n; ++i) | |||
subpaths[i] = subpaths1[i]->copy(); | subpaths[i] = subpaths1[i]->copy(); | |||
} | } | |||
double GfxPath::getCurX() { | ||||
if (justMoved) { | ||||
return firstX; | ||||
} else if (n > 0) { | ||||
return subpaths[n-1]->getLastX(); | ||||
} else { | ||||
return 0; | ||||
} | ||||
} | ||||
double GfxPath::getCurY() { | ||||
if (justMoved) { | ||||
return firstY; | ||||
} else if (n > 0) { | ||||
return subpaths[n-1]->getLastY(); | ||||
} else { | ||||
return 0; | ||||
} | ||||
} | ||||
void GfxPath::moveTo(double x, double y) { | void GfxPath::moveTo(double x, double y) { | |||
justMoved = gTrue; | justMoved = gTrue; | |||
firstX = x; | firstX = x; | |||
firstY = y; | firstY = y; | |||
} | } | |||
void GfxPath::lineTo(double x, double y) { | void GfxPath::lineTo(double x, double y) { | |||
if (justMoved || (n > 0 && subpaths[n-1]->isClosed())) { | if (justMoved || (n > 0 && subpaths[n-1]->isClosed())) { | |||
if (n >= size) { | if (n >= size) { | |||
size *= 2; | size *= 2; | |||
skipping to change at line 4541 | skipping to change at line 4603 | |||
} | } | |||
if (xMax < clipXMax) { | if (xMax < clipXMax) { | |||
clipXMax = xMax; | clipXMax = xMax; | |||
} | } | |||
if (yMax < clipYMax) { | if (yMax < clipYMax) { | |||
clipYMax = yMax; | clipYMax = yMax; | |||
} | } | |||
} | } | |||
void GfxState::clipToStrokePath() { | void GfxState::clipToStrokePath() { | |||
double xMin, yMin, xMax, yMax, x, y, t0, t1; | // We compute the stroke path bbox in user space (line width and | |||
GfxSubpath *subpath; | // miter limt are handled in user space), and then transform the | |||
int i, j; | // bbox to device space. This can result in a larger-than-needed | |||
// bbox if the matrix isn't "square", but that's ok. | ||||
xMin = xMax = yMin = yMax = 0; // make gcc happy | // | |||
for (i = 0; i < path->getNumSubpaths(); ++i) { | // There are two cases for each point on the path: | |||
subpath = path->getSubpath(i); | // (1) miter join, under miter limit => compute the miter point | |||
for (j = 0; j < subpath->getNumPoints(); ++j) { | // (2) all other joins and caps => use the path point +/- 0.5 * line width | |||
transform(subpath->getX(j), subpath->getY(j), &x, &y); | double xMin = 0, yMin = 0, xMax = 0, yMax = 0; | |||
double w = 0.5 * lineWidth; | ||||
for (int i = 0; i < path->getNumSubpaths(); ++i) { | ||||
GfxSubpath *subpath = path->getSubpath(i); | ||||
for (int j = 0; j < subpath->getNumPoints(); ++j) { | ||||
double x1 = subpath->getX(j); | ||||
double y1 = subpath->getY(j); | ||||
if (i == 0 && j == 0) { | if (i == 0 && j == 0) { | |||
xMin = xMax = x; | xMin = xMax = x1; | |||
yMin = yMax = y; | yMin = yMax = y1; | |||
} else { | } | |||
if (x < xMin) { | GBool useMiter = gFalse; | |||
xMin = x; | if (lineJoin == 0 && // miter join | |||
} else if (x > xMax) { | ((j > 0 && j < subpath->getNumPoints() - 1) || subpath->isClosed())) { | |||
xMax = x; | double x0, y0, x2, y2; | |||
if (j > 0) { | ||||
x0 = subpath->getX(j - 1); | ||||
y0 = subpath->getY(j - 1); | ||||
} else { | ||||
x0 = subpath->getLastX(); | ||||
y0 = subpath->getLastY(); | ||||
} | } | |||
if (y < yMin) { | if (j < subpath->getNumPoints() - 1) { | |||
yMin = y; | x2 = subpath->getX(j + 1); | |||
} else if (y > yMax) { | y2 = subpath->getY(j + 1); | |||
yMax = y; | } else { | |||
x2 = subpath->getX(0); | ||||
y2 = subpath->getY(0); | ||||
} | ||||
if ((fabs(x1 - x0) > 0.0001 || fabs(y1 - y0) > 0.0001) && | ||||
(fabs(x2 - x1) > 0.0001 || fabs(y2 - y1) > 0.0001)) { | ||||
double d01 = 1 / sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); | ||||
double ux = (x1 - x0) * d01; | ||||
double uy = (y1 - y0) * d01; | ||||
double d12 = 1 / sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); | ||||
double vx = (x2 - x1) * d12; | ||||
double vy = (y2 - y1) * d12; | ||||
double dot = -ux * vx - uy * vy; | ||||
if (dot < 0.9999) { | ||||
double miter = sqrt(2 / (1 - dot)); | ||||
if (miter <= miterLimit) { | ||||
double cross = ux * vy - uy * vx; | ||||
double m = sqrt(2 / (1 - dot) - 1); | ||||
double ax, ay; | ||||
if (cross >= 0) { | ||||
ax = x1 + w * uy; | ||||
ay = y1 - w * ux; | ||||
} else { | ||||
ax = x1 - w * uy; | ||||
ay = y1 + w * ux; | ||||
} | ||||
double mx = ax + m * w * ux; | ||||
double my = ay + m * w * uy; | ||||
if (mx < xMin) { | ||||
xMin = mx; | ||||
} else if (mx > xMax) { | ||||
xMax = mx; | ||||
} | ||||
if (my < yMin) { | ||||
yMin = my; | ||||
} else if (my > yMax) { | ||||
yMax = my; | ||||
} | ||||
useMiter = gTrue; | ||||
} | ||||
} | ||||
} | ||||
} | ||||
if (!useMiter) { | ||||
if (x1 - w < xMin) { | ||||
xMin = x1 - w; | ||||
} | ||||
if (x1 + w > xMax) { | ||||
xMax = x1 + w; | ||||
} | ||||
if (y1 - w < yMin) { | ||||
yMin = y1 - w; | ||||
} | ||||
if (y1 + w > yMax) { | ||||
yMax = y1 + w; | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
// allow for the line width | double xx, yy; | |||
//~ miter joins can extend farther than this | transform(xMin, yMin, &xx, &yy); | |||
t0 = fabs(ctm[0]); | if (xx < clipXMin) { | |||
t1 = fabs(ctm[2]); | clipXMin = xx; | |||
if (t0 > t1) { | } else if (xx > clipXMax) { | |||
xMin -= 0.5 * lineWidth * t0; | clipXMax = xx; | |||
xMax += 0.5 * lineWidth * t0; | } | |||
} else { | if (yy < clipYMin) { | |||
xMin -= 0.5 * lineWidth * t1; | clipYMin = yy; | |||
xMax += 0.5 * lineWidth * t1; | } else if (yy > clipYMax) { | |||
} | clipYMax = yy; | |||
t0 = fabs(ctm[0]); | } | |||
t1 = fabs(ctm[3]); | transform(xMin, yMax, &xx, &yy); | |||
if (t0 > t1) { | if (xx < clipXMin) { | |||
yMin -= 0.5 * lineWidth * t0; | clipXMin = xx; | |||
yMax += 0.5 * lineWidth * t0; | } else if (xx > clipXMax) { | |||
} else { | clipXMax = xx; | |||
yMin -= 0.5 * lineWidth * t1; | } | |||
yMax += 0.5 * lineWidth * t1; | if (yy < clipYMin) { | |||
} | clipYMin = yy; | |||
} else if (yy > clipYMax) { | ||||
if (xMin > clipXMin) { | clipYMax = yy; | |||
clipXMin = xMin; | } | |||
} | transform(xMax, yMin, &xx, &yy); | |||
if (yMin > clipYMin) { | if (xx < clipXMin) { | |||
clipYMin = yMin; | clipXMin = xx; | |||
} | } else if (xx > clipXMax) { | |||
if (xMax < clipXMax) { | clipXMax = xx; | |||
clipXMax = xMax; | } | |||
} | if (yy < clipYMin) { | |||
if (yMax < clipYMax) { | clipYMin = yy; | |||
clipYMax = yMax; | } else if (yy > clipYMax) { | |||
clipYMax = yy; | ||||
} | ||||
transform(xMax, yMax, &xx, &yy); | ||||
if (xx < clipXMin) { | ||||
clipXMin = xx; | ||||
} else if (xx > clipXMax) { | ||||
clipXMax = xx; | ||||
} | ||||
if (yy < clipYMin) { | ||||
clipYMin = yy; | ||||
} else if (yy > clipYMax) { | ||||
clipYMax = yy; | ||||
} | } | |||
} | } | |||
void GfxState::clipToRect(double xMin, double yMin, double xMax, double yMax) { | void GfxState::clipToRect(double xMin, double yMin, double xMax, double yMax) { | |||
double x, y, xMin1, yMin1, xMax1, yMax1; | double x, y, xMin1, yMin1, xMax1, yMax1; | |||
transform(xMin, yMin, &x, &y); | transform(xMin, yMin, &x, &y); | |||
xMin1 = xMax1 = x; | xMin1 = xMax1 = x; | |||
yMin1 = yMax1 = y; | yMin1 = yMax1 = y; | |||
transform(xMax, yMin, &x, &y); | transform(xMax, yMin, &x, &y); | |||
End of changes. 20 change blocks. | ||||
84 lines changed or deleted | 224 lines changed or added |