b=455976; wrong extend mode used for macosx for border-image

This commit is contained in:
Vladimir Vukicevic 2008-09-25 12:49:55 -07:00
parent 35aa89f44e
commit 596295f6f9
3 changed files with 38 additions and 2 deletions

View File

@ -71,7 +71,17 @@ public:
EXTEND_NONE,
EXTEND_REPEAT,
EXTEND_REFLECT,
EXTEND_PAD
EXTEND_PAD,
// Our own private flag for setting either NONE or PAD,
// depending on what the platform does for NONE. This is only
// relevant for surface patterns; for all other patterns, it
// behaves identical to PAD. On MacOS X, this becomes "NONE",
// because Quartz does the thing that we want at image edges;
// similarily on the win32 printing surface, since
// everything's done with GDI there. On other platforms, it
// usually becomes PAD.
EXTEND_PAD_EDGE = 1000
};
// none, repeat, reflect

View File

@ -118,6 +118,32 @@ gfxPattern::GetMatrix() const
void
gfxPattern::SetExtend(GraphicsExtend extend)
{
if (extend == EXTEND_PAD_EDGE) {
if (cairo_pattern_get_type(mPattern) == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_t *surf = NULL;
cairo_pattern_get_surface (mPattern, &surf);
if (surf) {
switch (cairo_surface_get_type(surf)) {
case CAIRO_SURFACE_TYPE_XLIB:
case CAIRO_SURFACE_TYPE_WIN32_PRINTING:
case CAIRO_SURFACE_TYPE_QUARTZ:
extend = EXTEND_NONE;
break;
case CAIRO_SURFACE_TYPE_WIN32:
default:
extend = EXTEND_PAD;
break;
}
}
}
// if something went wrong, or not a surface pattern, use PAD
if (extend == EXTEND_PAD_EDGE)
extend = EXTEND_PAD;
}
cairo_pattern_set_extend(mPattern, (cairo_extend_t)extend);
}

View File

@ -2319,7 +2319,7 @@ DrawBorderImageSide(gfxContext *aThebesContext,
gfxFloat hScale(1.0), vScale(1.0);
nsRefPtr<gfxPattern> pattern = new gfxPattern(interSurface);
pattern->SetExtend(gfxPattern::EXTEND_PAD);
pattern->SetExtend(gfxPattern::EXTEND_PAD_EDGE);
switch (aHFillType) {
case NS_STYLE_BORDER_IMAGE_REPEAT:
renderOffset.x = (rectSize.width - aInterSize.width*NS_ceil(rectSize.width/aInterSize.width))*-0.5;