OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 void paint(GraphicsContext&, const LayoutRect&); | 125 void paint(GraphicsContext&, const LayoutRect&); |
126 | 126 |
127 SkCanvas* drawingCanvas() const; | 127 SkCanvas* drawingCanvas() const; |
128 void disableDeferral(DisableDeferralReason) const; | 128 void disableDeferral(DisableDeferralReason) const; |
129 SkCanvas* existingDrawingCanvas() const; | 129 SkCanvas* existingDrawingCanvas() const; |
130 | 130 |
131 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 131 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
132 | 132 |
133 void ensureUnacceleratedImageBuffer(); | 133 void ensureUnacceleratedImageBuffer(); |
134 ImageBuffer* buffer() const; | 134 ImageBuffer* buffer() const; |
135 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; | 135 Image* copiedImage(SourceDrawingBuffer, AccelerationHint) const; |
136 void clearCopiedImage(); | 136 void clearCopiedImage(); |
137 | 137 |
138 SecurityOrigin* getSecurityOrigin() const; | 138 SecurityOrigin* getSecurityOrigin() const; |
139 bool originClean() const; | 139 bool originClean() const; |
140 void setOriginTainted() { m_originClean = false; } | 140 void setOriginTainted() { m_originClean = false; } |
141 | 141 |
142 AffineTransform baseTransform() const; | 142 AffineTransform baseTransform() const; |
143 | 143 |
144 bool is3D() const; | 144 bool is3D() const; |
145 bool isAnimated2D() const; | 145 bool isAnimated2D() const; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 bool shouldUseDisplayList(const IntSize& deviceSize); | 231 bool shouldUseDisplayList(const IntSize& deviceSize); |
232 | 232 |
233 void setSurfaceSize(const IntSize&); | 233 void setSurfaceSize(const IntSize&); |
234 | 234 |
235 bool paintsIntoCanvasBuffer() const; | 235 bool paintsIntoCanvasBuffer() const; |
236 | 236 |
237 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; | 237 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; |
238 | 238 |
239 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; | 239 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; |
240 | 240 |
241 Image* ensureTransparentImage() const; | |
242 | |
241 HeapHashSet<WeakMember<CanvasDrawListener>> m_listeners; | 243 HeapHashSet<WeakMember<CanvasDrawListener>> m_listeners; |
242 | 244 |
243 IntSize m_size; | 245 IntSize m_size; |
244 | 246 |
245 Member<CanvasRenderingContext> m_context; | 247 Member<CanvasRenderingContext> m_context; |
246 | 248 |
247 bool m_ignoreReset; | 249 bool m_ignoreReset; |
248 FloatRect m_dirtyRect; | 250 FloatRect m_dirtyRect; |
249 | 251 |
250 mutable intptr_t m_externallyAllocatedMemory; | 252 mutable intptr_t m_externallyAllocatedMemory; |
251 | 253 |
252 bool m_originClean; | 254 bool m_originClean; |
253 | 255 |
254 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer | 256 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer |
255 // after the first attempt failed. | 257 // after the first attempt failed. |
256 mutable bool m_didFailToCreateImageBuffer; | 258 mutable bool m_didFailToCreateImageBuffer; |
257 bool m_imageBufferIsClear; | 259 bool m_imageBufferIsClear; |
258 std::unique_ptr<ImageBuffer> m_imageBuffer; | 260 std::unique_ptr<ImageBuffer> m_imageBuffer; |
259 | 261 |
260 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). | 262 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). |
261 | 263 |
262 // Used for OffscreenCanvas that controls this HTML canvas element | 264 // Used for OffscreenCanvas that controls this HTML canvas element |
263 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 265 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
266 | |
267 mutable RefPtr<Image> m_transparentImage; | |
haraken
2016/07/06 12:46:44
Why do we need to keep alive the image after copie
hajimehoshi
2016/07/07 10:53:07
Hmm, I agree.
Do you think it'd make sense if m_t
haraken
2016/07/07 11:00:56
I don't fully understand what problem you're tryin
| |
264 }; | 268 }; |
265 | 269 |
266 } // namespace blink | 270 } // namespace blink |
267 | 271 |
268 #endif // HTMLCanvasElement_h | 272 #endif // HTMLCanvasElement_h |
OLD | NEW |