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

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

Issue 1881563003: Implement OffscreenCanvas.getContext('webgl') (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and remove static_cast Created 4 years, 7 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 static ContextType contextTypeFromId(const String& id); 66 static ContextType contextTypeFromId(const String& id);
67 static ContextType resolveContextTypeAliases(ContextType); 67 static ContextType resolveContextTypeAliases(ContextType);
68 68
69 HTMLCanvasElement* canvas() const { return m_canvas; } 69 HTMLCanvasElement* canvas() const { return m_canvas; }
70 70
71 virtual ContextType getContextType() const = 0; 71 virtual ContextType getContextType() const = 0;
72 virtual bool isAccelerated() const { return false; } 72 virtual bool isAccelerated() const { return false; }
73 virtual bool hasAlpha() const { return true; } 73 virtual bool hasAlpha() const { return true; }
74 virtual void setIsHidden(bool) = 0; 74 virtual void setIsHidden(bool) = 0;
75 virtual bool isContextLost() const { return true; } 75 virtual bool isContextLost() const { return true; }
76 virtual void setCanvasGetContextResult(RenderingContext&) = 0; 76 virtual void setCanvasGetContextResult(RenderingContext&) { ASSERT_NOT_REACH ED(); };
77 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { ASSERT_NOT_REACHED(); }
77 78
78 // Return true if the content is updated. 79 // Return true if the content is updated.
79 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { return fal se; } 80 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { return fal se; }
80 81
81 virtual WebLayer* platformLayer() const { return nullptr; } 82 virtual WebLayer* platformLayer() const { return nullptr; }
82 83
83 enum LostContextMode { 84 enum LostContextMode {
84 NotLostContext, 85 NotLostContext,
85 86
86 // Lost context occurred at the graphics system level. 87 // Lost context occurred at the graphics system level.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } 120 virtual bool paint(GraphicsContext&, const IntRect&) { return false; }
120 121
121 bool wouldTaintOrigin(CanvasImageSource*); 122 bool wouldTaintOrigin(CanvasImageSource*);
122 void didMoveToNewDocument(Document*); 123 void didMoveToNewDocument(Document*);
123 124
124 // OffscreenCanvas-specific methods 125 // OffscreenCanvas-specific methods
125 OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; } 126 OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; }
126 virtual ImageBitmap* transferToImageBitmap(ExceptionState&) { return nullptr ; } 127 virtual ImageBitmap* transferToImageBitmap(ExceptionState&) { return nullptr ; }
127 128
128 protected: 129 protected:
129 CanvasRenderingContext(HTMLCanvasElement*); 130 CanvasRenderingContext(HTMLCanvasElement* = nullptr, OffscreenCanvas* = null ptr);
130 CanvasRenderingContext(OffscreenCanvas*);
131 DECLARE_VIRTUAL_TRACE(); 131 DECLARE_VIRTUAL_TRACE();
132 virtual void stop() = 0; 132 virtual void stop() = 0;
133 133
134 private: 134 private:
135 Member<HTMLCanvasElement> m_canvas; 135 Member<HTMLCanvasElement> m_canvas;
136 Member<OffscreenCanvas> m_offscreenCanvas; 136 Member<OffscreenCanvas> m_offscreenCanvas;
137 HashSet<String> m_cleanURLs; 137 HashSet<String> m_cleanURLs;
138 HashSet<String> m_dirtyURLs; 138 HashSet<String> m_dirtyURLs;
139 }; 139 };
140 140
141 } // namespace blink 141 } // namespace blink
142 142
143 #endif 143 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698