| 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 "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 13 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Rect; | 16 class Rect; |
| 17 class Size; | 17 class Size; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gpu { |
| 21 struct Mailbox; |
| 22 } |
| 23 |
| 20 namespace media { | 24 namespace media { |
| 21 class VideoFrame; | 25 class VideoFrame; |
| 22 }; | 26 }; |
| 23 | 27 |
| 24 class SkRegion; | 28 class SkRegion; |
| 25 | 29 |
| 26 namespace content { | 30 namespace content { |
| 27 | 31 |
| 28 class GLHelperScaling; | 32 class GLHelperScaling; |
| 29 | 33 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // Note that the src_texture will have the min/mag filter set to GL_LINEAR | 222 // Note that the src_texture will have the min/mag filter set to GL_LINEAR |
| 219 // and wrap_s/t set to CLAMP_TO_EDGE in this call. | 223 // and wrap_s/t set to CLAMP_TO_EDGE in this call. |
| 220 void CropScaleReadbackAndCleanTexture( | 224 void CropScaleReadbackAndCleanTexture( |
| 221 WebKit::WebGLId src_texture, | 225 WebKit::WebGLId src_texture, |
| 222 const gfx::Size& src_size, | 226 const gfx::Size& src_size, |
| 223 const gfx::Rect& src_subrect, | 227 const gfx::Rect& src_subrect, |
| 224 const gfx::Size& dst_size, | 228 const gfx::Size& dst_size, |
| 225 unsigned char* out, | 229 unsigned char* out, |
| 226 const base::Callback<void(bool)>& callback); | 230 const base::Callback<void(bool)>& callback); |
| 227 | 231 |
| 232 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, |
| 233 // scales it to |dst_size|, and writes it into |out|. |
| 234 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA |
| 235 // and is potentially flipped vertically to make it a correct image |
| 236 // representation. |callback| is invoked with the copy result when the copy |
| 237 // operation has completed. |
| 238 // Note that the texture bound to src_mailbox will have the min/mag filter set |
| 239 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is |
| 240 // assumed to be GL_TEXTURE_2D. |
| 241 void CropScaleReadbackAndCleanMailbox( |
| 242 const gpu::Mailbox& src_mailbox, |
| 243 uint32 sync_point, |
| 244 const gfx::Size& src_size, |
| 245 const gfx::Rect& src_subrect, |
| 246 const gfx::Size& dst_size, |
| 247 unsigned char* out, |
| 248 const base::Callback<void(bool)>& callback); |
| 249 |
| 228 // Copies the texture data out of |texture| into |out|. |size| is the | 250 // Copies the texture data out of |texture| into |out|. |size| is the |
| 229 // size of the texture. No post processing is applied to the pixels. The | 251 // size of the texture. No post processing is applied to the pixels. The |
| 230 // texture is assumed to have a format of GL_RGBA with a pixel type of | 252 // texture is assumed to have a format of GL_RGBA with a pixel type of |
| 231 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this | 253 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this |
| 232 // current context. | 254 // current context. |
| 233 void ReadbackTextureSync(WebKit::WebGLId texture, | 255 void ReadbackTextureSync(WebKit::WebGLId texture, |
| 234 const gfx::Rect& src_rect, | 256 const gfx::Rect& src_rect, |
| 235 unsigned char* out); | 257 unsigned char* out); |
| 236 | 258 |
| 237 // Creates a copy of the specified texture. |size| is the size of the texture. | 259 // Creates a copy of the specified texture. |size| is the size of the texture. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 258 // Copies all pixels from |previous_texture| into |texture| that are | 280 // Copies all pixels from |previous_texture| into |texture| that are |
| 259 // inside the region covered by |old_damage| but not part of |new_damage|. | 281 // inside the region covered by |old_damage| but not part of |new_damage|. |
| 260 void CopySubBufferDamage(WebKit::WebGLId texture, | 282 void CopySubBufferDamage(WebKit::WebGLId texture, |
| 261 WebKit::WebGLId previous_texture, | 283 WebKit::WebGLId previous_texture, |
| 262 const SkRegion& new_damage, | 284 const SkRegion& new_damage, |
| 263 const SkRegion& old_damage); | 285 const SkRegion& old_damage); |
| 264 | 286 |
| 265 // Simply creates a texture. | 287 // Simply creates a texture. |
| 266 WebKit::WebGLId CreateTexture(); | 288 WebKit::WebGLId CreateTexture(); |
| 267 | 289 |
| 290 // Creates a texture and consumes a mailbox into it. Returns 0 on failure. |
| 291 // Note the mailbox is assumed to be GL_TEXTURE_2D. |
| 292 WebKit::WebGLId ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, |
| 293 uint32 sync_point); |
| 294 |
| 268 // Resizes the texture's size to |size|. | 295 // Resizes the texture's size to |size|. |
| 269 void ResizeTexture(WebKit::WebGLId texture, const gfx::Size& size); | 296 void ResizeTexture(WebKit::WebGLId texture, const gfx::Size& size); |
| 270 | 297 |
| 271 // Copies the framebuffer data given in |rect| to |texture|. | 298 // Copies the framebuffer data given in |rect| to |texture|. |
| 272 void CopyTextureSubImage(WebKit::WebGLId texture, const gfx::Rect& rect); | 299 void CopyTextureSubImage(WebKit::WebGLId texture, const gfx::Rect& rect); |
| 273 | 300 |
| 274 // Copies the all framebuffer data to |texture|. |size| specifies the | 301 // Copies the all framebuffer data to |texture|. |size| specifies the |
| 275 // size of the framebuffer. | 302 // size of the framebuffer. |
| 276 void CopyTextureFullImage(WebKit::WebGLId texture, const gfx::Size& size); | 303 void CopyTextureFullImage(WebKit::WebGLId texture, const gfx::Size& size); |
| 277 | 304 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 virtual void ReadbackYUV( | 383 virtual void ReadbackYUV( |
| 357 WebKit::WebGLId texture, | 384 WebKit::WebGLId texture, |
| 358 media::VideoFrame* target, | 385 media::VideoFrame* target, |
| 359 const base::Callback<void(bool)>& callback) = 0; | 386 const base::Callback<void(bool)>& callback) = 0; |
| 360 virtual GLHelper::ScalerInterface* scaler() = 0; | 387 virtual GLHelper::ScalerInterface* scaler() = 0; |
| 361 }; | 388 }; |
| 362 | 389 |
| 363 } // namespace content | 390 } // namespace content |
| 364 | 391 |
| 365 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 392 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |