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

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

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase mayhem Created 7 years 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) 2013, 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
(...skipping 10 matching lines...) Expand all
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 GaneshUtils_h 31 #ifndef ImageBufferSurface_h
32 #define GaneshUtils_h 32 #define ImageBufferSurface_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/geometry/IntSize.h" 35 #include "platform/geometry/IntSize.h"
36 #include "third_party/skia/include/core/SkBitmap.h" 36 #include "platform/graphics/GraphicsTypes3D.h"
37 #include "third_party/skia/include/gpu/GrContext.h" 37 #include "wtf/FastAllocBase.h"
38 #include "wtf/Noncopyable.h"
39
40 class SkCanvas;
41 class SkBitmap;
42
43 namespace blink { class WebLayer; }
38 44
39 namespace WebCore { 45 namespace WebCore {
40 46
41 bool PLATFORM_EXPORT ensureTextureBackedSkBitmap(GrContext*, SkBitmap&, const In tSize&, GrSurfaceOrigin, GrPixelConfig); 47 enum OpacityMode {
48 NonOpaque,
49 Opaque,
50 };
51
52 class PLATFORM_EXPORT ImageBufferSurface {
53 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED;
54 public:
55 virtual ~ImageBufferSurface() { }
56
57 virtual SkCanvas* canvas() const = 0;
58 virtual const SkBitmap& bitmap() const;
59 virtual void willUse() { } // Called by ImageBuffer before reading or writin g to the surface.
60 virtual bool isValid() const = 0;
61 virtual blink::WebLayer* layer() const { return 0; };
62 virtual bool isAccelerated() const { return false; }
63 virtual Platform3DObject getBackingTexture() const { return 0; }
64
65 OpacityMode opacityMode() const { return m_opacityMode; }
66 const IntSize& size() const { return m_size; }
67
68 protected:
69 void clear();
70
71 ImageBufferSurface(const IntSize& size, OpacityMode opacityMode)
72 : m_opacityMode(opacityMode)
73 , m_size(size)
74 { }
75
76 private:
77 OpacityMode m_opacityMode;
78 IntSize m_size;
79 };
42 80
43 } // namespace WebCore 81 } // namespace WebCore
44 82
45 #endif // GaneshUtils_h 83 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | Source/platform/graphics/ImageBufferSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698