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

Side by Side Diff: gpu/ipc/service/child_window_surface_win.cc

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « gpu/ipc/service/child_window_surface_win.h ('k') | gpu/ipc/service/gpu_channel.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "gpu/ipc/service/child_window_surface_win.h" 5 #include "gpu/ipc/service/child_window_surface_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/win/scoped_hdc.h" 10 #include "base/win/scoped_hdc.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 g_window_class = RegisterClassEx(&intermediate_class); 67 g_window_class = RegisterClassEx(&intermediate_class);
68 if (!g_window_class) { 68 if (!g_window_class) {
69 LOG(ERROR) << "RegisterClass failed."; 69 LOG(ERROR) << "RegisterClass failed.";
70 return; 70 return;
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 ChildWindowSurfaceWin::ChildWindowSurfaceWin(GpuChannelManager* manager, 75 ChildWindowSurfaceWin::ChildWindowSurfaceWin(GpuChannelManager* manager,
76 HWND parent_window) 76 HWND parent_window)
77 : gfx::NativeViewGLSurfaceEGL(0), 77 : gl::NativeViewGLSurfaceEGL(0),
78 parent_window_(parent_window), 78 parent_window_(parent_window),
79 manager_(manager), 79 manager_(manager),
80 alpha_(true), 80 alpha_(true),
81 first_swap_(true) { 81 first_swap_(true) {
82 // Don't use EGL_ANGLE_window_fixed_size so that we can avoid recreating the 82 // Don't use EGL_ANGLE_window_fixed_size so that we can avoid recreating the
83 // window surface, which can cause flicker on DirectComposition. 83 // window surface, which can cause flicker on DirectComposition.
84 enable_fixed_size_angle_ = false; 84 enable_fixed_size_angle_ = false;
85 } 85 }
86 86
87 EGLConfig ChildWindowSurfaceWin::GetConfig() { 87 EGLConfig ChildWindowSurfaceWin::GetConfig() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 bool ChildWindowSurfaceWin::Resize(const gfx::Size& size, 137 bool ChildWindowSurfaceWin::Resize(const gfx::Size& size,
138 float scale_factor, 138 float scale_factor,
139 bool has_alpha) { 139 bool has_alpha) {
140 if (!SupportsPostSubBuffer()) { 140 if (!SupportsPostSubBuffer()) {
141 if (!MoveWindow(window_, 0, 0, size.width(), size.height(), FALSE)) { 141 if (!MoveWindow(window_, 0, 0, size.width(), size.height(), FALSE)) {
142 return false; 142 return false;
143 } 143 }
144 alpha_ = has_alpha; 144 alpha_ = has_alpha;
145 return gfx::NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha); 145 return gl::NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha);
146 } else { 146 } else {
147 if (size == GetSize() && has_alpha == alpha_) 147 if (size == GetSize() && has_alpha == alpha_)
148 return true; 148 return true;
149 149
150 // Force a resize and redraw (but not a move, activate, etc.). 150 // Force a resize and redraw (but not a move, activate, etc.).
151 if (!SetWindowPos(window_, nullptr, 0, 0, size.width(), size.height(), 151 if (!SetWindowPos(window_, nullptr, 0, 0, size.width(), size.height(),
152 SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | 152 SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS |
153 SWP_NOOWNERZORDER | SWP_NOZORDER)) { 153 SWP_NOOWNERZORDER | SWP_NOZORDER)) {
154 return false; 154 return false;
155 } 155 }
156 size_ = size; 156 size_ = size;
157 if (has_alpha == alpha_) { 157 if (has_alpha == alpha_) {
158 // A 0-size PostSubBuffer doesn't swap but forces the swap chain to resize 158 // A 0-size PostSubBuffer doesn't swap but forces the swap chain to resize
159 // to match the window. 159 // to match the window.
160 PostSubBuffer(0, 0, 0, 0); 160 PostSubBuffer(0, 0, 0, 0);
161 } else { 161 } else {
162 alpha_ = has_alpha; 162 alpha_ = has_alpha;
163 config_ = nullptr; 163 config_ = nullptr;
164 164
165 std::unique_ptr<ui::ScopedMakeCurrent> scoped_make_current; 165 std::unique_ptr<ui::ScopedMakeCurrent> scoped_make_current;
166 gfx::GLContext* current_context = gfx::GLContext::GetCurrent(); 166 gl::GLContext* current_context = gl::GLContext::GetCurrent();
167 bool was_current = current_context && current_context->IsCurrent(this); 167 bool was_current = current_context && current_context->IsCurrent(this);
168 if (was_current) { 168 if (was_current) {
169 scoped_make_current.reset( 169 scoped_make_current.reset(
170 new ui::ScopedMakeCurrent(current_context, this)); 170 new ui::ScopedMakeCurrent(current_context, this));
171 current_context->ReleaseCurrent(this); 171 current_context->ReleaseCurrent(this);
172 } 172 }
173 173
174 Destroy(); 174 Destroy();
175 175
176 if (!Initialize()) { 176 if (!Initialize()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 rect_to_clear_ = gfx::Rect(); 221 rect_to_clear_ = gfx::Rect();
222 } 222 }
223 } 223 }
224 224
225 ChildWindowSurfaceWin::~ChildWindowSurfaceWin() { 225 ChildWindowSurfaceWin::~ChildWindowSurfaceWin() {
226 gfx::SetWindowUserData(window_, nullptr); 226 gfx::SetWindowUserData(window_, nullptr);
227 DestroyWindow(window_); 227 DestroyWindow(window_);
228 } 228 }
229 229
230 } // namespace gpu 230 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/child_window_surface_win.h ('k') | gpu/ipc/service/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698