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 "GraphicsContext3D.h" | |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/program_binding.h" | 10 #include "cc/program_binding.h" |
11 #include "cc/shader.h" | 11 #include "cc/shader.h" |
12 #include <wtf/OwnPtr.h> | 12 #include "GraphicsContext3D.h" |
13 #include <wtf/PassOwnPtr.h> | 13 #include "IntSize.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 class AcceleratedTextureCopier : public TextureCopier { | 38 class AcceleratedTextureCopier : public TextureCopier { |
39 public: | 39 public: |
40 static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) | 40 static scoped_ptr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) |
41 { | 41 { |
42 return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms)
); | 42 return make_scoped_ptr(new AcceleratedTextureCopier(context, usingBindUn
iforms)); |
43 } | 43 } |
44 virtual ~AcceleratedTextureCopier(); | 44 virtual ~AcceleratedTextureCopier(); |
45 | 45 |
46 virtual void copyTexture(Parameters) OVERRIDE; | 46 virtual void copyTexture(Parameters) OVERRIDE; |
47 virtual void flush() OVERRIDE; | 47 virtual void flush() OVERRIDE; |
48 | 48 |
49 protected: | 49 protected: |
50 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); | 50 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); |
51 | 51 |
52 private: | 52 private: |
53 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; | 53 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; |
54 | 54 |
55 WebKit::WebGraphicsContext3D* m_context; | 55 WebKit::WebGraphicsContext3D* m_context; |
56 Platform3DObject m_fbo; | 56 Platform3DObject m_fbo; |
57 Platform3DObject m_positionBuffer; | 57 Platform3DObject m_positionBuffer; |
58 OwnPtr<BlitProgram> m_blitProgram; | 58 scoped_ptr<BlitProgram> m_blitProgram; |
59 bool m_usingBindUniforms; | 59 bool m_usingBindUniforms; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); | 61 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); |
62 }; | 62 }; |
63 | 63 |
64 } | 64 } |
65 | 65 |
66 #endif | 66 #endif |
OLD | NEW |