| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Bicubic upscale + N * 50% bicubic downscales. | 154 // Bicubic upscale + N * 50% bicubic downscales. |
| 155 // Produces very good quality scaled images, but it's | 155 // Produces very good quality scaled images, but it's |
| 156 // 2-8x slower than the "GOOD" quality, so it's not always | 156 // 2-8x slower than the "GOOD" quality, so it's not always |
| 157 // worth it. | 157 // worth it. |
| 158 SCALER_QUALITY_BEST = 3, | 158 SCALER_QUALITY_BEST = 3, |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // Copies the block of pixels specified with |src_subrect| from |src_texture|, | 161 // Copies the block of pixels specified with |src_subrect| from |src_texture|, |
| 162 // scales it to |dst_size|, and writes it into |out|. | 162 // scales it to |dst_size|, and writes it into |out|. |
| 163 // |src_size| is the size of |src_texture|. The result is of format GL_BGRA | 163 // |src_size| is the size of |src_texture|. The result is in |out_color_type| |
| 164 // and is potentially flipped vertically to make it a correct image | 164 // format and is potentially flipped vertically to make it a correct image |
| 165 // representation. |callback| is invoked with the copy result when the copy | 165 // representation. |callback| is invoked with the copy result when the copy |
| 166 // operation has completed. | 166 // operation has completed. |
| 167 // Note that the src_texture will have the min/mag filter set to GL_LINEAR | 167 // Note that the src_texture will have the min/mag filter set to GL_LINEAR |
| 168 // and wrap_s/t set to CLAMP_TO_EDGE in this call. | 168 // and wrap_s/t set to CLAMP_TO_EDGE in this call. |
| 169 void CropScaleReadbackAndCleanTexture( | 169 void CropScaleReadbackAndCleanTexture( |
| 170 GLuint src_texture, | 170 GLuint src_texture, |
| 171 const gfx::Size& src_size, | 171 const gfx::Size& src_size, |
| 172 const gfx::Rect& src_subrect, | 172 const gfx::Rect& src_subrect, |
| 173 const gfx::Size& dst_size, | 173 const gfx::Size& dst_size, |
| 174 unsigned char* out, | 174 unsigned char* out, |
| 175 const SkColorType color_type, | 175 const SkColorType out_color_type, |
| 176 const base::Callback<void(bool)>& callback, | 176 const base::Callback<void(bool)>& callback, |
| 177 GLHelper::ScalerQuality quality); | 177 GLHelper::ScalerQuality quality); |
| 178 | 178 |
| 179 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, | 179 // Copies the block of pixels specified with |src_subrect| from |src_mailbox|, |
| 180 // scales it to |dst_size|, and writes it into |out|. | 180 // scales it to |dst_size|, and writes it into |out|. |
| 181 // |src_size| is the size of |src_mailbox|. The result is of format GL_BGRA | 181 // |src_size| is the size of |src_mailbox|. The result is in |out_color_type| |
| 182 // and is potentially flipped vertically to make it a correct image | 182 // format and is potentially flipped vertically to make it a correct image |
| 183 // representation. |callback| is invoked with the copy result when the copy | 183 // representation. |callback| is invoked with the copy result when the copy |
| 184 // operation has completed. | 184 // operation has completed. |
| 185 // Note that the texture bound to src_mailbox will have the min/mag filter set | 185 // Note that the texture bound to src_mailbox will have the min/mag filter set |
| 186 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is | 186 // to GL_LINEAR and wrap_s/t set to CLAMP_TO_EDGE in this call. src_mailbox is |
| 187 // assumed to be GL_TEXTURE_2D. | 187 // assumed to be GL_TEXTURE_2D. |
| 188 void CropScaleReadbackAndCleanMailbox( | 188 void CropScaleReadbackAndCleanMailbox( |
| 189 const gpu::Mailbox& src_mailbox, | 189 const gpu::Mailbox& src_mailbox, |
| 190 uint32 sync_point, | 190 uint32 sync_point, |
| 191 const gfx::Size& src_size, | 191 const gfx::Size& src_size, |
| 192 const gfx::Rect& src_subrect, | 192 const gfx::Rect& src_subrect, |
| 193 const gfx::Size& dst_size, | 193 const gfx::Size& dst_size, |
| 194 unsigned char* out, | 194 unsigned char* out, |
| 195 const SkColorType color_type, | 195 const SkColorType out_color_type, |
| 196 const base::Callback<void(bool)>& callback, | 196 const base::Callback<void(bool)>& callback, |
| 197 GLHelper::ScalerQuality quality); | 197 GLHelper::ScalerQuality quality); |
| 198 | 198 |
| 199 // Copies the texture data out of |texture| into |out|. |size| is the | 199 // Copies the texture data out of |texture| into |out|. |size| is the |
| 200 // size of the texture. No post processing is applied to the pixels. The | 200 // size of the texture. No post processing is applied to the pixels. The |
| 201 // texture is assumed to have a format of GL_RGBA with a pixel type of | 201 // texture is assumed to have a format of GL_RGBA with a pixel type of |
| 202 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on the | 202 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on the |
| 203 // current OpenGL context. | 203 // current OpenGL context. |
| 204 void ReadbackTextureSync(GLuint texture, | 204 void ReadbackTextureSync(GLuint texture, |
| 205 const gfx::Rect& src_rect, | 205 const gfx::Rect& src_rect, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, | 362 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, |
| 363 uint32 sync_point, | 363 uint32 sync_point, |
| 364 const scoped_refptr<media::VideoFrame>& target, | 364 const scoped_refptr<media::VideoFrame>& target, |
| 365 const base::Callback<void(bool)>& callback) = 0; | 365 const base::Callback<void(bool)>& callback) = 0; |
| 366 virtual GLHelper::ScalerInterface* scaler() = 0; | 366 virtual GLHelper::ScalerInterface* scaler() = 0; |
| 367 }; | 367 }; |
| 368 | 368 |
| 369 } // namespace content | 369 } // namespace content |
| 370 | 370 |
| 371 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 371 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |