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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2058013003: Revert of Optimize render passes with single quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert "Optimize render passes with single quads" Created 4 years, 6 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
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/data/rotated_drop_shadow_filter_gl.png » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 gl_->LineWidth(quad->width); 583 gl_->LineWidth(quad->width);
584 584
585 // The indices for the line are stored in the same array as the triangle 585 // The indices for the line are stored in the same array as the triangle
586 // indices. 586 // indices.
587 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0); 587 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0);
588 } 588 }
589 589
590 static sk_sp<SkImage> WrapTexture( 590 static sk_sp<SkImage> WrapTexture(
591 const ResourceProvider::ScopedReadLockGL& lock, 591 const ResourceProvider::ScopedReadLockGL& lock,
592 GrContext* context, 592 GrContext* context) {
593 bool flip_texture) {
594 // Wrap a given texture in a Ganesh platform texture. 593 // Wrap a given texture in a Ganesh platform texture.
595 GrBackendTextureDesc backend_texture_description; 594 GrBackendTextureDesc backend_texture_description;
596 GrGLTextureInfo texture_info; 595 GrGLTextureInfo texture_info;
597 texture_info.fTarget = lock.target(); 596 texture_info.fTarget = lock.target();
598 texture_info.fID = lock.texture_id(); 597 texture_info.fID = lock.texture_id();
599 backend_texture_description.fWidth = lock.texture_size().width(); 598 backend_texture_description.fWidth = lock.texture_size().width();
600 backend_texture_description.fHeight = lock.texture_size().height(); 599 backend_texture_description.fHeight = lock.texture_size().height();
601 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; 600 backend_texture_description.fConfig = kSkia8888_GrPixelConfig;
602 backend_texture_description.fTextureHandle = 601 backend_texture_description.fTextureHandle =
603 skia::GrGLTextureInfoToGrBackendObject(texture_info); 602 skia::GrGLTextureInfoToGrBackendObject(texture_info);
604 backend_texture_description.fOrigin = 603 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin;
605 flip_texture ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
606 604
607 return SkImage::MakeFromTexture(context, backend_texture_description); 605 return SkImage::MakeFromTexture(context, backend_texture_description);
608 } 606 }
609 607
610 static sk_sp<SkImage> ApplyImageFilter( 608 static sk_sp<SkImage> ApplyImageFilter(
611 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, 609 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context,
612 ResourceProvider* resource_provider, 610 ResourceProvider* resource_provider,
613 const gfx::RectF& src_rect, 611 const gfx::RectF& src_rect,
614 const gfx::RectF& dst_rect, 612 const gfx::RectF& dst_rect,
615 const gfx::Vector2dF& scale, 613 const gfx::Vector2dF& scale,
616 sk_sp<SkImageFilter> filter, 614 sk_sp<SkImageFilter> filter,
617 const Resource* source_texture_resource, 615 ScopedResource* source_texture_resource,
618 SkIPoint* offset, 616 SkIPoint* offset,
619 SkIRect* subset, 617 SkIRect* subset) {
620 bool flip_texture) {
621 if (!filter || !use_gr_context) 618 if (!filter || !use_gr_context)
622 return nullptr; 619 return nullptr;
623 620
624 ResourceProvider::ScopedReadLockGL lock(resource_provider, 621 ResourceProvider::ScopedReadLockGL lock(resource_provider,
625 source_texture_resource->id()); 622 source_texture_resource->id());
626 623
627 sk_sp<SkImage> src_image = 624 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context());
628 WrapTexture(lock, use_gr_context->context(), flip_texture);
629
630 if (!src_image) { 625 if (!src_image) {
631 TRACE_EVENT_INSTANT0("cc", 626 TRACE_EVENT_INSTANT0("cc",
632 "ApplyImageFilter wrap background texture failed", 627 "ApplyImageFilter wrap background texture failed",
633 TRACE_EVENT_SCOPE_THREAD); 628 TRACE_EVENT_SCOPE_THREAD);
634 return nullptr; 629 return nullptr;
635 } 630 }
636 631
637 SkMatrix local_matrix; 632 SkMatrix local_matrix;
638 local_matrix.setTranslate(-src_rect.x(), -src_rect.y()); 633 local_matrix.setTranslate(-src_rect.x(), -src_rect.y());
639 local_matrix.postScale(scale.x(), scale.y()); 634 local_matrix.postScale(scale.x(), scale.y());
640 635
641 SkIRect clip_bounds = gfx::RectFToSkRect(dst_rect).roundOut(); 636 SkIRect clip_bounds = gfx::RectFToSkRect(dst_rect).roundOut();
642 clip_bounds.offset(-src_rect.x(), -src_rect.y()); 637 clip_bounds.offset(-src_rect.x(), -src_rect.y());
643 filter = filter->makeWithLocalMatrix(local_matrix); 638 filter = filter->makeWithLocalMatrix(local_matrix);
644 SkIRect in_subset = SkIRect::MakeWH(src_rect.width(), src_rect.height()); 639 SkIRect in_subset = SkIRect::MakeWH(src_image->width(), src_image->height());
645 sk_sp<SkImage> image = src_image->makeWithFilter(filter.get(), in_subset, 640 sk_sp<SkImage> image = src_image->makeWithFilter(filter.get(), in_subset,
646 clip_bounds, subset, offset); 641 clip_bounds, subset, offset);
647 642
648 if (!image || !image->isTextureBacked()) { 643 if (!image || !image->isTextureBacked()) {
649 return nullptr; 644 return nullptr;
650 } 645 }
651 646
652 // Force a flush of the Skia pipeline before we switch back to the compositor 647 // Force a flush of the Skia pipeline before we switch back to the compositor
653 // context. 648 // context.
654 image->getTextureHandle(true); 649 image->getTextureHandle(true);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 845
851 // TODO(senorblanco): background filters should be moved to the 846 // TODO(senorblanco): background filters should be moved to the
852 // makeWithFilter fast-path, and go back to calling ApplyImageFilter(). 847 // makeWithFilter fast-path, and go back to calling ApplyImageFilter().
853 // See http://crbug.com/613233. 848 // See http://crbug.com/613233.
854 if (!filter || !use_gr_context) 849 if (!filter || !use_gr_context)
855 return nullptr; 850 return nullptr;
856 851
857 ResourceProvider::ScopedReadLockGL lock(resource_provider_, 852 ResourceProvider::ScopedReadLockGL lock(resource_provider_,
858 background_texture->id()); 853 background_texture->id());
859 854
860 bool flip_texture = true; 855 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context());
861 sk_sp<SkImage> src_image =
862 WrapTexture(lock, use_gr_context->context(), flip_texture);
863 if (!src_image) { 856 if (!src_image) {
864 TRACE_EVENT_INSTANT0( 857 TRACE_EVENT_INSTANT0(
865 "cc", "ApplyBackgroundFilters wrap background texture failed", 858 "cc", "ApplyBackgroundFilters wrap background texture failed",
866 TRACE_EVENT_SCOPE_THREAD); 859 TRACE_EVENT_SCOPE_THREAD);
867 return nullptr; 860 return nullptr;
868 } 861 }
869 862
870 // Create surface to draw into. 863 // Create surface to draw into.
871 SkImageInfo dst_info = 864 SkImageInfo dst_info =
872 SkImageInfo::MakeN32Premul(rect.width(), rect.height()); 865 SkImageInfo::MakeN32Premul(rect.width(), rect.height());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 DCHECK(did_invert); 903 DCHECK(did_invert);
911 bool clipped = false; 904 bool clipped = false;
912 gfx::QuadF local_quad = 905 gfx::QuadF local_quad =
913 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped); 906 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped);
914 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may 907 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may
915 // cause device_quad to become clipped. To our knowledge this scenario does 908 // cause device_quad to become clipped. To our knowledge this scenario does
916 // not need to be handled differently than the unclipped case. 909 // not need to be handled differently than the unclipped case.
917 return local_quad; 910 return local_quad;
918 } 911 }
919 912
920 const TileDrawQuad* GLRenderer::CanPassBeDrawnDirectly(const RenderPass* pass) {
921 // Can only collapse a single tile quad.
922 if (pass->quad_list.size() != 1)
923 return nullptr;
924 // If we need copy requests, then render pass has to exist.
925 if (!pass->copy_requests.empty())
926 return nullptr;
927
928 const DrawQuad* quad = *pass->quad_list.BackToFrontBegin();
929 // Hack: this could be supported by concatenating transforms, but
930 // in practice if there is one quad, it is at the origin of the render pass.
931 if (!quad->shared_quad_state->quad_to_target_transform.IsIdentity())
932 return nullptr;
933 // The quad is expected to be the entire layer so that AA edges are correct.
934 if (gfx::Rect(quad->shared_quad_state->quad_layer_bounds) != quad->rect)
935 return nullptr;
936 if (quad->material != DrawQuad::TILED_CONTENT)
937 return nullptr;
938
939 const TileDrawQuad* tile_quad = TileDrawQuad::MaterialCast(quad);
940 // Hack: this could be supported by passing in a subrectangle to draw
941 // render pass, although in practice if there is only one quad there
942 // will be no border texels on the input.
943 if (tile_quad->tex_coord_rect != gfx::RectF(tile_quad->rect))
944 return nullptr;
945 // Tile quad features not supported in render pass shaders.
946 if (tile_quad->swizzle_contents || tile_quad->nearest_neighbor)
947 return nullptr;
948 // BUG=skia:3868, Skia currently doesn't support texture rectangle inputs.
949 // See also the DCHECKs about GL_TEXTURE_2D in DrawRenderPassQuad.
950 GLenum target =
951 resource_provider_->GetResourceTextureTarget(tile_quad->resource_id());
952 if (target != GL_TEXTURE_2D)
953 return nullptr;
954 #if defined(OS_MACOSX)
955 // On Macs, this path can sometimes lead to all black output.
956 // TODO(enne): investigate this and remove this hack.
957 return nullptr;
958 #endif
959
960 return tile_quad;
961 }
962
963 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, 913 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
964 const RenderPassDrawQuad* quad, 914 const RenderPassDrawQuad* quad,
965 const gfx::QuadF* clip_region) { 915 const gfx::QuadF* clip_region) {
966 auto bypass = render_pass_bypass_quads_.find(quad->render_pass_id); 916 ScopedResource* contents_texture =
967 if (bypass != render_pass_bypass_quads_.end()) { 917 render_pass_textures_[quad->render_pass_id].get();
968 TileDrawQuad* tile_quad = &bypass->second; 918 DCHECK(contents_texture);
969 // RGBA_8888 here is arbitrary and unused. 919 DCHECK(contents_texture->id());
970 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size,
971 ResourceFormat::RGBA_8888);
972 // The projection matrix used by GLRenderer has a flip. As tile texture
973 // inputs are oriented opposite to framebuffer outputs, don't flip via
974 // texture coords and let the projection matrix naturallyd o it.
975 bool flip_texture = false;
976 DrawRenderPassQuadInternal(frame, quad, clip_region, &tile_resource,
977 flip_texture);
978 } else {
979 ScopedResource* contents_texture =
980 render_pass_textures_[quad->render_pass_id].get();
981 DCHECK(contents_texture);
982 DCHECK(contents_texture->id());
983 // See above comments about texture flipping. When the input is a
984 // render pass, it needs to an extra flip to be oriented correctly.
985 bool flip_texture = true;
986 DrawRenderPassQuadInternal(frame, quad, clip_region, contents_texture,
987 flip_texture);
988 }
989 }
990 920
991 void GLRenderer::DrawRenderPassQuadInternal(DrawingFrame* frame,
992 const RenderPassDrawQuad* quad,
993 const gfx::QuadF* clip_region,
994 const Resource* contents_texture,
995 bool flip_texture) {
996 SkMatrix scale_matrix; 921 SkMatrix scale_matrix;
997 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y()); 922 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y());
998 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix)); 923 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix));
999 gfx::Transform quad_rect_matrix; 924 gfx::Transform quad_rect_matrix;
1000 QuadRectTransform(&quad_rect_matrix, 925 QuadRectTransform(&quad_rect_matrix,
1001 quad->shared_quad_state->quad_to_target_transform, 926 quad->shared_quad_state->quad_to_target_transform,
1002 dst_rect); 927 dst_rect);
1003 gfx::Transform contents_device_transform = 928 gfx::Transform contents_device_transform =
1004 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; 929 frame->window_matrix * frame->projection_matrix * quad_rect_matrix;
1005 contents_device_transform.FlattenTo2d(); 930 contents_device_transform.FlattenTo2d();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 !use_shaders_for_blending && 1015 !use_shaders_for_blending &&
1091 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); 1016 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode)));
1092 1017
1093 // TODO(senorblanco): Cache this value so that we don't have to do it for both 1018 // TODO(senorblanco): Cache this value so that we don't have to do it for both
1094 // the surface and its replica. Apply filters to the contents texture. 1019 // the surface and its replica. Apply filters to the contents texture.
1095 sk_sp<SkImage> filter_image; 1020 sk_sp<SkImage> filter_image;
1096 GLuint filter_image_id = 0; 1021 GLuint filter_image_id = 0;
1097 SkScalar color_matrix[20]; 1022 SkScalar color_matrix[20];
1098 bool use_color_matrix = false; 1023 bool use_color_matrix = false;
1099 gfx::Size texture_size = contents_texture->size(); 1024 gfx::Size texture_size = contents_texture->size();
1025 bool flip_texture = true;
1100 gfx::Point src_offset; 1026 gfx::Point src_offset;
1101 if (!quad->filters.IsEmpty()) { 1027 if (!quad->filters.IsEmpty()) {
1102 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 1028 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
1103 quad->filters, gfx::SizeF(contents_texture->size())); 1029 quad->filters, gfx::SizeF(contents_texture->size()));
1104 if (filter) { 1030 if (filter) {
1105 SkColorFilter* colorfilter_rawptr = NULL; 1031 SkColorFilter* colorfilter_rawptr = NULL;
1106 filter->asColorFilter(&colorfilter_rawptr); 1032 filter->asColorFilter(&colorfilter_rawptr);
1107 sk_sp<SkColorFilter> cf(colorfilter_rawptr); 1033 sk_sp<SkColorFilter> cf(colorfilter_rawptr);
1108 1034
1109 if (cf && cf->asColorMatrix(color_matrix)) { 1035 if (cf && cf->asColorMatrix(color_matrix)) {
(...skipping 14 matching lines...) Expand all
1124 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); 1050 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad);
1125 dst_rect.Intersect(local_clip.BoundingBox()); 1051 dst_rect.Intersect(local_clip.BoundingBox());
1126 // If we've been fully clipped out (by crop rect or clipping), there's 1052 // If we've been fully clipped out (by crop rect or clipping), there's
1127 // nothing to draw. 1053 // nothing to draw.
1128 if (dst_rect.IsEmpty()) { 1054 if (dst_rect.IsEmpty()) {
1129 return; 1055 return;
1130 } 1056 }
1131 SkIPoint offset; 1057 SkIPoint offset;
1132 SkIRect subset; 1058 SkIRect subset;
1133 gfx::RectF src_rect(quad->rect); 1059 gfx::RectF src_rect(quad->rect);
1134 filter_image = ApplyImageFilter( 1060 filter_image = ApplyImageFilter(ScopedUseGrContext::Create(this, frame),
1135 ScopedUseGrContext::Create(this, frame), resource_provider_, 1061 resource_provider_, src_rect, dst_rect,
1136 src_rect, dst_rect, quad->filters_scale, std::move(filter), 1062 quad->filters_scale, std::move(filter),
1137 contents_texture, &offset, &subset, flip_texture); 1063 contents_texture, &offset, &subset);
1138 if (!filter_image) 1064 if (!filter_image) {
1139 return; 1065 return;
1066 }
1140 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo( 1067 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo(
1141 filter_image->getTextureHandle(true)) 1068 filter_image->getTextureHandle(true))
1142 ->fID; 1069 ->fID;
1143 texture_size.set_width(filter_image->width()); 1070 texture_size.set_width(filter_image->width());
1144 texture_size.set_height(filter_image->height()); 1071 texture_size.set_height(filter_image->height());
1145 DCHECK(filter_image_id); 1072 DCHECK(filter_image_id);
1146 dst_rect = 1073 dst_rect =
1147 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY, 1074 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY,
1148 subset.width(), subset.height()); 1075 subset.width(), subset.height());
1149 src_offset.SetPoint(subset.x(), subset.y()); 1076 src_offset.SetPoint(subset.x(), subset.y());
1150 // If the output of the filter needs to be flipped.
1151 flip_texture = 1077 flip_texture =
1152 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin; 1078 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin;
1153 } 1079 }
1154 } 1080 }
1155 } 1081 }
1156 1082
1157 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; 1083 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock;
1158 unsigned mask_texture_id = 0; 1084 unsigned mask_texture_id = 0;
1159 SamplerType mask_sampler = SAMPLER_TYPE_NA; 1085 SamplerType mask_sampler = SAMPLER_TYPE_NA;
1160 if (quad->mask_resource_id()) { 1086 if (quad->mask_resource_id()) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height()); 1192 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height());
1267 1193
1268 DCHECK(locations.tex_transform != -1 || IsContextLost()); 1194 DCHECK(locations.tex_transform != -1 || IsContextLost());
1269 if (flip_texture) { 1195 if (flip_texture) {
1270 // Flip the content vertically in the shader, as the RenderPass input 1196 // Flip the content vertically in the shader, as the RenderPass input
1271 // texture is already oriented the same way as the framebuffer, but the 1197 // texture is already oriented the same way as the framebuffer, but the
1272 // projection transform does a flip. 1198 // projection transform does a flip.
1273 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(), 1199 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(),
1274 tex_rect.width(), -tex_rect.height()); 1200 tex_rect.width(), -tex_rect.height());
1275 } else { 1201 } else {
1276 // Tile textures are oriented opposite the framebuffer, so can use
1277 // the projection transform to do the flip.
1278 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(), 1202 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(),
1279 tex_rect.width(), tex_rect.height()); 1203 tex_rect.width(), tex_rect.height());
1280 } 1204 }
1281 1205
1282 GLint last_texture_unit = 0; 1206 GLint last_texture_unit = 0;
1283 if (locations.mask_sampler != -1) { 1207 if (locations.mask_sampler != -1) {
1284 DCHECK_NE(locations.mask_tex_coord_scale, 1); 1208 DCHECK_NE(locations.mask_tex_coord_scale, 1);
1285 DCHECK_NE(locations.mask_tex_coord_offset, 1); 1209 DCHECK_NE(locations.mask_tex_coord_offset, 1);
1286 gl_->Uniform1i(locations.mask_sampler, 1); 1210 gl_->Uniform1i(locations.mask_sampler, 1);
1287 1211
1288 gfx::RectF mask_uv_rect = quad->MaskUVRect(); 1212 gfx::RectF mask_uv_rect = quad->MaskUVRect();
1289 if (mask_sampler != SAMPLER_TYPE_2D) { 1213 if (mask_sampler != SAMPLER_TYPE_2D) {
1290 mask_uv_rect.Scale(quad->mask_texture_size.width(), 1214 mask_uv_rect.Scale(quad->mask_texture_size.width(),
1291 quad->mask_texture_size.height()); 1215 quad->mask_texture_size.height());
1292 } 1216 }
1293 if (flip_texture) { 1217
1294 // Mask textures are oriented vertically flipped relative to the 1218 // Mask textures are oriented vertically flipped relative to the framebuffer
1295 // framebuffer and the RenderPass contents texture, so we flip the tex 1219 // and the RenderPass contents texture, so we flip the tex coords from the
1296 // coords from the RenderPass texture to find the mask texture coords. 1220 // RenderPass texture to find the mask texture coords.
1297 gl_->Uniform2f( 1221 gl_->Uniform2f(
1298 locations.mask_tex_coord_offset, mask_uv_rect.x(), 1222 locations.mask_tex_coord_offset, mask_uv_rect.x(),
1299 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y()); 1223 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y());
1300 gl_->Uniform2f(locations.mask_tex_coord_scale, 1224 gl_->Uniform2f(locations.mask_tex_coord_scale,
1301 mask_uv_rect.width() / tex_rect.width(), 1225 mask_uv_rect.width() / tex_rect.width(),
1302 -mask_uv_rect.height() / tex_rect.height()); 1226 -mask_uv_rect.height() / tex_rect.height());
1303 } else {
1304 // Tile textures are oriented the same way as mask textures.
1305 gl_->Uniform2f(locations.mask_tex_coord_offset, mask_uv_rect.x(),
1306 mask_uv_rect.y());
1307 gl_->Uniform2f(locations.mask_tex_coord_scale,
1308 mask_uv_rect.width() / tex_rect.width(),
1309 mask_uv_rect.height() / tex_rect.height());
1310 }
1311 1227
1312 last_texture_unit = 1; 1228 last_texture_unit = 1;
1313 } 1229 }
1314 1230
1315 if (locations.edge != -1) 1231 if (locations.edge != -1)
1316 gl_->Uniform3fv(locations.edge, 8, edge); 1232 gl_->Uniform3fv(locations.edge, 8, edge);
1317 1233
1318 if (locations.viewport != -1) { 1234 if (locations.viewport != -1) {
1319 float viewport[4] = { 1235 float viewport[4] = {
1320 static_cast<float>(current_window_space_viewport_.x()), 1236 static_cast<float>(current_window_space_viewport_.x()),
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 texture_id = pending_overlay_resources_.back()->GetTextureId(); 3644 texture_id = pending_overlay_resources_.back()->GetTextureId();
3729 } 3645 }
3730 3646
3731 context_support_->ScheduleOverlayPlane( 3647 context_support_->ScheduleOverlayPlane(
3732 overlay.plane_z_order, overlay.transform, texture_id, 3648 overlay.plane_z_order, overlay.transform, texture_id,
3733 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3649 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3734 } 3650 }
3735 } 3651 }
3736 3652
3737 } // namespace cc 3653 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/data/rotated_drop_shadow_filter_gl.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698