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" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // |src_size| is the size of |src_mailbox|. The result is in |out_color_type| | 182 // |src_size| is the size of |src_mailbox|. The result is in |out_color_type| |
183 // format and is potentially flipped vertically to make it a correct image | 183 // format and is potentially flipped vertically to make it a correct image |
184 // representation. |callback| is invoked with the copy result when the copy | 184 // representation. |callback| is invoked with the copy result when the copy |
185 // operation has completed. | 185 // operation has completed. |
186 // Note that the texture bound to src_mailbox will have the min/mag filter set | 186 // Note that the texture bound to src_mailbox will have the min/mag filter set |
187 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is | 187 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is |
188 // assumed to be GL_TEXTURE_2D. | 188 // assumed to be GL_TEXTURE_2D. |
189 void CropScaleReadbackAndCleanMailbox( | 189 void CropScaleReadbackAndCleanMailbox( |
190 const gpu::Mailbox& src_mailbox, | 190 const gpu::Mailbox& src_mailbox, |
191 uint32 sync_point, | 191 uint32 sync_point, |
| 192 const gpu::SyncToken& sync_token, |
192 const gfx::Size& src_size, | 193 const gfx::Size& src_size, |
193 const gfx::Rect& src_subrect, | 194 const gfx::Rect& src_subrect, |
194 const gfx::Size& dst_size, | 195 const gfx::Size& dst_size, |
195 unsigned char* out, | 196 unsigned char* out, |
196 const SkColorType out_color_type, | 197 const SkColorType out_color_type, |
197 const base::Callback<void(bool)>& callback, | 198 const base::Callback<void(bool)>& callback, |
198 GLHelper::ScalerQuality quality); | 199 GLHelper::ScalerQuality quality); |
199 | 200 |
200 // Copies the texture data out of |texture| into |out|. |size| is the | 201 // Copies the texture data out of |texture| into |out|. |size| is the |
201 // size of the texture. No post processing is applied to the pixels. The | 202 // size of the texture. No post processing is applied to the pixels. The |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const SkRegion& old_damage); | 241 const SkRegion& old_damage); |
241 | 242 |
242 // Simply creates a texture. | 243 // Simply creates a texture. |
243 GLuint CreateTexture(); | 244 GLuint CreateTexture(); |
244 // Deletes a texture. | 245 // Deletes a texture. |
245 void DeleteTexture(GLuint texture_id); | 246 void DeleteTexture(GLuint texture_id); |
246 | 247 |
247 // Insert a sync point into the GL command buffer. | 248 // Insert a sync point into the GL command buffer. |
248 uint32 InsertSyncPoint(); | 249 uint32 InsertSyncPoint(); |
249 // Wait for the sync point before executing further GL commands. | 250 // Wait for the sync point before executing further GL commands. |
250 void WaitSyncPoint(uint32 sync_point); | 251 void WaitSyncPoint(uint32 sync_point, const gpu::SyncToken& sync_token); |
251 | 252 |
252 // Creates a mailbox holder that is attached to the given texture id, with a | 253 // Creates a mailbox holder that is attached to the given texture id, with a |
253 // sync point to wait on before using the mailbox. Returns a holder with an | 254 // sync point to wait on before using the mailbox. Returns a holder with an |
254 // empty mailbox on failure. | 255 // empty mailbox on failure. |
255 // Note the texture is assumed to be GL_TEXTURE_2D. | 256 // Note the texture is assumed to be GL_TEXTURE_2D. |
256 gpu::MailboxHolder ProduceMailboxHolderFromTexture(GLuint texture_id); | 257 gpu::MailboxHolder ProduceMailboxHolderFromTexture(GLuint texture_id); |
257 | 258 |
258 // Creates a texture and consumes a mailbox into it. Returns 0 on failure. | 259 // Creates a texture and consumes a mailbox into it. Returns 0 on failure. |
259 // Note the mailbox is assumed to be GL_TEXTURE_2D. | 260 // Note the mailbox is assumed to be GL_TEXTURE_2D. |
260 GLuint ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, | 261 GLuint ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, |
261 uint32 sync_point); | 262 uint32 sync_point, |
| 263 const gpu::SyncToken& sync_token); |
262 | 264 |
263 // Resizes the texture's size to |size|. | 265 // Resizes the texture's size to |size|. |
264 void ResizeTexture(GLuint texture, const gfx::Size& size); | 266 void ResizeTexture(GLuint texture, const gfx::Size& size); |
265 | 267 |
266 // Copies the framebuffer data given in |rect| to |texture|. | 268 // Copies the framebuffer data given in |rect| to |texture|. |
267 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); | 269 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); |
268 | 270 |
269 // Copies the all framebuffer data to |texture|. |size| specifies the | 271 // Copies the all framebuffer data to |texture|. |size| specifies the |
270 // size of the framebuffer. | 272 // size of the framebuffer. |
271 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); | 273 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ReadbackYUVInterface() {} | 365 ReadbackYUVInterface() {} |
364 virtual ~ReadbackYUVInterface() {} | 366 virtual ~ReadbackYUVInterface() {} |
365 | 367 |
366 // Note that |target| must use YV12 format. |paste_location| specifies where | 368 // Note that |target| must use YV12 format. |paste_location| specifies where |
367 // the captured pixels that are read back will be placed in the video frame. | 369 // the captured pixels that are read back will be placed in the video frame. |
368 // The region defined by the |paste_location| and the |dst_size| specified in | 370 // The region defined by the |paste_location| and the |dst_size| specified in |
369 // the call to CreateReadbackPipelineYUV() must be fully contained within | 371 // the call to CreateReadbackPipelineYUV() must be fully contained within |
370 // |target->visible_rect()|. | 372 // |target->visible_rect()|. |
371 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, | 373 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, |
372 uint32 sync_point, | 374 uint32 sync_point, |
| 375 const gpu::SyncToken& sync_token, |
373 const scoped_refptr<media::VideoFrame>& target, | 376 const scoped_refptr<media::VideoFrame>& target, |
374 const gfx::Point& paste_location, | 377 const gfx::Point& paste_location, |
375 const base::Callback<void(bool)>& callback) = 0; | 378 const base::Callback<void(bool)>& callback) = 0; |
376 virtual GLHelper::ScalerInterface* scaler() = 0; | 379 virtual GLHelper::ScalerInterface* scaler() = 0; |
377 }; | 380 }; |
378 | 381 |
379 } // namespace content | 382 } // namespace content |
380 | 383 |
381 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 384 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
OLD | NEW |