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

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

Issue 907453003: Move overdraw tracking code from GraphicsContext to CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: adding missing test file Created 5 years, 10 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 | Annotate | Revision Log
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas 120 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas
121 GraphicsContext* existingDrawingContext() const; // Deprecated: use existing DrawingCanvas 121 GraphicsContext* existingDrawingContext() const; // Deprecated: use existing DrawingCanvas
122 SkCanvas* drawingCanvas() const; 122 SkCanvas* drawingCanvas() const;
123 SkCanvas* existingDrawingCanvas() const; 123 SkCanvas* existingDrawingCanvas() const;
124 124
125 CanvasRenderingContext* renderingContext() const { return m_context.get(); } 125 CanvasRenderingContext* renderingContext() const { return m_context.get(); }
126 126
127 void ensureUnacceleratedImageBuffer(); 127 void ensureUnacceleratedImageBuffer();
128 ImageBuffer* buffer() const; 128 ImageBuffer* buffer() const;
129 void createImageBufferUsingSurface(PassOwnPtr<ImageBufferSurface>); // For u nit testing
Stephen Chennney 2015/02/11 14:33:20 Nit: Could you put all test methods at the bottom
Justin Novosad 2015/02/11 18:59:54 Done.
129 PassRefPtr<Image> copiedImage(SourceDrawingBuffer) const; 130 PassRefPtr<Image> copiedImage(SourceDrawingBuffer) const;
130 void clearCopiedImage(); 131 void clearCopiedImage();
131 132
132 SecurityOrigin* securityOrigin() const; 133 SecurityOrigin* securityOrigin() const;
133 bool originClean() const; 134 bool originClean() const;
134 void setOriginTainted() { m_originClean = false; } 135 void setOriginTainted() { m_originClean = false; }
135 136
136 AffineTransform baseTransform() const; 137 AffineTransform baseTransform() const;
137 138
138 bool is3D() const; 139 bool is3D() const;
139 140
140 bool hasImageBuffer() const { return m_imageBuffer; } 141 bool hasImageBuffer() const { return m_imageBuffer; }
141 bool hasValidImageBuffer() const; 142 bool hasValidImageBuffer() const;
142 void discardImageBuffer(); 143 void discardImageBuffer();
143 144
144 bool shouldAccelerate(const IntSize&) const; 145 bool shouldAccelerate(const IntSize&) const;
145 146
146 virtual const AtomicString imageSourceURL() const override; 147 virtual const AtomicString imageSourceURL() const override;
147 148
148 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; 149 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
149 150
150 // DocumentVisibilityObserver implementation 151 // DocumentVisibilityObserver implementation
151 virtual void didChangeVisibilityState(PageVisibilityState) override; 152 virtual void didChangeVisibilityState(PageVisibilityState) override;
152 153
153 // CanvasImageSource implementation 154 // CanvasImageSource implementation
154 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const override; 155 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const override;
155 virtual bool wouldTaintOrigin(SecurityOrigin*) const override; 156 virtual bool wouldTaintOrigin(SecurityOrigin*) const override;
156 virtual FloatSize sourceSize() const override; 157 virtual FloatSize sourceSize() const override;
157 virtual bool isCanvasElement() const override { return true; } 158 virtual bool isCanvasElement() const override { return true; }
159 virtual bool isOpaque() const override;
158 160
159 // ImageBufferClient implementation 161 // ImageBufferClient implementation
160 virtual void notifySurfaceInvalid() override; 162 virtual void notifySurfaceInvalid() override;
161 virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); } 163 virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); }
162 virtual void didFinalizeFrame() override; 164 virtual void didFinalizeFrame() override;
163 virtual void restoreCanvasMatrixClipStack() override; 165 virtual void restoreCanvasMatrixClipStack() override;
164 166
165 void doDeferredPaintInvalidation(); 167 void doDeferredPaintInvalidation();
166 168
167 virtual void trace(Visitor*) override; 169 virtual void trace(Visitor*) override;
168 170
169 protected: 171 protected:
170 virtual void didMoveToNewDocument(Document& oldDocument) override; 172 virtual void didMoveToNewDocument(Document& oldDocument) override;
171 173
172 private: 174 private:
173 explicit HTMLCanvasElement(Document&); 175 explicit HTMLCanvasElement(Document&);
174 176
175 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide; 177 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide;
176 virtual LayoutObject* createRenderer(const RenderStyle&) override; 178 virtual LayoutObject* createRenderer(const RenderStyle&) override;
177 virtual void didRecalcStyle(StyleRecalcChange) override; 179 virtual void didRecalcStyle(StyleRecalcChange) override;
178 virtual bool areAuthorShadowsAllowed() const override { return false; } 180 virtual bool areAuthorShadowsAllowed() const override { return false; }
179 181
180 void reset(); 182 void reset();
181 183
182 PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> createSurfaceFactory( const IntSize& deviceSize, int* msaaSampleCount) const; 184 PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> createSurfaceFactory( const IntSize& deviceSize, int* msaaSampleCount) const;
183 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); 185 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount);
184 void createImageBuffer(); 186 void createImageBuffer();
185 void createImageBufferInternal(); 187 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e);
186 bool shouldUseDisplayList(const IntSize& deviceSize); 188 bool shouldUseDisplayList(const IntSize& deviceSize);
187 189
188 void setSurfaceSize(const IntSize&); 190 void setSurfaceSize(const IntSize&);
189 191
190 bool paintsIntoCanvasBuffer() const; 192 bool paintsIntoCanvasBuffer() const;
191 193
192 void updateExternallyAllocatedMemory() const; 194 void updateExternallyAllocatedMemory() const;
193 195
194 String toDataURLInternal(const String& mimeType, const double* quality, Sour ceDrawingBuffer) const; 196 String toDataURLInternal(const String& mimeType, const double* quality, Sour ceDrawingBuffer) const;
195 197
(...skipping 17 matching lines...) Expand all
213 bool m_imageBufferIsClear; 215 bool m_imageBufferIsClear;
214 OwnPtr<ImageBuffer> m_imageBuffer; 216 OwnPtr<ImageBuffer> m_imageBuffer;
215 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; 217 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver;
216 218
217 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 219 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
218 }; 220 };
219 221
220 } // namespace blink 222 } // namespace blink
221 223
222 #endif // HTMLCanvasElement_h 224 #endif // HTMLCanvasElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698