| 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 29 matching lines...) Expand all Loading... |
| 58 // Creates a scaled copy of the specified texture. |src_size| is the size of | 60 // Creates a scaled copy of the specified texture. |src_size| is the size of |
| 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 | 65 |
| 64 // Returns the shader compiled from the source. | 66 // Returns the shader compiled from the source. |
| 65 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, | 67 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, |
| 66 WebKit::WGC3Denum type); | 68 WebKit::WGC3Denum type); |
| 67 | 69 |
| 70 // Copies all pixels from |previous_texture| into |texture| that are |
| 71 // inside the region covered by |old_damage| but not part of |new_damage|. |
| 72 void CopySubBufferDamage(WebKit::WebGLId texture, |
| 73 WebKit::WebGLId previous_texture, |
| 74 const SkRegion& new_damage, |
| 75 const SkRegion& old_damage); |
| 68 private: | 76 private: |
| 69 class CopyTextureToImpl; | 77 class CopyTextureToImpl; |
| 70 | 78 |
| 71 // Creates |copy_texture_to_impl_| if NULL. | 79 // Creates |copy_texture_to_impl_| if NULL. |
| 72 void InitCopyTextToImpl(); | 80 void InitCopyTextToImpl(); |
| 73 | 81 |
| 74 WebKit::WebGraphicsContext3D* context_; | 82 WebKit::WebGraphicsContext3D* context_; |
| 75 WebKit::WebGraphicsContext3D* context_for_thread_; | 83 WebKit::WebGraphicsContext3D* context_for_thread_; |
| 76 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 84 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
| 77 | 85 |
| 78 // The number of all GLHelper instances. | 86 // The number of all GLHelper instances. |
| 79 static base::subtle::Atomic32 count_; | 87 static base::subtle::Atomic32 count_; |
| 80 | 88 |
| 81 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 89 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 } // namespace content | 92 } // namespace content |
| 85 | 93 |
| 86 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 94 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |