зеркало из https://github.com/mozilla/gecko-dev.git
Bug 348610 - Cairo degenerate path values are in device units. r=tor, sr=roc
This commit is contained in:
Родитель
f523dcb211
Коммит
d59c6344f6
|
@ -431,12 +431,10 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
|||
|
||||
SetupCairoStrokeGeometry(ctx);
|
||||
cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||
if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) {
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
if (!IsDegeneratePath(xmin, ymin, xmax, ymax))
|
||||
mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
cairo_destroy(ctx);
|
||||
|
||||
|
@ -502,14 +500,17 @@ nsSVGPathGeometryFrame::GetBBox(nsIDOMSVGRect **_retval)
|
|||
|
||||
cairo_fill_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
|
||||
if (IsDegeneratePath(xmin, ymin, xmax, ymax)) {
|
||||
/* cairo_stroke_extents doesn't work with stroke width zero, fudge */
|
||||
cairo_set_line_width(ctx, 0.0001);
|
||||
cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||
}
|
||||
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
}
|
||||
|
||||
cairo_destroy(ctx);
|
||||
|
||||
|
|
|
@ -135,12 +135,19 @@ private:
|
|||
|
||||
/*
|
||||
* Check for what cairo returns for the fill extents of a degenerate path
|
||||
*
|
||||
* @param xmin the minimum x value in device units
|
||||
* @param ymin the minimum y value in device units
|
||||
* @param xmax the maximum x value in device units
|
||||
* @param ymax the maximum y value in device units
|
||||
*
|
||||
* @return PR_TRUE if the path is degenerate
|
||||
*/
|
||||
static PRBool
|
||||
IsDegeneratePath(double xmin, double ymin, double xmax, double ymax)
|
||||
{
|
||||
return (xmin == 32767 && ymin == 32767 &&
|
||||
xmax == -32768 && ymax == -32768);
|
||||
return (fabs(xmin - 32767) < 1 && fabs(ymin - 32767) < 1 &&
|
||||
fabs(xmax + 32768) < 1 && fabs(ymax + 32768) < 1);
|
||||
}
|
||||
|
||||
nsSVGMarkerProperty *GetMarkerProperty();
|
||||
|
|
Загрузка…
Ссылка в новой задаче