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