Use SCHEME_HTTP for HTTPS proxies on Android.
[chromium-blink-merge.git] / cc / texture_copier.h
blob458a36366e50146e2733d55cd7666a7d6190422f
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.
5 #ifndef CC_TEXTURE_COPIER_H_
6 #define CC_TEXTURE_COPIER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/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"
16 namespace WebKit {
17 class WebGraphicsContext3D;
20 namespace cc {
22 class CC_EXPORT TextureCopier {
23 public:
24 struct Parameters {
25 unsigned sourceTexture;
26 unsigned destTexture;
27 gfx::Size size;
29 // Copy the base level contents of |sourceTexture| to |destTexture|. Both texture objects
30 // must be complete and have a base level of |size| dimensions. The color formats do not need
31 // to match, but |destTexture| must have a renderable format.
32 virtual void copyTexture(Parameters) = 0;
33 virtual void flush() = 0;
35 virtual ~TextureCopier() { }
38 class CC_EXPORT AcceleratedTextureCopier : public TextureCopier {
39 public:
40 static scoped_ptr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContext3D* context, bool usingBindUniforms)
42 return make_scoped_ptr(new AcceleratedTextureCopier(context, usingBindUniforms));
44 virtual ~AcceleratedTextureCopier();
46 virtual void copyTexture(Parameters) OVERRIDE;
47 virtual void flush() OVERRIDE;
49 protected:
50 AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUniforms);
52 private:
53 typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> BlitProgram;
55 WebKit::WebGraphicsContext3D* m_context;
56 GLuint m_fbo;
57 GLuint m_positionBuffer;
58 scoped_ptr<BlitProgram> m_blitProgram;
59 bool m_usingBindUniforms;
61 DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier);
66 #endif // CC_TEXTURE_COPIER_H_