OLD | NEW |
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 "ui/gl/gl_surface_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
6 | 6 |
7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) || | 665 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) || |
666 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) { | 666 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) { |
667 NOTREACHED() << "eglQuerySurface failed with error " | 667 NOTREACHED() << "eglQuerySurface failed with error " |
668 << GetLastEGLErrorString(); | 668 << GetLastEGLErrorString(); |
669 return gfx::Size(); | 669 return gfx::Size(); |
670 } | 670 } |
671 | 671 |
672 return gfx::Size(width, height); | 672 return gfx::Size(width, height); |
673 } | 673 } |
674 | 674 |
675 bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) { | 675 bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size, float scale_factor) { |
676 if (size == GetSize()) | 676 if (size == GetSize()) |
677 return true; | 677 return true; |
678 | 678 |
679 size_ = size; | 679 size_ = size; |
680 | 680 |
681 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 681 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
682 GLContext* current_context = GLContext::GetCurrent(); | 682 GLContext* current_context = GLContext::GetCurrent(); |
683 bool was_current = | 683 bool was_current = |
684 current_context && current_context->IsCurrent(this); | 684 current_context && current_context->IsCurrent(this); |
685 if (was_current) { | 685 if (was_current) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 gfx::SwapResult PbufferGLSurfaceEGL::SwapBuffers() { | 809 gfx::SwapResult PbufferGLSurfaceEGL::SwapBuffers() { |
810 NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL."; | 810 NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL."; |
811 return gfx::SwapResult::SWAP_FAILED; | 811 return gfx::SwapResult::SWAP_FAILED; |
812 } | 812 } |
813 | 813 |
814 gfx::Size PbufferGLSurfaceEGL::GetSize() { | 814 gfx::Size PbufferGLSurfaceEGL::GetSize() { |
815 return size_; | 815 return size_; |
816 } | 816 } |
817 | 817 |
818 bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) { | 818 bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size, float scale_factor) { |
819 if (size == size_) | 819 if (size == size_) |
820 return true; | 820 return true; |
821 | 821 |
822 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 822 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
823 GLContext* current_context = GLContext::GetCurrent(); | 823 GLContext* current_context = GLContext::GetCurrent(); |
824 bool was_current = | 824 bool was_current = |
825 current_context && current_context->IsCurrent(this); | 825 current_context && current_context->IsCurrent(this); |
826 if (was_current) { | 826 if (was_current) { |
827 scoped_make_current.reset( | 827 scoped_make_current.reset( |
828 new ui::ScopedMakeCurrent(current_context, this)); | 828 new ui::ScopedMakeCurrent(current_context, this)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 894 |
895 gfx::SwapResult SurfacelessEGL::SwapBuffers() { | 895 gfx::SwapResult SurfacelessEGL::SwapBuffers() { |
896 LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL."; | 896 LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL."; |
897 return gfx::SwapResult::SWAP_FAILED; | 897 return gfx::SwapResult::SWAP_FAILED; |
898 } | 898 } |
899 | 899 |
900 gfx::Size SurfacelessEGL::GetSize() { | 900 gfx::Size SurfacelessEGL::GetSize() { |
901 return size_; | 901 return size_; |
902 } | 902 } |
903 | 903 |
904 bool SurfacelessEGL::Resize(const gfx::Size& size) { | 904 bool SurfacelessEGL::Resize(const gfx::Size& size, float scale_factor) { |
905 size_ = size; | 905 size_ = size; |
906 return true; | 906 return true; |
907 } | 907 } |
908 | 908 |
909 EGLSurface SurfacelessEGL::GetHandle() { | 909 EGLSurface SurfacelessEGL::GetHandle() { |
910 return EGL_NO_SURFACE; | 910 return EGL_NO_SURFACE; |
911 } | 911 } |
912 | 912 |
913 void* SurfacelessEGL::GetShareHandle() { | 913 void* SurfacelessEGL::GetShareHandle() { |
914 return NULL; | 914 return NULL; |
915 } | 915 } |
916 | 916 |
917 SurfacelessEGL::~SurfacelessEGL() { | 917 SurfacelessEGL::~SurfacelessEGL() { |
918 } | 918 } |
919 | 919 |
920 } // namespace gfx | 920 } // namespace gfx |
OLD | NEW |