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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h

Issue 2738573002: Streamline the presentation of ImageBitmapRenderingContext (Closed)
Patch Set: Fix crash in gpu test Created 3 years, 9 months 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
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // be nullptr. 115 // be nullptr.
116 sk_sp<SkColorSpace> skSurfaceColorSpace() const; 116 sk_sp<SkColorSpace> skSurfaceColorSpace() const;
117 SkColorType colorType() const; 117 SkColorType colorType() const;
118 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const; 118 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const;
119 bool skSurfacesUseColorSpace() const; 119 bool skSurfacesUseColorSpace() const;
120 120
121 virtual PassRefPtr<Image> getImage(AccelerationHint, 121 virtual PassRefPtr<Image> getImage(AccelerationHint,
122 SnapshotReason) const = 0; 122 SnapshotReason) const = 0;
123 virtual ImageData* toImageData(SnapshotReason reason) { return nullptr; } 123 virtual ImageData* toImageData(SnapshotReason reason) { return nullptr; }
124 virtual ContextType getContextType() const = 0; 124 virtual ContextType getContextType() const = 0;
125 virtual bool isAccelerated() const { return false; } 125 virtual bool isComposited() const = 0;
126 virtual bool isAccelerated() const = 0;
126 virtual bool shouldAntialias() const { return false; } 127 virtual bool shouldAntialias() const { return false; }
127 virtual void setIsHidden(bool) = 0; 128 virtual void setIsHidden(bool) = 0;
128 virtual bool isContextLost() const { return true; } 129 virtual bool isContextLost() const { return true; }
129 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); }; 130 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); };
130 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { 131 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) {
131 NOTREACHED(); 132 NOTREACHED();
132 } 133 }
133 virtual bool isPaintable() const = 0; 134 virtual bool isPaintable() const = 0;
134 virtual void didDraw(const SkIRect& dirtyRect); 135 virtual void didDraw(const SkIRect& dirtyRect);
136 virtual void didDraw();
135 137
136 // Return true if the content is updated. 138 // Return true if the content is updated.
137 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { 139 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) {
138 return false; 140 return false;
139 } 141 }
140 142
141 virtual WebLayer* platformLayer() const { return nullptr; } 143 virtual WebLayer* platformLayer() const { return nullptr; }
142 144
143 enum LostContextMode { 145 enum LostContextMode {
144 NotLostContext, 146 NotLostContext,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 218
217 protected: 219 protected:
218 CanvasRenderingContext(HTMLCanvasElement*, 220 CanvasRenderingContext(HTMLCanvasElement*,
219 OffscreenCanvas*, 221 OffscreenCanvas*,
220 const CanvasContextCreationAttributes&); 222 const CanvasContextCreationAttributes&);
221 DECLARE_VIRTUAL_TRACE(); 223 DECLARE_VIRTUAL_TRACE();
222 virtual void stop() = 0; 224 virtual void stop() = 0;
223 225
224 private: 226 private:
225 void dispose(); 227 void dispose();
228 void scheduleFinalizeFrameIfNeeded();
226 229
227 Member<HTMLCanvasElement> m_canvas; 230 Member<HTMLCanvasElement> m_canvas;
228 Member<OffscreenCanvas> m_offscreenCanvas; 231 Member<OffscreenCanvas> m_offscreenCanvas;
229 HashSet<String> m_cleanURLs; 232 HashSet<String> m_cleanURLs;
230 HashSet<String> m_dirtyURLs; 233 HashSet<String> m_dirtyURLs;
231 CanvasColorSpace m_colorSpace; 234 CanvasColorSpace m_colorSpace;
232 CanvasPixelFormat m_pixelFormat; 235 CanvasPixelFormat m_pixelFormat;
233 bool m_linearPixelMath = false; 236 bool m_linearPixelMath = false;
234 CanvasContextCreationAttributes m_creationAttributes; 237 CanvasContextCreationAttributes m_creationAttributes;
235 bool m_finalizeFrameScheduled = false; 238 bool m_finalizeFrameScheduled = false;
236 }; 239 };
237 240
238 } // namespace blink 241 } // namespace blink
239 242
240 #endif 243 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698