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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 | 751 |
752 if (disable_blending) | 752 if (disable_blending) |
753 SetBlendEnabled(true); | 753 SetBlendEnabled(true); |
754 } | 754 } |
755 | 755 |
756 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 756 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
757 // the surface and its replica. Apply filters to the contents texture. | 757 // the surface and its replica. Apply filters to the contents texture. |
758 SkBitmap filter_bitmap; | 758 SkBitmap filter_bitmap; |
759 SkScalar color_matrix[20]; | 759 SkScalar color_matrix[20]; |
760 bool use_color_matrix = false; | 760 bool use_color_matrix = false; |
761 if (quad->filter) { | 761 // TODO(ajuma): Always use RenderSurfaceFilters::BuildImageFilter, not just |
762 // when we have a reference filter. | |
ajuma
2013/09/09 17:35:36
I'm leaving this for a separate CL in order to avo
| |
763 if (quad->filters.HasReferenceFilter()) { | |
764 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | |
765 quad->filters, contents_texture->size()); | |
762 skia::RefPtr<SkColorFilter> cf; | 766 skia::RefPtr<SkColorFilter> cf; |
763 | 767 |
764 { | 768 { |
765 SkColorFilter* colorfilter_rawptr = NULL; | 769 SkColorFilter* colorfilter_rawptr = NULL; |
766 quad->filter->asColorFilter(&colorfilter_rawptr); | 770 filter->asColorFilter(&colorfilter_rawptr); |
767 cf = skia::AdoptRef(colorfilter_rawptr); | 771 cf = skia::AdoptRef(colorfilter_rawptr); |
768 } | 772 } |
769 | 773 |
770 if (cf && cf->asColorMatrix(color_matrix) && !quad->filter->getInput(0)) { | 774 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { |
771 // We have a single color matrix as a filter; apply it locally | 775 // We have a single color matrix as a filter; apply it locally |
772 // in the compositor. | 776 // in the compositor. |
773 use_color_matrix = true; | 777 use_color_matrix = true; |
774 } else { | 778 } else { |
775 filter_bitmap = ApplyImageFilter(this, | 779 filter_bitmap = ApplyImageFilter(this, |
776 frame->offscreen_context_provider, | 780 frame->offscreen_context_provider, |
777 quad->rect.origin(), | 781 quad->rect.origin(), |
778 quad->filter.get(), | 782 filter.get(), |
779 contents_texture); | 783 contents_texture); |
780 } | 784 } |
781 } else if (!quad->filters.IsEmpty()) { | 785 } else if (!quad->filters.IsEmpty()) { |
782 FilterOperations optimized_filters = | 786 FilterOperations optimized_filters = |
783 RenderSurfaceFilters::Optimize(quad->filters); | 787 RenderSurfaceFilters::Optimize(quad->filters); |
784 | 788 |
785 if ((optimized_filters.size() == 1) && | 789 if ((optimized_filters.size() == 1) && |
786 (optimized_filters.at(0).type() == FilterOperation::COLOR_MATRIX)) { | 790 (optimized_filters.at(0).type() == FilterOperation::COLOR_MATRIX)) { |
787 memcpy( | 791 memcpy( |
788 color_matrix, optimized_filters.at(0).matrix(), sizeof(color_matrix)); | 792 color_matrix, optimized_filters.at(0).matrix(), sizeof(color_matrix)); |
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3150 std::string unique_context_name = base::StringPrintf( | 3154 std::string unique_context_name = base::StringPrintf( |
3151 "%s-Offscreen-%p", | 3155 "%s-Offscreen-%p", |
3152 Settings().compositor_name.c_str(), | 3156 Settings().compositor_name.c_str(), |
3153 context_); | 3157 context_); |
3154 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( | 3158 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( |
3155 unique_context_name.c_str()); | 3159 unique_context_name.c_str()); |
3156 } | 3160 } |
3157 | 3161 |
3158 | 3162 |
3159 } // namespace cc | 3163 } // namespace cc |
OLD | NEW |