| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TEXTURE_COPIER_H_ | |
| 6 #define CC_TEXTURE_COPIER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "cc/base/cc_export.h" | |
| 11 #include "cc/program_binding.h" | |
| 12 #include "cc/shader.h" | |
| 13 #include "third_party/khronos/GLES2/gl2.h" | |
| 14 #include "ui/gfx/size.h" | |
| 15 | |
| 16 namespace WebKit { class WebGraphicsContext3D; } | |
| 17 | |
| 18 namespace cc { | |
| 19 | |
| 20 class CC_EXPORT TextureCopier { | |
| 21 public: | |
| 22 struct Parameters { | |
| 23 unsigned source_texture; | |
| 24 unsigned dest_texture; | |
| 25 gfx::Size size; | |
| 26 }; | |
| 27 // Copy the base level contents of |source_texture| to |dest_texture|. Both | |
| 28 // texture objects must be complete and have a base level of |size| | |
| 29 // dimensions. The color formats do not need to match, but |dest_texture| must | |
| 30 // have a renderable format. | |
| 31 virtual void CopyTexture(Parameters parameters) = 0; | |
| 32 virtual void Flush() = 0; | |
| 33 | |
| 34 virtual ~TextureCopier() {} | |
| 35 }; | |
| 36 | |
| 37 class CC_EXPORT AcceleratedTextureCopier : public TextureCopier { | |
| 38 public: | |
| 39 static scoped_ptr<AcceleratedTextureCopier> Create( | |
| 40 WebKit::WebGraphicsContext3D* context, | |
| 41 bool using_bind_uniforms) { | |
| 42 return make_scoped_ptr( | |
| 43 new AcceleratedTextureCopier(context, using_bind_uniforms)); | |
| 44 } | |
| 45 virtual ~AcceleratedTextureCopier(); | |
| 46 | |
| 47 virtual void CopyTexture(Parameters parameters) OVERRIDE; | |
| 48 virtual void Flush() OVERRIDE; | |
| 49 | |
| 50 protected: | |
| 51 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D* context, | |
| 52 bool using_bind_uniforms); | |
| 53 | |
| 54 private: | |
| 55 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> | |
| 56 BlitProgram; | |
| 57 | |
| 58 WebKit::WebGraphicsContext3D* context_; | |
| 59 GLuint fbo_; | |
| 60 GLuint position_buffer_; | |
| 61 scoped_ptr<BlitProgram> blit_program_; | |
| 62 bool using_bind_uniforms_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); | |
| 65 }; | |
| 66 | |
| 67 } | |
| 68 | |
| 69 #endif // CC_TEXTURE_COPIER_H_ | |
| OLD | NEW |