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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool wasDrawnToAfterSnapshot() const { return m_snapshotState == DrawnToAfte
rSnapshot; } | 88 bool wasDrawnToAfterSnapshot() const { return m_snapshotState == DrawnToAfte
rSnapshot; } |
89 | 89 |
90 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ
uality(filterQuality); } | 90 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ
uality(filterQuality); } |
91 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } | 91 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } |
92 | 92 |
93 // Called by subclasses of ImageBufferSurface to install a new canvas object
. | 93 // Called by subclasses of ImageBufferSurface to install a new canvas object
. |
94 // Virtual for mocking | 94 // Virtual for mocking |
95 virtual void resetCanvas(SkCanvas*) const; | 95 virtual void resetCanvas(SkCanvas*) const; |
96 | 96 |
97 SkCanvas* canvas() const; | 97 SkCanvas* canvas() const; |
98 void disableDeferral() const; | 98 void disableDeferral(DisableDeferralReason) const; |
99 | 99 |
100 // Called at the end of a task that rendered a whole frame | 100 // Called at the end of a task that rendered a whole frame |
101 void finalizeFrame(const FloatRect &dirtyRect); | 101 void finalizeFrame(const FloatRect &dirtyRect); |
102 void didFinalizeFrame(); | 102 void didFinalizeFrame(); |
103 | 103 |
104 bool isDirty(); | 104 bool isDirty(); |
105 | 105 |
106 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); | 106 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); |
107 | 107 |
108 void willOverwriteCanvas() { m_surface->willOverwriteCanvas(); } | 108 void willOverwriteCanvas() { m_surface->willOverwriteCanvas(); } |
109 | 109 |
110 bool getImageData(Multiply, const IntRect&, WTF::ArrayBufferContents&) const
; | 110 bool getImageData(Multiply, const IntRect&, WTF::ArrayBufferContents&) const
; |
111 | 111 |
112 void putByteArray(Multiply, const unsigned char* source, const IntSize& sour
ceSize, const IntRect& sourceRect, const IntPoint& destPoint); | 112 void putByteArray(Multiply, const unsigned char* source, const IntSize& sour
ceSize, const IntRect& sourceRect, const IntPoint& destPoint); |
113 | 113 |
114 AffineTransform baseTransform() const { return AffineTransform(); } | 114 AffineTransform baseTransform() const { return AffineTransform(); } |
115 WebLayer* platformLayer() const; | 115 WebLayer* platformLayer() const; |
116 | 116 |
117 // FIXME: current implementations of this method have the restriction that t
hey only work | 117 // 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 | 118 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0
, as specified in |
119 // Extensions3D::canUseCopyTextureCHROMIUM(). | 119 // Extensions3D::canUseCopyTextureCHROMIUM(). |
120 // Destroys the TEXTURE_2D binding for the active texture unit of the passed
context | 120 // Destroys the TEXTURE_2D binding for the active texture unit of the passed
context |
121 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject, GLenum,
GLenum, GLint, bool, bool); | 121 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject, GLenum,
GLenum, GLint, bool, bool); |
122 | 122 |
123 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, SourceDrawingBuff
er); | 123 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, SourceDrawingBuff
er); |
124 | 124 |
125 void flush(); // process deferred draw commands immediately | 125 void flush(FlushReason); // process deferred draw commands immediately |
126 void flushGpu(); // Like flush(), but flushes all the way down to the Gpu co
ntext if the surface is accelerated | 126 void flushGpu(FlushReason); // Like flush(), but flushes all the way down to
the Gpu context if the surface is accelerated |
127 | 127 |
128 void notifySurfaceInvalid(); | 128 void notifySurfaceInvalid(); |
129 | 129 |
130 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint) const; | 130 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint, SnapshotReason) con
st; |
131 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration)
const; | 131 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration,
SnapshotReason = SnapshotReasonUnknown) const; |
132 | 132 |
133 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkXfermode::
Mode); | 133 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkXfermode::
Mode); |
134 | 134 |
135 void updateGPUMemoryUsage() const; | 135 void updateGPUMemoryUsage() const; |
136 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } | 136 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } |
137 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } | 137 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } |
138 | 138 |
139 protected: | 139 protected: |
140 ImageBuffer(PassOwnPtr<ImageBufferSurface>); | 140 ImageBuffer(PassOwnPtr<ImageBufferSurface>); |
141 | 141 |
(...skipping 20 matching lines...) Expand all Loading... |
162 int height() const { return m_size.height(); } | 162 int height() const { return m_size.height(); } |
163 int width() const { return m_size.width(); } | 163 int width() const { return m_size.width(); } |
164 | 164 |
165 const unsigned char* m_data; | 165 const unsigned char* m_data; |
166 const IntSize m_size; | 166 const IntSize m_size; |
167 }; | 167 }; |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
170 | 170 |
171 #endif // ImageBuffer_h | 171 #endif // ImageBuffer_h |
OLD | NEW |