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

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

Issue 2294383002: Make OffscreenCanvas a member of CanvasImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 static ContextType contextTypeFromId(const String& id); 75 static ContextType contextTypeFromId(const String& id);
76 static ContextType resolveContextTypeAliases(ContextType); 76 static ContextType resolveContextTypeAliases(ContextType);
77 77
78 HTMLCanvasElement* canvas() const { return m_canvas; } 78 HTMLCanvasElement* canvas() const { return m_canvas; }
79 79
80 CanvasColorSpace colorSpace() const { return m_colorSpace; }; 80 CanvasColorSpace colorSpace() const { return m_colorSpace; };
81 WTF::String colorSpaceAsString() const; 81 WTF::String colorSpaceAsString() const;
82 sk_sp<SkColorSpace> skColorSpace() const; 82 sk_sp<SkColorSpace> skColorSpace() const;
83 83
84 virtual PassRefPtr<Image> getImage(SnapshotReason) const = 0;
84 virtual ContextType getContextType() const = 0; 85 virtual ContextType getContextType() const = 0;
85 virtual bool isAccelerated() const { return false; } 86 virtual bool isAccelerated() const { return false; }
86 virtual bool shouldAntialias() const { return false; } 87 virtual bool shouldAntialias() const { return false; }
87 virtual void setIsHidden(bool) = 0; 88 virtual void setIsHidden(bool) = 0;
88 virtual bool isContextLost() const { return true; } 89 virtual bool isContextLost() const { return true; }
89 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); }; 90 virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); };
90 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { NOTREACHED(); } 91 virtual void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) { NOTREACHED(); }
92 virtual bool isPaintable() const = 0;
91 93
92 // Return true if the content is updated. 94 // Return true if the content is updated.
93 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { return fal se; } 95 virtual bool paintRenderingResultsToCanvas(SourceDrawingBuffer) { return fal se; }
94 96
95 // Note: this function is strictly for OffscreenCanvas only.
96 virtual bool isPaintable() const = 0;
97 97
98 virtual WebLayer* platformLayer() const { return nullptr; } 98 virtual WebLayer* platformLayer() const { return nullptr; }
99 99
100 enum LostContextMode { 100 enum LostContextMode {
101 NotLostContext, 101 NotLostContext,
102 102
103 // Lost context occurred at the graphics system level. 103 // Lost context occurred at the graphics system level.
104 RealLostContext, 104 RealLostContext,
105 105
106 // Lost context provoked by WEBGL_lose_context. 106 // Lost context provoked by WEBGL_lose_context.
(...skipping 23 matching lines...) Expand all
130 // WebGL-specific interface 130 // WebGL-specific interface
131 virtual bool is3d() const { return false; } 131 virtual bool is3d() const { return false; }
132 virtual void setFilterQuality(SkFilterQuality) { NOTREACHED(); } 132 virtual void setFilterQuality(SkFilterQuality) { NOTREACHED(); }
133 virtual void reshape(int width, int height) { NOTREACHED(); } 133 virtual void reshape(int width, int height) { NOTREACHED(); }
134 virtual void markLayerComposited() { NOTREACHED(); } 134 virtual void markLayerComposited() { NOTREACHED(); }
135 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { N OTREACHED(); return nullptr; } 135 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { N OTREACHED(); return nullptr; }
136 virtual int externallyAllocatedBytesPerPixel() { NOTREACHED(); return 0; } 136 virtual int externallyAllocatedBytesPerPixel() { NOTREACHED(); return 0; }
137 137
138 // ImageBitmap-specific interface 138 // ImageBitmap-specific interface
139 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } 139 virtual bool paint(GraphicsContext&, const IntRect&) { return false; }
140 virtual PassRefPtr<Image> getImage() const { return nullptr; }
141
142 bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr);
143 void didMoveToNewDocument(Document*);
144 140
145 // OffscreenCanvas-specific methods 141 // OffscreenCanvas-specific methods
146 OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; } 142 OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; }
147 virtual ImageBitmap* transferToImageBitmap(ExceptionState&) { return nullptr ; } 143 virtual ImageBitmap* transferToImageBitmap(ExceptionState&) { return nullptr ; }
148 144
145 bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr);
146 void didMoveToNewDocument(Document*);
147
149 void detachCanvas() { m_canvas = nullptr; } 148 void detachCanvas() { m_canvas = nullptr; }
150 149
151 const CanvasContextCreationAttributes& creationAttributes() const { return m _creationAttributes; } 150 const CanvasContextCreationAttributes& creationAttributes() const { return m _creationAttributes; }
152 151
153 protected: 152 protected:
154 CanvasRenderingContext(HTMLCanvasElement*, OffscreenCanvas*, const CanvasCon textCreationAttributes&); 153 CanvasRenderingContext(HTMLCanvasElement*, OffscreenCanvas*, const CanvasCon textCreationAttributes&);
155 DECLARE_VIRTUAL_TRACE(); 154 DECLARE_VIRTUAL_TRACE();
156 virtual void stop() = 0; 155 virtual void stop() = 0;
157 156
158 private: 157 private:
159 void dispose(); 158 void dispose();
160 159
161 Member<HTMLCanvasElement> m_canvas; 160 Member<HTMLCanvasElement> m_canvas;
162 Member<OffscreenCanvas> m_offscreenCanvas; 161 Member<OffscreenCanvas> m_offscreenCanvas;
163 HashSet<String> m_cleanURLs; 162 HashSet<String> m_cleanURLs;
164 HashSet<String> m_dirtyURLs; 163 HashSet<String> m_dirtyURLs;
165 CanvasColorSpace m_colorSpace; 164 CanvasColorSpace m_colorSpace;
166 CanvasContextCreationAttributes m_creationAttributes; 165 CanvasContextCreationAttributes m_creationAttributes;
167 }; 166 };
168 167
169 } // namespace blink 168 } // namespace blink
170 169
171 #endif 170 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698