| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |