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

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

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
43 43
44 #define CanvasDefaultInterpolationQuality InterpolationLow 44 #define CanvasDefaultInterpolationQuality InterpolationLow
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class AffineTransform; 48 class AffineTransform;
49 class CanvasContextCreationAttributes; 49 class CanvasContextCreationAttributes;
50 class CanvasRenderingContext; 50 class CanvasRenderingContext;
51 class GraphicsContext; 51 class GraphicsContext;
52 class GraphicsContextStateSaver;
53 class HTMLCanvasElement; 52 class HTMLCanvasElement;
54 class Image; 53 class Image;
55 class ImageBuffer; 54 class ImageBuffer;
56 class ImageBufferSurface; 55 class ImageBufferSurface;
57 class IntSize; 56 class IntSize;
58 57
59 class CORE_EXPORT CanvasObserver : public WillBeGarbageCollectedMixin { 58 class CORE_EXPORT CanvasObserver : public WillBeGarbageCollectedMixin {
60 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); 59 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver);
61 public: 60 public:
62 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0; 61 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 static String toEncodingMimeType(const String& mimeType); 108 static String toEncodingMimeType(const String& mimeType);
110 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; 109 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const;
111 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } 110 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); }
112 111
113 // Used for rendering 112 // Used for rendering
114 void didDraw(const FloatRect&); 113 void didDraw(const FloatRect&);
115 void notifyObserversCanvasChanged(const FloatRect&); 114 void notifyObserversCanvasChanged(const FloatRect&);
116 115
117 void paint(GraphicsContext*, const LayoutRect&); 116 void paint(GraphicsContext*, const LayoutRect&);
118 117
119 GraphicsContext* drawingContext() const; // Deprecated: use drawingCanvas
120 SkCanvas* drawingCanvas() const; 118 SkCanvas* drawingCanvas() const;
121 SkCanvas* existingDrawingCanvas() const; 119 SkCanvas* existingDrawingCanvas() const;
122 120
123 CanvasRenderingContext* renderingContext() const { return m_context.get(); } 121 CanvasRenderingContext* renderingContext() const { return m_context.get(); }
124 122
125 void ensureUnacceleratedImageBuffer(); 123 void ensureUnacceleratedImageBuffer();
126 ImageBuffer* buffer() const; 124 ImageBuffer* buffer() const;
127 PassRefPtr<Image> copiedImage(SourceDrawingBuffer) const; 125 PassRefPtr<Image> copiedImage(SourceDrawingBuffer) const;
128 void clearCopiedImage(); 126 void clearCopiedImage();
129 127
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 204
207 mutable intptr_t m_externallyAllocatedMemory; 205 mutable intptr_t m_externallyAllocatedMemory;
208 206
209 bool m_originClean; 207 bool m_originClean;
210 208
211 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer 209 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer
212 // after the first attempt failed. 210 // after the first attempt failed.
213 mutable bool m_didFailToCreateImageBuffer; 211 mutable bool m_didFailToCreateImageBuffer;
214 bool m_imageBufferIsClear; 212 bool m_imageBufferIsClear;
215 OwnPtr<ImageBuffer> m_imageBuffer; 213 OwnPtr<ImageBuffer> m_imageBuffer;
216 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver;
217 214
218 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 215 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 }; 216 };
220 217
221 } // namespace blink 218 } // namespace blink
222 219
223 #endif // HTMLCanvasElement_h 220 #endif // HTMLCanvasElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698