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

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

Issue 13620008: Enable 2D Canvas painting for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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 <list> 10 #include <list>
(...skipping 9846 matching lines...) Expand 10 before | Expand all | Expand 10 after
9857 } 9857 }
9858 9858
9859 texture_manager()->SetLevelInfo( 9859 texture_manager()->SetLevelInfo(
9860 dest_texture, GL_TEXTURE_2D, level, internal_format, source_width, 9860 dest_texture, GL_TEXTURE_2D, level, internal_format, source_width,
9861 source_height, 1, 0, internal_format, dest_type, true); 9861 source_height, 1, 0, internal_format, dest_type, true);
9862 } else { 9862 } else {
9863 texture_manager()->SetLevelCleared( 9863 texture_manager()->SetLevelCleared(
9864 dest_texture, GL_TEXTURE_2D, level, true); 9864 dest_texture, GL_TEXTURE_2D, level, true);
9865 } 9865 }
9866 9866
9867 copy_texture_CHROMIUM_->DoCopyTexture(this, 9867 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
9868 source_texture->target(), 9868 // before presenting.
9869 dest_texture->target(), 9869 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
9870 source_texture->service_id(), 9870 // TODO(hkuang): get the StreamTexture transform matrix in GPU process
9871 dest_texture->service_id(), level, 9871 // instead of using default matrix crbug.com/226218.
9872 source_width, source_height, 9872 const GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f,
9873 unpack_flip_y_, 9873 0.0f, 1.0f, 0.0f, 0.0f,
9874 unpack_premultiply_alpha_, 9874 0.0f, 0.0f, 1.0f, 0.0f,
9875 unpack_unpremultiply_alpha_); 9875 0.0f, 0.0f, 0.0f, 1.0f };
9876 copy_texture_CHROMIUM_->DoCopyTextureWithTransform(this,
9877 source_texture->target(),
9878 dest_texture->target(),
9879 source_texture->service_id(),
9880 dest_texture->service_id(), level,
9881 source_width, source_height,
9882 unpack_flip_y_,
9883 unpack_premultiply_alpha_,
9884 unpack_unpremultiply_alpha_,
9885 default_matrix);
9886 } else {
9887 copy_texture_CHROMIUM_->DoCopyTexture(this,
9888 source_texture->target(),
9889 dest_texture->target(),
9890 source_texture->service_id(),
9891 dest_texture->service_id(), level,
9892 source_width, source_height,
9893 unpack_flip_y_,
9894 unpack_premultiply_alpha_,
9895 unpack_unpremultiply_alpha_);
9896 }
9876 } 9897 }
9877 9898
9878 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { 9899 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) {
9879 switch (internalformat) { 9900 switch (internalformat) {
9880 case GL_RGB565: 9901 case GL_RGB565:
9881 return GL_UNSIGNED_SHORT_5_6_5; 9902 return GL_UNSIGNED_SHORT_5_6_5;
9882 case GL_RGBA4: 9903 case GL_RGBA4:
9883 return GL_UNSIGNED_SHORT_4_4_4_4; 9904 return GL_UNSIGNED_SHORT_4_4_4_4;
9884 case GL_RGB5_A1: 9905 case GL_RGB5_A1:
9885 return GL_UNSIGNED_SHORT_5_5_5_1; 9906 return GL_UNSIGNED_SHORT_5_5_5_1;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
10508 return error::kNoError; 10529 return error::kNoError;
10509 } 10530 }
10510 10531
10511 // Include the auto-generated part of this file. We split this because it means 10532 // Include the auto-generated part of this file. We split this because it means
10512 // we can easily edit the non-auto generated parts right here in this file 10533 // we can easily edit the non-auto generated parts right here in this file
10513 // instead of having to edit some template or the code generator. 10534 // instead of having to edit some template or the code generator.
10514 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10535 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10515 10536
10516 } // namespace gles2 10537 } // namespace gles2
10517 } // namespace gpu 10538 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698