Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | |
| 593 // Wrap a given texture in a Ganesh platform texture. | 594 // Wrap a given texture in a Ganesh platform texture. |
| 594 GrBackendTextureDesc backend_texture_description; | 595 GrBackendTextureDesc backend_texture_description; |
| 595 GrGLTextureInfo texture_info; | 596 GrGLTextureInfo texture_info; |
| 596 texture_info.fTarget = lock.target(); | 597 texture_info.fTarget = lock.target(); |
| 597 texture_info.fID = lock.texture_id(); | 598 texture_info.fID = lock.texture_id(); |
| 598 backend_texture_description.fWidth = lock.texture_size().width(); | 599 backend_texture_description.fWidth = lock.texture_size().width(); |
| 599 backend_texture_description.fHeight = lock.texture_size().height(); | 600 backend_texture_description.fHeight = lock.texture_size().height(); |
| 600 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; | 601 backend_texture_description.fConfig = kSkia8888_GrPixelConfig; |
| 601 backend_texture_description.fTextureHandle = | 602 backend_texture_description.fTextureHandle = |
| 602 skia::GrGLTextureInfoToGrBackendObject(texture_info); | 603 skia::GrGLTextureInfoToGrBackendObject(texture_info); |
| 603 backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; | 604 backend_texture_description.fOrigin = |
| 605 flip_texture ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin; | |
| 604 | 606 |
| 605 return SkImage::MakeFromTexture(context, backend_texture_description); | 607 return SkImage::MakeFromTexture(context, backend_texture_description); |
| 606 } | 608 } |
| 607 | 609 |
| 608 static sk_sp<SkImage> ApplyImageFilter( | 610 static sk_sp<SkImage> ApplyImageFilter( |
| 609 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, | 611 std::unique_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, |
| 610 ResourceProvider* resource_provider, | 612 ResourceProvider* resource_provider, |
| 611 const gfx::RectF& src_rect, | 613 const gfx::RectF& src_rect, |
| 612 const gfx::RectF& dst_rect, | 614 const gfx::RectF& dst_rect, |
| 613 const gfx::Vector2dF& scale, | 615 const gfx::Vector2dF& scale, |
| 614 sk_sp<SkImageFilter> filter, | 616 sk_sp<SkImageFilter> filter, |
| 615 ScopedResource* source_texture_resource, | 617 const Resource* source_texture_resource, |
| 616 SkIPoint* offset, | 618 SkIPoint* offset, |
| 617 SkIRect* subset) { | 619 SkIRect* subset, |
| 620 bool flip_texture) { | |
| 618 if (!filter || !use_gr_context) | 621 if (!filter || !use_gr_context) |
| 619 return nullptr; | 622 return nullptr; |
| 620 | 623 |
| 621 ResourceProvider::ScopedReadLockGL lock(resource_provider, | 624 ResourceProvider::ScopedReadLockGL lock(resource_provider, |
| 622 source_texture_resource->id()); | 625 source_texture_resource->id()); |
| 623 | 626 |
| 624 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context()); | 627 sk_sp<SkImage> src_image = |
| 628 WrapTexture(lock, use_gr_context->context(), flip_texture); | |
| 629 | |
| 625 if (!src_image) { | 630 if (!src_image) { |
| 626 TRACE_EVENT_INSTANT0("cc", | 631 TRACE_EVENT_INSTANT0("cc", |
| 627 "ApplyImageFilter wrap background texture failed", | 632 "ApplyImageFilter wrap background texture failed", |
| 628 TRACE_EVENT_SCOPE_THREAD); | 633 TRACE_EVENT_SCOPE_THREAD); |
| 629 return nullptr; | 634 return nullptr; |
| 630 } | 635 } |
| 631 | 636 |
| 632 SkMatrix local_matrix; | 637 SkMatrix local_matrix; |
| 633 local_matrix.setTranslate(-src_rect.x(), -src_rect.y()); | 638 local_matrix.setTranslate(-src_rect.x(), -src_rect.y()); |
| 634 local_matrix.postScale(scale.x(), scale.y()); | 639 local_matrix.postScale(scale.x(), scale.y()); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 | 850 |
| 846 // TODO(senorblanco): background filters should be moved to the | 851 // TODO(senorblanco): background filters should be moved to the |
| 847 // makeWithFilter fast-path, and go back to calling ApplyImageFilter(). | 852 // makeWithFilter fast-path, and go back to calling ApplyImageFilter(). |
| 848 // See http://crbug.com/613233. | 853 // See http://crbug.com/613233. |
| 849 if (!filter || !use_gr_context) | 854 if (!filter || !use_gr_context) |
| 850 return nullptr; | 855 return nullptr; |
| 851 | 856 |
| 852 ResourceProvider::ScopedReadLockGL lock(resource_provider_, | 857 ResourceProvider::ScopedReadLockGL lock(resource_provider_, |
| 853 background_texture->id()); | 858 background_texture->id()); |
| 854 | 859 |
| 855 sk_sp<SkImage> src_image = WrapTexture(lock, use_gr_context->context()); | 860 bool flip_texture = true; |
| 861 sk_sp<SkImage> src_image = | |
| 862 WrapTexture(lock, use_gr_context->context(), flip_texture); | |
| 856 if (!src_image) { | 863 if (!src_image) { |
| 857 TRACE_EVENT_INSTANT0( | 864 TRACE_EVENT_INSTANT0( |
| 858 "cc", "ApplyBackgroundFilters wrap background texture failed", | 865 "cc", "ApplyBackgroundFilters wrap background texture failed", |
| 859 TRACE_EVENT_SCOPE_THREAD); | 866 TRACE_EVENT_SCOPE_THREAD); |
| 860 return nullptr; | 867 return nullptr; |
| 861 } | 868 } |
| 862 | 869 |
| 863 // Create surface to draw into. | 870 // Create surface to draw into. |
| 864 SkImageInfo dst_info = | 871 SkImageInfo dst_info = |
| 865 SkImageInfo::MakeN32Premul(rect.width(), rect.height()); | 872 SkImageInfo::MakeN32Premul(rect.width(), rect.height()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 DCHECK(did_invert); | 910 DCHECK(did_invert); |
| 904 bool clipped = false; | 911 bool clipped = false; |
| 905 gfx::QuadF local_quad = | 912 gfx::QuadF local_quad = |
| 906 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped); | 913 MathUtil::MapQuad(inverse_device_transform, device_quad, &clipped); |
| 907 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may | 914 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may |
| 908 // cause device_quad to become clipped. To our knowledge this scenario does | 915 // cause device_quad to become clipped. To our knowledge this scenario does |
| 909 // not need to be handled differently than the unclipped case. | 916 // not need to be handled differently than the unclipped case. |
| 910 return local_quad; | 917 return local_quad; |
| 911 } | 918 } |
| 912 | 919 |
| 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 | |
| 955 return tile_quad; | |
| 956 } | |
| 957 | |
| 913 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, | 958 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| 914 const RenderPassDrawQuad* quad, | 959 const RenderPassDrawQuad* quad, |
| 915 const gfx::QuadF* clip_region) { | 960 const gfx::QuadF* clip_region) { |
| 916 ScopedResource* contents_texture = | 961 auto bypass = render_pass_bypass_quads_.find(quad->render_pass_id); |
| 917 render_pass_textures_[quad->render_pass_id].get(); | 962 if (bypass != render_pass_bypass_quads_.end()) { |
| 918 DCHECK(contents_texture); | 963 TileDrawQuad* tile_quad = &bypass->second; |
| 919 DCHECK(contents_texture->id()); | 964 // TODO(enne): format here doesn't appear to get used. |
| 965 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size, | |
| 966 ResourceFormat::RGBA_8888); | |
| 967 bool flip_texture = false; | |
|
ericrk
2016/06/07 20:23:17
Can you add a comment explaining why this is not f
enne (OOO)
2016/06/07 21:22:44
Done.
| |
| 968 DrawRenderPassQuadInternal(frame, quad, clip_region, &tile_resource, | |
| 969 flip_texture); | |
| 970 } else { | |
| 971 ScopedResource* contents_texture = | |
| 972 render_pass_textures_[quad->render_pass_id].get(); | |
| 973 DCHECK(contents_texture); | |
| 974 DCHECK(contents_texture->id()); | |
| 975 bool flip_texture = true; | |
| 976 DrawRenderPassQuadInternal(frame, quad, clip_region, contents_texture, | |
| 977 flip_texture); | |
| 978 } | |
| 979 } | |
| 920 | 980 |
| 981 void GLRenderer::DrawRenderPassQuadInternal(DrawingFrame* frame, | |
| 982 const RenderPassDrawQuad* quad, | |
| 983 const gfx::QuadF* clip_region, | |
| 984 const Resource* contents_texture, | |
| 985 bool flip_texture) { | |
| 921 SkMatrix scale_matrix; | 986 SkMatrix scale_matrix; |
| 922 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y()); | 987 scale_matrix.setScale(quad->filters_scale.x(), quad->filters_scale.y()); |
| 923 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix)); | 988 gfx::RectF dst_rect(quad->filters.MapRect(quad->rect, scale_matrix)); |
| 924 gfx::Transform quad_rect_matrix; | 989 gfx::Transform quad_rect_matrix; |
| 925 QuadRectTransform(&quad_rect_matrix, | 990 QuadRectTransform(&quad_rect_matrix, |
| 926 quad->shared_quad_state->quad_to_target_transform, | 991 quad->shared_quad_state->quad_to_target_transform, |
| 927 dst_rect); | 992 dst_rect); |
| 928 gfx::Transform contents_device_transform = | 993 gfx::Transform contents_device_transform = |
| 929 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; | 994 frame->window_matrix * frame->projection_matrix * quad_rect_matrix; |
| 930 contents_device_transform.FlattenTo2d(); | 995 contents_device_transform.FlattenTo2d(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 !use_shaders_for_blending && | 1080 !use_shaders_for_blending && |
| 1016 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); | 1081 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); |
| 1017 | 1082 |
| 1018 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 1083 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
| 1019 // the surface and its replica. Apply filters to the contents texture. | 1084 // the surface and its replica. Apply filters to the contents texture. |
| 1020 sk_sp<SkImage> filter_image; | 1085 sk_sp<SkImage> filter_image; |
| 1021 GLuint filter_image_id = 0; | 1086 GLuint filter_image_id = 0; |
| 1022 SkScalar color_matrix[20]; | 1087 SkScalar color_matrix[20]; |
| 1023 bool use_color_matrix = false; | 1088 bool use_color_matrix = false; |
| 1024 gfx::Size texture_size = contents_texture->size(); | 1089 gfx::Size texture_size = contents_texture->size(); |
| 1025 bool flip_texture = true; | |
| 1026 gfx::Point src_offset; | 1090 gfx::Point src_offset; |
| 1027 if (!quad->filters.IsEmpty()) { | 1091 if (!quad->filters.IsEmpty()) { |
| 1028 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 1092 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
| 1029 quad->filters, gfx::SizeF(contents_texture->size())); | 1093 quad->filters, gfx::SizeF(contents_texture->size())); |
| 1030 if (filter) { | 1094 if (filter) { |
| 1031 SkColorFilter* colorfilter_rawptr = NULL; | 1095 SkColorFilter* colorfilter_rawptr = NULL; |
| 1032 filter->asColorFilter(&colorfilter_rawptr); | 1096 filter->asColorFilter(&colorfilter_rawptr); |
| 1033 sk_sp<SkColorFilter> cf(colorfilter_rawptr); | 1097 sk_sp<SkColorFilter> cf(colorfilter_rawptr); |
| 1034 | 1098 |
| 1035 if (cf && cf->asColorMatrix(color_matrix)) { | 1099 if (cf && cf->asColorMatrix(color_matrix)) { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1050 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); | 1114 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); |
| 1051 dst_rect.Intersect(local_clip.BoundingBox()); | 1115 dst_rect.Intersect(local_clip.BoundingBox()); |
| 1052 // If we've been fully clipped out (by crop rect or clipping), there's | 1116 // If we've been fully clipped out (by crop rect or clipping), there's |
| 1053 // nothing to draw. | 1117 // nothing to draw. |
| 1054 if (dst_rect.IsEmpty()) { | 1118 if (dst_rect.IsEmpty()) { |
| 1055 return; | 1119 return; |
| 1056 } | 1120 } |
| 1057 SkIPoint offset; | 1121 SkIPoint offset; |
| 1058 SkIRect subset; | 1122 SkIRect subset; |
| 1059 gfx::RectF src_rect(quad->rect); | 1123 gfx::RectF src_rect(quad->rect); |
| 1060 filter_image = ApplyImageFilter(ScopedUseGrContext::Create(this, frame), | 1124 filter_image = ApplyImageFilter( |
| 1061 resource_provider_, src_rect, dst_rect, | 1125 ScopedUseGrContext::Create(this, frame), resource_provider_, |
| 1062 quad->filters_scale, std::move(filter), | 1126 src_rect, dst_rect, quad->filters_scale, std::move(filter), |
| 1063 contents_texture, &offset, &subset); | 1127 contents_texture, &offset, &subset, flip_texture); |
| 1064 if (!filter_image) { | 1128 if (!filter_image) |
| 1065 return; | 1129 return; |
| 1066 } | |
| 1067 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo( | 1130 filter_image_id = skia::GrBackendObjectToGrGLTextureInfo( |
| 1068 filter_image->getTextureHandle(true)) | 1131 filter_image->getTextureHandle(true)) |
| 1069 ->fID; | 1132 ->fID; |
| 1070 texture_size.set_width(filter_image->width()); | 1133 texture_size.set_width(filter_image->width()); |
| 1071 texture_size.set_height(filter_image->height()); | 1134 texture_size.set_height(filter_image->height()); |
| 1072 DCHECK(filter_image_id); | 1135 DCHECK(filter_image_id); |
| 1073 dst_rect = | 1136 dst_rect = |
| 1074 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY, | 1137 gfx::RectF(src_rect.x() + offset.fX, src_rect.y() + offset.fY, |
| 1075 subset.width(), subset.height()); | 1138 subset.width(), subset.height()); |
| 1076 src_offset.SetPoint(subset.x(), subset.y()); | 1139 src_offset.SetPoint(subset.x(), subset.y()); |
| 1140 // If the output of the filter needs to be flipped. | |
| 1077 flip_texture = | 1141 flip_texture = |
| 1078 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin; | 1142 filter_image->getTexture()->origin() == kBottomLeft_GrSurfaceOrigin; |
| 1079 } | 1143 } |
| 1080 } | 1144 } |
| 1081 } | 1145 } |
| 1082 | 1146 |
| 1083 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; | 1147 std::unique_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; |
| 1084 unsigned mask_texture_id = 0; | 1148 unsigned mask_texture_id = 0; |
| 1085 SamplerType mask_sampler = SAMPLER_TYPE_NA; | 1149 SamplerType mask_sampler = SAMPLER_TYPE_NA; |
| 1086 if (quad->mask_resource_id()) { | 1150 if (quad->mask_resource_id()) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1192 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height()); | 1256 tex_rect.Scale(1.0f / texture_size.width(), 1.0f / texture_size.height()); |
| 1193 | 1257 |
| 1194 DCHECK(locations.tex_transform != -1 || IsContextLost()); | 1258 DCHECK(locations.tex_transform != -1 || IsContextLost()); |
| 1195 if (flip_texture) { | 1259 if (flip_texture) { |
| 1196 // Flip the content vertically in the shader, as the RenderPass input | 1260 // Flip the content vertically in the shader, as the RenderPass input |
| 1197 // texture is already oriented the same way as the framebuffer, but the | 1261 // texture is already oriented the same way as the framebuffer, but the |
| 1198 // projection transform does a flip. | 1262 // projection transform does a flip. |
| 1199 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(), | 1263 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), 1.0f - tex_rect.y(), |
| 1200 tex_rect.width(), -tex_rect.height()); | 1264 tex_rect.width(), -tex_rect.height()); |
| 1201 } else { | 1265 } else { |
| 1266 // Tile textures are oriented opposite the framebuffer, so can use | |
| 1267 // the projection transform to do the flip. | |
| 1202 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(), | 1268 gl_->Uniform4f(locations.tex_transform, tex_rect.x(), tex_rect.y(), |
| 1203 tex_rect.width(), tex_rect.height()); | 1269 tex_rect.width(), tex_rect.height()); |
| 1204 } | 1270 } |
| 1205 | 1271 |
| 1206 GLint last_texture_unit = 0; | 1272 GLint last_texture_unit = 0; |
| 1207 if (locations.mask_sampler != -1) { | 1273 if (locations.mask_sampler != -1) { |
| 1208 DCHECK_NE(locations.mask_tex_coord_scale, 1); | 1274 DCHECK_NE(locations.mask_tex_coord_scale, 1); |
| 1209 DCHECK_NE(locations.mask_tex_coord_offset, 1); | 1275 DCHECK_NE(locations.mask_tex_coord_offset, 1); |
| 1210 gl_->Uniform1i(locations.mask_sampler, 1); | 1276 gl_->Uniform1i(locations.mask_sampler, 1); |
| 1211 | 1277 |
| 1212 gfx::RectF mask_uv_rect = quad->MaskUVRect(); | 1278 gfx::RectF mask_uv_rect = quad->MaskUVRect(); |
| 1213 if (mask_sampler != SAMPLER_TYPE_2D) { | 1279 if (mask_sampler != SAMPLER_TYPE_2D) { |
| 1214 mask_uv_rect.Scale(quad->mask_texture_size.width(), | 1280 mask_uv_rect.Scale(quad->mask_texture_size.width(), |
| 1215 quad->mask_texture_size.height()); | 1281 quad->mask_texture_size.height()); |
| 1216 } | 1282 } |
| 1217 | 1283 if (flip_texture) { |
| 1218 // Mask textures are oriented vertically flipped relative to the framebuffer | 1284 // Mask textures are oriented vertically flipped relative to the |
| 1219 // and the RenderPass contents texture, so we flip the tex coords from the | 1285 // framebuffer and the RenderPass contents texture, so we flip the tex |
| 1220 // RenderPass texture to find the mask texture coords. | 1286 // coords from the RenderPass texture to find the mask texture coords. |
| 1221 gl_->Uniform2f( | 1287 gl_->Uniform2f( |
| 1222 locations.mask_tex_coord_offset, mask_uv_rect.x(), | 1288 locations.mask_tex_coord_offset, mask_uv_rect.x(), |
| 1223 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y()); | 1289 mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y()); |
| 1224 gl_->Uniform2f(locations.mask_tex_coord_scale, | 1290 gl_->Uniform2f(locations.mask_tex_coord_scale, |
| 1225 mask_uv_rect.width() / tex_rect.width(), | 1291 mask_uv_rect.width() / tex_rect.width(), |
| 1226 -mask_uv_rect.height() / tex_rect.height()); | 1292 -mask_uv_rect.height() / tex_rect.height()); |
| 1293 } else { | |
| 1294 // Tile textures are oriented the same way as mask textures. | |
| 1295 gl_->Uniform2f(locations.mask_tex_coord_offset, mask_uv_rect.x(), | |
| 1296 mask_uv_rect.y()); | |
| 1297 gl_->Uniform2f(locations.mask_tex_coord_scale, | |
| 1298 mask_uv_rect.width() / tex_rect.width(), | |
| 1299 mask_uv_rect.height() / tex_rect.height()); | |
| 1300 } | |
| 1227 | 1301 |
| 1228 last_texture_unit = 1; | 1302 last_texture_unit = 1; |
| 1229 } | 1303 } |
| 1230 | 1304 |
| 1231 if (locations.edge != -1) | 1305 if (locations.edge != -1) |
| 1232 gl_->Uniform3fv(locations.edge, 8, edge); | 1306 gl_->Uniform3fv(locations.edge, 8, edge); |
| 1233 | 1307 |
| 1234 if (locations.viewport != -1) { | 1308 if (locations.viewport != -1) { |
| 1235 float viewport[4] = { | 1309 float viewport[4] = { |
| 1236 static_cast<float>(current_window_space_viewport_.x()), | 1310 static_cast<float>(current_window_space_viewport_.x()), |
| (...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3644 texture_id = pending_overlay_resources_.back()->GetTextureId(); | 3718 texture_id = pending_overlay_resources_.back()->GetTextureId(); |
| 3645 } | 3719 } |
| 3646 | 3720 |
| 3647 context_support_->ScheduleOverlayPlane( | 3721 context_support_->ScheduleOverlayPlane( |
| 3648 overlay.plane_z_order, overlay.transform, texture_id, | 3722 overlay.plane_z_order, overlay.transform, texture_id, |
| 3649 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3723 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3650 } | 3724 } |
| 3651 } | 3725 } |
| 3652 | 3726 |
| 3653 } // namespace cc | 3727 } // namespace cc |
| OLD | NEW |