| 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 21 matching lines...) Expand all Loading... |
| 32 #define WebGLImageBufferSurface_h | 32 #define WebGLImageBufferSurface_h |
| 33 | 33 |
| 34 #include "platform/graphics/ImageBufferSurface.h" | 34 #include "platform/graphics/ImageBufferSurface.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 36 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 class WebGraphicsContext3DProvider; | 39 class WebGraphicsContext3DProvider; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace blink { |
| 43 | 43 |
| 44 // This is a GPU backed surface that has no canvas or render target. | 44 // This is a GPU backed surface that has no canvas or render target. |
| 45 class PLATFORM_EXPORT WebGLImageBufferSurface : public ImageBufferSurface { | 45 class PLATFORM_EXPORT WebGLImageBufferSurface : public ImageBufferSurface { |
| 46 WTF_MAKE_NONCOPYABLE(WebGLImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; | 46 WTF_MAKE_NONCOPYABLE(WebGLImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
| 47 public: | 47 public: |
| 48 WebGLImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); | 48 WebGLImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); |
| 49 virtual ~WebGLImageBufferSurface(); | 49 virtual ~WebGLImageBufferSurface(); |
| 50 | 50 |
| 51 virtual SkCanvas* canvas() const OVERRIDE { return 0; } | 51 virtual SkCanvas* canvas() const OVERRIDE { return 0; } |
| 52 virtual const SkBitmap& bitmap() const OVERRIDE { return m_bitmap; } | 52 virtual const SkBitmap& bitmap() const OVERRIDE { return m_bitmap; } |
| 53 virtual bool isValid() const OVERRIDE { return m_bitmap.pixelRef(); } | 53 virtual bool isValid() const OVERRIDE { return m_bitmap.pixelRef(); } |
| 54 virtual bool isAccelerated() const OVERRIDE { return true; } | 54 virtual bool isAccelerated() const OVERRIDE { return true; } |
| 55 virtual Platform3DObject getBackingTexture() const OVERRIDE; | 55 virtual Platform3DObject getBackingTexture() const OVERRIDE; |
| 56 virtual bool cachedBitmapEnabled() const OVERRIDE { return true; } | 56 virtual bool cachedBitmapEnabled() const OVERRIDE { return true; } |
| 57 virtual const SkBitmap& cachedBitmap() const OVERRIDE { return m_cachedBitma
p; } | 57 virtual const SkBitmap& cachedBitmap() const OVERRIDE { return m_cachedBitma
p; } |
| 58 virtual void invalidateCachedBitmap() OVERRIDE; | 58 virtual void invalidateCachedBitmap() OVERRIDE; |
| 59 virtual void updateCachedBitmapIfNeeded() OVERRIDE; | 59 virtual void updateCachedBitmapIfNeeded() OVERRIDE; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 SkBitmap m_bitmap; | 62 SkBitmap m_bitmap; |
| 63 // This raw-pixel based SkBitmap works as a cache at CPU side to avoid heavy
cost | 63 // This raw-pixel based SkBitmap works as a cache at CPU side to avoid heavy
cost |
| 64 // on readback from GPU side to CPU side in some cases. | 64 // on readback from GPU side to CPU side in some cases. |
| 65 SkBitmap m_cachedBitmap; | 65 SkBitmap m_cachedBitmap; |
| 66 OwnPtr<blink::WebGraphicsContext3DProvider> m_contextProvider; | 66 OwnPtr<blink::WebGraphicsContext3DProvider> m_contextProvider; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 | 69 |
| 70 } // namespace WebCore | 70 } // namespace blink |
| 71 | 71 |
| 72 #endif | 72 #endif |
| OLD | NEW |