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

Unified Diff: Source/platform/graphics/Image.h

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: pdr corrections + needsrebaselines Created 5 years, 7 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/platform/graphics/Image.h
diff --git a/Source/platform/graphics/Image.h b/Source/platform/graphics/Image.h
index 9ce321aecd348438217877392990d2074ade5be6..838de7e3bb5be7915feeb18cb0e7ea1931a67373 100644
--- a/Source/platform/graphics/Image.h
+++ b/Source/platform/graphics/Image.h
@@ -33,7 +33,7 @@
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/ImageAnimationPolicy.h"
#include "platform/graphics/ImageOrientation.h"
-#include "third_party/skia/include/core/SkXfermode.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "wtf/Assertions.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -52,10 +52,19 @@ class FloatSize;
class GraphicsContext;
class Length;
class SharedBuffer;
+class Image;
// This class gets notified when an image creates or destroys decoded frames and when it advances animation frames.
class ImageObserver;
+class ImageFilterQualityHelper {
+public:
+ virtual SkFilterQuality computeFilterQuality(Image*, const FloatRect& dest, const FloatRect& src) const = 0;
+ virtual bool shouldClampToSourceRect() const = 0;
+ virtual bool shouldDrawAntiAliased(const FloatRect&destRect) const = 0;
+ virtual ~ImageFilterQualityHelper() { }
+};
+
class PLATFORM_EXPORT Image : public RefCounted<Image> {
friend class GeneratedImage;
friend class CrossfadeGeneratedImage;
@@ -70,6 +79,8 @@ public:
virtual bool isSVGImage() const { return false; }
virtual bool isBitmapImage() const { return false; }
+ virtual bool isLazyDecodedBitmap() { return false; }
+ virtual bool isImmutableBitmap() { return false; }
virtual bool currentFrameKnownToBeOpaque() = 0;
virtual PassRefPtr<SkImage> skImage();
@@ -138,13 +149,14 @@ public:
virtual bool notSolidColor() { return true; }
#endif
+ virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, const ImageFilterQualityHelper*) = 0;
Stephen White 2015/05/27 15:46:02 To be honest, I'm not a fan of this callback objec
+
protected:
Image(ImageObserver* = 0);
static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, const Color&, SkXfermode::Mode);
static FloatRect adjustForNegativeSize(const FloatRect&); // A helper method for translating negative width and height values.
- virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, SkXfermode::Mode, RespectImageOrientationEnum) = 0;
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
SkXfermode::Mode, const IntSize& repeatSpacing);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfermode::Mode);

Powered by Google App Engine
This is Rietveld 408576698