OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TextureCopier_h | 5 #ifndef TextureCopier_h |
6 #define TextureCopier_h | 6 #define TextureCopier_h |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "GraphicsContext3D.h" | 9 #include "GraphicsContext3D.h" |
9 #include "ProgramBinding.h" | 10 #include "ProgramBinding.h" |
10 #include "ShaderChromium.h" | 11 #include "ShaderChromium.h" |
11 #include <wtf/OwnPtr.h> | 12 #include <wtf/OwnPtr.h> |
12 #include <wtf/PassOwnPtr.h> | 13 #include <wtf/PassOwnPtr.h> |
13 #include <wtf/Noncopyable.h> | |
14 | 14 |
15 namespace WebKit { | 15 namespace WebKit { |
16 class WebGraphicsContext3D; | 16 class WebGraphicsContext3D; |
17 } | 17 } |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class IntSize; | 20 class IntSize; |
21 | 21 |
22 class TextureCopier { | 22 class TextureCopier { |
23 public: | 23 public: |
24 struct Parameters { | 24 struct Parameters { |
25 unsigned sourceTexture; | 25 unsigned sourceTexture; |
26 unsigned destTexture; | 26 unsigned destTexture; |
27 IntSize size; | 27 IntSize size; |
28 }; | 28 }; |
29 // Copy the base level contents of |sourceTexture| to |destTexture|. Both te
xture objects | 29 // Copy the base level contents of |sourceTexture| to |destTexture|. Both te
xture objects |
30 // must be complete and have a base level of |size| dimensions. The color fo
rmats do not need | 30 // must be complete and have a base level of |size| dimensions. The color fo
rmats do not need |
31 // to match, but |destTexture| must have a renderable format. | 31 // to match, but |destTexture| must have a renderable format. |
32 virtual void copyTexture(Parameters) = 0; | 32 virtual void copyTexture(Parameters) = 0; |
33 virtual void flush() = 0; | 33 virtual void flush() = 0; |
34 | 34 |
35 virtual ~TextureCopier() { } | 35 virtual ~TextureCopier() { } |
36 }; | 36 }; |
37 | 37 |
38 #if USE(ACCELERATED_COMPOSITING) | 38 #if USE(ACCELERATED_COMPOSITING) |
39 | 39 |
40 class AcceleratedTextureCopier : public TextureCopier { | 40 class AcceleratedTextureCopier : public TextureCopier { |
41 WTF_MAKE_NONCOPYABLE(AcceleratedTextureCopier); | |
42 public: | 41 public: |
43 static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) | 42 static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) |
44 { | 43 { |
45 return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms)
); | 44 return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms)
); |
46 } | 45 } |
47 virtual ~AcceleratedTextureCopier(); | 46 virtual ~AcceleratedTextureCopier(); |
48 | 47 |
49 virtual void copyTexture(Parameters) OVERRIDE; | 48 virtual void copyTexture(Parameters) OVERRIDE; |
50 virtual void flush() OVERRIDE; | 49 virtual void flush() OVERRIDE; |
51 | 50 |
52 protected: | 51 protected: |
53 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); | 52 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); |
54 | 53 |
55 private: | 54 private: |
56 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; | 55 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; |
57 | 56 |
58 WebKit::WebGraphicsContext3D* m_context; | 57 WebKit::WebGraphicsContext3D* m_context; |
59 Platform3DObject m_fbo; | 58 Platform3DObject m_fbo; |
60 Platform3DObject m_positionBuffer; | 59 Platform3DObject m_positionBuffer; |
61 OwnPtr<BlitProgram> m_blitProgram; | 60 OwnPtr<BlitProgram> m_blitProgram; |
62 bool m_usingBindUniforms; | 61 bool m_usingBindUniforms; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); |
63 }; | 64 }; |
64 | 65 |
65 #endif // USE(ACCELERATED_COMPOSITING) | 66 #endif // USE(ACCELERATED_COMPOSITING) |
66 | 67 |
67 } | 68 } |
68 | 69 |
69 #endif | 70 #endif |
OLD | NEW |