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

Side by Side Diff: ui/gl/gl_surface_egl.cc

Issue 2673473002: Rename SwapBuffersWithDamage to SwapBuffersWithBounds (Closed)
Patch Set: fix windows compile warning Created 3 years, 10 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/gl_surface_egl.h ('k') | ui/gl/gl_switches.h » ('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 (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 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } 780 }
781 781
782 if (g_driver_egl.ext.b_EGL_NV_post_sub_buffer) { 782 if (g_driver_egl.ext.b_EGL_NV_post_sub_buffer) {
783 EGLint surfaceVal; 783 EGLint surfaceVal;
784 EGLBoolean retVal = eglQuerySurface( 784 EGLBoolean retVal = eglQuerySurface(
785 GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal); 785 GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal);
786 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; 786 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE;
787 } 787 }
788 788
789 supports_swap_buffer_with_damage_ = 789 supports_swap_buffer_with_damage_ =
790 g_driver_egl.ext.b_EGL_KHR_swap_buffers_with_damage && 790 g_driver_egl.ext.b_EGL_KHR_swap_buffers_with_damage;
791 base::CommandLine::ForCurrentProcess()->HasSwitch(
792 switches::kEnableSwapBuffersWithDamage);
793 791
794 if (sync_provider) 792 if (sync_provider)
795 vsync_provider_ = std::move(sync_provider); 793 vsync_provider_ = std::move(sync_provider);
796 else if (g_egl_sync_control_supported) 794 else if (g_egl_sync_control_supported)
797 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); 795 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_));
798 return true; 796 return true;
799 } 797 }
800 798
801 bool NativeViewGLSurfaceEGL::InitializeNativeWindow() { 799 bool NativeViewGLSurfaceEGL::InitializeNativeWindow() {
802 return true; 800 return true;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 LOG(ERROR) << "Failed to create surface."; 921 LOG(ERROR) << "Failed to create surface.";
924 return false; 922 return false;
925 } 923 }
926 return true; 924 return true;
927 } 925 }
928 926
929 EGLSurface NativeViewGLSurfaceEGL::GetHandle() { 927 EGLSurface NativeViewGLSurfaceEGL::GetHandle() {
930 return surface_; 928 return surface_;
931 } 929 }
932 930
933 bool NativeViewGLSurfaceEGL::SupportsSwapBuffersWithDamage() {
934 return supports_swap_buffer_with_damage_;
935 }
936
937 bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() { 931 bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() {
938 return supports_post_sub_buffer_; 932 return supports_post_sub_buffer_;
939 } 933 }
940 934
941 bool NativeViewGLSurfaceEGL::FlipsVertically() const { 935 bool NativeViewGLSurfaceEGL::FlipsVertically() const {
942 return flips_vertically_; 936 return flips_vertically_;
943 } 937 }
944 938
945 bool NativeViewGLSurfaceEGL::BuffersFlipped() const { 939 bool NativeViewGLSurfaceEGL::BuffersFlipped() const {
946 return g_use_direct_composition; 940 return g_use_direct_composition;
947 } 941 }
948 942
949 gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffersWithDamage(int x, 943 gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffersWithDamage(
950 int y, 944 const std::vector<int>& rects) {
951 int width,
952 int height) {
953 DCHECK(supports_swap_buffer_with_damage_); 945 DCHECK(supports_swap_buffer_with_damage_);
954 UpdateSwapInterval(); 946 UpdateSwapInterval();
955 if (!CommitAndClearPendingOverlays()) { 947 if (!CommitAndClearPendingOverlays()) {
956 DVLOG(1) << "Failed to commit pending overlay planes."; 948 DVLOG(1) << "Failed to commit pending overlay planes.";
957 return gfx::SwapResult::SWAP_FAILED; 949 return gfx::SwapResult::SWAP_FAILED;
958 } 950 }
959 if (flips_vertically_) {
960 // With EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE the contents are rendered
961 // inverted, but the damage rectangle is still measured from the
962 // bottom left.
963 y = GetSize().height() - y - height;
964 }
965 951
966 EGLint damage_rect[4] = {x, y, width, height}; 952 if (!eglSwapBuffersWithDamageKHR(GetDisplay(), surface_,
967 if (!eglSwapBuffersWithDamageKHR(GetDisplay(), surface_, damage_rect, 1)) { 953 const_cast<EGLint*>(rects.data()),
954 static_cast<EGLint>(rects.size() / 4))) {
968 DVLOG(1) << "eglSwapBuffersWithDamageKHR failed with error " 955 DVLOG(1) << "eglSwapBuffersWithDamageKHR failed with error "
969 << GetLastEGLErrorString(); 956 << GetLastEGLErrorString();
970 return gfx::SwapResult::SWAP_FAILED; 957 return gfx::SwapResult::SWAP_FAILED;
971 } 958 }
972 return gfx::SwapResult::SWAP_ACK; 959 return gfx::SwapResult::SWAP_ACK;
973 } 960 }
974 961
975 gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(int x, 962 gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(int x,
976 int y, 963 int y,
977 int width, 964 int width,
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1228 }
1242 1229
1243 void* SurfacelessEGL::GetShareHandle() { 1230 void* SurfacelessEGL::GetShareHandle() {
1244 return NULL; 1231 return NULL;
1245 } 1232 }
1246 1233
1247 SurfacelessEGL::~SurfacelessEGL() { 1234 SurfacelessEGL::~SurfacelessEGL() {
1248 } 1235 }
1249 1236
1250 } // namespace gl 1237 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698