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

Side by Side Diff: cc/gl_renderer.cc

Issue 12393053: Re-land: cc: Added antialiasing support for solid color layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed formatting in GLRenderer to Chrome style. Created 7 years, 9 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/gl_renderer.h" 5 #include "cc/gl_renderer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 SetShaderQuadF(surface_quad, shader_quad_location); 839 SetShaderQuadF(surface_quad, shader_quad_location);
840 DrawQuadGeometry( 840 DrawQuadGeometry(
841 frame, quad->quadTransform(), quad->rect, shader_matrix_location); 841 frame, quad->quadTransform(), quad->rect, shader_matrix_location);
842 842
843 // Flush the compositor context before the filter bitmap goes out of 843 // Flush the compositor context before the filter bitmap goes out of
844 // scope, so the draw gets processed before the filter texture gets deleted. 844 // scope, so the draw gets processed before the filter texture gets deleted.
845 if (filter_bitmap.getTexture()) 845 if (filter_bitmap.getTexture())
846 context_->flush(); 846 context_->flush();
847 } 847 }
848 848
849 struct SolidColorProgramUniforms {
850 unsigned program;
851 unsigned matrix_location;
852 unsigned color_location;
853 unsigned point_location;
854 unsigned tex_scale_location;
855 unsigned edge_location;
856 };
857
858 template<class T>
859 static void SolidColorUniformLocation(T program,
860 SolidColorProgramUniforms& uniforms) {
danakj 2013/03/14 00:54:25 no non-const references. this should be a pointer.
ernstm 2013/03/14 17:08:33 Done.
861 uniforms.program = program->program();
862 uniforms.matrix_location = program->vertexShader().matrixLocation();
danakj 2013/03/14 00:54:25 2 space indents
ernstm 2013/03/14 17:08:33 Done.
863 uniforms.color_location = program->fragmentShader().colorLocation();
864 uniforms.point_location = program->vertexShader().pointLocation();
865 uniforms.tex_scale_location = program->vertexShader().texScaleLocation();
866 uniforms.edge_location = program->fragmentShader().edgeLocation();
867 }
868
869 bool GLRenderer::SetupQuadForAntialiasing(const gfx::Transform& device_transform ,
danakj 2013/03/14 00:54:25 80 cols
ernstm 2013/03/14 17:08:33 Done.
870 const DrawQuad* quad,
871 gfx::QuadF* local_quad,
872 float edge[24]) const {
873 gfx::Rect tile_rect = quad->visible_rect;
874
875 bool clipped = false;
876 gfx::QuadF device_layer_quad = MathUtil::mapQuad(
877 device_transform, gfx::QuadF(quad->visibleContentRect()), clipped);
878 DCHECK(!clipped);
879
880 // TODO(reveman): Axis-aligned is not enough to avoid anti-aliasing.
881 // Bounding rectangle for quad also needs to be expressible as an integer
882 // rectangle. crbug.com/169374
883 bool is_axis_aligned_in_target = device_layer_quad.IsRectilinear();
884 bool use_aa = !clipped && !is_axis_aligned_in_target && quad->IsEdge();
885
886 if (!use_aa)
887 return false;
888
889 LayerQuad device_layer_bounds(gfx::QuadF(device_layer_quad.BoundingBox()));
890 device_layer_bounds.InflateAntiAliasingDistance();
891
892 LayerQuad device_layer_edges(device_layer_quad);
893 device_layer_edges.InflateAntiAliasingDistance();
894
895 device_layer_edges.ToFloatArray(edge);
896 device_layer_bounds.ToFloatArray(&edge[12]);
897
898 gfx::PointF bottom_right = tile_rect.bottom_right();
899 gfx::PointF bottom_left = tile_rect.bottom_left();
900 gfx::PointF top_left = tile_rect.origin();
901 gfx::PointF top_right = tile_rect.top_right();
902
903 // Map points to device space.
904 bottom_right = MathUtil::mapPoint(device_transform, bottom_right, clipped);
905 DCHECK(!clipped);
906 bottom_left = MathUtil::mapPoint(device_transform, bottom_left, clipped);
907 DCHECK(!clipped);
908 top_left = MathUtil::mapPoint(device_transform, top_left, clipped);
909 DCHECK(!clipped);
910 top_right = MathUtil::mapPoint(device_transform, top_right, clipped);
911 DCHECK(!clipped);
912
913 LayerQuad::Edge bottom_edge(bottom_right, bottom_left);
914 LayerQuad::Edge left_edge(bottom_left, top_left);
915 LayerQuad::Edge top_edge(top_left, top_right);
916 LayerQuad::Edge right_edge(top_right, bottom_right);
917
918 // Only apply anti-aliasing to edges not clipped by culling or scissoring.
919 if (quad->IsTopEdge() && tile_rect.y() == quad->rect.y())
920 top_edge = device_layer_edges.top();
921 if (quad->IsLeftEdge() && tile_rect.x() == quad->rect.x())
922 left_edge = device_layer_edges.left();
923 if (quad->IsRightEdge() && tile_rect.right() == quad->rect.right())
924 right_edge = device_layer_edges.right();
925 if (quad->IsBottomEdge() && tile_rect.bottom() == quad->rect.bottom())
926 bottom_edge = device_layer_edges.bottom();
927
928 float sign = gfx::QuadF(tile_rect).IsCounterClockwise() ? -1 : 1;
929 bottom_edge.scale(sign);
930 left_edge.scale(sign);
931 top_edge.scale(sign);
932 right_edge.scale(sign);
933
934 // Create device space quad.
935 LayerQuad device_quad(left_edge, top_edge, right_edge, bottom_edge);
936
937 // Map device space quad to local space. deviceTransform has no 3d
938 // component since it was flattened, so we don't need to project. We should
939 // have already checked that the transform was uninvertible above.
940 gfx::Transform inverse_device_transform(
941 gfx::Transform::kSkipInitialization);
942 bool did_invert = device_transform.GetInverse(&inverse_device_transform);
943 DCHECK(did_invert);
944 *local_quad = MathUtil::mapQuad(
945 inverse_device_transform, device_quad.ToQuadF(), clipped);
946 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may
947 // cause deviceQuad to become clipped. To our knowledge this scenario does
948 // not need to be handled differently than the unclipped case.
949
950 return true;
951 }
952
849 void GLRenderer::DrawSolidColorQuad(const DrawingFrame& frame, 953 void GLRenderer::DrawSolidColorQuad(const DrawingFrame& frame,
850 const SolidColorDrawQuad* quad) { 954 const SolidColorDrawQuad* quad) {
851 SetBlendEnabled(quad->ShouldDrawWithBlending()); 955 SetBlendEnabled(quad->ShouldDrawWithBlending());
956 gfx::Rect tile_rect = quad->visible_rect;
852 957
853 const SolidColorProgram* program = GetSolidColorProgram(); 958 gfx::Transform device_transform =
854 SetUseProgram(program->program()); 959 frame.window_matrix * frame.projection_matrix * quad->quadTransform();
960 device_transform.FlattenTo2d();
961 if (!device_transform.IsInvertible())
962 return;
963
964 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect));
965 float edge[24];
966 bool use_aa = SetupQuadForAntialiasing(
967 device_transform, quad, &local_quad, edge);
968
969 SolidColorProgramUniforms uniforms;
970 if (use_aa)
971 SolidColorUniformLocation(GetSolidColorProgramAA(), uniforms);
972 else
973 SolidColorUniformLocation(GetSolidColorProgram(), uniforms);
974 SetUseProgram(uniforms.program);
855 975
856 SkColor color = quad->color; 976 SkColor color = quad->color;
857 float opacity = quad->opacity(); 977 float opacity = quad->opacity();
858 float alpha = (SkColorGetA(color) * (1.0f / 255.0f)) * opacity; 978 float alpha = (SkColorGetA(color) * (1.0f / 255.0f)) * opacity;
859 979
860 GLC(Context(), 980 GLC(Context(),
861 Context()->uniform4f(program->fragmentShader().colorLocation(), 981 Context()->uniform4f(uniforms.color_location,
862 (SkColorGetR(color) * (1.0f / 255.0f)) * alpha, 982 (SkColorGetR(color) * (1.0f / 255.0f)) * alpha,
863 (SkColorGetG(color) * (1.0f / 255.0f)) * alpha, 983 (SkColorGetG(color) * (1.0f / 255.0f)) * alpha,
864 (SkColorGetB(color) * (1.0f / 255.0f)) * alpha, 984 (SkColorGetB(color) * (1.0f / 255.0f)) * alpha,
865 alpha)); 985 alpha));
866 986
867 DrawQuadGeometry(frame, 987 GLC(Context(), Context()->uniform2f(uniforms.tex_scale_location, 1.0f, 1.0f));
868 quad->quadTransform(), 988
869 quad->rect, 989 if (use_aa) {
danakj 2013/03/14 00:54:25 no {} for 1 line
ernstm 2013/03/14 17:08:33 Done.
870 program->vertexShader().matrixLocation()); 990 GLC(Context(), Context()->uniform3fv(uniforms.edge_location, 8, edge));
991 }
992
993 // Enable blending when the quad properties require it or if we decided
994 // to use antialiasing.
995 SetBlendEnabled(quad->ShouldDrawWithBlending() || use_aa);
996
997 // Normalize to tileRect.
998 local_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height());
999
1000 SetShaderQuadF(local_quad, uniforms.point_location);
1001
1002 // The transform and vertex data are used to figure out the extents that the
1003 // un-antialiased quad should have and which vertex this is and the float
1004 // quad passed in via uniform is the actual geometry that gets used to draw
1005 // it. This is why this centered rect is used and not the original quadRect.
1006 gfx::RectF centered_rect(gfx::PointF(-0.5 * tile_rect.width(),
danakj 2013/03/14 00:54:25 0.5f
ernstm 2013/03/14 17:08:33 Done.
1007 -0.5 * tile_rect.height()),
1008 tile_rect.size());
1009 DrawQuadGeometry(frame, quad->quadTransform(),
1010 centered_rect, uniforms.matrix_location);
871 } 1011 }
872 1012
873 struct TileProgramUniforms { 1013 struct TileProgramUniforms {
874 unsigned program; 1014 unsigned program;
875 unsigned sampler_location; 1015 unsigned sampler_location;
876 unsigned vertex_tex_transform_location; 1016 unsigned vertex_tex_transform_location;
877 unsigned fragment_tex_transform_location; 1017 unsigned fragment_tex_transform_location;
878 unsigned edge_location; 1018 unsigned edge_location;
879 unsigned matrix_location; 1019 unsigned matrix_location;
880 unsigned alpha_location; 1020 unsigned alpha_location;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); 1080 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width();
941 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); 1081 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height();
942 1082
943 // Map to normalized texture coordinates. 1083 // Map to normalized texture coordinates.
944 gfx::Size texture_size = quad->texture_size; 1084 gfx::Size texture_size = quad->texture_size;
945 float fragment_tex_translate_x = clamp_tex_rect.x() / texture_size.width(); 1085 float fragment_tex_translate_x = clamp_tex_rect.x() / texture_size.width();
946 float fragment_tex_translate_y = clamp_tex_rect.y() / texture_size.height(); 1086 float fragment_tex_translate_y = clamp_tex_rect.y() / texture_size.height();
947 float fragment_tex_scale_x = clamp_tex_rect.width() / texture_size.width(); 1087 float fragment_tex_scale_x = clamp_tex_rect.width() / texture_size.width();
948 float fragment_tex_scale_y = clamp_tex_rect.height() / texture_size.height(); 1088 float fragment_tex_scale_y = clamp_tex_rect.height() / texture_size.height();
949 1089
950 gfx::QuadF local_quad;
951 gfx::Transform device_transform = 1090 gfx::Transform device_transform =
952 frame.window_matrix * frame.projection_matrix * quad->quadTransform(); 1091 frame.window_matrix * frame.projection_matrix * quad->quadTransform();
953 device_transform.FlattenTo2d(); 1092 device_transform.FlattenTo2d();
954 if (!device_transform.IsInvertible()) 1093 if (!device_transform.IsInvertible())
955 return; 1094 return;
956 1095
957 bool clipped = false; 1096 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect));
958 gfx::QuadF device_layer_quad = MathUtil::mapQuad( 1097 float edge[24];
959 device_transform, gfx::QuadF(quad->visibleContentRect()), clipped); 1098 bool use_aa = SetupQuadForAntialiasing(
960 DCHECK(!clipped); 1099 device_transform, quad, &local_quad, edge);
961
962 // TODO(reveman): Axis-aligned is not enough to avoid anti-aliasing.
963 // Bounding rectangle for quad also needs to be expressible as
964 // an integer rectangle. crbug.com/169374
965 bool is_axis_aligned_in_target = device_layer_quad.IsRectilinear();
966 bool use_aa = !clipped && !is_axis_aligned_in_target && quad->IsEdge();
967 1100
968 TileProgramUniforms uniforms; 1101 TileProgramUniforms uniforms;
969 if (use_aa) { 1102 if (use_aa) {
970 if (quad->swizzle_contents) 1103 if (quad->swizzle_contents)
971 TileUniformLocation(GetTileProgramSwizzleAA(), uniforms); 1104 TileUniformLocation(GetTileProgramSwizzleAA(), uniforms);
972 else 1105 else
973 TileUniformLocation(GetTileProgramAA(), uniforms); 1106 TileUniformLocation(GetTileProgramAA(), uniforms);
974 } else { 1107 } else {
975 if (quad->ShouldDrawWithBlending()) { 1108 if (quad->ShouldDrawWithBlending()) {
976 if (quad->swizzle_contents) 1109 if (quad->swizzle_contents)
(...skipping 12 matching lines...) Expand all
989 GLC(Context(), Context()->uniform1i(uniforms.sampler_location, 0)); 1122 GLC(Context(), Context()->uniform1i(uniforms.sampler_location, 0));
990 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f); 1123 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f);
991 GLenum filter = (use_aa || scaled || 1124 GLenum filter = (use_aa || scaled ||
992 !quad->quadTransform().IsIdentityOrIntegerTranslation()) 1125 !quad->quadTransform().IsIdentityOrIntegerTranslation())
993 ? GL_LINEAR 1126 ? GL_LINEAR
994 : GL_NEAREST; 1127 : GL_NEAREST;
995 ResourceProvider::ScopedSamplerGL quad_resource_lock( 1128 ResourceProvider::ScopedSamplerGL quad_resource_lock(
996 resource_provider_, quad->resource_id, GL_TEXTURE_2D, filter); 1129 resource_provider_, quad->resource_id, GL_TEXTURE_2D, filter);
997 1130
998 if (use_aa) { 1131 if (use_aa) {
999 LayerQuad deviceLayerBounds(gfx::QuadF(device_layer_quad.BoundingBox()));
1000 deviceLayerBounds.InflateAntiAliasingDistance();
1001
1002 LayerQuad device_layer_edges(device_layer_quad);
1003 device_layer_edges.InflateAntiAliasingDistance();
1004
1005 float edge[24];
1006 device_layer_edges.ToFloatArray(edge);
1007 deviceLayerBounds.ToFloatArray(&edge[12]);
1008 GLC(Context(), Context()->uniform3fv(uniforms.edge_location, 8, edge)); 1132 GLC(Context(), Context()->uniform3fv(uniforms.edge_location, 8, edge));
1009 1133
1010 GLC(Context(), 1134 GLC(Context(),
1011 Context()->uniform4f(uniforms.vertex_tex_transform_location, 1135 Context()->uniform4f(uniforms.vertex_tex_transform_location,
1012 vertex_tex_translate_x, 1136 vertex_tex_translate_x,
1013 vertex_tex_translate_y, 1137 vertex_tex_translate_y,
1014 vertex_tex_scale_x, 1138 vertex_tex_scale_x,
1015 vertex_tex_scale_y)); 1139 vertex_tex_scale_y));
1016 GLC(Context(), 1140 GLC(Context(),
1017 Context()->uniform4f(uniforms.fragment_tex_transform_location, 1141 Context()->uniform4f(uniforms.fragment_tex_transform_location,
1018 fragment_tex_translate_x, 1142 fragment_tex_translate_x,
1019 fragment_tex_translate_y, 1143 fragment_tex_translate_y,
1020 fragment_tex_scale_x, 1144 fragment_tex_scale_x,
1021 fragment_tex_scale_y)); 1145 fragment_tex_scale_y));
1022
1023 gfx::PointF bottom_right = tile_rect.bottom_right();
1024 gfx::PointF bottom_left = tile_rect.bottom_left();
1025 gfx::PointF top_left = tile_rect.origin();
1026 gfx::PointF top_right = tile_rect.top_right();
1027
1028 // Map points to device space.
1029 bottom_right = MathUtil::mapPoint(device_transform, bottom_right, clipped);
1030 DCHECK(!clipped);
1031 bottom_left = MathUtil::mapPoint(device_transform, bottom_left, clipped);
1032 DCHECK(!clipped);
1033 top_left = MathUtil::mapPoint(device_transform, top_left, clipped);
1034 DCHECK(!clipped);
1035 top_right = MathUtil::mapPoint(device_transform, top_right, clipped);
1036 DCHECK(!clipped);
1037
1038 LayerQuad::Edge bottom_edge(bottom_right, bottom_left);
1039 LayerQuad::Edge left_edge(bottom_left, top_left);
1040 LayerQuad::Edge top_edge(top_left, top_right);
1041 LayerQuad::Edge right_edge(top_right, bottom_right);
1042
1043 // Only apply anti-aliasing to edges not clipped by culling or scissoring.
1044 if (quad->IsTopEdge() && tile_rect.y() == quad->rect.y())
1045 top_edge = device_layer_edges.top();
1046 if (quad->IsLeftEdge() && tile_rect.x() == quad->rect.x())
1047 left_edge = device_layer_edges.left();
1048 if (quad->IsRightEdge() && tile_rect.right() == quad->rect.right())
1049 right_edge = device_layer_edges.right();
1050 if (quad->IsBottomEdge() && tile_rect.bottom() == quad->rect.bottom())
1051 bottom_edge = device_layer_edges.bottom();
1052
1053 float sign = gfx::QuadF(tile_rect).IsCounterClockwise() ? -1 : 1;
1054 bottom_edge.scale(sign);
1055 left_edge.scale(sign);
1056 top_edge.scale(sign);
1057 right_edge.scale(sign);
1058
1059 // Create device space quad.
1060 LayerQuad device_quad(left_edge, top_edge, right_edge, bottom_edge);
1061
1062 // Map device space quad to local space. device_transform has no 3d
1063 // component since it was flattened, so we don't need to project. We should
1064 // have already checked that the transform was uninvertible above.
1065 gfx::Transform inverse_device_transform(
1066 gfx::Transform::kSkipInitialization);
1067 bool did_invert = device_transform.GetInverse(&inverse_device_transform);
1068 DCHECK(did_invert);
1069 local_quad = MathUtil::mapQuad(
1070 inverse_device_transform, device_quad.ToQuadF(), clipped);
1071
1072 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may
1073 // cause device_quad to become clipped. To our knowledge this scenario does
1074 // not need to be handled differently than the unclipped case.
1075 } else { 1146 } else {
1076 // Move fragment shader transform to vertex shader. We can do this while 1147 // Move fragment shader transform to vertex shader. We can do this while
1077 // still producing correct results as fragment_tex_transform_location 1148 // still producing correct results as fragment_tex_transform_location
1078 // should always be non-negative when tiles are transformed in a way 1149 // should always be non-negative when tiles are transformed in a way
1079 // that could result in sampling outside the layer. 1150 // that could result in sampling outside the layer.
1080 vertex_tex_scale_x *= fragment_tex_scale_x; 1151 vertex_tex_scale_x *= fragment_tex_scale_x;
1081 vertex_tex_scale_y *= fragment_tex_scale_y; 1152 vertex_tex_scale_y *= fragment_tex_scale_y;
1082 vertex_tex_translate_x *= fragment_tex_scale_x; 1153 vertex_tex_translate_x *= fragment_tex_scale_x;
1083 vertex_tex_translate_y *= fragment_tex_scale_y; 1154 vertex_tex_translate_y *= fragment_tex_scale_y;
1084 vertex_tex_translate_x += fragment_tex_translate_x; 1155 vertex_tex_translate_x += fragment_tex_translate_x;
1085 vertex_tex_translate_y += fragment_tex_translate_y; 1156 vertex_tex_translate_y += fragment_tex_translate_y;
1086 1157
1087 GLC(Context(), 1158 GLC(Context(),
1088 Context()->uniform4f(uniforms.vertex_tex_transform_location, 1159 Context()->uniform4f(uniforms.vertex_tex_transform_location,
1089 vertex_tex_translate_x, 1160 vertex_tex_translate_x,
1090 vertex_tex_translate_y, 1161 vertex_tex_translate_y,
1091 vertex_tex_scale_x, 1162 vertex_tex_scale_x,
1092 vertex_tex_scale_y)); 1163 vertex_tex_scale_y));
1093
1094 local_quad = gfx::RectF(tile_rect);
1095 } 1164 }
1096 1165
1097 // Enable blending when the quad properties require it or if we decided 1166 // Enable blending when the quad properties require it or if we decided
1098 // to use antialiasing. 1167 // to use antialiasing.
1099 SetBlendEnabled(quad->ShouldDrawWithBlending() || use_aa); 1168 SetBlendEnabled(quad->ShouldDrawWithBlending() || use_aa);
1100 1169
1101 // Normalize to tile_rect. 1170 // Normalize to tile_rect.
1102 local_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height()); 1171 local_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height());
1103 1172
1104 SetShaderOpacity(quad->opacity(), uniforms.alpha_location); 1173 SetShaderOpacity(quad->opacity(), uniforms.alpha_location);
1105 SetShaderQuadF(local_quad, uniforms.point_location); 1174 SetShaderQuadF(local_quad, uniforms.point_location);
1106 1175
1107 // The tile quad shader behaves differently compared to all other shaders.
1108 // The transform and vertex data are used to figure out the extents that the 1176 // The transform and vertex data are used to figure out the extents that the
1109 // un-antialiased quad should have and which vertex this is and the float 1177 // un-antialiased quad should have and which vertex this is and the float
1110 // quad passed in via uniform is the actual geometry that gets used to draw 1178 // quad passed in via uniform is the actual geometry that gets used to draw
1111 // it. This is why this centered rect is used and not the original quad_rect. 1179 // it. This is why this centered rect is used and not the original quad_rect.
1112 gfx::RectF centeredRect( 1180 gfx::RectF centeredRect(
1113 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), 1181 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()),
1114 tile_rect.size()); 1182 tile_rect.size());
1115 DrawQuadGeometry( 1183 DrawQuadGeometry(
1116 frame, quad->quadTransform(), centeredRect, uniforms.matrix_location); 1184 frame, quad->quadTransform(), centeredRect, uniforms.matrix_location);
1117 } 1185 }
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { 1983 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() {
1916 if (!solid_color_program_) 1984 if (!solid_color_program_)
1917 solid_color_program_ = make_scoped_ptr(new SolidColorProgram(context_)); 1985 solid_color_program_ = make_scoped_ptr(new SolidColorProgram(context_));
1918 if (!solid_color_program_->initialized()) { 1986 if (!solid_color_program_->initialized()) {
1919 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); 1987 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
1920 solid_color_program_->initialize(context_, is_using_bind_uniform_); 1988 solid_color_program_->initialize(context_, is_using_bind_uniform_);
1921 } 1989 }
1922 return solid_color_program_.get(); 1990 return solid_color_program_.get();
1923 } 1991 }
1924 1992
1993 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA()
1994 {
1995 if (!solid_color_program_aa_)
1996 solid_color_program_aa_ = make_scoped_ptr(new SolidColorProgramAA(context_)) ;
danakj 2013/03/14 00:54:25 80 cols. line break and use {} for the if.
ernstm 2013/03/14 17:08:33 Done.
1997 if (!solid_color_program_aa_->initialized()) {
1998 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
1999 solid_color_program_aa_->initialize(context_, is_using_bind_uniform_);
2000 }
2001 return solid_color_program_aa_.get();
2002 }
2003
1925 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram() { 2004 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram() {
1926 DCHECK(render_pass_program_); 2005 DCHECK(render_pass_program_);
1927 if (!render_pass_program_->initialized()) { 2006 if (!render_pass_program_->initialized()) {
1928 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); 2007 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
1929 render_pass_program_->initialize(context_, is_using_bind_uniform_); 2008 render_pass_program_->initialize(context_, is_using_bind_uniform_);
1930 } 2009 }
1931 return render_pass_program_.get(); 2010 return render_pass_program_.get();
1932 } 2011 }
1933 2012
1934 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA() { 2013 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA() {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 if (texture_io_surface_program_) 2196 if (texture_io_surface_program_)
2118 texture_io_surface_program_->cleanup(context_); 2197 texture_io_surface_program_->cleanup(context_);
2119 2198
2120 if (video_yuv_program_) 2199 if (video_yuv_program_)
2121 video_yuv_program_->cleanup(context_); 2200 video_yuv_program_->cleanup(context_);
2122 if (video_stream_texture_program_) 2201 if (video_stream_texture_program_)
2123 video_stream_texture_program_->cleanup(context_); 2202 video_stream_texture_program_->cleanup(context_);
2124 2203
2125 if (solid_color_program_) 2204 if (solid_color_program_)
2126 solid_color_program_->cleanup(context_); 2205 solid_color_program_->cleanup(context_);
2206 if (solid_color_program_aa_)
2207 solid_color_program_aa_->cleanup(context_);
2127 2208
2128 if (offscreen_framebuffer_id_) 2209 if (offscreen_framebuffer_id_)
2129 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); 2210 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_));
2130 2211
2131 ReleaseRenderPassTextures(); 2212 ReleaseRenderPassTextures();
2132 } 2213 }
2133 2214
2134 bool GLRenderer::IsContextLost() { 2215 bool GLRenderer::IsContextLost() {
2135 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2216 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
2136 } 2217 }
2137 2218
2138 } // namespace cc 2219 } // namespace cc
OLDNEW
« cc/gl_renderer.h ('K') | « cc/gl_renderer.h ('k') | cc/gl_renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698