| 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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 bool use_color_matrix = false; | 1001 bool use_color_matrix = false; |
| 1002 gfx::RectF rect = gfx::RectF(quad->rect); | 1002 gfx::RectF rect = gfx::RectF(quad->rect); |
| 1003 if (!quad->filters.IsEmpty()) { | 1003 if (!quad->filters.IsEmpty()) { |
| 1004 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 1004 sk_sp<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
| 1005 quad->filters, gfx::SizeF(contents_texture->size())); | 1005 quad->filters, gfx::SizeF(contents_texture->size())); |
| 1006 if (filter) { | 1006 if (filter) { |
| 1007 SkColorFilter* colorfilter_rawptr = NULL; | 1007 SkColorFilter* colorfilter_rawptr = NULL; |
| 1008 filter->asColorFilter(&colorfilter_rawptr); | 1008 filter->asColorFilter(&colorfilter_rawptr); |
| 1009 sk_sp<SkColorFilter> cf(colorfilter_rawptr); | 1009 sk_sp<SkColorFilter> cf(colorfilter_rawptr); |
| 1010 | 1010 |
| 1011 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { | 1011 if (cf && cf->asColorMatrix(color_matrix)) { |
| 1012 // We have a single color matrix as a filter; apply it locally | 1012 // We have a color matrix at the root of the filter DAG; apply it |
| 1013 // in the compositor. | 1013 // locally in the compositor and process the rest of the DAG (if any) |
| 1014 // in Skia. |
| 1014 use_color_matrix = true; | 1015 use_color_matrix = true; |
| 1015 } else { | 1016 filter = sk_ref_sp(filter->getInput(0)); |
| 1017 } |
| 1018 if (filter) { |
| 1016 gfx::Vector2dF scale = quad->filters_scale; | 1019 gfx::Vector2dF scale = quad->filters_scale; |
| 1017 SkMatrix scale_matrix; | 1020 SkMatrix scale_matrix; |
| 1018 scale_matrix.setScale(scale.x(), scale.y()); | 1021 scale_matrix.setScale(scale.x(), scale.y()); |
| 1019 SkIRect result_rect = | 1022 SkIRect result_rect = |
| 1020 filter->filterBounds(gfx::RectToSkIRect(quad->rect), scale_matrix, | 1023 filter->filterBounds(gfx::RectToSkIRect(quad->rect), scale_matrix, |
| 1021 SkImageFilter::kForward_MapDirection); | 1024 SkImageFilter::kForward_MapDirection); |
| 1022 gfx::RectF dst_rect = gfx::SkRectToRectF(SkRect::Make(result_rect)); | 1025 gfx::RectF dst_rect = gfx::SkRectToRectF(SkRect::Make(result_rect)); |
| 1023 // If the destination rect is not the same as the source rect, the edges | 1026 // If the destination rect is not the same as the source rect, the edges |
| 1024 // previously computed for AA will be wrong. Rather than recompute them | 1027 // previously computed for AA will be wrong. Rather than recompute them |
| 1025 // here, disable antialiasing and use a 1-pixel transparent | 1028 // here, disable antialiasing and use a 1-pixel transparent |
| (...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3661 texture_id = pending_overlay_resources_.back()->texture_id(); | 3664 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3662 } | 3665 } |
| 3663 | 3666 |
| 3664 context_support_->ScheduleOverlayPlane( | 3667 context_support_->ScheduleOverlayPlane( |
| 3665 overlay.plane_z_order, overlay.transform, texture_id, | 3668 overlay.plane_z_order, overlay.transform, texture_id, |
| 3666 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3669 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3667 } | 3670 } |
| 3668 } | 3671 } |
| 3669 | 3672 |
| 3670 } // namespace cc | 3673 } // namespace cc |
| OLD | NEW |