Snap edges to pixels rather than sizes. b=371225 r=vlad

This commit is contained in:
dbaron%dbaron.org 2007-02-23 17:50:32 +00:00
Родитель 1b25f2ca26
Коммит ce9b0a8211
2 изменённых файлов: 25 добавлений и 27 удалений

Просмотреть файл

@ -994,18 +994,19 @@ nsThebesRenderingContext::DrawImage(imgIContainer *aImage,
// and has nothing to do with the current transform (it's a region // and has nothing to do with the current transform (it's a region
// of the image) // of the image)
double p2a = nsIDeviceContext::AppUnitsPerCSSPixel(); double p2a = nsIDeviceContext::AppUnitsPerCSSPixel();
nsIntRect pxSr(NSAppUnitsToIntPixels(twSrcRect.x, p2a), nsIntRect pxSr;
NSAppUnitsToIntPixels(twSrcRect.y, p2a), pxSr.x = NSAppUnitsToIntPixels(twSrcRect.x, p2a);
NSAppUnitsToIntPixels(twSrcRect.width, p2a), pxSr.y = NSAppUnitsToIntPixels(twSrcRect.y, p2a);
NSAppUnitsToIntPixels(twSrcRect.height, p2a)); pxSr.width = NSAppUnitsToIntPixels(twSrcRect.XMost(), p2a) - pxSr.x;
pxSr.height = NSAppUnitsToIntPixels(twSrcRect.YMost(), p2a) - pxSr.y;
// the dest rect is affected by the current transform; that'll be // the dest rect is affected by the current transform; that'll be
// handled by Image::Draw(), when we actually set up the rectangle. // handled by Image::Draw(), when we actually set up the rectangle.
nsIntRect pxDr; nsIntRect pxDr;
pxDr.x = NSToIntRound(FROM_TWIPS(twDestRect.x)); pxDr.x = FROM_TWIPS_INT(twDestRect.x);
pxDr.y = NSToIntRound(FROM_TWIPS(twDestRect.y)); pxDr.y = FROM_TWIPS_INT(twDestRect.y);
pxDr.width = NSToIntRound(FROM_TWIPS(twDestRect.width)); pxDr.width = FROM_TWIPS_INT(twDestRect.XMost()) - pxDr.x;
pxDr.height = NSToIntRound(FROM_TWIPS(twDestRect.height)); pxDr.height = FROM_TWIPS_INT(twDestRect.YMost()) - pxDr.y;
// If we were asked to draw a 0-width or 0-height image, // If we were asked to draw a 0-width or 0-height image,
// as either the src or dst, just bail; we can't do anything // as either the src or dst, just bail; we can't do anything

Просмотреть файл

@ -51,36 +51,33 @@ fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == border-top-6.html border-top-10-ref.htm
!= background-image-base.html background-image-height-10-ref.html != background-image-base.html background-image-height-10-ref.html
== background-image-height-4.html background-image-base.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-height-4.html background-image-base.html # bug 371316
fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == background-image-height-5.html background-image-height-10-ref.html # bug 371225 fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == background-image-height-5.html background-image-height-10-ref.html # bug 371316
== background-image-height-6.html background-image-height-10-ref.html == background-image-height-6.html background-image-height-10-ref.html
!= background-image-base.html background-image-top-10-ref.html != background-image-base.html background-image-top-10-ref.html
== background-image-top-4.html background-image-base.html == background-image-top-4.html background-image-base.html
== background-image-top-5.html background-image-top-10-ref.html == background-image-top-5.html background-image-top-10-ref.html
== background-image-top-6.html background-image-top-10-ref.html == background-image-top-6.html background-image-top-10-ref.html
!= background-image-base.html background-image-width-10-ref.html != background-image-base.html background-image-width-10-ref.html
== background-image-width-4.html background-image-base.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-width-4.html background-image-base.html # bug 371316
fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == background-image-width-5.html background-image-width-10-ref.html # bug 371225 fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == background-image-width-5.html background-image-width-10-ref.html # bug 371316
== background-image-width-6.html background-image-width-10-ref.html == background-image-width-6.html background-image-width-10-ref.html
!= background-image-base.html background-image-left-10-ref.html != background-image-base.html background-image-left-10-ref.html
== background-image-left-4.html background-image-base.html == background-image-left-4.html background-image-base.html
== background-image-left-5.html background-image-left-10-ref.html == background-image-left-5.html background-image-left-10-ref.html
== background-image-left-6.html background-image-left-10-ref.html == background-image-left-6.html background-image-left-10-ref.html
# These tests have different patterns of failures on different fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-top-height-4.html background-image-height-4.html # bug 371316
# platforms. It doesn't make sense yet, but once bug 371225 is fixed fails-if(MOZ_WIDGET_TOOLKIT=="windows") == background-image-top-height-5.html background-image-height-5.html # bug 371316
# they might make more sense. == background-image-top-height-6.html background-image-height-6.html
random == background-image-top-height-4.html background-image-height-4.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-left-width-4.html background-image-width-4.html # bug 371316
random == background-image-top-height-5.html background-image-height-5.html fails-if(MOZ_WIDGET_TOOLKIT=="windows") == background-image-left-width-5.html background-image-width-5.html # bug 371316
random == background-image-top-height-6.html background-image-height-6.html == background-image-left-width-6.html background-image-width-6.html
random == background-image-left-width-4.html background-image-width-4.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-height-top-4.html background-image-height-4.html # bug 371316
random == background-image-left-width-5.html background-image-width-5.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == background-image-height-top-5.html background-image-height-5.html # bug 371316
random == background-image-left-width-6.html background-image-width-6.html fails-if(MOZ_WIDGET_TOOLKIT=="windows") == background-image-height-top-6.html background-image-height-6.html # bug 371316
random == background-image-height-top-4.html background-image-height-4.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-width-left-4.html background-image-width-4.html # bug 371316
random == background-image-height-top-5.html background-image-height-5.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == background-image-width-left-5.html background-image-width-5.html # bug 371316
random == background-image-height-top-6.html background-image-height-6.html fails-if(MOZ_WIDGET_TOOLKIT=="windows") == background-image-width-left-6.html background-image-width-6.html # bug 371316
random == background-image-width-left-4.html background-image-width-4.html
random == background-image-width-left-5.html background-image-width-5.html
random == background-image-width-left-6.html background-image-width-6.html
# These all fail due to any of bug 371182, bug 155955, and maybe also # These all fail due to any of bug 371182, bug 155955, and maybe also