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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 // in the compositor. | 1003 // in the compositor. |
| 1004 use_color_matrix = true; | 1004 use_color_matrix = true; |
| 1005 } else { | 1005 } else { |
| 1006 gfx::Vector2dF scale = quad->filters_scale; | 1006 gfx::Vector2dF scale = quad->filters_scale; |
| 1007 SkMatrix scale_matrix; | 1007 SkMatrix scale_matrix; |
| 1008 scale_matrix.setScale(scale.x(), scale.y()); | 1008 scale_matrix.setScale(scale.x(), scale.y()); |
| 1009 SkIRect result_rect = | 1009 SkIRect result_rect = |
| 1010 filter->filterBounds(gfx::RectToSkIRect(quad->rect), scale_matrix, | 1010 filter->filterBounds(gfx::RectToSkIRect(quad->rect), scale_matrix, |
| 1011 SkImageFilter::kForward_MapDirection); | 1011 SkImageFilter::kForward_MapDirection); |
| 1012 gfx::RectF dst_rect = gfx::SkRectToRectF(SkRect::Make(result_rect)); | 1012 gfx::RectF dst_rect = gfx::SkRectToRectF(SkRect::Make(result_rect)); |
| 1013 // If the destination rect is not the same as the source rect, the edges | |
| 1014 // computed for AA will be wrong. So disable antialiasing, and use | |
|
enne (OOO)
2016/05/03 18:25:39
It might be worth saying the correct aa edges *cou
Stephen White
2016/05/03 18:44:15
Done.
| |
| 1015 // a 1-pixel transparent border to achieve a similar effect. | |
| 1016 if (use_aa && dst_rect != rect) { | |
| 1017 dst_rect.Inset(-1.0f, -1.0f); | |
| 1018 use_aa = false; | |
| 1019 } | |
| 1013 gfx::Rect clip_rect = quad->shared_quad_state->clip_rect; | 1020 gfx::Rect clip_rect = quad->shared_quad_state->clip_rect; |
| 1014 if (clip_rect.IsEmpty()) { | 1021 if (clip_rect.IsEmpty()) { |
| 1015 clip_rect = current_draw_rect_; | 1022 clip_rect = current_draw_rect_; |
| 1016 } | 1023 } |
| 1017 gfx::Transform transform = | 1024 gfx::Transform transform = |
| 1018 quad->shared_quad_state->quad_to_target_transform; | 1025 quad->shared_quad_state->quad_to_target_transform; |
| 1019 gfx::QuadF clip_quad = gfx::QuadF(gfx::RectF(clip_rect)); | 1026 gfx::QuadF clip_quad = gfx::QuadF(gfx::RectF(clip_rect)); |
| 1020 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); | 1027 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); |
| 1021 dst_rect.Intersect(local_clip.BoundingBox()); | 1028 dst_rect.Intersect(local_clip.BoundingBox()); |
| 1022 // If we've been fully clipped out (by crop rect or clipping), there's | 1029 // If we've been fully clipped out (by crop rect or clipping), there's |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1045 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( | 1052 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( |
| 1046 resource_provider_, quad->mask_resource_id(), GL_TEXTURE1, GL_LINEAR)); | 1053 resource_provider_, quad->mask_resource_id(), GL_TEXTURE1, GL_LINEAR)); |
| 1047 mask_texture_id = mask_resource_lock->texture_id(); | 1054 mask_texture_id = mask_resource_lock->texture_id(); |
| 1048 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); | 1055 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); |
| 1049 } | 1056 } |
| 1050 | 1057 |
| 1051 std::unique_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; | 1058 std::unique_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; |
| 1052 if (filter_image_id) { | 1059 if (filter_image_id) { |
| 1053 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 1060 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 1054 gl_->BindTexture(GL_TEXTURE_2D, filter_image_id); | 1061 gl_->BindTexture(GL_TEXTURE_2D, filter_image_id); |
| 1062 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 1063 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
| 1055 } else { | 1064 } else { |
| 1056 contents_resource_lock = | 1065 contents_resource_lock = |
| 1057 base::WrapUnique(new ResourceProvider::ScopedSamplerGL( | 1066 base::WrapUnique(new ResourceProvider::ScopedSamplerGL( |
| 1058 resource_provider_, contents_texture->id(), GL_LINEAR)); | 1067 resource_provider_, contents_texture->id(), GL_LINEAR)); |
| 1059 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 1068 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
| 1060 contents_resource_lock->target()); | 1069 contents_resource_lock->target()); |
| 1061 } | 1070 } |
| 1062 | 1071 |
| 1063 if (!use_shaders_for_blending) { | 1072 if (!use_shaders_for_blending) { |
| 1064 if (!use_blend_equation_advanced_coherent_ && use_blend_equation_advanced_) | 1073 if (!use_blend_equation_advanced_coherent_ && use_blend_equation_advanced_) |
| (...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3638 texture_id = pending_overlay_resources_.back()->texture_id(); | 3647 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3639 } | 3648 } |
| 3640 | 3649 |
| 3641 context_support_->ScheduleOverlayPlane( | 3650 context_support_->ScheduleOverlayPlane( |
| 3642 overlay.plane_z_order, overlay.transform, texture_id, | 3651 overlay.plane_z_order, overlay.transform, texture_id, |
| 3643 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3652 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3644 } | 3653 } |
| 3645 } | 3654 } |
| 3646 | 3655 |
| 3647 } // namespace cc | 3656 } // namespace cc |
| OLD | NEW |