diff options
author | Mike Reed <reed@google.com> | 2009-09-25 12:02:27 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2009-09-25 12:58:05 -0400 |
commit | 546e1baf07e19b1a2cbc746e1b08e6e6e317862f (patch) | |
tree | 6a9ccd26ca3e9c4704dbcb393c874a4d8ab3d8f5 /WebCore | |
parent | 28e09963cd0ab02a20ddd0b687e55f97921445cc (diff) | |
download | external_webkit-546e1baf07e19b1a2cbc746e1b08e6e6e317862f.zip external_webkit-546e1baf07e19b1a2cbc746e1b08e6e6e317862f.tar.gz external_webkit-546e1baf07e19b1a2cbc746e1b08e6e6e317862f.tar.bz2 |
disable antialiasing for bitmaps
Since we are never rotated, and when we are zoomed, the
antialiasing can double-draw the shared border for images that are meant to seam (ala nine-patch)
http://b/issue?id=2105990&cookieId=2009268085657820
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/ImageAndroid.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp index 93aacbc..16a450f 100644 --- a/WebCore/platform/graphics/android/ImageAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageAndroid.cpp @@ -172,6 +172,19 @@ static void round_scaled(SkIRect* dst, const WebCore::FloatRect& src, SkScalarRound(SkFloatToScalar((src.y() + src.height()) * sy))); } +static inline void fixPaintForBitmapsThatMaySeam(SkPaint* paint) { + /* Bitmaps may be drawn to seem next to other images. If we are drawn + zoomed, or at fractional coordinates, we may see cracks/edges if + we antialias, because that will cause us to draw the same pixels + more than once (e.g. from the left and right bitmaps that share + an edge). + + Disabling antialiasing fixes this, and since so far we are never + rotated at non-multiple-of-90 angles, this seems to do no harm + */ + paint->setAntiAlias(false); +} + void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) { @@ -214,6 +227,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, ctxt->setupFillPaint(&paint); // need global alpha among other things paint.setFilterBitmap(true); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp)); + fixPaintForBitmapsThatMaySeam(&paint); canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint); #ifdef TRACE_SUBSAMPLED_BITMAPS @@ -287,6 +301,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, // now paint is the only owner of shader paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp)); paint.setFilterBitmap(true); + fixPaintForBitmapsThatMaySeam(&paint); SkMatrix matrix(patternTransform); |