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 "services/ui/surfaces/display_output_surface.h" | 5 #include "services/ui/surfaces/display_output_surface.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 float device_scale_factor, | 58 float device_scale_factor, |
59 const gfx::ColorSpace& color_space, | 59 const gfx::ColorSpace& color_space, |
60 bool has_alpha, | 60 bool has_alpha, |
61 bool use_stencil) { | 61 bool use_stencil) { |
62 context_provider()->ContextGL()->ResizeCHROMIUM( | 62 context_provider()->ContextGL()->ResizeCHROMIUM( |
63 size.width(), size.height(), device_scale_factor, has_alpha); | 63 size.width(), size.height(), device_scale_factor, has_alpha); |
64 } | 64 } |
65 | 65 |
66 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { | 66 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { |
67 DCHECK(context_provider_); | 67 DCHECK(context_provider_); |
68 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) { | 68 if (frame.sub_buffer_rect) { |
| 69 context_provider_->ContextSupport()->PartialSwapBuffers( |
| 70 *frame.sub_buffer_rect); |
| 71 } else { |
69 context_provider_->ContextSupport()->Swap(); | 72 context_provider_->ContextSupport()->Swap(); |
70 } else { | |
71 context_provider_->ContextSupport()->PartialSwapBuffers( | |
72 frame.sub_buffer_rect); | |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() { | 76 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() { |
77 // TODO(danakj): What attributes are used for the default framebuffer here? | 77 // TODO(danakj): What attributes are used for the default framebuffer here? |
78 // Can it have alpha? cc::InProcessContextProvider doesn't take any | 78 // Can it have alpha? cc::InProcessContextProvider doesn't take any |
79 // attributes. | 79 // attributes. |
80 return GL_RGB; | 80 return GL_RGB; |
81 } | 81 } |
82 | 82 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase, | 117 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase, |
118 base::TimeDelta interval) { | 118 base::TimeDelta interval) { |
119 // TODO(brianderson): We should not be receiving 0 intervals. | 119 // TODO(brianderson): We should not be receiving 0 intervals. |
120 synthetic_begin_frame_source_->OnUpdateVSyncParameters( | 120 synthetic_begin_frame_source_->OnUpdateVSyncParameters( |
121 timebase, | 121 timebase, |
122 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); | 122 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); |
123 } | 123 } |
124 | 124 |
125 } // namespace ui | 125 } // namespace ui |
OLD | NEW |