Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 1942863002: cc: fix pixel-moving filter effects on a rotated layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/software_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // previously computed for AA will be wrong. Rather than recompute them
1015 // here, disable antialiasing and use a 1-pixel transparent
1016 // border to achieve a similar effect.
1017 if (use_aa && dst_rect != rect) {
1018 dst_rect.Inset(-1.0f, -1.0f);
1019 use_aa = false;
1020 }
1013 gfx::Rect clip_rect = quad->shared_quad_state->clip_rect; 1021 gfx::Rect clip_rect = quad->shared_quad_state->clip_rect;
1014 if (clip_rect.IsEmpty()) { 1022 if (clip_rect.IsEmpty()) {
1015 clip_rect = current_draw_rect_; 1023 clip_rect = current_draw_rect_;
1016 } 1024 }
1017 gfx::Transform transform = 1025 gfx::Transform transform =
1018 quad->shared_quad_state->quad_to_target_transform; 1026 quad->shared_quad_state->quad_to_target_transform;
1019 gfx::QuadF clip_quad = gfx::QuadF(gfx::RectF(clip_rect)); 1027 gfx::QuadF clip_quad = gfx::QuadF(gfx::RectF(clip_rect));
1020 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad); 1028 gfx::QuadF local_clip = MapQuadToLocalSpace(transform, clip_quad);
1021 dst_rect.Intersect(local_clip.BoundingBox()); 1029 dst_rect.Intersect(local_clip.BoundingBox());
1022 // If we've been fully clipped out (by crop rect or clipping), there's 1030 // If we've been fully clipped out (by crop rect or clipping), there's
(...skipping 22 matching lines...) Expand all
1045 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( 1053 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL(
1046 resource_provider_, quad->mask_resource_id(), GL_TEXTURE1, GL_LINEAR)); 1054 resource_provider_, quad->mask_resource_id(), GL_TEXTURE1, GL_LINEAR));
1047 mask_texture_id = mask_resource_lock->texture_id(); 1055 mask_texture_id = mask_resource_lock->texture_id();
1048 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); 1056 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target());
1049 } 1057 }
1050 1058
1051 std::unique_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; 1059 std::unique_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock;
1052 if (filter_image_id) { 1060 if (filter_image_id) {
1053 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); 1061 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
1054 gl_->BindTexture(GL_TEXTURE_2D, filter_image_id); 1062 gl_->BindTexture(GL_TEXTURE_2D, filter_image_id);
1063 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1064 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1055 } else { 1065 } else {
1056 contents_resource_lock = 1066 contents_resource_lock =
1057 base::WrapUnique(new ResourceProvider::ScopedSamplerGL( 1067 base::WrapUnique(new ResourceProvider::ScopedSamplerGL(
1058 resource_provider_, contents_texture->id(), GL_LINEAR)); 1068 resource_provider_, contents_texture->id(), GL_LINEAR));
1059 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), 1069 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D),
1060 contents_resource_lock->target()); 1070 contents_resource_lock->target());
1061 } 1071 }
1062 1072
1063 if (!use_shaders_for_blending) { 1073 if (!use_shaders_for_blending) {
1064 if (!use_blend_equation_advanced_coherent_ && use_blend_equation_advanced_) 1074 if (!use_blend_equation_advanced_coherent_ && use_blend_equation_advanced_)
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 texture_id = pending_overlay_resources_.back()->texture_id(); 3648 texture_id = pending_overlay_resources_.back()->texture_id();
3639 } 3649 }
3640 3650
3641 context_support_->ScheduleOverlayPlane( 3651 context_support_->ScheduleOverlayPlane(
3642 overlay.plane_z_order, overlay.transform, texture_id, 3652 overlay.plane_z_order, overlay.transform, texture_id,
3643 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3653 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3644 } 3654 }
3645 } 3655 }
3646 3656
3647 } // namespace cc 3657 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/software_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698