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

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: Addressing scherkus's comments. 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 static 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(
9877 this,
9878 source_texture->target(),
9879 dest_texture->target(),
9880 source_texture->service_id(),
9881 dest_texture->service_id(), level,
9882 source_width, source_height,
9883 unpack_flip_y_,
9884 unpack_premultiply_alpha_,
9885 unpack_unpremultiply_alpha_,
9886 default_matrix);
9887 } else {
9888 copy_texture_CHROMIUM_->DoCopyTexture(
9889 this,
9890 source_texture->target(),
9891 dest_texture->target(),
9892 source_texture->service_id(),
9893 dest_texture->service_id(), level,
9894 source_width, source_height,
9895 unpack_flip_y_,
9896 unpack_premultiply_alpha_,
9897 unpack_unpremultiply_alpha_);
9898 }
9876 } 9899 }
9877 9900
9878 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { 9901 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) {
9879 switch (internalformat) { 9902 switch (internalformat) {
9880 case GL_RGB565: 9903 case GL_RGB565:
9881 return GL_UNSIGNED_SHORT_5_6_5; 9904 return GL_UNSIGNED_SHORT_5_6_5;
9882 case GL_RGBA4: 9905 case GL_RGBA4:
9883 return GL_UNSIGNED_SHORT_4_4_4_4; 9906 return GL_UNSIGNED_SHORT_4_4_4_4;
9884 case GL_RGB5_A1: 9907 case GL_RGB5_A1:
9885 return GL_UNSIGNED_SHORT_5_5_5_1; 9908 return GL_UNSIGNED_SHORT_5_5_5_1;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
10508 return error::kNoError; 10531 return error::kNoError;
10509 } 10532 }
10510 10533
10511 // Include the auto-generated part of this file. We split this because it means 10534 // 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 10535 // 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. 10536 // instead of having to edit some template or the code generator.
10514 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10537 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10515 10538
10516 } // namespace gles2 10539 } // namespace gles2
10517 } // namespace gpu 10540 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698