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

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

Issue 1367683002: Make 2D canvas smarter about chosing whether or not to use GPU acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added nullptr check + fixed style check errors Created 5 years, 2 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 SkCanvas* drawingCanvas() const; 126 SkCanvas* drawingCanvas() const;
127 void disableDeferral() const; 127 void disableDeferral() const;
128 SkCanvas* existingDrawingCanvas() const; 128 SkCanvas* existingDrawingCanvas() const;
129 129
130 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); 130 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>);
131 CanvasRenderingContext* renderingContext() const { return m_context.get(); } 131 CanvasRenderingContext* renderingContext() const { return m_context.get(); }
132 132
133 void ensureUnacceleratedImageBuffer(); 133 void ensureUnacceleratedImageBuffer();
134 ImageBuffer* buffer() const; 134 ImageBuffer* buffer() const;
135 PassRefPtr<Image> copiedImage(SourceDrawingBuffer) const; 135 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const;
136 void clearCopiedImage(); 136 void clearCopiedImage();
137 137
138 SecurityOrigin* securityOrigin() const; 138 SecurityOrigin* securityOrigin() const;
139 bool originClean() const; 139 bool originClean() const;
140 void setOriginTainted() { m_originClean = false; } 140 void setOriginTainted() { m_originClean = false; }
141 141
142 AffineTransform baseTransform() const; 142 AffineTransform baseTransform() const;
143 143
144 bool is3D() const; 144 bool is3D() const;
145 bool isAnimated2D() const; 145 bool isAnimated2D() const;
146 146
147 bool hasImageBuffer() const { return m_imageBuffer; } 147 bool hasImageBuffer() const { return m_imageBuffer; }
148 void discardImageBuffer(); 148 void discardImageBuffer();
149 149
150 bool shouldAccelerate(const IntSize&) const; 150 bool shouldAccelerate(const IntSize&) const;
151 151
152 bool shouldBeDirectComposited() const; 152 bool shouldBeDirectComposited() const;
153 153
154 void prepareSurfaceForPaintingIfNeeded() const;
155
154 const AtomicString imageSourceURL() const override; 156 const AtomicString imageSourceURL() const override;
155 157
156 InsertionNotificationRequest insertedInto(ContainerNode*) override; 158 InsertionNotificationRequest insertedInto(ContainerNode*) override;
157 159
158 // DocumentVisibilityObserver implementation 160 // DocumentVisibilityObserver implementation
159 void didChangeVisibilityState(PageVisibilityState) override; 161 void didChangeVisibilityState(PageVisibilityState) override;
160 162
161 // CanvasImageSource implementation 163 // CanvasImageSource implementation
162 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*) const override ; 164 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt) const override;
163 bool wouldTaintOrigin(SecurityOrigin*) const override; 165 bool wouldTaintOrigin(SecurityOrigin*) const override;
164 FloatSize elementSize() const override; 166 FloatSize elementSize() const override;
165 bool isCanvasElement() const override { return true; } 167 bool isCanvasElement() const override { return true; }
166 bool isOpaque() const override; 168 bool isOpaque() const override;
167 169
168 // ImageBufferClient implementation 170 // ImageBufferClient implementation
169 void notifySurfaceInvalid() override; 171 void notifySurfaceInvalid() override;
170 bool isDirty() override { return !m_dirtyRect.isEmpty(); } 172 bool isDirty() override { return !m_dirtyRect.isEmpty(); }
171 void didFinalizeFrame() override; 173 void didFinalizeFrame() override;
172 void restoreCanvasMatrixClipStack(SkCanvas*) const override; 174 void restoreCanvasMatrixClipStack(SkCanvas*) const override;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 mutable bool m_didFailToCreateImageBuffer; 232 mutable bool m_didFailToCreateImageBuffer;
231 bool m_imageBufferIsClear; 233 bool m_imageBufferIsClear;
232 OwnPtr<ImageBuffer> m_imageBuffer; 234 OwnPtr<ImageBuffer> m_imageBuffer;
233 235
234 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 236 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
235 }; 237 };
236 238
237 } // namespace blink 239 } // namespace blink
238 240
239 #endif // HTMLCanvasElement_h 241 #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