OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
7 | 7 |
8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Rect; | 15 class Rect; |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 class SkRegion; | |
20 | |
21 namespace content { | 19 namespace content { |
22 | 20 |
23 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D | 21 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D |
24 // interfaces. | 22 // interfaces. |
25 class GLHelper { | 23 class GLHelper { |
26 public: | 24 public: |
27 GLHelper(WebKit::WebGraphicsContext3D* context, | 25 GLHelper(WebKit::WebGraphicsContext3D* context, |
28 WebKit::WebGraphicsContext3D* context_for_thread); | 26 WebKit::WebGraphicsContext3D* context_for_thread); |
29 virtual ~GLHelper(); | 27 virtual ~GLHelper(); |
30 | 28 |
(...skipping 30 matching lines...) Expand all Loading... |
61 // the texture and |dst_size| is the size of the resulting copy. | 59 // the texture and |dst_size| is the size of the resulting copy. |
62 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, | 60 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, |
63 const gfx::Size& src_size, | 61 const gfx::Size& src_size, |
64 const gfx::Size& dst_size, | 62 const gfx::Size& dst_size, |
65 bool vertically_flip_texture); | 63 bool vertically_flip_texture); |
66 | 64 |
67 // Returns the shader compiled from the source. | 65 // Returns the shader compiled from the source. |
68 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, | 66 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, |
69 WebKit::WGC3Denum type); | 67 WebKit::WGC3Denum type); |
70 | 68 |
71 // Copies all pixels from |previous_texture| into |texture| that are | |
72 // inside the region covered by |old_damage| but not part of |new_damage|. | |
73 void CopySubBufferDamage(WebKit::WebGLId texture, | |
74 WebKit::WebGLId previous_texture, | |
75 const SkRegion& new_damage, | |
76 const SkRegion& old_damage); | |
77 private: | 69 private: |
78 class CopyTextureToImpl; | 70 class CopyTextureToImpl; |
79 | 71 |
80 // Creates |copy_texture_to_impl_| if NULL. | 72 // Creates |copy_texture_to_impl_| if NULL. |
81 void InitCopyTextToImpl(); | 73 void InitCopyTextToImpl(); |
82 | 74 |
83 WebKit::WebGraphicsContext3D* context_; | 75 WebKit::WebGraphicsContext3D* context_; |
84 WebKit::WebGraphicsContext3D* context_for_thread_; | 76 WebKit::WebGraphicsContext3D* context_for_thread_; |
85 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 77 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
86 | 78 |
87 // The number of all GLHelper instances. | 79 // The number of all GLHelper instances. |
88 static base::subtle::Atomic32 count_; | 80 static base::subtle::Atomic32 count_; |
89 | 81 |
90 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 82 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
91 }; | 83 }; |
92 | 84 |
93 } // namespace content | 85 } // namespace content |
94 | 86 |
95 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 87 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
OLD | NEW |