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 |
| 5 #ifndef TextureCopier_h |
| 6 #define TextureCopier_h |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "GraphicsContext3D.h" |
| 10 #include "ProgramBinding.h" |
| 11 #include "ShaderChromium.h" |
| 12 #include <wtf/OwnPtr.h> |
| 13 #include <wtf/PassOwnPtr.h> |
| 14 |
| 15 namespace WebKit { |
| 16 class WebGraphicsContext3D; |
| 17 } |
| 18 |
| 19 namespace cc { |
| 20 class IntSize; |
| 21 |
| 22 class TextureCopier { |
| 23 public: |
| 24 struct Parameters { |
| 25 unsigned sourceTexture; |
| 26 unsigned destTexture; |
| 27 IntSize size; |
| 28 }; |
| 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 |
| 31 // to match, but |destTexture| must have a renderable format. |
| 32 virtual void copyTexture(Parameters) = 0; |
| 33 virtual void flush() = 0; |
| 34 |
| 35 virtual ~TextureCopier() { } |
| 36 }; |
| 37 |
| 38 #if USE(ACCELERATED_COMPOSITING) |
| 39 |
| 40 class AcceleratedTextureCopier : public TextureCopier { |
| 41 public: |
| 42 static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContex
t3D* context, bool usingBindUniforms) |
| 43 { |
| 44 return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms)
); |
| 45 } |
| 46 virtual ~AcceleratedTextureCopier(); |
| 47 |
| 48 virtual void copyTexture(Parameters) OVERRIDE; |
| 49 virtual void flush() OVERRIDE; |
| 50 |
| 51 protected: |
| 52 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUnifor
ms); |
| 53 |
| 54 private: |
| 55 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> Bl
itProgram; |
| 56 |
| 57 WebKit::WebGraphicsContext3D* m_context; |
| 58 Platform3DObject m_fbo; |
| 59 Platform3DObject m_positionBuffer; |
| 60 OwnPtr<BlitProgram> m_blitProgram; |
| 61 bool m_usingBindUniforms; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); |
| 64 }; |
| 65 |
| 66 #endif // USE(ACCELERATED_COMPOSITING) |
| 67 |
| 68 } |
| 69 |
| 70 #endif |
OLD | NEW |