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

Side by Side Diff: Source/platform/graphics/ImageBuffer.h

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/Image.cpp ('k') | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 10 matching lines...) Expand all
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef ImageBuffer_h 28 #ifndef ImageBuffer_h
29 #define ImageBuffer_h 29 #define ImageBuffer_h
30 30
31 #include "core/platform/graphics/GraphicsContext.h" 31 #include "platform/PlatformExport.h"
32 #include "core/platform/graphics/Canvas2DLayerBridge.h"
33 #include "platform/geometry/FloatRect.h" 32 #include "platform/geometry/FloatRect.h"
34 #include "platform/geometry/IntSize.h" 33 #include "platform/geometry/IntSize.h"
34 #include "platform/graphics/Canvas2DLayerBridge.h"
35 #include "platform/graphics/ColorSpace.h" 35 #include "platform/graphics/ColorSpace.h"
36 #include "platform/graphics/GraphicsContext.h"
36 #include "platform/graphics/GraphicsTypes.h" 37 #include "platform/graphics/GraphicsTypes.h"
37 #include "platform/graphics/GraphicsTypes3D.h" 38 #include "platform/graphics/GraphicsTypes3D.h"
38 #include "platform/transforms/AffineTransform.h" 39 #include "platform/transforms/AffineTransform.h"
39 #include "wtf/Forward.h" 40 #include "wtf/Forward.h"
40 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
41 #include "wtf/PassOwnPtr.h" 42 #include "wtf/PassOwnPtr.h"
42 #include "wtf/PassRefPtr.h" 43 #include "wtf/PassRefPtr.h"
43 #include "wtf/Uint8ClampedArray.h" 44 #include "wtf/Uint8ClampedArray.h"
44 #include "wtf/Vector.h" 45 #include "wtf/Vector.h"
45 46
(...skipping 28 matching lines...) Expand all
74 enum ScaleBehavior { 75 enum ScaleBehavior {
75 Scaled, 76 Scaled,
76 Unscaled 77 Unscaled
77 }; 78 };
78 79
79 enum OpacityMode { 80 enum OpacityMode {
80 NonOpaque, 81 NonOpaque,
81 Opaque, 82 Opaque,
82 }; 83 };
83 84
84 class ImageBuffer { 85 class PLATFORM_EXPORT ImageBuffer {
85 WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED; 86 WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
86 public: 87 public:
87 // Will return a null pointer on allocation failure. 88 // Will return a null pointer on allocation failure.
88 static PassOwnPtr<ImageBuffer> create(const IntSize& size, float resolutionS cale = 1, RenderingMode renderingMode = Unaccelerated, OpacityMode opacityMode = NonOpaque, int acceleratedMSAASampleCount = 0) 89 static PassOwnPtr<ImageBuffer> create(const IntSize& size, float resolutionS cale = 1, RenderingMode renderingMode = Unaccelerated, OpacityMode opacityMode = NonOpaque, int acceleratedMSAASampleCount = 0)
89 { 90 {
90 bool success = false; 91 bool success = false;
91 OwnPtr<ImageBuffer> buf = adoptPtr(new ImageBuffer(size, resolutionScale , renderingMode, opacityMode, acceleratedMSAASampleCount, success)); 92 OwnPtr<ImageBuffer> buf = adoptPtr(new ImageBuffer(size, resolutionScale , renderingMode, opacityMode, acceleratedMSAASampleCount, success));
92 if (!success) 93 if (!success)
93 return nullptr; 94 return nullptr;
94 return buf.release(); 95 return buf.release();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 struct ImageDataBuffer { 162 struct ImageDataBuffer {
162 ImageDataBuffer(const IntSize& size, PassRefPtr<Uint8ClampedArray> data) : m _size(size), m_data(data) { } 163 ImageDataBuffer(const IntSize& size, PassRefPtr<Uint8ClampedArray> data) : m _size(size), m_data(data) { }
163 IntSize size() const { return m_size; } 164 IntSize size() const { return m_size; }
164 unsigned char* data() const { return m_data->data(); } 165 unsigned char* data() const { return m_data->data(); }
165 166
166 IntSize m_size; 167 IntSize m_size;
167 RefPtr<Uint8ClampedArray> m_data; 168 RefPtr<Uint8ClampedArray> m_data;
168 }; 169 };
169 170
170 String ImageDataToDataURL(const ImageDataBuffer&, const String& mimeType, const double* quality); 171 String PLATFORM_EXPORT ImageDataToDataURL(const ImageDataBuffer&, const String& mimeType, const double* quality);
171 172
172 } // namespace WebCore 173 } // namespace WebCore
173 174
174 #endif // ImageBuffer_h 175 #endif // ImageBuffer_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/Image.cpp ('k') | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698