Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: content/common/gpu/client/gl_helper.h

Issue 149123008: Implement GLHelperReadbackSupport for GLHelper usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary space. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map>
9
8 #include "base/atomicops.h" 10 #include "base/atomicops.h"
9 #include "base/basictypes.h" 11 #include "base/basictypes.h"
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
12 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
13 #include "gpu/command_buffer/client/gles2_interface.h" 15 #include "gpu/command_buffer/client/gles2_interface.h"
14 #include "gpu/command_buffer/common/mailbox_holder.h" 16 #include "gpu/command_buffer/common/mailbox_holder.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
16 18
17 namespace gfx { 19 namespace gfx {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // Resizes the texture's size to |size|. 272 // Resizes the texture's size to |size|.
271 void ResizeTexture(GLuint texture, const gfx::Size& size); 273 void ResizeTexture(GLuint texture, const gfx::Size& size);
272 274
273 // Copies the framebuffer data given in |rect| to |texture|. 275 // Copies the framebuffer data given in |rect| to |texture|.
274 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); 276 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect);
275 277
276 // Copies the all framebuffer data to |texture|. |size| specifies the 278 // Copies the all framebuffer data to |texture|. |size| specifies the
277 // size of the framebuffer. 279 // size of the framebuffer.
278 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); 280 void CopyTextureFullImage(GLuint texture, const gfx::Size& size);
279 281
280 // Check whether rgb565 readback is supported or not. 282 // Helper functions for checking the supported texture formats.
281 bool CanUseRgb565Readback(); 283 bool SupportsFormat(GLint format, GLint type);
no sievers 2014/02/18 19:35:44 nit: can be private
sivag 2014/02/19 15:49:04 Done.
284
285 // Checks whether the readback using passed texture format
286 // is supported or not.
287 bool IsReadBackConfigSupported(const SkBitmap::Config& texture_format);
no sievers 2014/02/18 19:35:44 Please describe that this does not specify whether
sivag 2014/02/19 15:49:04 The reason why i kept a SkBitmap::Config is in Co
282 288
283 // A scaler will cache all intermediate textures and programs 289 // A scaler will cache all intermediate textures and programs
284 // needed to scale from a specified size to a destination size. 290 // needed to scale from a specified size to a destination size.
285 // If the source or destination sizes changes, you must create 291 // If the source or destination sizes changes, you must create
286 // a new scaler. 292 // a new scaler.
287 class CONTENT_EXPORT ScalerInterface { 293 class CONTENT_EXPORT ScalerInterface {
288 public: 294 public:
289 ScalerInterface() {} 295 ScalerInterface() {}
290 virtual ~ScalerInterface() {} 296 virtual ~ScalerInterface() {}
291 297
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 339
334 // Creates |copy_texture_to_impl_| if NULL. 340 // Creates |copy_texture_to_impl_| if NULL.
335 void InitCopyTextToImpl(); 341 void InitCopyTextToImpl();
336 // Creates |scaler_impl_| if NULL. 342 // Creates |scaler_impl_| if NULL.
337 void InitScalerImpl(); 343 void InitScalerImpl();
338 344
339 gpu::gles2::GLES2Interface* gl_; 345 gpu::gles2::GLES2Interface* gl_;
340 gpu::ContextSupport* context_support_; 346 gpu::ContextSupport* context_support_;
341 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; 347 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_;
342 scoped_ptr<GLHelperScaling> scaler_impl_; 348 scoped_ptr<GLHelperScaling> scaler_impl_;
343 bool initialized_565_format_check_; 349 std::map<SkBitmap::Config, bool> config_map_;
piman 2014/02/18 22:23:15 map is way overkill. SkBitmap::Config is a finite
sivag 2014/02/19 15:49:04 Done.
344 bool support_565_format_;
345 350
346 DISALLOW_COPY_AND_ASSIGN(GLHelper); 351 DISALLOW_COPY_AND_ASSIGN(GLHelper);
347 }; 352 };
348 353
349 // Similar to a ScalerInterface, a yuv readback pipeline will 354 // Similar to a ScalerInterface, a yuv readback pipeline will
350 // cache a scaler and all intermediate textures and frame buffers 355 // cache a scaler and all intermediate textures and frame buffers
351 // needed to scale, crop, letterbox and read back a texture from 356 // needed to scale, crop, letterbox and read back a texture from
352 // the GPU into CPU-accessible RAM. A single readback pipeline 357 // the GPU into CPU-accessible RAM. A single readback pipeline
353 // can handle multiple outstanding readbacks at the same time, but 358 // can handle multiple outstanding readbacks at the same time, but
354 // if the source or destination sizes change, you'll need to create 359 // if the source or destination sizes change, you'll need to create
355 // a new readback pipeline. 360 // a new readback pipeline.
356 class CONTENT_EXPORT ReadbackYUVInterface { 361 class CONTENT_EXPORT ReadbackYUVInterface {
357 public: 362 public:
358 ReadbackYUVInterface() {} 363 ReadbackYUVInterface() {}
359 virtual ~ReadbackYUVInterface() {} 364 virtual ~ReadbackYUVInterface() {}
360 365
361 // Note that |target| must use YV12 format. 366 // Note that |target| must use YV12 format.
362 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, 367 virtual void ReadbackYUV(const gpu::Mailbox& mailbox,
363 uint32 sync_point, 368 uint32 sync_point,
364 const scoped_refptr<media::VideoFrame>& target, 369 const scoped_refptr<media::VideoFrame>& target,
365 const base::Callback<void(bool)>& callback) = 0; 370 const base::Callback<void(bool)>& callback) = 0;
366 virtual GLHelper::ScalerInterface* scaler() = 0; 371 virtual GLHelper::ScalerInterface* scaler() = 0;
367 }; 372 };
368 373
369 } // namespace content 374 } // namespace content
370 375
371 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ 376 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698