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

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: GYP 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
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return true; 629 return true;
630 for (size_t i = 0; i < arraysize(textures_); i++) { 630 for (size_t i = 0; i < arraysize(textures_); i++) {
631 scoped_refptr<ui::NativePixmap> pixmap = 631 scoped_refptr<ui::NativePixmap> pixmap =
632 ui::OzonePlatform::GetInstance() 632 ui::OzonePlatform::GetInstance()
633 ->GetSurfaceFactoryOzone() 633 ->GetSurfaceFactoryOzone()
634 ->CreateNativePixmap(widget_, GetSize(), 634 ->CreateNativePixmap(widget_, GetSize(),
635 gfx::BufferFormat::BGRA_8888, 635 gfx::BufferFormat::BGRA_8888,
636 gfx::BufferUsage::SCANOUT); 636 gfx::BufferUsage::SCANOUT);
637 if (!pixmap) 637 if (!pixmap)
638 return false; 638 return false;
639 scoped_refptr<GLImageOzoneNativePixmap> image = 639 scoped_refptr<ui::GLImageOzoneNativePixmap> image =
640 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); 640 new ui::GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT);
641 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) 641 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888))
642 return false; 642 return false;
643 // Image must have Destroy() called before destruction. 643 // Image must have Destroy() called before destruction.
644 if (images_[i]) 644 if (images_[i])
645 images_[i]->Destroy(true); 645 images_[i]->Destroy(true);
646 images_[i] = image; 646 images_[i] = image;
647 // Bind image to texture. 647 // Bind image to texture.
648 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); 648 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]);
649 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) 649 if (!images_[i]->BindTexImage(GL_TEXTURE_2D))
650 return false; 650 return false;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 ui::OzonePlatform::GetInstance() 684 ui::OzonePlatform::GetInstance()
685 ->GetSurfaceFactoryOzone() 685 ->GetSurfaceFactoryOzone()
686 ->CreateSurfacelessEGLSurfaceForWidget(window); 686 ->CreateSurfacelessEGLSurfaceForWidget(window);
687 if (!surface_ozone) 687 if (!surface_ozone)
688 return nullptr; 688 return nullptr;
689 return InitializeGLSurface(new GLSurfaceOzoneSurfacelessSurfaceImpl( 689 return InitializeGLSurface(new GLSurfaceOzoneSurfacelessSurfaceImpl(
690 std::move(surface_ozone), window)); 690 std::move(surface_ozone), window));
691 } 691 }
692 692
693 } // namespace gl 693 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698