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

Side by Side Diff: Source/core/platform/graphics/Image.h

Issue 16357011: Remove support for -webkit-color-correction (which we've never supported on (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resolve merge conflicts, obey brace style changes Created 7 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 10 matching lines...) Expand all
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef Image_h 27 #ifndef Image_h
28 #define Image_h 28 #define Image_h
29 29
30 #include "core/platform/graphics/Color.h" 30 #include "core/platform/graphics/Color.h"
31 #include "core/platform/graphics/ColorSpace.h"
32 #include "core/platform/graphics/GraphicsTypes.h" 31 #include "core/platform/graphics/GraphicsTypes.h"
33 #include "core/platform/graphics/ImageOrientation.h" 32 #include "core/platform/graphics/ImageOrientation.h"
34 #include "core/platform/graphics/IntRect.h" 33 #include "core/platform/graphics/IntRect.h"
35 #include "core/platform/graphics/NativeImagePtr.h" 34 #include "core/platform/graphics/NativeImagePtr.h"
36 #include "third_party/skia/include/core/SkXfermode.h" 35 #include "third_party/skia/include/core/SkXfermode.h"
37 #include <wtf/PassRefPtr.h> 36 #include <wtf/PassRefPtr.h>
38 #include <wtf/RefCounted.h> 37 #include <wtf/RefCounted.h>
39 #include <wtf/RefPtr.h> 38 #include <wtf/RefPtr.h>
40 #include <wtf/RetainPtr.h> 39 #include <wtf/RetainPtr.h>
41 #include <wtf/text/WTFString.h> 40 #include <wtf/text/WTFString.h>
(...skipping 12 matching lines...) Expand all
54 class ImageObserver; 53 class ImageObserver;
55 54
56 class Image : public RefCounted<Image> { 55 class Image : public RefCounted<Image> {
57 friend class GeneratedImage; 56 friend class GeneratedImage;
58 friend class CrossfadeGeneratedImage; 57 friend class CrossfadeGeneratedImage;
59 friend class GeneratorGeneratedImage; 58 friend class GeneratorGeneratedImage;
60 friend class GraphicsContext; 59 friend class GraphicsContext;
61 60
62 public: 61 public:
63 virtual ~Image(); 62 virtual ~Image();
64 63
65 static PassRefPtr<Image> create(ImageObserver* = 0); 64 static PassRefPtr<Image> create(ImageObserver* = 0);
66 static PassRefPtr<Image> loadPlatformResource(const char* name); 65 static PassRefPtr<Image> loadPlatformResource(const char* name);
67 static bool supportsType(const String&); 66 static bool supportsType(const String&);
68 67
69 virtual bool isSVGImage() const { return false; } 68 virtual bool isSVGImage() const { return false; }
70 virtual bool isBitmapImage() const { return false; } 69 virtual bool isBitmapImage() const { return false; }
71 virtual bool currentFrameKnownToBeOpaque() = 0; 70 virtual bool currentFrameKnownToBeOpaque() = 0;
72 71
73 // Derived classes should override this if they can assure that 72 // Derived classes should override this if they can assure that
74 // the image contains only resources from its own security origin. 73 // the image contains only resources from its own security origin.
75 virtual bool hasSingleSecurityOrigin() const { return false; } 74 virtual bool hasSingleSecurityOrigin() const { return false; }
76 75
77 static Image* nullImage(); 76 static Image* nullImage();
78 bool isNull() const { return size().isEmpty(); } 77 bool isNull() const { return size().isEmpty(); }
79 78
80 virtual void setContainerSize(const IntSize&) { } 79 virtual void setContainerSize(const IntSize&) { }
81 virtual bool usesContainerSize() const { return false; } 80 virtual bool usesContainerSize() const { return false; }
82 virtual bool hasRelativeWidth() const { return false; } 81 virtual bool hasRelativeWidth() const { return false; }
83 virtual bool hasRelativeHeight() const { return false; } 82 virtual bool hasRelativeHeight() const { return false; }
84 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio); 83 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio);
85 84
86 virtual IntSize size() const = 0; 85 virtual IntSize size() const = 0;
87 IntRect rect() const { return IntRect(IntPoint(), size()); } 86 IntRect rect() const { return IntRect(IntPoint(), size()); }
88 int width() const { return size().width(); } 87 int width() const { return size().width(); }
89 int height() const { return size().height(); } 88 int height() const { return size().height(); }
90 virtual bool getHotSpot(IntPoint&) const { return false; } 89 virtual bool getHotSpot(IntPoint&) const { return false; }
91 90
92 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); 91 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived);
93 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } 92 virtual bool dataChanged(bool /*allDataReceived*/) { return false; }
94 93
95 virtual String filenameExtension() const { return String(); } // null string if unknown 94 virtual String filenameExtension() const { return String(); } // null string if unknown
96 95
97 virtual void destroyDecodedData() = 0; 96 virtual void destroyDecodedData() = 0;
98 virtual unsigned decodedSize() const = 0; 97 virtual unsigned decodedSize() const = 0;
99 98
100 SharedBuffer* data() { return m_encodedImageData.get(); } 99 SharedBuffer* data() { return m_encodedImageData.get(); }
101 100
102 // Animation begins whenever someone draws the image, so startAnimation() is not normally called. 101 // Animation begins whenever someone draws the image, so startAnimation() is not normally called.
103 // It will automatically pause once all observers no longer want to render t he image anywhere. 102 // It will automatically pause once all observers no longer want to render t he image anywhere.
104 virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { } 103 virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { }
105 virtual void stopAnimation() {} 104 virtual void stopAnimation() {}
106 virtual void resetAnimation() {} 105 virtual void resetAnimation() {}
107 106
108 // Typically the CachedImage that owns us. 107 // Typically the CachedImage that owns us.
109 ImageObserver* imageObserver() const { return m_imageObserver; } 108 ImageObserver* imageObserver() const { return m_imageObserver; }
110 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer; } 109 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer; }
111 110
112 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; 111 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile };
113 112
114 virtual PassNativeImagePtr nativeImageForCurrentFrame() { return 0; } 113 virtual PassNativeImagePtr nativeImageForCurrentFrame() { return 0; }
115 114
116 virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const A ffineTransform& patternTransform, 115 virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const A ffineTransform& patternTransform,
117 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal); 116 const FloatPoint& phase, CompositeOperator, const FloatRect& destRect, B lendMode = BlendModeNormal);
118 117
119 #if !ASSERT_DISABLED 118 #if !ASSERT_DISABLED
120 virtual bool notSolidColor() { return true; } 119 virtual bool notSolidColor() { return true; }
121 #endif 120 #endif
122 121
123 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 122 virtual void reportMemoryUsage(MemoryObjectInfo*) const;
124 123
125 protected: 124 protected:
126 Image(ImageObserver* = 0); 125 Image(ImageObserver* = 0);
127 126
128 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c onst Color&, ColorSpace styleColorSpace, CompositeOperator); 127 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c onst Color&, CompositeOperator);
129 static FloatRect adjustForNegativeSize(const FloatRect&); // A helper method for translating negative width and height values. 128 static FloatRect adjustForNegativeSize(const FloatRect&); // A helper method for translating negative width and height values.
130 129
131 // FIXME (crbug.com/242060): This does not belong on Image. 130 // FIXME (crbug.com/242060): This does not belong on Image.
132 static void paintSkBitmap(GraphicsContext*, const NativeImageSkia&, const Sk Rect& /*srcRect*/, const SkRect& /*destRect*/, const SkXfermode::Mode&); 131 static void paintSkBitmap(GraphicsContext*, const NativeImageSkia&, const Sk Rect& /*srcRect*/, const SkRect& /*destRect*/, const SkXfermode::Mode&);
133 132
134 // The ColorSpace parameter will only be used for untagged images. 133 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, BlendMode) = 0;
135 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode) = 0; 134 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum);
136 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, RespectIma geOrientationEnum); 135 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
137 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace,
138 CompositeOperator , BlendMode); 136 CompositeOperator , BlendMode);
139 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, Color Space styleColorSpace, CompositeOperator); 137 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, Compo siteOperator);
140 138
141 // Supporting tiled drawing 139 // Supporting tiled drawing
142 virtual bool mayFillWithSolidColor() { return false; } 140 virtual bool mayFillWithSolidColor() { return false; }
143 virtual Color solidColor() const { return Color(); } 141 virtual Color solidColor() const { return Color(); }
144 142
145 private: 143 private:
146 RefPtr<SharedBuffer> m_encodedImageData; 144 RefPtr<SharedBuffer> m_encodedImageData;
147 ImageObserver* m_imageObserver; 145 ImageObserver* m_imageObserver;
148 }; 146 };
149 147
150 } 148 }
151 149
152 #endif 150 #endif
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/GraphicsContextState.h ('k') | Source/core/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698