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

Side by Side Diff: services/ui/surfaces/display_output_surface.cc

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: rebase Created 3 years, 9 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 "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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void DisplayOutputSurface::EnsureBackbuffer() {} 47 void DisplayOutputSurface::EnsureBackbuffer() {}
48 48
49 void DisplayOutputSurface::DiscardBackbuffer() { 49 void DisplayOutputSurface::DiscardBackbuffer() {
50 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); 50 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
51 } 51 }
52 52
53 void DisplayOutputSurface::BindFramebuffer() { 53 void DisplayOutputSurface::BindFramebuffer() {
54 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); 54 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
55 } 55 }
56 56
57 void DisplayOutputSurface::SetDrawRectangle(const gfx::Rect& rect) {
58 if (set_draw_rectangle_for_frame_)
59 return;
60 DCHECK(gfx::Rect(size_).Contains(rect));
61 DCHECK(has_set_draw_rectangle_since_last_resize_ ||
62 (gfx::Rect(size_) == rect));
63 set_draw_rectangle_for_frame_ = true;
64 has_set_draw_rectangle_since_last_resize_ = true;
65 context_provider()->ContextGL()->SetDrawRectangleCHROMIUM(
66 rect.x(), rect.y(), rect.width(), rect.height());
67 }
68
57 void DisplayOutputSurface::Reshape(const gfx::Size& size, 69 void DisplayOutputSurface::Reshape(const gfx::Size& size,
58 float device_scale_factor, 70 float device_scale_factor,
59 const gfx::ColorSpace& color_space, 71 const gfx::ColorSpace& color_space,
60 bool has_alpha, 72 bool has_alpha,
61 bool use_stencil) { 73 bool use_stencil) {
74 size_ = size;
75 has_set_draw_rectangle_since_last_resize_ = false;
62 context_provider()->ContextGL()->ResizeCHROMIUM( 76 context_provider()->ContextGL()->ResizeCHROMIUM(
63 size.width(), size.height(), device_scale_factor, has_alpha); 77 size.width(), size.height(), device_scale_factor, has_alpha);
64 } 78 }
65 79
66 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { 80 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) {
67 DCHECK(context_provider_); 81 DCHECK(context_provider_);
82 set_draw_rectangle_for_frame_ = false;
68 if (frame.sub_buffer_rect) { 83 if (frame.sub_buffer_rect) {
69 context_provider_->ContextSupport()->PartialSwapBuffers( 84 context_provider_->ContextSupport()->PartialSwapBuffers(
70 *frame.sub_buffer_rect); 85 *frame.sub_buffer_rect);
71 } else { 86 } else {
72 context_provider_->ContextSupport()->Swap(); 87 context_provider_->ContextSupport()->Swap();
73 } 88 }
74 } 89 }
75 90
76 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() { 91 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() {
77 // TODO(danakj): What attributes are used for the default framebuffer here? 92 // TODO(danakj): What attributes are used for the default framebuffer here?
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 131
117 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase, 132 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase,
118 base::TimeDelta interval) { 133 base::TimeDelta interval) {
119 // TODO(brianderson): We should not be receiving 0 intervals. 134 // TODO(brianderson): We should not be receiving 0 intervals.
120 synthetic_begin_frame_source_->OnUpdateVSyncParameters( 135 synthetic_begin_frame_source_->OnUpdateVSyncParameters(
121 timebase, 136 timebase,
122 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); 137 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval);
123 } 138 }
124 139
125 } // namespace ui 140 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/display_output_surface.h ('k') | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698