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" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 422 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
423 GL_TEXTURE_2D, textures_[current_surface_], 0); | 423 GL_TEXTURE_2D, textures_[current_surface_], 0); |
424 } | 424 } |
425 | 425 |
426 bool CreatePixmaps() { | 426 bool CreatePixmaps() { |
427 if (!fbo_) | 427 if (!fbo_) |
428 return true; | 428 return true; |
429 for (size_t i = 0; i < arraysize(textures_); i++) { | 429 for (size_t i = 0; i < arraysize(textures_); i++) { |
430 scoped_refptr<ui::NativePixmap> pixmap = | 430 scoped_refptr<ui::NativePixmap> pixmap = |
431 ui::SurfaceFactoryOzone::GetInstance()->CreateNativePixmap( | 431 ui::SurfaceFactoryOzone::GetInstance()->CreateNativePixmap( |
432 widget_, GetSize(), ui::SurfaceFactoryOzone::RGBA_8888, | 432 widget_, GetSize(), ui::SurfaceFactoryOzone::BGRA_8888, |
433 ui::SurfaceFactoryOzone::SCANOUT); | 433 ui::SurfaceFactoryOzone::SCANOUT, nullptr); |
434 if (!pixmap) | 434 if (!pixmap) |
435 return false; | 435 return false; |
436 scoped_refptr<SurfaceImage> image = new SurfaceImage(GetSize(), GL_RGBA); | 436 scoped_refptr<SurfaceImage> image = |
| 437 new SurfaceImage(GetSize(), GL_BGRA_EXT); |
437 if (!image->Initialize(pixmap, gfx::GpuMemoryBuffer::Format::BGRA_8888)) | 438 if (!image->Initialize(pixmap, gfx::GpuMemoryBuffer::Format::BGRA_8888)) |
438 return false; | 439 return false; |
439 images_[i] = image; | 440 images_[i] = image; |
440 // Bind image to texture. | 441 // Bind image to texture. |
441 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 442 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
442 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 443 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
443 return false; | 444 return false; |
444 } | 445 } |
445 return true; | 446 return true; |
446 } | 447 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 NOTREACHED(); | 564 NOTREACHED(); |
564 return NULL; | 565 return NULL; |
565 } | 566 } |
566 } | 567 } |
567 | 568 |
568 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 569 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
569 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 570 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
570 } | 571 } |
571 | 572 |
572 } // namespace gfx | 573 } // namespace gfx |
OLD | NEW |