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

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

Issue 88033002: Add RGB565 Texture readback support in gl_helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected indentation. Created 6 years, 11 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 "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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // representation. |callback| is invoked with the copy result when the copy 174 // representation. |callback| is invoked with the copy result when the copy
175 // operation has completed. 175 // operation has completed.
176 // Note that the src_texture will have the min/mag filter set to GL_LINEAR 176 // Note that the src_texture will have the min/mag filter set to GL_LINEAR
177 // and wrap_s/t set to CLAMP_TO_EDGE in this call. 177 // and wrap_s/t set to CLAMP_TO_EDGE in this call.
178 void CropScaleReadbackAndCleanTexture( 178 void CropScaleReadbackAndCleanTexture(
179 GLuint src_texture, 179 GLuint src_texture,
180 const gfx::Size& src_size, 180 const gfx::Size& src_size,
181 const gfx::Rect& src_subrect, 181 const gfx::Rect& src_subrect,
182 const gfx::Size& dst_size, 182 const gfx::Size& dst_size,
183 unsigned char* out, 183 unsigned char* out,
184 bool readback_config_rgb565,
184 const base::Callback<void(bool)>& callback); 185 const base::Callback<void(bool)>& callback);
185 186
186 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, 187 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|,
187 // scales it to |dst_size|, and writes it into |out|. 188 // scales it to |dst_size|, and writes it into |out|.
188 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA 189 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA
189 // and is potentially flipped vertically to make it a correct image 190 // and is potentially flipped vertically to make it a correct image
190 // representation. |callback| is invoked with the copy result when the copy 191 // representation. |callback| is invoked with the copy result when the copy
191 // operation has completed. 192 // operation has completed.
192 // Note that the texture bound to src_mailbox will have the min/mag filter set 193 // Note that the texture bound to src_mailbox will have the min/mag filter set
193 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is 194 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is
194 // assumed to be GL_TEXTURE_2D. 195 // assumed to be GL_TEXTURE_2D.
195 void CropScaleReadbackAndCleanMailbox( 196 void CropScaleReadbackAndCleanMailbox(
196 const gpu::Mailbox& src_mailbox, 197 const gpu::Mailbox& src_mailbox,
197 uint32 sync_point, 198 uint32 sync_point,
198 const gfx::Size& src_size, 199 const gfx::Size& src_size,
199 const gfx::Rect& src_subrect, 200 const gfx::Rect& src_subrect,
200 const gfx::Size& dst_size, 201 const gfx::Size& dst_size,
201 unsigned char* out, 202 unsigned char* out,
203 bool readback_config_rgb565,
202 const base::Callback<void(bool)>& callback); 204 const base::Callback<void(bool)>& callback);
203 205
204 // Copies the texture data out of |texture| into |out|. |size| is the 206 // Copies the texture data out of |texture| into |out|. |size| is the
205 // size of the texture. No post processing is applied to the pixels. The 207 // size of the texture. No post processing is applied to the pixels. The
206 // texture is assumed to have a format of GL_RGBA with a pixel type of 208 // texture is assumed to have a format of GL_RGBA with a pixel type of
207 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on the 209 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on the
208 // current OpenGL context. 210 // current OpenGL context.
209 void ReadbackTextureSync(GLuint texture, 211 void ReadbackTextureSync(GLuint texture,
210 const gfx::Rect& src_rect, 212 const gfx::Rect& src_rect,
211 unsigned char* out); 213 unsigned char* out);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // Resizes the texture's size to |size|. 261 // Resizes the texture's size to |size|.
260 void ResizeTexture(GLuint texture, const gfx::Size& size); 262 void ResizeTexture(GLuint texture, const gfx::Size& size);
261 263
262 // Copies the framebuffer data given in |rect| to |texture|. 264 // Copies the framebuffer data given in |rect| to |texture|.
263 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect); 265 void CopyTextureSubImage(GLuint texture, const gfx::Rect& rect);
264 266
265 // Copies the all framebuffer data to |texture|. |size| specifies the 267 // Copies the all framebuffer data to |texture|. |size| specifies the
266 // size of the framebuffer. 268 // size of the framebuffer.
267 void CopyTextureFullImage(GLuint texture, const gfx::Size& size); 269 void CopyTextureFullImage(GLuint texture, const gfx::Size& size);
268 270
271 // Check whether rgb565 readback is supported or not.
272 bool CanUseRgb565Readback();
273
269 // A scaler will cache all intermediate textures and programs 274 // A scaler will cache all intermediate textures and programs
270 // needed to scale from a specified size to a destination size. 275 // needed to scale from a specified size to a destination size.
271 // If the source or destination sizes changes, you must create 276 // If the source or destination sizes changes, you must create
272 // a new scaler. 277 // a new scaler.
273 class CONTENT_EXPORT ScalerInterface { 278 class CONTENT_EXPORT ScalerInterface {
274 public: 279 public:
275 ScalerInterface() {} 280 ScalerInterface() {}
276 virtual ~ScalerInterface() {} 281 virtual ~ScalerInterface() {}
277 282
278 // Note that the src_texture will have the min/mag filter set to GL_LINEAR 283 // Note that the src_texture will have the min/mag filter set to GL_LINEAR
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, 351 virtual void ReadbackYUV(const gpu::Mailbox& mailbox,
347 uint32 sync_point, 352 uint32 sync_point,
348 const scoped_refptr<media::VideoFrame>& target, 353 const scoped_refptr<media::VideoFrame>& target,
349 const base::Callback<void(bool)>& callback) = 0; 354 const base::Callback<void(bool)>& callback) = 0;
350 virtual GLHelper::ScalerInterface* scaler() = 0; 355 virtual GLHelper::ScalerInterface* scaler() = 0;
351 }; 356 };
352 357
353 } // namespace content 358 } // namespace content
354 359
355 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ 360 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698