| 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 |
| 19 namespace content { | 21 namespace content { |
| 20 | 22 |
| 21 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D | 23 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D |
| 22 // interfaces. | 24 // interfaces. |
| 23 class GLHelper { | 25 class GLHelper { |
| 24 public: | 26 public: |
| 25 GLHelper(WebKit::WebGraphicsContext3D* context, | 27 GLHelper(WebKit::WebGraphicsContext3D* context, |
| 26 WebKit::WebGraphicsContext3D* context_for_thread); | 28 WebKit::WebGraphicsContext3D* context_for_thread); |
| 27 virtual ~GLHelper(); | 29 virtual ~GLHelper(); |
| 28 | 30 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 59 // the texture and |dst_size| is the size of the resulting copy. | 61 // the texture and |dst_size| is the size of the resulting copy. |
| 60 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, | 62 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, |
| 61 const gfx::Size& src_size, | 63 const gfx::Size& src_size, |
| 62 const gfx::Size& dst_size, | 64 const gfx::Size& dst_size, |
| 63 bool vertically_flip_texture); | 65 bool vertically_flip_texture); |
| 64 | 66 |
| 65 // Returns the shader compiled from the source. | 67 // Returns the shader compiled from the source. |
| 66 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, | 68 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, |
| 67 WebKit::WGC3Denum type); | 69 WebKit::WGC3Denum type); |
| 68 | 70 |
| 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); |
| 69 private: | 77 private: |
| 70 class CopyTextureToImpl; | 78 class CopyTextureToImpl; |
| 71 | 79 |
| 72 // Creates |copy_texture_to_impl_| if NULL. | 80 // Creates |copy_texture_to_impl_| if NULL. |
| 73 void InitCopyTextToImpl(); | 81 void InitCopyTextToImpl(); |
| 74 | 82 |
| 75 WebKit::WebGraphicsContext3D* context_; | 83 WebKit::WebGraphicsContext3D* context_; |
| 76 WebKit::WebGraphicsContext3D* context_for_thread_; | 84 WebKit::WebGraphicsContext3D* context_for_thread_; |
| 77 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 85 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
| 78 | 86 |
| 79 // The number of all GLHelper instances. | 87 // The number of all GLHelper instances. |
| 80 static base::subtle::Atomic32 count_; | 88 static base::subtle::Atomic32 count_; |
| 81 | 89 |
| 82 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 90 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
| 83 }; | 91 }; |
| 84 | 92 |
| 85 } // namespace content | 93 } // namespace content |
| 86 | 94 |
| 87 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 95 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |