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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #include "third_party/skia/include/core/SkColor.h" | 49 #include "third_party/skia/include/core/SkColor.h" |
50 #include "third_party/skia/include/core/SkColorFilter.h" | 50 #include "third_party/skia/include/core/SkColorFilter.h" |
51 #include "third_party/skia/include/core/SkImage.h" | 51 #include "third_party/skia/include/core/SkImage.h" |
52 #include "third_party/skia/include/core/SkSurface.h" | 52 #include "third_party/skia/include/core/SkSurface.h" |
53 #include "third_party/skia/include/gpu/GrContext.h" | 53 #include "third_party/skia/include/gpu/GrContext.h" |
54 #include "third_party/skia/include/gpu/GrTexture.h" | 54 #include "third_party/skia/include/gpu/GrTexture.h" |
55 #include "third_party/skia/include/gpu/GrTextureProvider.h" | 55 #include "third_party/skia/include/gpu/GrTextureProvider.h" |
56 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 56 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
57 #include "ui/gfx/geometry/quad_f.h" | 57 #include "ui/gfx/geometry/quad_f.h" |
58 #include "ui/gfx/geometry/rect_conversions.h" | 58 #include "ui/gfx/geometry/rect_conversions.h" |
59 #include "ui/gfx/skia_util.h" | |
59 | 60 |
60 using gpu::gles2::GLES2Interface; | 61 using gpu::gles2::GLES2Interface; |
61 | 62 |
62 namespace cc { | 63 namespace cc { |
63 namespace { | 64 namespace { |
64 | 65 |
65 bool NeedsIOSurfaceReadbackWorkaround() { | 66 bool NeedsIOSurfaceReadbackWorkaround() { |
66 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
67 // This isn't strictly required in DumpRenderTree-mode when Mesa is used, | 68 // This isn't strictly required in DumpRenderTree-mode when Mesa is used, |
68 // but it doesn't seem to hurt. | 69 // but it doesn't seem to hurt. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 gl_->LineWidth(quad->width); | 595 gl_->LineWidth(quad->width); |
595 | 596 |
596 // The indices for the line are stored in the same array as the triangle | 597 // The indices for the line are stored in the same array as the triangle |
597 // indices. | 598 // indices. |
598 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0); | 599 gl_->DrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0); |
599 } | 600 } |
600 | 601 |
601 static skia::RefPtr<SkImage> ApplyImageFilter( | 602 static skia::RefPtr<SkImage> ApplyImageFilter( |
602 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, | 603 scoped_ptr<GLRenderer::ScopedUseGrContext> use_gr_context, |
603 ResourceProvider* resource_provider, | 604 ResourceProvider* resource_provider, |
604 const gfx::Rect& rect, | 605 const gfx::RectF& src_rect, |
606 const gfx::RectF& dst_rect, | |
605 const gfx::Vector2dF& scale, | 607 const gfx::Vector2dF& scale, |
606 SkImageFilter* filter, | 608 SkImageFilter* filter, |
607 ScopedResource* source_texture_resource) { | 609 ScopedResource* source_texture_resource) { |
608 if (!filter) | 610 if (!filter) |
609 return skia::RefPtr<SkImage>(); | 611 return skia::RefPtr<SkImage>(); |
610 | 612 |
611 if (!use_gr_context) | 613 if (!use_gr_context) |
612 return skia::RefPtr<SkImage>(); | 614 return skia::RefPtr<SkImage>(); |
613 | 615 |
614 ResourceProvider::ScopedReadLockGL lock(resource_provider, | 616 ResourceProvider::ScopedReadLockGL lock(resource_provider, |
(...skipping 12 matching lines...) Expand all Loading... | |
627 use_gr_context->context(), backend_texture_description)); | 629 use_gr_context->context(), backend_texture_description)); |
628 if (!srcImage.get()) { | 630 if (!srcImage.get()) { |
629 TRACE_EVENT_INSTANT0("cc", | 631 TRACE_EVENT_INSTANT0("cc", |
630 "ApplyImageFilter wrap background texture failed", | 632 "ApplyImageFilter wrap background texture failed", |
631 TRACE_EVENT_SCOPE_THREAD); | 633 TRACE_EVENT_SCOPE_THREAD); |
632 return skia::RefPtr<SkImage>(); | 634 return skia::RefPtr<SkImage>(); |
633 } | 635 } |
634 | 636 |
635 // Create surface to draw into. | 637 // Create surface to draw into. |
636 SkImageInfo dst_info = | 638 SkImageInfo dst_info = |
637 SkImageInfo::MakeN32Premul(srcImage->width(), srcImage->height()); | 639 SkImageInfo::MakeN32Premul(dst_rect.width(), dst_rect.height()); |
638 skia::RefPtr<SkSurface> surface = skia::AdoptRef(SkSurface::NewRenderTarget( | 640 skia::RefPtr<SkSurface> surface = skia::AdoptRef(SkSurface::NewRenderTarget( |
639 use_gr_context->context(), SkSurface::kYes_Budgeted, dst_info, 0)); | 641 use_gr_context->context(), SkSurface::kYes_Budgeted, dst_info, 0)); |
640 if (!surface) { | 642 if (!surface) { |
641 TRACE_EVENT_INSTANT0("cc", "ApplyImageFilter surface allocation failed", | 643 TRACE_EVENT_INSTANT0("cc", "ApplyImageFilter surface allocation failed", |
642 TRACE_EVENT_SCOPE_THREAD); | 644 TRACE_EVENT_SCOPE_THREAD); |
643 return skia::RefPtr<SkImage>(); | 645 return skia::RefPtr<SkImage>(); |
644 } | 646 } |
645 | 647 |
646 // The origin of the filter is top-left and the origin of the source is | 648 // The origin of the filter is top-left and the origin of the source is |
647 // bottom-left, but the orientation is the same, so we must translate the | 649 // bottom-left, but the orientation is the same, so we must translate the |
648 // filter so that it renders at the bottom of the texture to avoid | 650 // filter so that it renders at the bottom of the texture to avoid |
649 // misregistration. | 651 // misregistration. |
650 int y_translate = source_texture_resource->size().height() - rect.height() - | 652 float y_offset = source_texture_resource->size().height() - src_rect.height(); |
651 rect.origin().y(); | 653 SkMatrix local_matrix; |
652 SkMatrix localM; | 654 local_matrix.setScale(scale.x(), scale.y()); |
653 localM.setTranslate(-rect.origin().x(), y_translate); | 655 skia::RefPtr<SkImageFilter> filter_with_local_scale = |
654 localM.preScale(scale.x(), scale.y()); | 656 skia::AdoptRef(filter->newWithLocalMatrix(local_matrix)); |
655 skia::RefPtr<SkImageFilter> localIMF = | |
656 skia::AdoptRef(filter->newWithLocalMatrix(localM)); | |
657 | 657 |
658 SkPaint paint; | 658 SkPaint paint; |
659 paint.setImageFilter(localIMF.get()); | 659 paint.setImageFilter(filter_with_local_scale.get()); |
660 surface->getCanvas()->drawImage(srcImage.get(), 0, 0, &paint); | 660 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y()); |
661 surface->getCanvas()->drawImage(srcImage.get(), src_rect.x(), | |
662 src_rect.y() - y_offset, &paint); | |
661 | 663 |
662 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); | 664 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); |
663 if (!image || !image->isTextureBacked()) { | 665 if (!image || !image->isTextureBacked()) { |
664 return skia::RefPtr<SkImage>(); | 666 return skia::RefPtr<SkImage>(); |
665 } | 667 } |
666 | 668 |
667 CHECK(image->isTextureBacked()); | 669 CHECK(image->isTextureBacked()); |
668 return image; | 670 return image; |
669 } | 671 } |
670 | 672 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 int top, right, bottom, left; | 817 int top, right, bottom, left; |
816 quad->background_filters.GetOutsets(&top, &right, &bottom, &left); | 818 quad->background_filters.GetOutsets(&top, &right, &bottom, &left); |
817 backdrop_rect.Inset(-left, -top, -right, -bottom); | 819 backdrop_rect.Inset(-left, -top, -right, -bottom); |
818 } | 820 } |
819 | 821 |
820 if (!backdrop_rect.IsEmpty() && use_aa) { | 822 if (!backdrop_rect.IsEmpty() && use_aa) { |
821 const int kOutsetForAntialiasing = 1; | 823 const int kOutsetForAntialiasing = 1; |
822 backdrop_rect.Inset(-kOutsetForAntialiasing, -kOutsetForAntialiasing); | 824 backdrop_rect.Inset(-kOutsetForAntialiasing, -kOutsetForAntialiasing); |
823 } | 825 } |
824 | 826 |
827 if (!quad->filters.IsEmpty()) { | |
828 // If we have filters, grab an extra one-pixel border around the | |
829 // background, so texture edge clamping gives us a transparent border | |
830 // in case the filter expands the result. | |
831 backdrop_rect.Inset(-1, -1, -1, -1); | |
832 } | |
833 | |
825 backdrop_rect.Intersect(MoveFromDrawToWindowSpace( | 834 backdrop_rect.Intersect(MoveFromDrawToWindowSpace( |
826 frame, frame->current_render_pass->output_rect)); | 835 frame, frame->current_render_pass->output_rect)); |
827 return backdrop_rect; | 836 return backdrop_rect; |
828 } | 837 } |
829 | 838 |
830 scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture( | 839 scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture( |
831 const gfx::Rect& bounding_rect) { | 840 const gfx::Rect& bounding_rect) { |
832 scoped_ptr<ScopedResource> device_background_texture = | 841 scoped_ptr<ScopedResource> device_background_texture = |
833 ScopedResource::Create(resource_provider_); | 842 ScopedResource::Create(resource_provider_); |
834 // CopyTexImage2D fails when called on a texture having immutable storage. | 843 // CopyTexImage2D fails when called on a texture having immutable storage. |
835 device_background_texture->Allocate( | 844 device_background_texture->Allocate( |
836 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, | 845 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, |
837 resource_provider_->best_texture_format()); | 846 resource_provider_->best_texture_format()); |
838 { | 847 { |
839 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, | 848 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, |
840 device_background_texture->id()); | 849 device_background_texture->id()); |
841 GetFramebufferTexture(lock.texture_id(), RGBA_8888, bounding_rect); | 850 GetFramebufferTexture(lock.texture_id(), RGBA_8888, bounding_rect); |
842 } | 851 } |
843 return device_background_texture; | 852 return device_background_texture; |
844 } | 853 } |
845 | 854 |
846 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( | 855 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( |
847 DrawingFrame* frame, | 856 DrawingFrame* frame, |
848 const RenderPassDrawQuad* quad, | 857 const RenderPassDrawQuad* quad, |
849 ScopedResource* background_texture) { | 858 ScopedResource* background_texture, |
859 const gfx::RectF& rect) { | |
850 DCHECK(ShouldApplyBackgroundFilters(quad)); | 860 DCHECK(ShouldApplyBackgroundFilters(quad)); |
851 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 861 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
852 quad->background_filters, gfx::SizeF(background_texture->size())); | 862 quad->background_filters, gfx::SizeF(background_texture->size())); |
853 | 863 |
854 skia::RefPtr<SkImage> background_with_filters = ApplyImageFilter( | 864 skia::RefPtr<SkImage> background_with_filters = ApplyImageFilter( |
855 ScopedUseGrContext::Create(this, frame), resource_provider_, quad->rect, | 865 ScopedUseGrContext::Create(this, frame), resource_provider_, rect, rect, |
856 quad->filters_scale, filter.get(), background_texture); | 866 quad->filters_scale, filter.get(), background_texture); |
857 return background_with_filters; | 867 return background_with_filters; |
858 } | 868 } |
859 | 869 |
860 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, | 870 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
861 const RenderPassDrawQuad* quad, | 871 const RenderPassDrawQuad* quad, |
862 const gfx::QuadF* clip_region) { | 872 const gfx::QuadF* clip_region) { |
863 ScopedResource* contents_texture = | 873 ScopedResource* contents_texture = |
864 render_pass_textures_.get(quad->render_pass_id); | 874 render_pass_textures_.get(quad->render_pass_id); |
865 DCHECK(contents_texture); | 875 DCHECK(contents_texture); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 | 928 |
919 // Read the pixels in the bounding box into a buffer R. | 929 // Read the pixels in the bounding box into a buffer R. |
920 // This function allocates a texture, which should contribute to the | 930 // This function allocates a texture, which should contribute to the |
921 // amount of memory used by render surfaces: | 931 // amount of memory used by render surfaces: |
922 // LayerTreeHost::CalculateMemoryForRenderSurfaces. | 932 // LayerTreeHost::CalculateMemoryForRenderSurfaces. |
923 background_texture = GetBackdropTexture(background_rect); | 933 background_texture = GetBackdropTexture(background_rect); |
924 | 934 |
925 if (ShouldApplyBackgroundFilters(quad) && background_texture) { | 935 if (ShouldApplyBackgroundFilters(quad) && background_texture) { |
926 // Apply the background filters to R, so that it is applied in the | 936 // Apply the background filters to R, so that it is applied in the |
927 // pixels' coordinate space. | 937 // pixels' coordinate space. |
928 background_image = | 938 background_image = ApplyBackgroundFilters( |
929 ApplyBackgroundFilters(frame, quad, background_texture.get()); | 939 frame, quad, background_texture.get(), gfx::RectF(background_rect)); |
930 if (background_image) | 940 if (background_image) |
931 background_image_id = background_image->getTextureHandle(true); | 941 background_image_id = background_image->getTextureHandle(true); |
932 DCHECK(background_image_id); | 942 DCHECK(background_image_id); |
933 } | 943 } |
934 } | 944 } |
935 | 945 |
936 if (!background_texture) { | 946 if (!background_texture) { |
937 // Something went wrong with reading the backdrop. | 947 // Something went wrong with reading the backdrop. |
938 DCHECK(!background_image_id); | 948 DCHECK(!background_image_id); |
939 use_shaders_for_blending = false; | 949 use_shaders_for_blending = false; |
(...skipping 16 matching lines...) Expand all Loading... | |
956 SetBlendEnabled( | 966 SetBlendEnabled( |
957 !use_shaders_for_blending && | 967 !use_shaders_for_blending && |
958 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); | 968 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); |
959 | 969 |
960 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 970 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
961 // the surface and its replica. Apply filters to the contents texture. | 971 // the surface and its replica. Apply filters to the contents texture. |
962 skia::RefPtr<SkImage> filter_image; | 972 skia::RefPtr<SkImage> filter_image; |
963 GLuint filter_image_id = 0; | 973 GLuint filter_image_id = 0; |
964 SkScalar color_matrix[20]; | 974 SkScalar color_matrix[20]; |
965 bool use_color_matrix = false; | 975 bool use_color_matrix = false; |
976 gfx::RectF rect = gfx::RectF(quad->rect); | |
966 if (!quad->filters.IsEmpty()) { | 977 if (!quad->filters.IsEmpty()) { |
967 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 978 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
968 quad->filters, gfx::SizeF(contents_texture->size())); | 979 quad->filters, gfx::SizeF(contents_texture->size())); |
969 if (filter) { | 980 if (filter) { |
970 skia::RefPtr<SkColorFilter> cf; | 981 skia::RefPtr<SkColorFilter> cf; |
971 | 982 |
972 { | 983 { |
973 SkColorFilter* colorfilter_rawptr = NULL; | 984 SkColorFilter* colorfilter_rawptr = NULL; |
974 filter->asColorFilter(&colorfilter_rawptr); | 985 filter->asColorFilter(&colorfilter_rawptr); |
975 cf = skia::AdoptRef(colorfilter_rawptr); | 986 cf = skia::AdoptRef(colorfilter_rawptr); |
976 } | 987 } |
977 | 988 |
978 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { | 989 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { |
979 // We have a single color matrix as a filter; apply it locally | 990 // We have a single color matrix as a filter; apply it locally |
980 // in the compositor. | 991 // in the compositor. |
981 use_color_matrix = true; | 992 use_color_matrix = true; |
982 } else { | 993 } else { |
983 filter_image = ApplyImageFilter( | 994 gfx::RectF src_rect = rect; |
984 ScopedUseGrContext::Create(this, frame), resource_provider_, | 995 gfx::Vector2dF scale = quad->filters_scale; |
985 quad->rect, quad->filters_scale, filter.get(), contents_texture); | 996 // Compute the destination rect for the filtered output. |
997 // Note that we leave the dest rect equal to the src rect when | |
998 // a filter chain cannot compute its bounds. This is correct | |
999 // behaviour, but Skia is a little conservative at the moment. | |
1000 // Once Skia makes the fast-bounds traversal crop-rect aware | |
1001 // (http://skbug.com/4627), this won't be a problem | |
1002 // for Chrome since Blink always sets a crop rect on the leaf nodes | |
1003 // of the DAG, making it always computable. | |
1004 // TODO(senorblanco): remove this comment when http://skbug.com/4627 | |
enne (OOO)
2016/01/20 22:59:29
Thanks for this. :)
| |
1005 // is fixed. | |
1006 if (filter->canComputeFastBounds()) { | |
1007 SkRect result_rect; | |
1008 rect.Scale(1.0f / scale.x(), 1.0f / scale.y()); | |
1009 filter->computeFastBounds(gfx::RectFToSkRect(rect), &result_rect); | |
1010 rect = gfx::SkRectToRectF(result_rect); | |
1011 rect.Scale(scale.x(), scale.y()); | |
1012 } | |
1013 filter_image = ApplyImageFilter(ScopedUseGrContext::Create(this, frame), | |
1014 resource_provider_, src_rect, rect, | |
1015 scale, filter.get(), contents_texture); | |
986 if (filter_image) { | 1016 if (filter_image) { |
987 filter_image_id = filter_image->getTextureHandle(true); | 1017 filter_image_id = filter_image->getTextureHandle(true); |
988 DCHECK(filter_image_id); | 1018 DCHECK(filter_image_id); |
989 } | 1019 } |
990 } | 1020 } |
991 } | 1021 } |
992 } | 1022 } |
993 | 1023 |
994 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; | 1024 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; |
995 unsigned mask_texture_id = 0; | 1025 unsigned mask_texture_id = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1089 program->fragment_shader().FillLocations(&locations); | 1119 program->fragment_shader().FillLocations(&locations); |
1090 gl_->Uniform1i(locations.sampler, 0); | 1120 gl_->Uniform1i(locations.sampler, 0); |
1091 } else { | 1121 } else { |
1092 const RenderPassProgram* program = | 1122 const RenderPassProgram* program = |
1093 GetRenderPassProgram(tex_coord_precision, shader_blend_mode); | 1123 GetRenderPassProgram(tex_coord_precision, shader_blend_mode); |
1094 SetUseProgram(program->program()); | 1124 SetUseProgram(program->program()); |
1095 program->vertex_shader().FillLocations(&locations); | 1125 program->vertex_shader().FillLocations(&locations); |
1096 program->fragment_shader().FillLocations(&locations); | 1126 program->fragment_shader().FillLocations(&locations); |
1097 gl_->Uniform1i(locations.sampler, 0); | 1127 gl_->Uniform1i(locations.sampler, 0); |
1098 } | 1128 } |
1099 float tex_scale_x = | 1129 float tex_scale_x, tex_scale_y; |
1100 quad->rect.width() / static_cast<float>(contents_texture->size().width()); | 1130 if (filter_image) { |
1101 float tex_scale_y = quad->rect.height() / | 1131 // Skia filters always return SkImages with snug textures. |
1102 static_cast<float>(contents_texture->size().height()); | 1132 tex_scale_x = tex_scale_y = 1.0f; |
1133 } else { | |
1134 tex_scale_x = quad->rect.width() / | |
1135 static_cast<float>(contents_texture->size().width()); | |
1136 tex_scale_y = quad->rect.height() / | |
1137 static_cast<float>(contents_texture->size().height()); | |
1138 } | |
1103 DCHECK_LE(tex_scale_x, 1.0f); | 1139 DCHECK_LE(tex_scale_x, 1.0f); |
1104 DCHECK_LE(tex_scale_y, 1.0f); | 1140 DCHECK_LE(tex_scale_y, 1.0f); |
1105 | 1141 |
1106 DCHECK(locations.tex_transform != -1 || IsContextLost()); | 1142 DCHECK(locations.tex_transform != -1 || IsContextLost()); |
1107 // Flip the content vertically in the shader, as the RenderPass input | 1143 // Flip the content vertically in the shader, as the RenderPass input |
1108 // texture is already oriented the same way as the framebuffer, but the | 1144 // texture is already oriented the same way as the framebuffer, but the |
1109 // projection transform does a flip. | 1145 // projection transform does a flip. |
1110 gl_->Uniform4f(locations.tex_transform, 0.0f, tex_scale_y, tex_scale_x, | 1146 gl_->Uniform4f(locations.tex_transform, 0.0f, tex_scale_y, tex_scale_x, |
1111 -tex_scale_y); | 1147 -tex_scale_y); |
1112 | 1148 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1190 GL_TEXTURE0 + last_texture_unit, | 1226 GL_TEXTURE0 + last_texture_unit, |
1191 GL_LINEAR)); | 1227 GL_LINEAR)); |
1192 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 1228 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
1193 shader_background_sampler_lock->target()); | 1229 shader_background_sampler_lock->target()); |
1194 } | 1230 } |
1195 } | 1231 } |
1196 | 1232 |
1197 SetShaderOpacity(quad->shared_quad_state->opacity, locations.alpha); | 1233 SetShaderOpacity(quad->shared_quad_state->opacity, locations.alpha); |
1198 SetShaderQuadF(surface_quad, locations.quad); | 1234 SetShaderQuadF(surface_quad, locations.quad); |
1199 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, | 1235 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, |
1200 gfx::RectF(quad->rect), locations.matrix); | 1236 rect, locations.matrix); |
1201 | 1237 |
1202 // Flush the compositor context before the filter bitmap goes out of | 1238 // Flush the compositor context before the filter bitmap goes out of |
1203 // scope, so the draw gets processed before the filter texture gets deleted. | 1239 // scope, so the draw gets processed before the filter texture gets deleted. |
1204 if (filter_image_id) | 1240 if (filter_image_id) |
1205 gl_->Flush(); | 1241 gl_->Flush(); |
1206 | 1242 |
1207 if (!use_shaders_for_blending) | 1243 if (!use_shaders_for_blending) |
1208 RestoreBlendFuncToDefault(blend_mode); | 1244 RestoreBlendFuncToDefault(blend_mode); |
1209 } | 1245 } |
1210 | 1246 |
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3585 texture_id = pending_overlay_resources_.back()->texture_id(); | 3621 texture_id = pending_overlay_resources_.back()->texture_id(); |
3586 } | 3622 } |
3587 | 3623 |
3588 context_support_->ScheduleOverlayPlane( | 3624 context_support_->ScheduleOverlayPlane( |
3589 overlay.plane_z_order, overlay.transform, texture_id, | 3625 overlay.plane_z_order, overlay.transform, texture_id, |
3590 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3626 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
3591 } | 3627 } |
3592 } | 3628 } |
3593 | 3629 |
3594 } // namespace cc | 3630 } // namespace cc |
OLD | NEW |