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

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

Issue 2245813002: Round IOSurface sizes to 64 pixels for filter effects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp73_rp_fuzzy_match
Patch Set: Compile error. Created 4 years, 4 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 | no next file » | 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 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 // Perform basic initialization with the screen-sized viewport. 3935 // Perform basic initialization with the screen-sized viewport.
3936 if (!InitializeRPDQParameters(&params)) 3936 if (!InitializeRPDQParameters(&params))
3937 return; 3937 return;
3938 3938
3939 if (!UpdateRPDQWithSkiaFilters(&params)) 3939 if (!UpdateRPDQWithSkiaFilters(&params))
3940 return; 3940 return;
3941 3941
3942 // |params.dst_rect| now contain values that reflect a potentially increased 3942 // |params.dst_rect| now contain values that reflect a potentially increased
3943 // size quad. 3943 // size quad.
3944 gfx::RectF updated_dst_rect = params.dst_rect; 3944 gfx::RectF updated_dst_rect = params.dst_rect;
3945 *new_bounds = updated_dst_rect; 3945
3946 // Round the size of the IOSurface to a multiple of 64 pixels. This reduces
3947 // memory fragmentation. https://crbug.com/146070. This also allows IOSurfaces
3948 // to be more easily reused during a resize operation.
3949 uint32_t iosurface_multiple = 64;
ccameron 2016/08/15 18:37:06 May be more concise to do updated_dst_rest.set_w
erikchen 2016/08/15 19:31:57 Done, although we can't change updated_dst_rect, s
3950 uint32_t iosurface_width = updated_dst_rect.width();
3951 if (iosurface_width % iosurface_multiple != 0) {
3952 iosurface_width -= iosurface_width % iosurface_multiple;
3953 iosurface_width += iosurface_multiple;
3954 }
3955
3956 uint32_t iosurface_height = updated_dst_rect.height();
3957 if (iosurface_height % iosurface_multiple != 0) {
3958 iosurface_height -= iosurface_height % iosurface_multiple;
3959 iosurface_height += iosurface_multiple;
3960 }
3961
3962 *resource = overlay_resource_pool_->AcquireResource(
3963 gfx::Size(iosurface_width, iosurface_height), ResourceFormat::RGBA_8888,
3964 output_surface_->device_color_space());
3965 *new_bounds =
3966 gfx::RectF(updated_dst_rect.x(), updated_dst_rect.y(),
3967 (*resource)->size().width(), (*resource)->size().height());
3946 3968
3947 // Calculate new projection and window matrices for a minimally sized viewport 3969 // Calculate new projection and window matrices for a minimally sized viewport
3948 // using InitializeViewport(). This requires creating a dummy DrawingFrame. 3970 // using InitializeViewport(). This requires creating a dummy DrawingFrame.
3949 { 3971 {
3950 DrawingFrame frame; 3972 DrawingFrame frame;
3951 force_drawing_frame_framebuffer_unflipped_ = true; 3973 force_drawing_frame_framebuffer_unflipped_ = true;
3952 gfx::Rect frame_rect = 3974 gfx::Rect frame_rect =
3953 gfx::Rect(0, 0, updated_dst_rect.width(), updated_dst_rect.height()); 3975 gfx::Rect(0, 0, updated_dst_rect.width(), updated_dst_rect.height());
3954 InitializeViewport(&frame, frame_rect, frame_rect, frame_rect.size()); 3976 InitializeViewport(&frame, frame_rect, frame_rect, frame_rect.size());
3955 force_drawing_frame_framebuffer_unflipped_ = false; 3977 force_drawing_frame_framebuffer_unflipped_ = false;
(...skipping 19 matching lines...) Expand all
3975 bool clipped = false; 3997 bool clipped = false;
3976 params.contents_device_transform.FlattenTo2d(); 3998 params.contents_device_transform.FlattenTo2d();
3977 gfx::QuadF device_layer_quad = MathUtil::MapQuad( 3999 gfx::QuadF device_layer_quad = MathUtil::MapQuad(
3978 params.contents_device_transform, SharedGeometryQuad(), &clipped); 4000 params.contents_device_transform, SharedGeometryQuad(), &clipped);
3979 LayerQuad device_layer_edges(device_layer_quad); 4001 LayerQuad device_layer_edges(device_layer_quad);
3980 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges, 4002 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges,
3981 params.edge); 4003 params.edge);
3982 } 4004 }
3983 4005
3984 // Establish destination texture. 4006 // Establish destination texture.
3985 *resource = overlay_resource_pool_->AcquireResource(
3986 gfx::Size(updated_dst_rect.width(), updated_dst_rect.height()),
3987 ResourceFormat::RGBA_8888, output_surface_->device_color_space());
3988 ResourceProvider::ScopedWriteLockGL destination(resource_provider_, 4007 ResourceProvider::ScopedWriteLockGL destination(resource_provider_,
3989 (*resource)->id(), false); 4008 (*resource)->id(), false);
3990 GLuint temp_fbo; 4009 GLuint temp_fbo;
3991 4010
3992 gl_->GenFramebuffers(1, &temp_fbo); 4011 gl_->GenFramebuffers(1, &temp_fbo);
3993 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); 4012 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo);
3994 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 4013 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3995 destination.target(), destination.texture_id(), 0); 4014 destination.target(), destination.texture_id(), 0);
3996 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) == 4015 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) ==
3997 GL_FRAMEBUFFER_COMPLETE); 4016 GL_FRAMEBUFFER_COMPLETE);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4061 4080
4062 gl_->ScheduleCALayerSharedStateCHROMIUM( 4081 gl_->ScheduleCALayerSharedStateCHROMIUM(
4063 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, 4082 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect,
4064 sorting_context_id, gl_transform); 4083 sorting_context_id, gl_transform);
4065 gl_->ScheduleCALayerCHROMIUM( 4084 gl_->ScheduleCALayerCHROMIUM(
4066 texture_id, contents_rect, ca_layer_overlay->background_color, 4085 texture_id, contents_rect, ca_layer_overlay->background_color,
4067 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4086 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4068 } 4087 }
4069 4088
4070 } // namespace cc 4089 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698