| 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 #include "content/common/gpu/client/gl_helper.h" | 5 #include "content/common/gpu/client/gl_helper.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 676 |
| 677 GLHelper::~GLHelper() {} | 677 GLHelper::~GLHelper() {} |
| 678 | 678 |
| 679 void GLHelper::CropScaleReadbackAndCleanTexture( | 679 void GLHelper::CropScaleReadbackAndCleanTexture( |
| 680 GLuint src_texture, | 680 GLuint src_texture, |
| 681 const gfx::Size& src_size, | 681 const gfx::Size& src_size, |
| 682 const gfx::Rect& src_subrect, | 682 const gfx::Rect& src_subrect, |
| 683 const gfx::Size& dst_size, | 683 const gfx::Size& dst_size, |
| 684 unsigned char* out, | 684 unsigned char* out, |
| 685 const SkBitmap::Config config, | 685 const SkBitmap::Config config, |
| 686 const base::Callback<void(bool)>& callback) { | 686 const base::Callback<void(bool)>& callback, |
| 687 GLHelper::ScalerQuality quality) { |
| 687 InitCopyTextToImpl(); | 688 InitCopyTextToImpl(); |
| 688 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( | 689 copy_texture_to_impl_->CropScaleReadbackAndCleanTexture( |
| 689 src_texture, | 690 src_texture, |
| 690 src_size, | 691 src_size, |
| 691 src_subrect, | 692 src_subrect, |
| 692 dst_size, | 693 dst_size, |
| 693 out, | 694 out, |
| 694 config, | 695 config, |
| 695 callback, | 696 callback, |
| 696 GLHelper::SCALER_QUALITY_FAST); | 697 quality); |
| 697 } | 698 } |
| 698 | 699 |
| 699 void GLHelper::CropScaleReadbackAndCleanMailbox( | 700 void GLHelper::CropScaleReadbackAndCleanMailbox( |
| 700 const gpu::Mailbox& src_mailbox, | 701 const gpu::Mailbox& src_mailbox, |
| 701 uint32 sync_point, | 702 uint32 sync_point, |
| 702 const gfx::Size& src_size, | 703 const gfx::Size& src_size, |
| 703 const gfx::Rect& src_subrect, | 704 const gfx::Rect& src_subrect, |
| 704 const gfx::Size& dst_size, | 705 const gfx::Size& dst_size, |
| 705 unsigned char* out, | 706 unsigned char* out, |
| 706 const SkBitmap::Config bitmap_config, | 707 const SkBitmap::Config bitmap_config, |
| 707 const base::Callback<void(bool)>& callback) { | 708 const base::Callback<void(bool)>& callback, |
| 709 GLHelper::ScalerQuality quality) { |
| 708 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); | 710 GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); |
| 709 CropScaleReadbackAndCleanTexture( | 711 CropScaleReadbackAndCleanTexture( |
| 710 mailbox_texture, src_size, src_subrect, dst_size, out, | 712 mailbox_texture, src_size, src_subrect, dst_size, out, |
| 711 bitmap_config, | 713 bitmap_config, |
| 712 callback); | 714 callback, |
| 715 quality); |
| 713 gl_->DeleteTextures(1, &mailbox_texture); | 716 gl_->DeleteTextures(1, &mailbox_texture); |
| 714 } | 717 } |
| 715 | 718 |
| 716 void GLHelper::ReadbackTextureSync(GLuint texture, | 719 void GLHelper::ReadbackTextureSync(GLuint texture, |
| 717 const gfx::Rect& src_rect, | 720 const gfx::Rect& src_rect, |
| 718 unsigned char* out, | 721 unsigned char* out, |
| 719 SkBitmap::Config format) { | 722 SkBitmap::Config format) { |
| 720 InitCopyTextToImpl(); | 723 InitCopyTextToImpl(); |
| 721 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); | 724 copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); |
| 722 } | 725 } |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, | 1253 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, |
| 1251 src_size, | 1254 src_size, |
| 1252 src_subrect, | 1255 src_subrect, |
| 1253 dst_size, | 1256 dst_size, |
| 1254 dst_subrect, | 1257 dst_subrect, |
| 1255 flip_vertically, | 1258 flip_vertically, |
| 1256 use_mrt); | 1259 use_mrt); |
| 1257 } | 1260 } |
| 1258 | 1261 |
| 1259 } // namespace content | 1262 } // namespace content |
| OLD | NEW |