| 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/Platform/chromium/public/WebGraphicsContext3
D.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.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; | 19 class SkRegion; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D | 23 // Provides higher level operations on top of the WebKit::WebGraphicsContext3D |
| 24 // interfaces. | 24 // interfaces. |
| 25 class GLHelper { | 25 class GLHelper { |
| 26 public: | 26 public: |
| 27 GLHelper(WebKit::WebGraphicsContext3D* context, | 27 GLHelper(WebKit::WebGraphicsContext3D* context); |
| 28 WebKit::WebGraphicsContext3D* context_for_thread); | |
| 29 virtual ~GLHelper(); | 28 virtual ~GLHelper(); |
| 30 | 29 |
| 31 WebKit::WebGraphicsContext3D* context() const; | 30 WebKit::WebGraphicsContext3D* context() const; |
| 32 | 31 |
| 33 // Copies the block of pixels specified with |src_subrect| from |src_texture|, | 32 // Copies the block of pixels specified with |src_subrect| from |src_texture|, |
| 34 // scales it to |dst_size|, and writes it into |out|. | 33 // scales it to |dst_size|, and writes it into |out|. |
| 35 // |src_size| is the size of |src_texture|. The result is of format GL_BGRA | 34 // |src_size| is the size of |src_texture|. The result is of format GL_BGRA |
| 36 // and is potentially flipped vertically to make it a correct image | 35 // and is potentially flipped vertically to make it a correct image |
| 37 // representation. |callback| is invoked with the copy result when the copy | 36 // representation. |callback| is invoked with the copy result when the copy |
| 38 // operation has completed. | 37 // operation has completed. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const SkRegion& new_damage, | 74 const SkRegion& new_damage, |
| 76 const SkRegion& old_damage); | 75 const SkRegion& old_damage); |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 class CopyTextureToImpl; | 78 class CopyTextureToImpl; |
| 80 | 79 |
| 81 // Creates |copy_texture_to_impl_| if NULL. | 80 // Creates |copy_texture_to_impl_| if NULL. |
| 82 void InitCopyTextToImpl(); | 81 void InitCopyTextToImpl(); |
| 83 | 82 |
| 84 WebKit::WebGraphicsContext3D* context_; | 83 WebKit::WebGraphicsContext3D* context_; |
| 85 WebKit::WebGraphicsContext3D* context_for_thread_; | |
| 86 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 84 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
| 87 | 85 |
| 88 // The number of all GLHelper instances. | |
| 89 static base::subtle::Atomic32 count_; | |
| 90 | |
| 91 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 86 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
| 92 }; | 87 }; |
| 93 | 88 |
| 94 } // namespace content | 89 } // namespace content |
| 95 | 90 |
| 96 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 91 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |