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

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

Issue 2849463005: Refactor ImageBuffer to make OffscreenCanvas match HTMLCanvasElement (Closed)
Patch Set: x Created 3 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) 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Used for canvas capture. 133 // Used for canvas capture.
134 void AddListener(CanvasDrawListener*); 134 void AddListener(CanvasDrawListener*);
135 void RemoveListener(CanvasDrawListener*); 135 void RemoveListener(CanvasDrawListener*);
136 136
137 // Used for rendering 137 // Used for rendering
138 void DidDraw(const FloatRect&) override; 138 void DidDraw(const FloatRect&) override;
139 void DidDraw() override; 139 void DidDraw() override;
140 140
141 void Paint(GraphicsContext&, const LayoutRect&); 141 void Paint(GraphicsContext&, const LayoutRect&);
142 142
143 PaintCanvas* DrawingCanvas() const; 143 PaintCanvas* DrawingCanvas();
144 void DisableDeferral(DisableDeferralReason) const; 144 void DisableDeferral(DisableDeferralReason);
145 PaintCanvas* ExistingDrawingCanvas() const; 145 PaintCanvas* ExistingDrawingCanvas() const;
146 146
147 CanvasRenderingContext* RenderingContext() const { return context_.Get(); } 147 CanvasRenderingContext* RenderingContext() const { return context_.Get(); }
148 148
149 void EnsureUnacceleratedImageBuffer(); 149 void EnsureUnacceleratedImageBuffer();
150 ImageBuffer* Buffer() const;
151 PassRefPtr<Image> CopiedImage(SourceDrawingBuffer, 150 PassRefPtr<Image> CopiedImage(SourceDrawingBuffer,
152 AccelerationHint, 151 AccelerationHint,
153 SnapshotReason) const; 152 SnapshotReason);
154 void ClearCopiedImage(); 153 void ClearCopiedImage();
155 154
156 bool OriginClean() const; 155 bool OriginClean() const;
157 void SetOriginTainted() { origin_clean_ = false; } 156 void SetOriginTainted() { origin_clean_ = false; }
158 157
159 AffineTransform BaseTransform() const; 158 AffineTransform BaseTransform() const;
160 159
161 bool Is3d() const; 160 bool Is3d() const;
162 bool Is2d() const; 161 bool Is2d() const;
163 bool IsAnimated2d() const; 162 bool IsAnimated2d() const;
164 163
165 bool HasImageBuffer() const { return image_buffer_.get(); } 164 void DiscardImageBuffer() override;
166 void DiscardImageBuffer(); 165 ImageBuffer* GetImageBuffer() const override { return image_buffer_.get(); }
166 ImageBuffer* GetOrCreateImageBuffer() override;
167 167
168 bool ShouldBeDirectComposited() const; 168 bool ShouldBeDirectComposited() const;
169 169
170 void PrepareSurfaceForPaintingIfNeeded() const; 170 void PrepareSurfaceForPaintingIfNeeded();
171 171
172 const AtomicString ImageSourceURL() const override; 172 const AtomicString ImageSourceURL() const override;
173 173
174 InsertionNotificationRequest InsertedInto(ContainerNode*) override; 174 InsertionNotificationRequest InsertedInto(ContainerNode*) override;
175 175
176 bool IsDirty() { return !dirty_rect_.IsEmpty(); } 176 bool IsDirty() { return !dirty_rect_.IsEmpty(); }
177 177
178 void DoDeferredPaintInvalidation(); 178 void DoDeferredPaintInvalidation();
179 179
180 void FinalizeFrame() override; 180 void FinalizeFrame() override;
181 181
182 // ContextLifecycleObserver and PageVisibilityObserver implementation 182 // ContextLifecycleObserver and PageVisibilityObserver implementation
183 void ContextDestroyed(ExecutionContext*) override; 183 void ContextDestroyed(ExecutionContext*) override;
184 184
185 // PageVisibilityObserver implementation 185 // PageVisibilityObserver implementation
186 void PageVisibilityChanged() override; 186 void PageVisibilityChanged() override;
187 187
188 // CanvasImageSource implementation 188 // CanvasImageSource implementation
189 PassRefPtr<Image> GetSourceImageForCanvas(SourceImageStatus*, 189 PassRefPtr<Image> GetSourceImageForCanvas(SourceImageStatus*,
190 AccelerationHint, 190 AccelerationHint,
191 SnapshotReason, 191 SnapshotReason,
192 const FloatSize&) const override; 192 const FloatSize&) override;
193 bool WouldTaintOrigin(SecurityOrigin*) const override; 193 bool WouldTaintOrigin(SecurityOrigin*) const override;
194 FloatSize ElementSize(const FloatSize&) const override; 194 FloatSize ElementSize(const FloatSize&) const override;
195 bool IsCanvasElement() const override { return true; } 195 bool IsCanvasElement() const override { return true; }
196 bool IsOpaque() const override; 196 bool IsOpaque() const override;
197 bool IsAccelerated() const override; 197 bool IsAccelerated() const override;
198 int SourceWidth() override { return size_.Width(); } 198 int SourceWidth() override { return size_.Width(); }
199 int SourceHeight() override { return size_.Height(); } 199 int SourceHeight() override { return size_.Height(); }
200 200
201 // CanvasSurfaceLayerBridgeObserver implementation 201 // CanvasSurfaceLayerBridgeObserver implementation
202 void OnWebLayerReplaced() override; 202 void OnWebLayerReplaced() override;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 std::unique_ptr<CanvasSurfaceLayerBridge> surface_layer_bridge_; 336 std::unique_ptr<CanvasSurfaceLayerBridge> surface_layer_bridge_;
337 337
338 int num_frames_since_last_rendering_mode_switch_; 338 int num_frames_since_last_rendering_mode_switch_;
339 bool pending_rendering_mode_switch_; 339 bool pending_rendering_mode_switch_;
340 bool did_notify_listeners_for_current_frame_ = false; 340 bool did_notify_listeners_for_current_frame_ = false;
341 }; 341 };
342 342
343 } // namespace blink 343 } // namespace blink
344 344
345 #endif // HTMLCanvasElement_h 345 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.cpp ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698