summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/GraphicsContext.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /WebCore/platform/graphics/GraphicsContext.cpp
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'WebCore/platform/graphics/GraphicsContext.cpp')
-rw-r--r--WebCore/platform/graphics/GraphicsContext.cpp53
1 files changed, 28 insertions, 25 deletions
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index ec15d26..52312a4 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -404,25 +404,27 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const
th = image->height();
if (useLowQualityScale) {
- save();
+ InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
+ // FIXME: Should be InterpolationLow
setImageInterpolationQuality(InterpolationNone);
- }
- image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
- if (useLowQualityScale)
- restore();
+ image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
+ setImageInterpolationQuality(previousInterpolationQuality);
+ } else
+ image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
}
void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale)
{
if (paintingDisabled() || !image)
return;
+
if (useLowQualityScale) {
- save();
+ InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
setImageInterpolationQuality(InterpolationLow);
- }
- image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op);
- if (useLowQualityScale)
- restore();
+ image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op);
+ setImageInterpolationQuality(previousInterpolationQuality);
+ } else
+ image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op);
}
void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, bool useLowQualityScale)
@@ -430,17 +432,19 @@ void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, c
if (paintingDisabled() || !image)
return;
- if (useLowQualityScale) {
- save();
- setImageInterpolationQuality(InterpolationLow);
- }
- if (hRule == Image::StretchTile && vRule == Image::StretchTile)
+ if (hRule == Image::StretchTile && vRule == Image::StretchTile) {
// Just do a scale.
drawImage(image, styleColorSpace, dest, srcRect, op);
- else
+ return;
+ }
+
+ if (useLowQualityScale) {
+ InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
+ setImageInterpolationQuality(InterpolationLow);
+ image->drawTiled(this, dest, srcRect, hRule, vRule, styleColorSpace, op);
+ setImageInterpolationQuality(previousInterpolationQuality);
+ } else
image->drawTiled(this, dest, srcRect, hRule, vRule, styleColorSpace, op);
- if (useLowQualityScale)
- restore();
}
void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
@@ -484,14 +488,13 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorS
th = image->height();
if (useLowQualityScale) {
- save();
+ InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
+ // FIXME: Should be InterpolationLow
setImageInterpolationQuality(InterpolationNone);
- }
-
- image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale);
-
- if (useLowQualityScale)
- restore();
+ image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale);
+ setImageInterpolationQuality(previousInterpolationQuality);
+ } else
+ image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale);
}
void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,