OLD | NEW |
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_surfaceless_browser_compositor_output_s
urface.h" | 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
6 | 6 |
7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
8 #include "content/browser/compositor/buffer_queue.h" | 8 #include "content/browser/compositor/buffer_queue.h" |
9 #include "content/browser/compositor/reflector_impl.h" | 9 #include "content/browser/compositor/reflector_impl.h" |
10 #include "content/browser/gpu/gpu_surface_tracker.h" | 10 #include "content/browser/gpu/gpu_surface_tracker.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 GpuSurfacelessBrowserCompositorOutputSurface:: | 42 GpuSurfacelessBrowserCompositorOutputSurface:: |
43 ~GpuSurfacelessBrowserCompositorOutputSurface() { | 43 ~GpuSurfacelessBrowserCompositorOutputSurface() { |
44 } | 44 } |
45 | 45 |
46 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( | 46 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( |
47 cc::CompositorFrame* frame) { | 47 cc::CompositorFrame* frame) { |
48 DCHECK(output_surface_); | 48 DCHECK(output_surface_); |
49 | 49 |
50 GLuint texture = output_surface_->current_texture_id(); | 50 GLuint texture; |
51 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); | 51 if (!frame->gl_frame_data->sub_buffer_rect.IsEmpty()) { |
| 52 texture = output_surface_->current_texture_id(); |
| 53 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); |
| 54 } else { |
| 55 texture = output_surface_->last_texture_id(); |
| 56 } |
52 const gfx::Size& size = frame->gl_frame_data->size; | 57 const gfx::Size& size = frame->gl_frame_data->size; |
53 context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM( | 58 context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM( |
54 0, | 59 0, |
55 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM, | 60 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM, |
56 texture, | 61 texture, |
57 0, | 62 0, |
58 0, | 63 0, |
59 size.width(), | 64 size.width(), |
60 size.height(), | 65 size.height(), |
61 0, | 66 0, |
(...skipping 16 matching lines...) Expand all Loading... |
78 | 83 |
79 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( | 84 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( |
80 const gfx::Size& size, | 85 const gfx::Size& size, |
81 float scale_factor) { | 86 float scale_factor) { |
82 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); | 87 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor); |
83 DCHECK(output_surface_); | 88 DCHECK(output_surface_); |
84 output_surface_->Reshape(SurfaceSize(), scale_factor); | 89 output_surface_->Reshape(SurfaceSize(), scale_factor); |
85 } | 90 } |
86 | 91 |
87 } // namespace content | 92 } // namespace content |
OLD | NEW |