| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Image quality is nearly as good as the BEST option. | 207 // Image quality is nearly as good as the BEST option. |
| 208 SCALER_QUALITY_GOOD = 2, | 208 SCALER_QUALITY_GOOD = 2, |
| 209 | 209 |
| 210 // Bicubic upscale + N * 50% bicubic downscales. | 210 // Bicubic upscale + N * 50% bicubic downscales. |
| 211 // Produces very good quality scaled images, but it's | 211 // Produces very good quality scaled images, but it's |
| 212 // 2-8x slower than the "GOOD" quality, so it's not always | 212 // 2-8x slower than the "GOOD" quality, so it's not always |
| 213 // worth it. | 213 // worth it. |
| 214 SCALER_QUALITY_BEST = 3, | 214 SCALER_QUALITY_BEST = 3, |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 | |
| 218 // Copies the block of pixels specified with |src_subrect| from |src_texture|, | 217 // Copies the block of pixels specified with |src_subrect| from |src_texture|, |
| 219 // scales it to |dst_size|, and writes it into |out|. | 218 // scales it to |dst_size|, and writes it into |out|. |
| 220 // |src_size| is the size of |src_texture|. The result is of format GL_BGRA | 219 // |src_size| is the size of |src_texture|. The result is of format GL_BGRA |
| 221 // and is potentially flipped vertically to make it a correct image | 220 // and is potentially flipped vertically to make it a correct image |
| 222 // representation. |callback| is invoked with the copy result when the copy | 221 // representation. |callback| is invoked with the copy result when the copy |
| 223 // operation has completed. | 222 // operation has completed. |
| 224 // Note that the src_texture will have the min/mag filter set to GL_LINEAR | 223 // Note that the src_texture will have the min/mag filter set to GL_LINEAR |
| 225 // and wrap_s/t set to CLAMP_TO_EDGE in this call. | 224 // and wrap_s/t set to CLAMP_TO_EDGE in this call. |
| 226 void CropScaleReadbackAndCleanTexture( | 225 void CropScaleReadbackAndCleanTexture( |
| 227 blink::WebGLId src_texture, | 226 blink::WebGLId src_texture, |
| 228 const gfx::Size& src_size, | 227 const gfx::Size& src_size, |
| 229 const gfx::Rect& src_subrect, | 228 const gfx::Rect& src_subrect, |
| 230 const gfx::Size& dst_size, | 229 const gfx::Size& dst_size, |
| 231 unsigned char* out, | 230 unsigned char* out, |
| 231 bool readback_config_rgb565, |
| 232 const base::Callback<void(bool)>& callback); | 232 const base::Callback<void(bool)>& callback); |
| 233 | 233 |
| 234 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, | 234 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, |
| 235 // scales it to |dst_size|, and writes it into |out|. | 235 // scales it to |dst_size|, and writes it into |out|. |
| 236 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA | 236 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA |
| 237 // and is potentially flipped vertically to make it a correct image | 237 // and is potentially flipped vertically to make it a correct image |
| 238 // representation. |callback| is invoked with the copy result when the copy | 238 // representation. |callback| is invoked with the copy result when the copy |
| 239 // operation has completed. | 239 // operation has completed. |
| 240 // Note that the texture bound to src_mailbox will have the min/mag filter set | 240 // Note that the texture bound to src_mailbox will have the min/mag filter set |
| 241 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is | 241 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is |
| 242 // assumed to be GL_TEXTURE_2D. | 242 // assumed to be GL_TEXTURE_2D. |
| 243 void CropScaleReadbackAndCleanMailbox( | 243 void CropScaleReadbackAndCleanMailbox( |
| 244 const gpu::Mailbox& src_mailbox, | 244 const gpu::Mailbox& src_mailbox, |
| 245 uint32 sync_point, | 245 uint32 sync_point, |
| 246 const gfx::Size& src_size, | 246 const gfx::Size& src_size, |
| 247 const gfx::Rect& src_subrect, | 247 const gfx::Rect& src_subrect, |
| 248 const gfx::Size& dst_size, | 248 const gfx::Size& dst_size, |
| 249 unsigned char* out, | 249 unsigned char* out, |
| 250 bool readback_config_rgb565, |
| 250 const base::Callback<void(bool)>& callback); | 251 const base::Callback<void(bool)>& callback); |
| 251 | 252 |
| 252 // Copies the texture data out of |texture| into |out|. |size| is the | 253 // Copies the texture data out of |texture| into |out|. |size| is the |
| 253 // size of the texture. No post processing is applied to the pixels. The | 254 // size of the texture. No post processing is applied to the pixels. The |
| 254 // texture is assumed to have a format of GL_RGBA with a pixel type of | 255 // texture is assumed to have a format of GL_RGBA with a pixel type of |
| 255 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this | 256 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this |
| 256 // current context. | 257 // current context. |
| 257 void ReadbackTextureSync(blink::WebGLId texture, | 258 void ReadbackTextureSync(blink::WebGLId texture, |
| 258 const gfx::Rect& src_rect, | 259 const gfx::Rect& src_rect, |
| 259 unsigned char* out); | 260 unsigned char* out); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 const gpu::Mailbox& mailbox, | 402 const gpu::Mailbox& mailbox, |
| 402 uint32 sync_point, | 403 uint32 sync_point, |
| 403 const scoped_refptr<media::VideoFrame>& target, | 404 const scoped_refptr<media::VideoFrame>& target, |
| 404 const base::Callback<void(bool)>& callback) = 0; | 405 const base::Callback<void(bool)>& callback) = 0; |
| 405 virtual GLHelper::ScalerInterface* scaler() = 0; | 406 virtual GLHelper::ScalerInterface* scaler() = 0; |
| 406 }; | 407 }; |
| 407 | 408 |
| 408 } // namespace content | 409 } // namespace content |
| 409 | 410 |
| 410 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 411 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |