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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1152693002: ui: Add sub region copy support to GLImage::CopyTexImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 11855 matching lines...) Expand 10 before | Expand all | Expand 10 after
11866 true); 11866 true);
11867 } 11867 }
11868 11868
11869 ScopedModifyPixels modify(dest_texture_ref); 11869 ScopedModifyPixels modify(dest_texture_ref);
11870 11870
11871 // Try using GLImage::CopyTexImage when possible. 11871 // Try using GLImage::CopyTexImage when possible.
11872 bool unpack_premultiply_alpha_change = 11872 bool unpack_premultiply_alpha_change =
11873 unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; 11873 unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_;
11874 if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change) { 11874 if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change) {
11875 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 11875 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id());
11876 if (image->CopyTexImage(GL_TEXTURE_2D)) 11876 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0),
11877 gfx::Rect(0, 0, source_width, source_height))) {
11877 return; 11878 return;
11879 }
11878 } 11880 }
11879 11881
11880 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); 11882 DoWillUseTexImageIfNeeded(source_texture, source_texture->target());
11881 11883
11882 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix 11884 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
11883 // before presenting. 11885 // before presenting.
11884 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { 11886 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
11885 // TODO(hkuang): get the StreamTexture transform matrix in GPU process 11887 // TODO(hkuang): get the StreamTexture transform matrix in GPU process
11886 // instead of using kIdentityMatrix crbug.com/226218. 11888 // instead of using kIdentityMatrix crbug.com/226218.
11887 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( 11889 copy_texture_CHROMIUM_->DoCopyTextureWithTransform(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
12003 } else { 12005 } else {
12004 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, 12006 texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0,
12005 true); 12007 true);
12006 } 12008 }
12007 12009
12008 ScopedModifyPixels modify(dest_texture_ref); 12010 ScopedModifyPixels modify(dest_texture_ref);
12009 12011
12010 // Try using GLImage::CopyTexSubImage when possible. 12012 // Try using GLImage::CopyTexSubImage when possible.
12011 bool unpack_premultiply_alpha_change = 12013 bool unpack_premultiply_alpha_change =
12012 unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; 12014 unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_;
12013 if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change && 12015 if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change) {
12014 !xoffset && !yoffset) {
12015 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); 12016 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id());
12016 if (image->CopyTexImage(GL_TEXTURE_2D)) 12017 if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset),
12018 gfx::Rect(0, 0, source_width, source_height))) {
12017 return; 12019 return;
12020 }
12018 } 12021 }
12019 12022
12020 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); 12023 DoWillUseTexImageIfNeeded(source_texture, source_texture->target());
12021 12024
12022 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix 12025 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
12023 // before presenting. 12026 // before presenting.
12024 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { 12027 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
12025 // TODO(hkuang): get the StreamTexture transform matrix in GPU process 12028 // TODO(hkuang): get the StreamTexture transform matrix in GPU process
12026 // instead of using kIdentityMatrix crbug.com/226218. 12029 // instead of using kIdentityMatrix crbug.com/226218.
12027 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( 12030 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform(
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
13186 } 13189 }
13187 } 13190 }
13188 13191
13189 // Include the auto-generated part of this file. We split this because it means 13192 // Include the auto-generated part of this file. We split this because it means
13190 // we can easily edit the non-auto generated parts right here in this file 13193 // we can easily edit the non-auto generated parts right here in this file
13191 // instead of having to edit some template or the code generator. 13194 // instead of having to edit some template or the code generator.
13192 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 13195 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
13193 13196
13194 } // namespace gles2 13197 } // namespace gles2
13195 } // namespace gpu 13198 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/stream_texture_android.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698