WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch.
textmate stdin O19kuf.txt (text/plain), 13.74 KB, created by
Damian Kaleta
on 2010-05-28 15:32:20 PDT
(
hide
)
Description:
Proposed patch.
Filename:
MIME Type:
Creator:
Damian Kaleta
Created:
2010-05-28 15:32:20 PDT
Size:
13.74 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 60367) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2010-05-28 Damian Kaleta <dkaleta@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Pixel cracks in border images when drawing with a scale factor > 1 >+ https://bugs.webkit.org/show_bug.cgi?id=15720 >+ >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::drawImage): >+ (WebCore::GraphicsContext::drawTiledImage): >+ * platform/graphics/GraphicsContext.h: Added two new methods to support drawing using FloatRect. >+ If the boolean flag roundToPixels is true, the pixels are adjusted with the pixel boundaries. >+ * rendering/RenderBoxModelObject.cpp: >+ (WebCore::RenderBoxModelObject::paintNinePieceImage): >+ > 2010-05-28 Adam Treat <atreat@rim.com> > > Reviewed by Daniel Bates. >Index: WebCore/platform/graphics/GraphicsContext.h >=================================================================== >--- WebCore/platform/graphics/GraphicsContext.h (revision 60363) >+++ WebCore/platform/graphics/GraphicsContext.h (working copy) >@@ -223,12 +223,17 @@ > void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver); > void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); > void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), >- CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); >+ CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, bool roundToPixels = false); > void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, > CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); > void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, > Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, > CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); >+ void drawTiledImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatPoint& srcPoint, const IntSize& tileSize, >+ CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, bool roundToPixels = false); >+ void drawTiledImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, >+ Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, >+ CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, bool roundToPixels = false); > > void setImageInterpolationQuality(InterpolationQuality); > InterpolationQuality imageInterpolationQuality() const; >Index: WebCore/platform/graphics/GraphicsContext.cpp >=================================================================== >--- WebCore/platform/graphics/GraphicsContext.cpp (revision 60363) >+++ WebCore/platform/graphics/GraphicsContext.cpp (working copy) >@@ -382,8 +382,11 @@ > fillRect(font.selectionRectForText(run, point, h, from, to), backgroundColor, colorSpace); > } > >-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale) >+void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale, bool roundToPixels) > { >+ if (roundToPixels) >+ roundToDevicePixels(dest); >+ > if (paintingDisabled() || !image) > return; > >@@ -413,31 +416,50 @@ > > void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale) > { >+ drawTiledImage(image, styleColorSpace, FloatRect(rect), FloatPoint(srcPoint), tileSize, op, useLowQualityScale); >+} >+ >+void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, bool useLowQualityScale) >+{ >+ drawTiledImage(image, styleColorSpace, FloatRect(dest), FloatRect(srcRect), hRule, vRule, op, useLowQualityScale); >+} >+ >+void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const FloatRect& rect, const FloatPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, bool roundToPixels) >+{ >+ FloatRect dstRect(rect); >+ >+ if (roundToPixels) >+ dstRect = roundToDevicePixels(rect); >+ > if (paintingDisabled() || !image) > return; > if (useLowQualityScale) { > save(); > setImageInterpolationQuality(InterpolationLow); > } >- image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op); >+ image->drawTiled(this, dstRect, srcPoint, tileSize, styleColorSpace, op); > if (useLowQualityScale) > restore(); > } > >-void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, bool useLowQualityScale) >+void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, bool useLowQualityScale, bool roundToPixels) > { >+ FloatRect dstRect(dest); >+ >+ if (roundToPixels) >+ dstRect = roundToDevicePixels(dest); >+ > if (paintingDisabled() || !image) > return; >- > if (useLowQualityScale) { > save(); > setImageInterpolationQuality(InterpolationLow); > } > if (hRule == Image::StretchTile && vRule == Image::StretchTile) > // Just do a scale. >- drawImage(image, styleColorSpace, dest, srcRect, op); >+ drawImage(image, styleColorSpace, dstRect, srcRect, op); > else >- image->drawTiled(this, dest, srcRect, hRule, vRule, styleColorSpace, op); >+ image->drawTiled(this, dstRect, srcRect, hRule, vRule, styleColorSpace, op); > if (useLowQualityScale) > restore(); > } >Index: WebCore/rendering/RenderBoxModelObject.cpp >=================================================================== >--- WebCore/rendering/RenderBoxModelObject.cpp (revision 60363) >+++ WebCore/rendering/RenderBoxModelObject.cpp (working copy) >@@ -888,21 +888,20 @@ > // The top left corner rect is (tx, ty, leftWidth, topWidth) > // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice) > if (drawTop) >- graphicsContext->drawImage(image, colorSpace, IntRect(tx, ty, leftWidth, topWidth), >- IntRect(0, 0, leftSlice, topSlice), op); >+ graphicsContext->drawImage(image, colorSpace, FloatRect(tx, ty, leftWidth, topWidth), >+ FloatRect(0, 0, leftSlice, topSlice), op, false, true); > > // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth) > // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice) > if (drawBottom) >- graphicsContext->drawImage(image, colorSpace, IntRect(tx, ty + h - bottomWidth, leftWidth, bottomWidth), >- IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op); >+ graphicsContext->drawImage(image, colorSpace, FloatRect(tx, ty + h - bottomWidth, leftWidth, bottomWidth), >+ FloatRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op, false, true); > > // Paint the left edge. > // Have to scale and tile into the border rect. >- graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx, ty + topWidth, leftWidth, >- h - topWidth - bottomWidth), >- IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice), >- Image::StretchTile, (Image::TileRule)vRule, op); >+ graphicsContext->drawTiledImage(image, colorSpace, FloatRect(tx, ty + topWidth, leftWidth, h - topWidth - bottomWidth), >+ FloatRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice), >+ Image::StretchTile, (Image::TileRule)vRule, op, false, true); > } > > if (drawRight) { >@@ -910,41 +909,38 @@ > // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, topWidth) > // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice) > if (drawTop) >- graphicsContext->drawImage(image, colorSpace, IntRect(tx + w - rightWidth, ty, rightWidth, topWidth), >- IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op); >+ graphicsContext->drawImage(image, colorSpace, FloatRect(tx + w - rightWidth, ty, rightWidth, topWidth), >+ FloatRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op, false, true); > > // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth) > // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice) > if (drawBottom) >- graphicsContext->drawImage(image, colorSpace, IntRect(tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth), >- IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op); >+ graphicsContext->drawImage(image, colorSpace, FloatRect(tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth), >+ FloatRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op, false, true); > > // Paint the right edge. >- graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + w - rightWidth, ty + topWidth, rightWidth, >- h - topWidth - bottomWidth), >- IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice), >- Image::StretchTile, (Image::TileRule)vRule, op); >+ graphicsContext->drawTiledImage(image, colorSpace, graphicsContext->roundToDevicePixels(FloatRect(tx + w - rightWidth, ty + topWidth, rightWidth, h - topWidth - bottomWidth)), >+ FloatRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice), >+ Image::StretchTile, (Image::TileRule)vRule, op, false, true); > } > > // Paint the top edge. > if (drawTop) >- graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty, w - leftWidth - rightWidth, topWidth), >- IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice), >- (Image::TileRule)hRule, Image::StretchTile, op); >+ graphicsContext->drawTiledImage(image, colorSpace, FloatRect(tx + leftWidth, ty, w - leftWidth - rightWidth, topWidth), >+ FloatRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice), >+ (Image::TileRule)hRule, Image::StretchTile, op, false, true); > > // Paint the bottom edge. > if (drawBottom) >- graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty + h - bottomWidth, >- w - leftWidth - rightWidth, bottomWidth), >- IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice), >- (Image::TileRule)hRule, Image::StretchTile, op); >+ graphicsContext->drawTiledImage(image, colorSpace, FloatRect(tx + leftWidth, ty + h - bottomWidth, w - leftWidth - rightWidth, bottomWidth), >+ FloatRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice), >+ (Image::TileRule)hRule, Image::StretchTile, op, false, true); > > // Paint the middle. > if (drawMiddle) >- graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty + topWidth, w - leftWidth - rightWidth, >- h - topWidth - bottomWidth), >- IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice), >- (Image::TileRule)hRule, (Image::TileRule)vRule, op); >+ graphicsContext->drawTiledImage(image, colorSpace, FloatRect(tx + leftWidth, ty + topWidth, w - leftWidth - rightWidth, h - topWidth - bottomWidth), >+ FloatRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice), >+ (Image::TileRule)hRule, (Image::TileRule)vRule, op, false, true); > > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
eric
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 15720
:
16896
|
56917
|
56920
|
57389