OLD | NEW |
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/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 15 #include "content/common/generic_shared_memory_id_generator.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gl/gl_context.h" | 17 #include "ui/gl/gl_context.h" |
17 #include "ui/gl/gl_image.h" | 18 #include "ui/gl/gl_image.h" |
18 #include "ui/gl/gl_image_ozone_native_pixmap.h" | 19 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
19 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
20 #include "ui/gl/gl_surface_egl.h" | 21 #include "ui/gl/gl_surface_egl.h" |
21 #include "ui/gl/gl_surface_osmesa.h" | 22 #include "ui/gl/gl_surface_osmesa.h" |
22 #include "ui/gl/gl_surface_stub.h" | 23 #include "ui/gl/gl_surface_stub.h" |
23 #include "ui/gl/scoped_binders.h" | 24 #include "ui/gl/scoped_binders.h" |
24 #include "ui/gl/scoped_make_current.h" | 25 #include "ui/gl/scoped_make_current.h" |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 scoped_refptr<ui::NativePixmap> pixmap = | 547 scoped_refptr<ui::NativePixmap> pixmap = |
547 ui::OzonePlatform::GetInstance() | 548 ui::OzonePlatform::GetInstance() |
548 ->GetSurfaceFactoryOzone() | 549 ->GetSurfaceFactoryOzone() |
549 ->CreateNativePixmap(widget_, GetSize(), | 550 ->CreateNativePixmap(widget_, GetSize(), |
550 gfx::BufferFormat::BGRA_8888, | 551 gfx::BufferFormat::BGRA_8888, |
551 gfx::BufferUsage::SCANOUT); | 552 gfx::BufferUsage::SCANOUT); |
552 if (!pixmap) | 553 if (!pixmap) |
553 return false; | 554 return false; |
554 scoped_refptr<GLImageOzoneNativePixmap> image = | 555 scoped_refptr<GLImageOzoneNativePixmap> image = |
555 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); | 556 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); |
556 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) | 557 if (GetNextGenericSharedMemoryId(), |
| 558 !image->Initialize(pixmap.get(), |
| 559 gfx::GpuMemoryBuffer::Format::BGRA_8888)) |
557 return false; | 560 return false; |
558 images_[i] = image; | 561 images_[i] = image; |
559 // Bind image to texture. | 562 // Bind image to texture. |
560 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 563 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
561 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 564 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
562 return false; | 565 return false; |
563 } | 566 } |
564 return true; | 567 return true; |
565 } | 568 } |
566 | 569 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 688 } |
686 } | 689 } |
687 | 690 |
688 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 691 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
689 return ui::OzonePlatform::GetInstance() | 692 return ui::OzonePlatform::GetInstance() |
690 ->GetSurfaceFactoryOzone() | 693 ->GetSurfaceFactoryOzone() |
691 ->GetNativeDisplay(); | 694 ->GetNativeDisplay(); |
692 } | 695 } |
693 | 696 |
694 } // namespace gfx | 697 } // namespace gfx |
OLD | NEW |