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