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

Side by Side Diff: Source/platform/graphics/RecordingImageBufferSurface.h

Issue 379253002: Initial implementation of display list backed 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: compile error fix Created 6 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) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef UnacceleratedImageBufferSurface_h 31 #ifndef RecordingImageBufferSurface_h
32 #define UnacceleratedImageBufferSurface_h 32 #define RecordingImageBufferSurface_h
33 33
34 #include "platform/graphics/ImageBufferSurface.h" 34 #include "platform/graphics/ImageBufferSurface.h"
35 #include "wtf/OwnPtr.h"
35 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
36 37
38 class SkPicture;
39 class SkPictureRecorder;
40
37 namespace WebCore { 41 namespace WebCore {
38 42
39 class PLATFORM_EXPORT UnacceleratedImageBufferSurface : public ImageBufferSurfac e { 43 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface {
40 WTF_MAKE_NONCOPYABLE(UnacceleratedImageBufferSurface); WTF_MAKE_FAST_ALLOCAT ED; 44 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED;
41 public: 45 public:
42 UnacceleratedImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); 46 RecordingImageBufferSurface(const IntSize&, OpacityMode = NonOpaque);
43 virtual ~UnacceleratedImageBufferSurface() { } 47 virtual ~RecordingImageBufferSurface();
44 48
45 virtual SkCanvas* canvas() const OVERRIDE { return m_canvas.get(); } 49 virtual SkCanvas* canvas() const OVERRIDE;
46 virtual bool isValid() const OVERRIDE { return m_canvas; } 50 virtual PassRefPtr<SkPicture> getPicture() OVERRIDE;
51 virtual bool isValid() const OVERRIDE { return true; }
52 virtual void willReadback() OVERRIDE;
53 virtual void didClearCanvas() OVERRIDE;
54 virtual void setImageBuffer(ImageBuffer*) OVERRIDE;
47 55
48 private: 56 private:
49 RefPtr<SkCanvas> m_canvas; 57 void fallbackToRasterCanvas();
Stephen White 2014/07/09 20:04:08 Bikeshed: "fallback" is a noun; I'd use "fallBackT
Justin Novosad 2014/07/11 21:16:08 Done.
Stephen White 2014/07/14 15:19:15 Still seems to be "fallback" in the lastest patch?
Justin Novosad 2014/07/17 18:34:14 I changed it everywhere else LOL. That's why all t
58 void initializeCurrentFrame();
59 bool handleOpaqueFrame();
60
61 OwnPtr<SkPictureRecorder> m_currentFrame;
62 RefPtr<SkPicture> m_previousFrame;
63 OwnPtr<SkCanvas> m_rasterCanvas;
64 ImageBuffer* m_imageBuffer;
65 bool m_frameWasCleared;
50 }; 66 };
51 67
52 } // namespace WebCore 68 } // namespace WebCore
53 69
54 #endif 70 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698