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

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

Issue 2625873005: Add an heuristic for promoting canvases to GPU acceleration (Closed)
Patch Set: webgl test fix Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 String getIdFromControl(const Element*); 231 String getIdFromControl(const Element*);
232 232
233 // For OffscreenCanvas that controls this html canvas element 233 // For OffscreenCanvas that controls this html canvas element
234 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { 234 CanvasSurfaceLayerBridge* surfaceLayerBridge() const {
235 return m_surfaceLayerBridge.get(); 235 return m_surfaceLayerBridge.get();
236 } 236 }
237 void createLayer(); 237 void createLayer();
238 238
239 void detachContext() { m_context = nullptr; } 239 void detachContext() { m_context = nullptr; }
240 240
241 void willDrawImageTo2DContext(CanvasImageSource*);
242
241 protected: 243 protected:
242 void didMoveToNewDocument(Document& oldDocument) override; 244 void didMoveToNewDocument(Document& oldDocument) override;
243 245
244 private: 246 private:
245 explicit HTMLCanvasElement(Document&); 247 explicit HTMLCanvasElement(Document&);
246 void dispose(); 248 void dispose();
247 249
248 using ContextFactoryVector = 250 using ContextFactoryVector =
249 Vector<std::unique_ptr<CanvasRenderingContextFactory>>; 251 Vector<std::unique_ptr<CanvasRenderingContextFactory>>;
250 static ContextFactoryVector& renderingContextFactories(); 252 static ContextFactoryVector& renderingContextFactories();
251 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 253 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
252 254
253 bool shouldAccelerate(const IntSize&) const; 255 enum AccelerationCriteria {
256 NormalAccelerationCriteria,
257 IgnoreCanvasSizeAccelerationCriteria,
258 };
259 bool shouldAccelerate(AccelerationCriteria) const;
254 260
255 void parseAttribute(const AttributeModificationParams&) override; 261 void parseAttribute(const AttributeModificationParams&) override;
256 LayoutObject* createLayoutObject(const ComputedStyle&) override; 262 LayoutObject* createLayoutObject(const ComputedStyle&) override;
257 bool areAuthorShadowsAllowed() const override { return false; } 263 bool areAuthorShadowsAllowed() const override { return false; }
258 264
259 void reset(); 265 void reset();
260 266
261 std::unique_ptr<ImageBufferSurface> createWebGLImageBufferSurface( 267 std::unique_ptr<ImageBufferSurface> createWebGLImageBufferSurface(
262 const IntSize& deviceSize,
263 OpacityMode); 268 OpacityMode);
264 std::unique_ptr<ImageBufferSurface> createAcceleratedImageBufferSurface( 269 std::unique_ptr<ImageBufferSurface> createAcceleratedImageBufferSurface(
265 const IntSize& deviceSize,
266 OpacityMode, 270 OpacityMode,
267 int* msaaSampleCount); 271 int* msaaSampleCount);
268 std::unique_ptr<ImageBufferSurface> createUnacceleratedImageBufferSurface( 272 std::unique_ptr<ImageBufferSurface> createUnacceleratedImageBufferSurface(
269 const IntSize& deviceSize,
270 OpacityMode); 273 OpacityMode);
271 void createImageBuffer(); 274 void createImageBuffer();
272 void createImageBufferInternal( 275 void createImageBufferInternal(
273 std::unique_ptr<ImageBufferSurface> externalSurface); 276 std::unique_ptr<ImageBufferSurface> externalSurface);
274 bool shouldUseDisplayList(const IntSize& deviceSize); 277 bool shouldUseDisplayList();
275 278
276 void setSurfaceSize(const IntSize&); 279 void setSurfaceSize(const IntSize&);
277 280
278 bool paintsIntoCanvasBuffer() const; 281 bool paintsIntoCanvasBuffer() const;
279 282
280 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; 283 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const;
281 284
282 String toDataURLInternal(const String& mimeType, 285 String toDataURLInternal(const String& mimeType,
283 const double& quality, 286 const double& quality,
284 SourceDrawingBuffer) const; 287 SourceDrawingBuffer) const;
(...skipping 24 matching lines...) Expand all
309 // Used for OffscreenCanvas that controls this HTML canvas element 312 // Used for OffscreenCanvas that controls this HTML canvas element
310 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; 313 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge;
311 314
312 int m_numFramesSinceLastRenderingModeSwitch; 315 int m_numFramesSinceLastRenderingModeSwitch;
313 bool m_pendingRenderingModeSwitch; 316 bool m_pendingRenderingModeSwitch;
314 }; 317 };
315 318
316 } // namespace blink 319 } // namespace blink
317 320
318 #endif // HTMLCanvasElement_h 321 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698