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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // scales it to |dst_size|, and writes it into |out|. | 181 // scales it to |dst_size|, and writes it into |out|. |
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 const gpu::SyncToken& sync_token, |
192 const gfx::Size& src_size, | 192 const gfx::Size& src_size, |
193 const gfx::Rect& src_subrect, | 193 const gfx::Rect& src_subrect, |
194 const gfx::Size& dst_size, | 194 const gfx::Size& dst_size, |
195 unsigned char* out, | 195 unsigned char* out, |
196 const SkColorType out_color_type, | 196 const SkColorType out_color_type, |
197 const base::Callback<void(bool)>& callback, | 197 const base::Callback<void(bool)>& callback, |
198 GLHelper::ScalerQuality quality); | 198 GLHelper::ScalerQuality quality); |
199 | 199 |
200 // Copies the texture data out of |texture| into |out|. |size| is the | 200 // 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 | 201 // size of the texture. No post processing is applied to the pixels. The |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const SkRegion& new_damage, | 239 const SkRegion& new_damage, |
240 const SkRegion& old_damage); | 240 const SkRegion& old_damage); |
241 | 241 |
242 // Simply creates a texture. | 242 // Simply creates a texture. |
243 GLuint CreateTexture(); | 243 GLuint CreateTexture(); |
244 // Deletes a texture. | 244 // Deletes a texture. |
245 void DeleteTexture(GLuint texture_id); | 245 void DeleteTexture(GLuint texture_id); |
246 | 246 |
247 // Insert a sync point into the GL command buffer. | 247 // Insert a sync point into the GL command buffer. |
248 uint32 InsertSyncPoint(); | 248 uint32 InsertSyncPoint(); |
249 // Wait for the sync point before executing further GL commands. | 249 |
250 void WaitSyncPoint(uint32 sync_point); | 250 // Wait for the sync token before executing further GL commands. |
| 251 void WaitSyncToken(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 const gpu::SyncToken& sync_token); |
262 | 263 |
263 // Resizes the texture's size to |size|. | 264 // Resizes the texture's size to |size|. |
264 void ResizeTexture(GLuint texture, const gfx::Size& size); | 265 void ResizeTexture(GLuint texture, const gfx::Size& size); |
265 | 266 |
266 // Copies the framebuffer data given in |rect| to |texture|. | 267 // Copies the framebuffer data given in |rect| to |texture|. |
267 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); | 268 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); |
268 | 269 |
269 // Copies the all framebuffer data to |texture|. |size| specifies the | 270 // Copies the all framebuffer data to |texture|. |size| specifies the |
270 // size of the framebuffer. | 271 // size of the framebuffer. |
271 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); | 272 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 public: | 363 public: |
363 ReadbackYUVInterface() {} | 364 ReadbackYUVInterface() {} |
364 virtual ~ReadbackYUVInterface() {} | 365 virtual ~ReadbackYUVInterface() {} |
365 | 366 |
366 // Note that |target| must use YV12 format. |paste_location| specifies where | 367 // 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. | 368 // 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 | 369 // The region defined by the |paste_location| and the |dst_size| specified in |
369 // the call to CreateReadbackPipelineYUV() must be fully contained within | 370 // the call to CreateReadbackPipelineYUV() must be fully contained within |
370 // |target->visible_rect()|. | 371 // |target->visible_rect()|. |
371 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, | 372 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, |
372 uint32 sync_point, | 373 const gpu::SyncToken& sync_token, |
373 const scoped_refptr<media::VideoFrame>& target, | 374 const scoped_refptr<media::VideoFrame>& target, |
374 const gfx::Point& paste_location, | 375 const gfx::Point& paste_location, |
375 const base::Callback<void(bool)>& callback) = 0; | 376 const base::Callback<void(bool)>& callback) = 0; |
376 virtual GLHelper::ScalerInterface* scaler() = 0; | 377 virtual GLHelper::ScalerInterface* scaler() = 0; |
377 }; | 378 }; |
378 | 379 |
379 } // namespace content | 380 } // namespace content |
380 | 381 |
381 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 382 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
OLD | NEW |