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

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

Issue 1234083003: Canvas.toDataURL to use SkBitmap::readPixels to avoid uninitialized memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: batter asan fix Created 5 years, 5 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 class AffineTransform; 49 class AffineTransform;
50 class CanvasContextCreationAttributes; 50 class CanvasContextCreationAttributes;
51 class CanvasRenderingContext; 51 class CanvasRenderingContext;
52 class CanvasRenderingContextFactory; 52 class CanvasRenderingContextFactory;
53 class GraphicsContext; 53 class GraphicsContext;
54 class HTMLCanvasElement; 54 class HTMLCanvasElement;
55 class Image; 55 class Image;
56 class ImageBuffer; 56 class ImageBuffer;
57 class ImageBufferSurface; 57 class ImageBufferSurface;
58 class ImageData;
58 class IntSize; 59 class IntSize;
59 60
60 class CORE_EXPORT CanvasObserver : public WillBeGarbageCollectedMixin { 61 class CORE_EXPORT CanvasObserver : public WillBeGarbageCollectedMixin {
61 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); 62 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver);
62 public: 63 public:
63 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0; 64 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0;
64 virtual void canvasResized(HTMLCanvasElement*) = 0; 65 virtual void canvasResized(HTMLCanvasElement*) = 0;
65 #if !ENABLE(OILPAN) 66 #if !ENABLE(OILPAN)
66 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; 67 virtual void canvasDestroyed(HTMLCanvasElement*) = 0;
67 #endif 68 #endif
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 193
193 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); 194 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount);
194 void createImageBuffer(); 195 void createImageBuffer();
195 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e); 196 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e);
196 bool shouldUseDisplayList(const IntSize& deviceSize); 197 bool shouldUseDisplayList(const IntSize& deviceSize);
197 198
198 void setSurfaceSize(const IntSize&); 199 void setSurfaceSize(const IntSize&);
199 200
200 bool paintsIntoCanvasBuffer() const; 201 bool paintsIntoCanvasBuffer() const;
201 202
203 ImageData* toImageData(SourceDrawingBuffer) const;
202 String toDataURLInternal(const String& mimeType, const double* quality, Sour ceDrawingBuffer) const; 204 String toDataURLInternal(const String& mimeType, const double* quality, Sour ceDrawingBuffer) const;
203 205
204 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers; 206 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers;
205 207
206 IntSize m_size; 208 IntSize m_size;
207 209
208 OwnPtrWillBeMember<CanvasRenderingContext> m_context; 210 OwnPtrWillBeMember<CanvasRenderingContext> m_context;
209 211
210 bool m_ignoreReset; 212 bool m_ignoreReset;
211 bool m_accelerationDisabled; 213 bool m_accelerationDisabled;
212 FloatRect m_dirtyRect; 214 FloatRect m_dirtyRect;
213 215
214 mutable intptr_t m_externallyAllocatedMemory; 216 mutable intptr_t m_externallyAllocatedMemory;
215 217
216 bool m_originClean; 218 bool m_originClean;
217 219
218 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer 220 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer
219 // after the first attempt failed. 221 // after the first attempt failed.
220 mutable bool m_didFailToCreateImageBuffer; 222 mutable bool m_didFailToCreateImageBuffer;
221 bool m_imageBufferIsClear; 223 bool m_imageBufferIsClear;
222 OwnPtr<ImageBuffer> m_imageBuffer; 224 OwnPtr<ImageBuffer> m_imageBuffer;
223 225
224 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 226 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
225 }; 227 };
226 228
227 } // namespace blink 229 } // namespace blink
228 230
229 #endif // HTMLCanvasElement_h 231 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLCanvasElement.cpp » ('j') | Source/platform/image-encoders/skia/WEBPImageEncoder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698