summaryrefslogtreecommitdiffstats
path: root/app/surface
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-05 18:07:26 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-05 18:07:26 +0000
commitebb090d01ffa509095e49d78f28574b8ed6cb669 (patch)
tree7d009277cc82c36cf206b3298a92005e1821d950 /app/surface
parent52d60bf31bf6243338d96d8c87158f3a3216c51e (diff)
downloadchromium_src-ebb090d01ffa509095e49d78f28574b8ed6cb669.zip
chromium_src-ebb090d01ffa509095e49d78f28574b8ed6cb669.tar.gz
chromium_src-ebb090d01ffa509095e49d78f28574b8ed6cb669.tar.bz2
Mac/gpu: Don't show uninitialized surfaces while resizing plugins / composited tabs.
BUG=53165 TEST=Go to http://webkit.org/blog/386/3d-transforms/. Resize window. Watch a youtube video click the "make bigger" button. No garbage should appear. There are still some funky artifacts at the top/right border during resizing caused by clamping the texture instead of filling with white, and sometimes (rarely) the tab flashes black/white but I'd like to tackle that in follow-up CLs. This is already much better than what's in the tree currently. Review URL: http://codereview.chromium.org/4101002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/surface')
-rw-r--r--app/surface/io_surface_support_mac.cc30
-rw-r--r--app/surface/io_surface_support_mac.h3
2 files changed, 33 insertions, 0 deletions
diff --git a/app/surface/io_surface_support_mac.cc b/app/surface/io_surface_support_mac.cc
index 3a2e814..154f895 100644
--- a/app/surface/io_surface_support_mac.cc
+++ b/app/surface/io_surface_support_mac.cc
@@ -12,6 +12,8 @@ typedef uint32 (*IOSurfaceGetIDProcPtr)(CFTypeRef io_surface);
typedef CFTypeRef (*IOSurfaceLookupProcPtr)(uint32 io_surface_id);
typedef mach_port_t (*IOSurfaceCreateMachPortProcPtr)(CFTypeRef io_surface);
typedef CFTypeRef (*IOSurfaceLookupFromMachPortProcPtr)(mach_port_t port);
+typedef size_t (*IOSurfaceGetWidthPtr)(CFTypeRef io_surface);
+typedef size_t (*IOSurfaceGetHeightPtr)(CFTypeRef io_surface);
typedef CGLError (*CGLTexImageIOSurface2DProcPtr)(CGLContextObj ctx,
GLenum target,
GLenum internal_format,
@@ -41,6 +43,9 @@ class IOSurfaceSupportImpl : public IOSurfaceSupport {
virtual mach_port_t IOSurfaceCreateMachPort(CFTypeRef io_surface);
virtual CFTypeRef IOSurfaceLookupFromMachPort(mach_port_t port);
+ virtual size_t IOSurfaceGetWidth(CFTypeRef io_surface);
+ virtual size_t IOSurfaceGetHeight(CFTypeRef io_surface);
+
virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx,
GLenum target,
GLenum internal_format,
@@ -66,6 +71,8 @@ class IOSurfaceSupportImpl : public IOSurfaceSupport {
IOSurfaceLookupProcPtr io_surface_lookup_;
IOSurfaceCreateMachPortProcPtr io_surface_create_mach_port_;
IOSurfaceLookupFromMachPortProcPtr io_surface_lookup_from_mach_port_;
+ IOSurfaceGetWidthPtr io_surface_get_width_;
+ IOSurfaceGetHeightPtr io_surface_get_height_;
CGLTexImageIOSurface2DProcPtr cgl_tex_image_io_surface_2d_;
bool initialized_successfully_;
@@ -120,6 +127,15 @@ CFTypeRef IOSurfaceSupportImpl::IOSurfaceLookupFromMachPort(mach_port_t port) {
return io_surface_lookup_from_mach_port_(port);
}
+size_t IOSurfaceSupportImpl::IOSurfaceGetWidth(CFTypeRef io_surface) {
+ return io_surface_get_width_(io_surface);
+}
+
+size_t IOSurfaceSupportImpl::IOSurfaceGetHeight(CFTypeRef io_surface) {
+ return io_surface_get_height_(io_surface);
+}
+
+
CGLError IOSurfaceSupportImpl::CGLTexImageIOSurface2D(CGLContextObj ctx,
GLenum target,
GLenum internal_format,
@@ -152,6 +168,8 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
io_surface_lookup_(NULL),
io_surface_create_mach_port_(NULL),
io_surface_lookup_from_mach_port_(NULL),
+ io_surface_get_width_(NULL),
+ io_surface_get_height_(NULL),
cgl_tex_image_io_surface_2d_(NULL),
initialized_successfully_(false) {
iosurface_handle_ = dlopen(
@@ -181,6 +199,10 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
dlsym(iosurface_handle_, "IOSurfaceCreateMachPort");
void* surface_lookup_from_mach_port_ptr =
dlsym(iosurface_handle_, "IOSurfaceLookupFromMachPort");
+ void* io_surface_get_width_ptr =
+ dlsym(iosurface_handle_, "IOSurfaceGetWidth");
+ void* io_surface_get_height_ptr =
+ dlsym(iosurface_handle_, "IOSurfaceGetHeight");
void* tex_image_io_surface_2d_ptr =
dlsym(opengl_handle_, "CGLTexImageIOSurface2D");
if (!surface_width_ptr ||
@@ -192,6 +214,8 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
!surface_lookup_ptr ||
!surface_create_mach_port_ptr ||
!surface_lookup_from_mach_port_ptr ||
+ !io_surface_get_width_ptr ||
+ !io_surface_get_height_ptr ||
!tex_image_io_surface_2d_ptr) {
dlclose(iosurface_handle_);
iosurface_handle_ = NULL;
@@ -217,6 +241,12 @@ IOSurfaceSupportImpl::IOSurfaceSupportImpl()
io_surface_lookup_from_mach_port_ =
reinterpret_cast<IOSurfaceLookupFromMachPortProcPtr>(
surface_lookup_from_mach_port_ptr);
+ io_surface_get_width_ =
+ reinterpret_cast<IOSurfaceGetWidthPtr>(
+ io_surface_get_width_ptr);
+ io_surface_get_height_ =
+ reinterpret_cast<IOSurfaceGetHeightPtr>(
+ io_surface_get_height_ptr);
cgl_tex_image_io_surface_2d_ =
reinterpret_cast<CGLTexImageIOSurface2DProcPtr>(
tex_image_io_surface_2d_ptr);
diff --git a/app/surface/io_surface_support_mac.h b/app/surface/io_surface_support_mac.h
index 10c09cf..82dccca 100644
--- a/app/surface/io_surface_support_mac.h
+++ b/app/surface/io_surface_support_mac.h
@@ -46,6 +46,9 @@ class IOSurfaceSupport {
virtual mach_port_t IOSurfaceCreateMachPort(CFTypeRef io_surface) = 0;
virtual CFTypeRef IOSurfaceLookupFromMachPort(mach_port_t port) = 0;
+ virtual size_t IOSurfaceGetWidth(CFTypeRef io_surface) = 0;
+ virtual size_t IOSurfaceGetHeight(CFTypeRef io_surface) = 0;
+
virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx,
GLenum target,
GLenum internal_format,