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

Side by Side Diff: ui/gl/init/gl_surface_ozone.cc

Issue 2102443003: Break //ui/gl/ dependency on //ui/ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_bindings
Patch Set: Rebase again. Created 4 years, 5 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 | « ui/gl/init/gl_init.gyp ('k') | ui/gl/test/DEPS » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/gl/init/gl_surface_ozone.h" 5 #include "ui/gl/init/gl_surface_ozone.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/worker_pool.h" 18 #include "base/threading/worker_pool.h"
19 #include "ui/gl/egl_util.h" 19 #include "ui/gl/egl_util.h"
20 #include "ui/gl/gl_context.h" 20 #include "ui/gl/gl_context.h"
21 #include "ui/gl/gl_image.h" 21 #include "ui/gl/gl_image.h"
22 #include "ui/gl/gl_image_ozone_native_pixmap.h"
23 #include "ui/gl/gl_implementation.h" 22 #include "ui/gl/gl_implementation.h"
24 #include "ui/gl/gl_surface_egl.h" 23 #include "ui/gl/gl_surface_egl.h"
25 #include "ui/gl/gl_surface_osmesa.h" 24 #include "ui/gl/gl_surface_osmesa.h"
26 #include "ui/gl/gl_surface_overlay.h" 25 #include "ui/gl/gl_surface_overlay.h"
27 #include "ui/gl/gl_surface_stub.h" 26 #include "ui/gl/gl_surface_stub.h"
28 #include "ui/gl/scoped_binders.h" 27 #include "ui/gl/scoped_binders.h"
29 #include "ui/gl/scoped_make_current.h" 28 #include "ui/gl/scoped_make_current.h"
29 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
30 #include "ui/ozone/public/native_pixmap.h" 30 #include "ui/ozone/public/native_pixmap.h"
31 #include "ui/ozone/public/ozone_platform.h" 31 #include "ui/ozone/public/ozone_platform.h"
32 #include "ui/ozone/public/surface_factory_ozone.h" 32 #include "ui/ozone/public/surface_factory_ozone.h"
33 #include "ui/ozone/public/surface_ozone_egl.h" 33 #include "ui/ozone/public/surface_ozone_egl.h"
34 34
35 namespace gl { 35 namespace gl {
36 36
37 namespace { 37 namespace {
38 38
39 // Helper function for base::Bind to create callback to eglChooseConfig. 39 // Helper function for base::Bind to create callback to eglChooseConfig.
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 return true; 643 return true;
644 for (size_t i = 0; i < arraysize(textures_); i++) { 644 for (size_t i = 0; i < arraysize(textures_); i++) {
645 scoped_refptr<ui::NativePixmap> pixmap = 645 scoped_refptr<ui::NativePixmap> pixmap =
646 ui::OzonePlatform::GetInstance() 646 ui::OzonePlatform::GetInstance()
647 ->GetSurfaceFactoryOzone() 647 ->GetSurfaceFactoryOzone()
648 ->CreateNativePixmap(widget_, GetSize(), 648 ->CreateNativePixmap(widget_, GetSize(),
649 gfx::BufferFormat::BGRA_8888, 649 gfx::BufferFormat::BGRA_8888,
650 gfx::BufferUsage::SCANOUT); 650 gfx::BufferUsage::SCANOUT);
651 if (!pixmap) 651 if (!pixmap)
652 return false; 652 return false;
653 scoped_refptr<GLImageOzoneNativePixmap> image = 653 scoped_refptr<ui::GLImageOzoneNativePixmap> image =
654 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); 654 new ui::GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT);
655 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) 655 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888))
656 return false; 656 return false;
657 // Image must have Destroy() called before destruction. 657 // Image must have Destroy() called before destruction.
658 if (images_[i]) 658 if (images_[i])
659 images_[i]->Destroy(true); 659 images_[i]->Destroy(true);
660 images_[i] = image; 660 images_[i] = image;
661 // Bind image to texture. 661 // Bind image to texture.
662 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); 662 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]);
663 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) 663 if (!images_[i]->BindTexImage(GL_TEXTURE_2D))
664 return false; 664 return false;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 ui::OzonePlatform::GetInstance() 698 ui::OzonePlatform::GetInstance()
699 ->GetSurfaceFactoryOzone() 699 ->GetSurfaceFactoryOzone()
700 ->CreateSurfacelessEGLSurfaceForWidget(window); 700 ->CreateSurfacelessEGLSurfaceForWidget(window);
701 if (!surface_ozone) 701 if (!surface_ozone)
702 return nullptr; 702 return nullptr;
703 return InitializeGLSurface(new GLSurfaceOzoneSurfacelessSurfaceImpl( 703 return InitializeGLSurface(new GLSurfaceOzoneSurfacelessSurfaceImpl(
704 std::move(surface_ozone), window)); 704 std::move(surface_ozone), window));
705 } 705 }
706 706
707 } // namespace gl 707 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_init.gyp ('k') | ui/gl/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698