| 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 22 matching lines...) Expand all Loading... |
| 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 #include "wtf/PassRefPtr.h" |
| 40 | 40 |
| 41 class SkBitmap; | 41 class SkBitmap; |
| 42 class SkCanvas; | 42 class SkCanvas; |
| 43 class SkImage; |
| 43 class SkPicture; | 44 class SkPicture; |
| 44 | 45 |
| 45 namespace blink { class WebLayer; } | 46 namespace blink { class WebLayer; } |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 class ImageBuffer; | 50 class ImageBuffer; |
| 50 | 51 |
| 51 enum OpacityMode { | 52 enum OpacityMode { |
| 52 NonOpaque, | 53 NonOpaque, |
| 53 Opaque, | 54 Opaque, |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 class PLATFORM_EXPORT ImageBufferSurface { | 57 class PLATFORM_EXPORT ImageBufferSurface { |
| 57 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; | 58 WTF_MAKE_NONCOPYABLE(ImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
| 58 public: | 59 public: |
| 59 virtual ~ImageBufferSurface() { } | 60 virtual ~ImageBufferSurface(); |
| 60 | 61 |
| 61 virtual SkCanvas* canvas() const = 0; | 62 virtual SkCanvas* canvas() const = 0; |
| 62 virtual const SkBitmap& bitmap(); | 63 virtual const SkBitmap& bitmap(); |
| 63 virtual void didDraw() { } | 64 virtual void didDraw() { } |
| 64 virtual void willReadback() { } | 65 virtual void willReadback() { } |
| 65 virtual bool isValid() const = 0; | 66 virtual bool isValid() const = 0; |
| 66 virtual bool restore() { return false; }; | 67 virtual bool restore() { return false; }; |
| 67 virtual blink::WebLayer* layer() const { return 0; }; | 68 virtual blink::WebLayer* layer() const { return 0; }; |
| 68 virtual bool isAccelerated() const { return false; } | 69 virtual bool isAccelerated() const { return false; } |
| 69 virtual Platform3DObject getBackingTexture() const { return 0; } | 70 virtual Platform3DObject getBackingTexture() const { return 0; } |
| 70 virtual bool cachedBitmapEnabled() const { return false; } | 71 virtual bool cachedBitmapEnabled() const { return false; } |
| 71 virtual const SkBitmap& cachedBitmap() const; | 72 virtual const SkBitmap& cachedBitmap() const; |
| 72 virtual void invalidateCachedBitmap() { } | 73 virtual void invalidateCachedBitmap() { } |
| 73 virtual void updateCachedBitmapIfNeeded() { } | 74 virtual void updateCachedBitmapIfNeeded() { } |
| 74 virtual void setIsHidden(bool) { } | 75 virtual void setIsHidden(bool) { } |
| 75 virtual void setImageBuffer(ImageBuffer*) { } | 76 virtual void setImageBuffer(ImageBuffer*) { } |
| 76 virtual PassRefPtr<SkPicture> getPicture(); | 77 virtual PassRefPtr<SkPicture> getPicture(); |
| 77 virtual void didClearCanvas() { } | 78 virtual void didClearCanvas() { } |
| 78 | 79 |
| 80 virtual PassRefPtr<SkImage> newImageSnapshot() const; |
| 81 |
| 79 OpacityMode opacityMode() const { return m_opacityMode; } | 82 OpacityMode opacityMode() const { return m_opacityMode; } |
| 80 const IntSize& size() const { return m_size; } | 83 const IntSize& size() const { return m_size; } |
| 81 void notifyIsValidChanged(bool isValid) const; | 84 void notifyIsValidChanged(bool isValid) const; |
| 82 | 85 |
| 83 protected: | 86 protected: |
| 84 ImageBufferSurface(const IntSize&, OpacityMode); | 87 ImageBufferSurface(const IntSize&, OpacityMode); |
| 85 void clear(); | 88 void clear(); |
| 86 | 89 |
| 87 private: | 90 private: |
| 88 OpacityMode m_opacityMode; | 91 OpacityMode m_opacityMode; |
| 89 IntSize m_size; | 92 IntSize m_size; |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 } // namespace blink | 95 } // namespace blink |
| 93 | 96 |
| 94 #endif | 97 #endif |
| OLD | NEW |