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 26 matching lines...) Expand all Loading... |
37 #include "wtf/FastAllocBase.h" | 37 #include "wtf/FastAllocBase.h" |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 | 39 |
40 class SkCanvas; | 40 class SkCanvas; |
41 class SkBitmap; | 41 class SkBitmap; |
42 | 42 |
43 namespace blink { class WebLayer; } | 43 namespace blink { class WebLayer; } |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
| 47 class ImageBuffer; |
| 48 |
47 enum OpacityMode { | 49 enum OpacityMode { |
48 NonOpaque, | 50 NonOpaque, |
49 Opaque, | 51 Opaque, |
50 }; | 52 }; |
51 | 53 |
52 class PLATFORM_EXPORT ImageBufferSurface { | 54 class PLATFORM_EXPORT ImageBufferSurface { |
53 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; | 55 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
54 public: | 56 public: |
55 virtual ~ImageBufferSurface() { } | 57 virtual ~ImageBufferSurface() { } |
56 | 58 |
57 virtual SkCanvas* canvas() const = 0; | 59 virtual SkCanvas* canvas() const = 0; |
58 virtual const SkBitmap& bitmap() const; | 60 virtual const SkBitmap& bitmap() const; |
59 virtual void willUse() { } // Called by ImageBuffer before reading or writin
g to the surface. | 61 virtual void willUse() { } // Called by ImageBuffer before reading or writin
g to the surface. |
60 virtual bool isValid() const = 0; | 62 virtual bool isValid() const = 0; |
| 63 virtual bool restore() { return false; }; |
61 virtual blink::WebLayer* layer() const { return 0; }; | 64 virtual blink::WebLayer* layer() const { return 0; }; |
62 virtual bool isAccelerated() const { return false; } | 65 virtual bool isAccelerated() const { return false; } |
63 virtual Platform3DObject getBackingTexture() const { return 0; } | 66 virtual Platform3DObject getBackingTexture() const { return 0; } |
64 virtual bool cachedBitmapEnabled() const { return false; } | 67 virtual bool cachedBitmapEnabled() const { return false; } |
65 virtual const SkBitmap& cachedBitmap() const; | 68 virtual const SkBitmap& cachedBitmap() const; |
66 virtual void invalidateCachedBitmap() { } | 69 virtual void invalidateCachedBitmap() { } |
67 virtual void updateCachedBitmapIfNeeded() { } | 70 virtual void updateCachedBitmapIfNeeded() { } |
68 virtual void setIsHidden(bool) { } | 71 virtual void setIsHidden(bool) { } |
| 72 virtual void setImageBuffer(ImageBuffer*) { } |
69 | 73 |
70 OpacityMode opacityMode() const { return m_opacityMode; } | 74 OpacityMode opacityMode() const { return m_opacityMode; } |
71 const IntSize& size() const { return m_size; } | 75 const IntSize& size() const { return m_size; } |
| 76 void notifyIsValidChanged(bool isValid) const; |
72 | 77 |
73 protected: | 78 protected: |
| 79 ImageBufferSurface(const IntSize&, OpacityMode); |
74 void clear(); | 80 void clear(); |
75 | 81 |
76 ImageBufferSurface(const IntSize& size, OpacityMode opacityMode) | |
77 : m_opacityMode(opacityMode) | |
78 , m_size(size) | |
79 { | |
80 setIsHidden(false); | |
81 } | |
82 | |
83 private: | 82 private: |
84 OpacityMode m_opacityMode; | 83 OpacityMode m_opacityMode; |
85 IntSize m_size; | 84 IntSize m_size; |
86 }; | 85 }; |
87 | 86 |
88 } // namespace WebCore | 87 } // namespace WebCore |
89 | 88 |
90 #endif | 89 #endif |
OLD | NEW |