Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Unified Diff: Source/core/platform/graphics/GraphicsContext.cpp

Issue 19705006: Use SkImage as a backing store for copying 2d Contexts to ImageBitmaps. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/GraphicsContext.cpp
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index c9da39c0e1a3c6ff6f3253f8e695f52315c73e6a..0a18abb222f84ec43a5096d5beb842dcd5be6452 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -39,6 +39,7 @@
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkDevice.h"
+#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
@@ -1017,6 +1018,24 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float
setImageInterpolationQuality(previousInterpolationQuality);
}
+void GraphicsContext::drawImage(SkImage* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
+{
+ if (paintingDisabled() || !image)
+ return;
+
+ InterpolationQuality previousInterpolationQuality = InterpolationDefault;
+
+ if (useLowQualityScale) {
+ previousInterpolationQuality = imageInterpolationQuality();
+ setImageInterpolationQuality(InterpolationLow);
+ }
+
+ image->draw(canvas(), dest, src, 0);
+
+ if (useLowQualityScale)
+ setImageInterpolationQuality(previousInterpolationQuality);
+}
+
void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, BlendMode blendMode)
{
if (paintingDisabled() || !image)

Powered by Google App Engine
This is Rietveld 408576698