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

Side by Side Diff: gpu/gles2_conform_support/egl/display.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, 7 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/gles2_conform_support/egl/context.cc ('k') | gpu/gles2_conform_support/egl/surface.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gles2_conform_support/egl/display.h" 5 #include "gpu/gles2_conform_support/egl/display.h"
6 6
7 #include "gpu/gles2_conform_support/egl/config.h" 7 #include "gpu/gles2_conform_support/egl/config.h"
8 #include "gpu/gles2_conform_support/egl/context.h" 8 #include "gpu/gles2_conform_support/egl/context.h"
9 #include "gpu/gles2_conform_support/egl/surface.h" 9 #include "gpu/gles2_conform_support/egl/surface.h"
10 #include "gpu/gles2_conform_support/egl/thread_state.h" 10 #include "gpu/gles2_conform_support/egl/thread_state.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 } 172 }
173 return DoCreatePbufferSurface(ts, config, width, height); 173 return DoCreatePbufferSurface(ts, config, width, height);
174 } 174 }
175 175
176 EGLSurface Display::DoCreatePbufferSurface(ThreadState* ts, 176 EGLSurface Display::DoCreatePbufferSurface(ThreadState* ts,
177 const Config* config, 177 const Config* config,
178 EGLint width, 178 EGLint width,
179 EGLint height) { 179 EGLint height) {
180 lock_.AssertAcquired(); 180 lock_.AssertAcquired();
181 scoped_refptr<gfx::GLSurface> gl_surface; 181 scoped_refptr<gl::GLSurface> gl_surface;
182 gl_surface = gl::init::CreateOffscreenGLSurface(gfx::Size(width, height)); 182 gl_surface = gl::init::CreateOffscreenGLSurface(gfx::Size(width, height));
183 if (!gl_surface) 183 if (!gl_surface)
184 return ts->ReturnError(EGL_BAD_ALLOC, nullptr); 184 return ts->ReturnError(EGL_BAD_ALLOC, nullptr);
185 surfaces_.emplace_back(new Surface(gl_surface.get(), config)); 185 surfaces_.emplace_back(new Surface(gl_surface.get(), config));
186 return ts->ReturnSuccess<EGLSurface>(surfaces_.back().get()); 186 return ts->ReturnSuccess<EGLSurface>(surfaces_.back().get());
187 } 187 }
188 188
189 EGLSurface Display::CreateWindowSurface(ThreadState* ts, 189 EGLSurface Display::CreateWindowSurface(ThreadState* ts,
190 EGLConfig cfg, 190 EGLConfig cfg,
191 EGLNativeWindowType win, 191 EGLNativeWindowType win,
(...skipping 14 matching lines...) Expand all
206 return ts->ReturnError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE); 206 return ts->ReturnError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
207 if (next_create_window_surface_creates_pbuffer_) { 207 if (next_create_window_surface_creates_pbuffer_) {
208 EGLSurface result = DoCreatePbufferSurface(ts, config, 208 EGLSurface result = DoCreatePbufferSurface(ts, config,
209 window_surface_pbuffer_width_, 209 window_surface_pbuffer_width_,
210 window_surface_pbuffer_height_); 210 window_surface_pbuffer_height_);
211 next_create_window_surface_creates_pbuffer_ = false; 211 next_create_window_surface_creates_pbuffer_ = false;
212 window_surface_pbuffer_width_ = 0; 212 window_surface_pbuffer_width_ = 0;
213 window_surface_pbuffer_height_ = 0; 213 window_surface_pbuffer_height_ = 0;
214 return result; 214 return result;
215 } 215 }
216 scoped_refptr<gfx::GLSurface> gl_surface; 216 scoped_refptr<gl::GLSurface> gl_surface;
217 gl_surface = gl::init::CreateViewGLSurface(win); 217 gl_surface = gl::init::CreateViewGLSurface(win);
218 if (!gl_surface) 218 if (!gl_surface)
219 return ts->ReturnError(EGL_BAD_ALLOC, EGL_NO_SURFACE); 219 return ts->ReturnError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
220 surfaces_.emplace_back(new Surface(gl_surface.get(), config)); 220 surfaces_.emplace_back(new Surface(gl_surface.get(), config));
221 return ts->ReturnSuccess(surfaces_.back().get()); 221 return ts->ReturnSuccess(surfaces_.back().get());
222 } 222 }
223 223
224 EGLBoolean Display::DestroySurface(ThreadState* ts, EGLSurface sfe) { 224 EGLBoolean Display::DestroySurface(ThreadState* ts, EGLSurface sfe) {
225 base::AutoLock auto_lock(lock_); 225 base::AutoLock auto_lock(lock_);
226 if (!is_initialized_) 226 if (!is_initialized_)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 bool Display::IsFenceSyncFlushReceived(uint64_t release) { 361 bool Display::IsFenceSyncFlushReceived(uint64_t release) {
362 return IsFenceSyncRelease(release); 362 return IsFenceSyncRelease(release);
363 } 363 }
364 364
365 void Display::InitializeConfigsIfNeeded() { 365 void Display::InitializeConfigsIfNeeded() {
366 lock_.AssertAcquired(); 366 lock_.AssertAcquired();
367 if (!configs_[0]) { 367 if (!configs_[0]) {
368 // The interface offers separate configs for window and pbuffer. 368 // The interface offers separate configs for window and pbuffer.
369 // This way we can record the client intention at context creation time. 369 // This way we can record the client intention at context creation time.
370 // The GL implementation (gfx::GLContext and gfx::GLSurface) needs this 370 // The GL implementation (gl::GLContext and gl::GLSurface) needs this
371 // distinction when creating a context. 371 // distinction when creating a context.
372 configs_[0].reset(new Config(EGL_WINDOW_BIT)); 372 configs_[0].reset(new Config(EGL_WINDOW_BIT));
373 configs_[1].reset(new Config(EGL_PBUFFER_BIT)); 373 configs_[1].reset(new Config(EGL_PBUFFER_BIT));
374 } 374 }
375 } 375 }
376 376
377 const Config* Display::GetConfig(EGLConfig cfg) { 377 const Config* Display::GetConfig(EGLConfig cfg) {
378 lock_.AssertAcquired(); 378 lock_.AssertAcquired();
379 for (const auto& config : configs_) { 379 for (const auto& config : configs_) {
380 if (config.get() == cfg) 380 if (config.get() == cfg)
(...skipping 12 matching lines...) Expand all
393 393
394 Context* Display::GetContext(EGLContext context) { 394 Context* Display::GetContext(EGLContext context) {
395 lock_.AssertAcquired(); 395 lock_.AssertAcquired();
396 auto it = std::find(contexts_.begin(), contexts_.end(), context); 396 auto it = std::find(contexts_.begin(), contexts_.end(), context);
397 if (it == contexts_.end()) 397 if (it == contexts_.end())
398 return nullptr; 398 return nullptr;
399 return it->get(); 399 return it->get();
400 } 400 }
401 401
402 } // namespace egl 402 } // namespace egl
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/gles2_conform_support/egl/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698