summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-25 13:00:04 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-25 13:00:04 -0400
commit6f855d88ef8d1b401944d290772a26222b61a505 (patch)
treed19566d83b1301c53e9a55266e2e50f45fc39051 /WebCore
parent22a6ea4bb37dc6e22fb998cf887d9fa6de07bdc6 (diff)
parent546e1baf07e19b1a2cbc746e1b08e6e6e317862f (diff)
downloadexternal_webkit-6f855d88ef8d1b401944d290772a26222b61a505.zip
external_webkit-6f855d88ef8d1b401944d290772a26222b61a505.tar.gz
external_webkit-6f855d88ef8d1b401944d290772a26222b61a505.tar.bz2
Merge change 27041 into eclair
* changes: disable antialiasing for bitmaps
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/platform/graphics/android/ImageAndroid.cpp15
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);