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

Side by Side Diff: content/browser/compositor/gpu_browser_compositor_output_surface.cc

Issue 2699173002: cc: Make OutputSurfaceFrame::sub_buffer_rect optional (Closed)
Patch Set: Removed obsolete comment Created 3 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/compositor/gpu_browser_compositor_output_surface.h" 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool has_alpha, 89 bool has_alpha,
90 bool use_stencil) { 90 bool use_stencil) {
91 context_provider()->ContextGL()->ResizeCHROMIUM( 91 context_provider()->ContextGL()->ResizeCHROMIUM(
92 size.width(), size.height(), device_scale_factor, has_alpha); 92 size.width(), size.height(), device_scale_factor, has_alpha);
93 } 93 }
94 94
95 void GpuBrowserCompositorOutputSurface::SwapBuffers( 95 void GpuBrowserCompositorOutputSurface::SwapBuffers(
96 cc::OutputSurfaceFrame frame) { 96 cc::OutputSurfaceFrame frame) {
97 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info); 97 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info);
98 98
99 gfx::Rect swap_rect = frame.sub_buffer_rect;
100 gfx::Size surface_size = frame.size; 99 gfx::Size surface_size = frame.size;
101 if (reflector_) { 100 if (reflector_) {
102 if (swap_rect == gfx::Rect(surface_size)) { 101 if (frame.sub_buffer_rect) {
102 reflector_texture_->CopyTextureSubImage(*frame.sub_buffer_rect);
103 reflector_->OnSourcePostSubBuffer(*frame.sub_buffer_rect, surface_size);
104 } else {
103 reflector_texture_->CopyTextureFullImage(surface_size); 105 reflector_texture_->CopyTextureFullImage(surface_size);
104 reflector_->OnSourceSwapBuffers(surface_size); 106 reflector_->OnSourceSwapBuffers(surface_size);
105 } else {
106 reflector_texture_->CopyTextureSubImage(swap_rect);
107 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size);
108 } 107 }
109 } 108 }
110 109
111 if (swap_rect == gfx::Rect(frame.size)) 110 if (frame.sub_buffer_rect) {
111 context_provider_->ContextSupport()->PartialSwapBuffers(
112 *frame.sub_buffer_rect);
113 } else {
112 context_provider_->ContextSupport()->Swap(); 114 context_provider_->ContextSupport()->Swap();
113 else 115 }
114 context_provider_->ContextSupport()->PartialSwapBuffers(swap_rect);
115 } 116 }
116 117
117 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { 118 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
118 auto* gl = static_cast<ui::ContextProviderCommandBuffer*>(context_provider()); 119 auto* gl = static_cast<ui::ContextProviderCommandBuffer*>(context_provider());
119 return gl->GetCopyTextureInternalFormat(); 120 return gl->GetCopyTextureInternalFormat();
120 } 121 }
121 122
122 bool GpuBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const { 123 bool GpuBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const {
123 return false; 124 return false;
124 } 125 }
(...skipping 15 matching lines...) Expand all
140 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { 141 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() {
141 ui::ContextProviderCommandBuffer* provider_command_buffer = 142 ui::ContextProviderCommandBuffer* provider_command_buffer =
142 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get()); 143 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get());
143 gpu::CommandBufferProxyImpl* command_buffer_proxy = 144 gpu::CommandBufferProxyImpl* command_buffer_proxy =
144 provider_command_buffer->GetCommandBufferProxy(); 145 provider_command_buffer->GetCommandBufferProxy();
145 DCHECK(command_buffer_proxy); 146 DCHECK(command_buffer_proxy);
146 return command_buffer_proxy; 147 return command_buffer_proxy;
147 } 148 }
148 149
149 } // namespace content 150 } // namespace content
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.cc ('k') | content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698