| 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 LayoutRectRecorder_h | 31 #ifndef ImageBufferSurface_h |
| 32 #define LayoutRectRecorder_h | 32 #define ImageBufferSurface_h |
| 33 | 33 |
| 34 #include "platform/geometry/LayoutRect.h" | 34 #include "platform/geometry/IntSize.h" |
| 35 #include "platform/graphics/GraphicsTypes3D.h" |
| 36 #include "wtf/FastAllocBase.h" |
| 35 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
| 36 | 38 |
| 39 class SkCanvas; |
| 40 class SkBitmap; |
| 41 |
| 42 namespace blink { class WebLayer; } |
| 43 |
| 37 namespace WebCore { | 44 namespace WebCore { |
| 38 | 45 |
| 39 class RenderLayerModelObject; | 46 enum OpacityMode { |
| 40 class RenderObject; | 47 NonOpaque, |
| 48 Opaque, |
| 49 }; |
| 41 | 50 |
| 42 class LayoutRectRecorder { | 51 class ImageBufferSurface { |
| 43 WTF_MAKE_NONCOPYABLE(LayoutRectRecorder); | 52 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
| 44 public: | 53 public: |
| 45 LayoutRectRecorder(RenderObject&, bool skipRecording = false); | 54 virtual ~ImageBufferSurface() { } |
| 46 ~LayoutRectRecorder(); | |
| 47 | 55 |
| 48 static bool shouldRecordLayoutRects(); | 56 virtual SkCanvas* canvas() const = 0; |
| 57 virtual const SkBitmap& bitmap() const; |
| 58 virtual void aboutToUse() { } // Called by ImageBuffer before reading or wri
ting to the surface. |
| 59 virtual bool isValid() const = 0; |
| 60 virtual blink::WebLayer* layer() const { return 0; }; |
| 61 virtual bool isAccelerated() const { return false; } |
| 62 virtual Platform3DObject getBackingTexture() const { return 0; } |
| 63 |
| 64 OpacityMode opacityMode() const { return m_opacityMode; } |
| 65 const IntSize& size() const { return m_size; } |
| 66 |
| 67 protected: |
| 68 void clear(); |
| 69 |
| 70 ImageBufferSurface(const IntSize& size, OpacityMode opacityMode) |
| 71 : m_opacityMode(opacityMode) |
| 72 , m_size(size) |
| 73 { } |
| 49 | 74 |
| 50 private: | 75 private: |
| 51 RenderObject& m_object; | 76 OpacityMode m_opacityMode; |
| 52 RenderLayerModelObject* m_repaintContainer; | 77 IntSize m_size; |
| 53 unsigned m_skipRecording : 1; | |
| 54 }; | 78 }; |
| 55 | 79 |
| 56 } // namespace WebCore | 80 } // namespace WebCore |
| 57 | 81 |
| 58 #endif // LayoutRectRecorder_h | 82 #endif |
| 59 | |
| OLD | NEW |