| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 #include "platform/transforms/AffineTransform.h" | 39 #include "platform/transforms/AffineTransform.h" |
| 40 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 41 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
| 43 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
| 44 #include "wtf/Uint8ClampedArray.h" | 44 #include "wtf/Uint8ClampedArray.h" |
| 45 | 45 |
| 46 class SkCanvas; | 46 class SkCanvas; |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 class WebGraphicsContext3D; | |
| 50 } | |
| 51 | |
| 52 namespace blink { | |
| 53 | 49 |
| 54 class DrawingBuffer; | 50 class DrawingBuffer; |
| 55 class GraphicsContext; | 51 class GraphicsContext; |
| 56 class Image; | 52 class Image; |
| 57 class ImageBufferClient; | 53 class ImageBufferClient; |
| 58 class IntPoint; | 54 class IntPoint; |
| 59 class IntRect; | 55 class IntRect; |
| 56 class WebGraphicsContext3D; |
| 60 | 57 |
| 61 enum Multiply { | 58 enum Multiply { |
| 62 Premultiplied, | 59 Premultiplied, |
| 63 Unmultiplied | 60 Unmultiplied |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 enum BackingStoreCopy { | 63 enum BackingStoreCopy { |
| 67 CopyBackingStore, // Guarantee subsequent draws don't affect the copy. | 64 CopyBackingStore, // Guarantee subsequent draws don't affect the copy. |
| 68 DontCopyBackingStore // Subsequent draws may affect the copy. | 65 DontCopyBackingStore // Subsequent draws may affect the copy. |
| 69 }; | 66 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // or return CopyBackingStore if it doesn't. | 102 // or return CopyBackingStore if it doesn't. |
| 106 static BackingStoreCopy fastCopyImageMode(); | 103 static BackingStoreCopy fastCopyImageMode(); |
| 107 | 104 |
| 108 PassRefPtr<Uint8ClampedArray> getImageData(Multiply, const IntRect&) const; | 105 PassRefPtr<Uint8ClampedArray> getImageData(Multiply, const IntRect&) const; |
| 109 | 106 |
| 110 void putByteArray(Multiply, Uint8ClampedArray*, const IntSize& sourceSize, c
onst IntRect& sourceRect, const IntPoint& destPoint); | 107 void putByteArray(Multiply, Uint8ClampedArray*, const IntSize& sourceSize, c
onst IntRect& sourceRect, const IntPoint& destPoint); |
| 111 | 108 |
| 112 String toDataURL(const String& mimeType, const double* quality = 0) const; | 109 String toDataURL(const String& mimeType, const double* quality = 0) const; |
| 113 AffineTransform baseTransform() const { return AffineTransform(); } | 110 AffineTransform baseTransform() const { return AffineTransform(); } |
| 114 void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace)
; | 111 void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace)
; |
| 115 blink::WebLayer* platformLayer() const; | 112 WebLayer* platformLayer() const; |
| 116 | 113 |
| 117 // FIXME: current implementations of this method have the restriction that t
hey only work | 114 // FIXME: current implementations of this method have the restriction that t
hey only work |
| 118 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0
, as specified in | 115 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0
, as specified in |
| 119 // Extensions3D::canUseCopyTextureCHROMIUM(). | 116 // Extensions3D::canUseCopyTextureCHROMIUM(). |
| 120 // Destroys the TEXTURE_2D binding for the active texture unit of the passed
context | 117 // Destroys the TEXTURE_2D binding for the active texture unit of the passed
context |
| 121 bool copyToPlatformTexture(blink::WebGraphicsContext3D*, Platform3DObject, G
Lenum, GLenum, GLint, bool, bool); | 118 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject, GLenum,
GLenum, GLint, bool, bool); |
| 122 | 119 |
| 123 Platform3DObject getBackingTexture(); | 120 Platform3DObject getBackingTexture(); |
| 124 | 121 |
| 125 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, bool fromFrontBuf
fer = false); | 122 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, bool fromFrontBuf
fer = false); |
| 126 | 123 |
| 127 void flush(); | 124 void flush(); |
| 128 | 125 |
| 129 void notifySurfaceInvalid(); | 126 void notifySurfaceInvalid(); |
| 130 | 127 |
| 131 private: | 128 private: |
| 132 ImageBuffer(PassOwnPtr<ImageBufferSurface>); | 129 ImageBuffer(PassOwnPtr<ImageBufferSurface>); |
| 133 | 130 |
| 134 void draw(GraphicsContext*, const FloatRect&, const FloatRect* = 0, Composit
eOperator = CompositeSourceOver, WebBlendMode = WebBlendModeNormal); | 131 void draw(GraphicsContext*, const FloatRect&, const FloatRect* = 0, Composit
eOperator = CompositeSourceOver, WebBlendMode = WebBlendModeNormal); |
| 135 void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const
FloatPoint&, CompositeOperator, const FloatRect&, blink::WebBlendMode, const In
tSize& repeatSpacing = IntSize()); | 132 void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const
FloatPoint&, CompositeOperator, const FloatRect&, WebBlendMode, const IntSize&
repeatSpacing = IntSize()); |
| 136 static PassRefPtr<SkColorFilter> createColorSpaceFilter(ColorSpace srcColorS
pace, ColorSpace dstColorSpace); | 133 static PassRefPtr<SkColorFilter> createColorSpaceFilter(ColorSpace srcColorS
pace, ColorSpace dstColorSpace); |
| 137 | 134 |
| 138 friend class GraphicsContext; | 135 friend class GraphicsContext; |
| 139 friend class GeneratedImage; | 136 friend class GeneratedImage; |
| 140 friend class CrossfadeGeneratedImage; | 137 friend class CrossfadeGeneratedImage; |
| 141 friend class GradientGeneratedImage; | 138 friend class GradientGeneratedImage; |
| 142 friend class SkiaImageFilterBuilder; | 139 friend class SkiaImageFilterBuilder; |
| 143 | 140 |
| 144 OwnPtr<ImageBufferSurface> m_surface; | 141 OwnPtr<ImageBufferSurface> m_surface; |
| 145 OwnPtr<GraphicsContext> m_context; | 142 OwnPtr<GraphicsContext> m_context; |
| 146 ImageBufferClient* m_client; | 143 ImageBufferClient* m_client; |
| 147 }; | 144 }; |
| 148 | 145 |
| 149 struct ImageDataBuffer { | 146 struct ImageDataBuffer { |
| 150 ImageDataBuffer(const IntSize& size, PassRefPtr<Uint8ClampedArray> data) : m
_size(size), m_data(data) { } | 147 ImageDataBuffer(const IntSize& size, PassRefPtr<Uint8ClampedArray> data) : m
_size(size), m_data(data) { } |
| 151 IntSize size() const { return m_size; } | 148 IntSize size() const { return m_size; } |
| 152 unsigned char* data() const { return m_data->data(); } | 149 unsigned char* data() const { return m_data->data(); } |
| 153 | 150 |
| 154 IntSize m_size; | 151 IntSize m_size; |
| 155 RefPtr<Uint8ClampedArray> m_data; | 152 RefPtr<Uint8ClampedArray> m_data; |
| 156 }; | 153 }; |
| 157 | 154 |
| 158 String PLATFORM_EXPORT ImageDataToDataURL(const ImageDataBuffer&, const String&
mimeType, const double* quality); | 155 String PLATFORM_EXPORT ImageDataToDataURL(const ImageDataBuffer&, const String&
mimeType, const double* quality); |
| 159 | 156 |
| 160 } // namespace blink | 157 } // namespace blink |
| 161 | 158 |
| 162 #endif // ImageBuffer_h | 159 #endif // ImageBuffer_h |
| OLD | NEW |