OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // be nullptr. | 105 // be nullptr. |
106 sk_sp<SkColorSpace> skSurfaceColorSpace() const; | 106 sk_sp<SkColorSpace> skSurfaceColorSpace() const; |
107 SkColorType colorType() const; | 107 SkColorType colorType() const; |
108 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const; | 108 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const; |
109 bool skSurfacesUseColorSpace() const; | 109 bool skSurfacesUseColorSpace() const; |
110 | 110 |
111 virtual PassRefPtr<Image> getImage(AccelerationHint, | 111 virtual PassRefPtr<Image> getImage(AccelerationHint, |
112 SnapshotReason) const = 0; | 112 SnapshotReason) const = 0; |
113 virtual ImageData* toImageData(SnapshotReason reason) { return nullptr; } | 113 virtual ImageData* toImageData(SnapshotReason reason) { return nullptr; } |
114 virtual ContextType getContextType() const = 0; | 114 virtual ContextType getContextType() const = 0; |
115 virtual bool isAccelerated() const { return false; } | 115 virtual bool isComposited() const = 0; |
| 116 virtual bool isAccelerated() const = 0; |
116 virtual bool shouldAntialias() const { return false; } | 117 virtual bool shouldAntialias() const { return false; } |
117 virtual void setIsHidden(bool) = 0; | 118 virtual void setIsHidden(bool) = 0; |
118 virtual bool isContextLost() const { return true; } | 119 virtual bool isContextLost() const { return true; } |
119 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); }; | 120 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); }; |
120 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { | 121 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { |
121 NOTREACHED(); | 122 NOTREACHED(); |
122 } | 123 } |
123 virtual bool isPaintable() const = 0; | 124 virtual bool isPaintable() const = 0; |
124 virtual void didDraw(const SkIRect& dirtyRect); | 125 virtual void didDraw(const SkIRect& dirtyRect); |
| 126 virtual void didDraw(); |
125 | 127 |
126 // Return true if the content is updated. | 128 // Return true if the content is updated. |
127 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { | 129 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { |
128 return false; | 130 return false; |
129 } | 131 } |
130 | 132 |
131 virtual WebLayer* platformLayer() const { return nullptr; } | 133 virtual WebLayer* platformLayer() const { return nullptr; } |
132 | 134 |
133 enum LostContextMode { | 135 enum LostContextMode { |
134 NotLostContext, | 136 NotLostContext, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 208 |
207 protected: | 209 protected: |
208 CanvasRenderingContext(HTMLCanvasElement*, | 210 CanvasRenderingContext(HTMLCanvasElement*, |
209 OffscreenCanvas*, | 211 OffscreenCanvas*, |
210 const CanvasContextCreationAttributes&); | 212 const CanvasContextCreationAttributes&); |
211 DECLARE_VIRTUAL_TRACE(); | 213 DECLARE_VIRTUAL_TRACE(); |
212 virtual void stop() = 0; | 214 virtual void stop() = 0; |
213 | 215 |
214 private: | 216 private: |
215 void dispose(); | 217 void dispose(); |
| 218 void scheduleFinalizeFrameIfNeeded(); |
216 | 219 |
217 Member<HTMLCanvasElement> m_canvas; | 220 Member<HTMLCanvasElement> m_canvas; |
218 Member<OffscreenCanvas> m_offscreenCanvas; | 221 Member<OffscreenCanvas> m_offscreenCanvas; |
219 HashSet<String> m_cleanURLs; | 222 HashSet<String> m_cleanURLs; |
220 HashSet<String> m_dirtyURLs; | 223 HashSet<String> m_dirtyURLs; |
221 CanvasColorSpace m_colorSpace; | 224 CanvasColorSpace m_colorSpace; |
222 CanvasPixelFormat m_pixelFormat; | 225 CanvasPixelFormat m_pixelFormat; |
223 bool m_linearPixelMath = false; | 226 bool m_linearPixelMath = false; |
224 CanvasContextCreationAttributes m_creationAttributes; | 227 CanvasContextCreationAttributes m_creationAttributes; |
225 bool m_finalizeFrameScheduled = false; | 228 bool m_finalizeFrameScheduled = false; |
226 }; | 229 }; |
227 | 230 |
228 } // namespace blink | 231 } // namespace blink |
229 | 232 |
230 #endif | 233 #endif |
OLD | NEW |