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 "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/cc_export.h" |
10 #include "cc/program_binding.h" | 11 #include "cc/program_binding.h" |
11 #include "cc/shader.h" | 12 #include "cc/shader.h" |
12 #include "third_party/khronos/GLES2/gl2.h" | 13 #include "third_party/khronos/GLES2/gl2.h" |
13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
14 | 15 |
15 namespace WebKit { | 16 namespace WebKit { |
16 class WebGraphicsContext3D; | 17 class WebGraphicsContext3D; |
17 } | 18 } |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 | 21 |
21 class TextureCopier { | 22 class CC_EXPORT TextureCopier { |
22 public: | 23 public: |
23 struct Parameters { | 24 struct Parameters { |
24 unsigned sourceTexture; | 25 unsigned sourceTexture; |
25 unsigned destTexture; | 26 unsigned destTexture; |
26 gfx::Size size; | 27 gfx::Size size; |
27 }; | 28 }; |
28 // 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 |
29 // 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 |
30 // to match, but |destTexture| must have a renderable format. | 31 // to match, but |destTexture| must have a renderable format. |
31 virtual void copyTexture(Parameters) = 0; | 32 virtual void copyTexture(Parameters) = 0; |
32 virtual void flush() = 0; | 33 virtual void flush() = 0; |
33 | 34 |
34 virtual ~TextureCopier() { } | 35 virtual ~TextureCopier() { } |
35 }; | 36 }; |
36 | 37 |
37 class AcceleratedTextureCopier : public TextureCopier { | 38 class CC_EXPORT AcceleratedTextureCopier : public TextureCopier { |
38 public: | 39 public: |
39 static scoped_ptr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) | 40 static scoped_ptr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) |
40 { | 41 { |
41 return make_scoped_ptr(new AcceleratedTextureCopier(context, usingBindUn
iforms)); | 42 return make_scoped_ptr(new AcceleratedTextureCopier(context, usingBindUn
iforms)); |
42 } | 43 } |
43 virtual ~AcceleratedTextureCopier(); | 44 virtual ~AcceleratedTextureCopier(); |
44 | 45 |
45 virtual void copyTexture(Parameters) OVERRIDE; | 46 virtual void copyTexture(Parameters) OVERRIDE; |
46 virtual void flush() OVERRIDE; | 47 virtual void flush() OVERRIDE; |
47 | 48 |
48 protected: | 49 protected: |
49 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); | 50 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); |
50 | 51 |
51 private: | 52 private: |
52 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; | 53 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; |
53 | 54 |
54 WebKit::WebGraphicsContext3D* m_context; | 55 WebKit::WebGraphicsContext3D* m_context; |
55 GLuint m_fbo; | 56 GLuint m_fbo; |
56 GLuint m_positionBuffer; | 57 GLuint m_positionBuffer; |
57 scoped_ptr<BlitProgram> m_blitProgram; | 58 scoped_ptr<BlitProgram> m_blitProgram; |
58 bool m_usingBindUniforms; | 59 bool m_usingBindUniforms; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); | 61 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); |
61 }; | 62 }; |
62 | 63 |
63 } | 64 } |
64 | 65 |
65 #endif | 66 #endif |
OLD | NEW |