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