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

Side by Side Diff: ui/ozone/demo/surfaceless_gl_renderer.cc

Issue 1513283002: Add support to send optimal format as part of ScheduleOverlayPlane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update cmd_buffer_functions Created 5 years 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
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/platform/cast/surface_factory_cast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/ozone/demo/surfaceless_gl_renderer.h" 5 #include "ui/ozone/demo/surfaceless_gl_renderer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 float fraction = NextFraction(); 103 float fraction = NextFraction();
104 104
105 context_->MakeCurrent(surface_.get()); 105 context_->MakeCurrent(surface_.get());
106 buffers_[back_buffer_]->BindFramebuffer(); 106 buffers_[back_buffer_]->BindFramebuffer();
107 107
108 glViewport(0, 0, size_.width(), size_.height()); 108 glViewport(0, 0, size_.width(), size_.height());
109 glClearColor(1 - fraction, 0.0, fraction, 1.0); 109 glClearColor(1 - fraction, 0.0, fraction, 1.0);
110 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 110 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
111 111
112 surface_->ScheduleOverlayPlane(0, gfx::OVERLAY_TRANSFORM_NONE, 112 surface_->ScheduleOverlayPlane(
113 buffers_[back_buffer_]->image(), 113 0, gfx::OVERLAY_TRANSFORM_NONE, gfx::BufferFormat::BGRX_8888,
114 gfx::Rect(size_), gfx::RectF(0, 0, 1, 1)); 114 buffers_[back_buffer_]->image(), gfx::Rect(size_), gfx::RectF(0, 0, 1, 1),
115 true);
115 back_buffer_ ^= 1; 116 back_buffer_ ^= 1;
116 surface_->SwapBuffersAsync( 117 surface_->SwapBuffersAsync(
117 base::Bind(&SurfacelessGlRenderer::PostRenderFrameTask, 118 base::Bind(&SurfacelessGlRenderer::PostRenderFrameTask,
118 weak_ptr_factory_.GetWeakPtr())); 119 weak_ptr_factory_.GetWeakPtr()));
119 } 120 }
120 121
121 void SurfacelessGlRenderer::PostRenderFrameTask(gfx::SwapResult result) { 122 void SurfacelessGlRenderer::PostRenderFrameTask(gfx::SwapResult result) {
122 switch (result) { 123 switch (result) {
123 case gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS: 124 case gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS:
124 for (size_t i = 0; i < arraysize(buffers_); ++i) { 125 for (size_t i = 0; i < arraysize(buffers_); ++i) {
125 buffers_[i].reset(new BufferWrapper()); 126 buffers_[i].reset(new BufferWrapper());
126 if (!buffers_[i]->Initialize(widget_, size_)) 127 if (!buffers_[i]->Initialize(widget_, size_))
127 LOG(FATAL) << "Failed to recreate buffer"; 128 LOG(FATAL) << "Failed to recreate buffer";
128 } 129 }
129 // Fall through since we want to render a new frame anyways. 130 // Fall through since we want to render a new frame anyways.
130 case gfx::SwapResult::SWAP_ACK: 131 case gfx::SwapResult::SWAP_ACK:
131 GlRenderer::PostRenderFrameTask(result); 132 GlRenderer::PostRenderFrameTask(result);
132 break; 133 break;
133 case gfx::SwapResult::SWAP_FAILED: 134 case gfx::SwapResult::SWAP_FAILED:
134 LOG(FATAL) << "Failed to swap buffers"; 135 LOG(FATAL) << "Failed to swap buffers";
135 break; 136 break;
136 } 137 }
137 } 138 }
138 139
139 } // namespace ui 140 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/platform/cast/surface_factory_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698