Index: cc/output/direct_renderer.cc |
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc |
index 4eb13ec146f8e7817045366787d14c29bfc8e421..cc7fd12c67002cf9dd367ff183eebf9d9792a2d6 100644 |
--- a/cc/output/direct_renderer.cc |
+++ b/cc/output/direct_renderer.cc |
@@ -233,14 +233,24 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, |
frame.root_damage_rect.Union(overlay_processor_->GetAndResetOverlayDamage()); |
frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_size)); |
frame.device_viewport_size = device_viewport_size; |
+ frame.device_color_space = device_color_space; |
// Only reshape when we know we are going to draw. Otherwise, the reshape |
// can leave the window at the wrong size if we never draw and the proper |
// viewport size is never set. |
- output_surface_->Reshape(device_viewport_size, device_scale_factor, |
- device_color_space, |
- frame.root_render_pass->has_transparent_background); |
- surface_size_for_swap_buffers_ = device_viewport_size; |
+ bool frame_has_alpha = frame.root_render_pass->has_transparent_background; |
+ if (device_viewport_size != reshape_surface_size_ || |
+ device_scale_factor != reshape_device_scale_factor_ || |
+ device_color_space != reshape_device_color_space_ || |
+ frame_has_alpha != reshape_has_alpha_) { |
+ reshape_surface_size_ = device_viewport_size; |
+ reshape_device_scale_factor_ = device_scale_factor; |
+ reshape_device_color_space_ = device_color_space; |
+ reshape_has_alpha_ = frame.root_render_pass->has_transparent_background; |
+ output_surface_->Reshape(reshape_surface_size_, |
+ reshape_device_scale_factor_, |
+ reshape_device_color_space_, reshape_has_alpha_); |
+ } |
BeginDrawingFrame(&frame); |
@@ -542,10 +552,9 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame, |
size.Enlarge(enlarge_pass_texture_amount_.width(), |
enlarge_pass_texture_amount_.height()); |
if (!texture->id()) { |
- texture->Allocate(size, |
- ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
- resource_provider_->best_texture_format(), |
- output_surface_->device_color_space()); |
+ texture->Allocate( |
+ size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
+ resource_provider_->best_texture_format(), frame->device_color_space); |
} |
DCHECK(texture->id()); |