diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 00:00:40 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 00:00:40 +0000 |
commit | c758e0bef0a9c322efb2b9b505f05d019cbcb48d (patch) | |
tree | 731299b2483a1162fe6564cf21eea201ad543608 /webkit | |
parent | 8af9d0341d6c00ee537adc089f938b120d1d8d34 (diff) | |
download | chromium_src-c758e0bef0a9c322efb2b9b505f05d019cbcb48d.zip chromium_src-c758e0bef0a9c322efb2b9b505f05d019cbcb48d.tar.gz chromium_src-c758e0bef0a9c322efb2b9b505f05d019cbcb48d.tar.bz2 |
Fixed clipping of GPU plugin instances on Mac OS X against the browser
window's scrollbars, etc.
BUG=none
TEST=none (ran Pepper test plugin, resized and scrolled window)
Review URL: http://codereview.chromium.org/595011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/mac_gpu_plugin_container.cc | 27 | ||||
-rw-r--r-- | webkit/glue/plugins/mac_gpu_plugin_container.h | 6 |
2 files changed, 20 insertions, 13 deletions
diff --git a/webkit/glue/plugins/mac_gpu_plugin_container.cc b/webkit/glue/plugins/mac_gpu_plugin_container.cc index e38234f..f6cff17 100644 --- a/webkit/glue/plugins/mac_gpu_plugin_container.cc +++ b/webkit/glue/plugins/mac_gpu_plugin_container.cc @@ -46,10 +46,10 @@ void MacGPUPluginContainer::SetSizeAndBackingStore( void MacGPUPluginContainer::MoveTo( const webkit_glue::WebPluginGeometry& geom) { - // TODO(kbr): figure out whether additional information is necessary - // to keep around. x_ = geom.window_rect.x(); y_ = geom.window_rect.y(); + // TODO(kbr): may need to pay attention to cutout rects. + clipRect_ = geom.clip_rect; } void MacGPUPluginContainer::Draw(CGLContextObj context) { @@ -81,16 +81,21 @@ void MacGPUPluginContainer::Draw(CGLContextObj context) { glBindTexture(target, texture_); glEnable(target); glBegin(GL_TRIANGLE_STRIP); - int x = x_; - int y = y_; - glTexCoord2f(0, height_); + // TODO(kbr): may need to pay attention to cutout rects. + int clipX = clipRect_.x(); + int clipY = clipRect_.y(); + int clipWidth = clipRect_.width(); + int clipHeight = clipRect_.height(); + int x = x_ + clipX; + int y = y_ + clipY; + glTexCoord2f(clipX, height_ - clipY); glVertex3f(x, y, 0); - glTexCoord2f(width_, height_); - glVertex3f(x + width_, y, 0); - glTexCoord2f(0, 0); - glVertex3f(x, y + height_, 0); - glTexCoord2f(width_, 0); - glVertex3f(x + width_, y + height_, 0); + glTexCoord2f(clipX + clipWidth, height_ - clipY); + glVertex3f(x + clipWidth, y, 0); + glTexCoord2f(clipX, height_ - clipY - clipHeight); + glVertex3f(x, y + clipHeight, 0); + glTexCoord2f(clipX + clipWidth, height_ - clipY - clipHeight); + glVertex3f(x + clipWidth, y + clipHeight, 0); glDisable(target); glEnd(); } diff --git a/webkit/glue/plugins/mac_gpu_plugin_container.h b/webkit/glue/plugins/mac_gpu_plugin_container.h index 92e9fcb..9b2c91f 100644 --- a/webkit/glue/plugins/mac_gpu_plugin_container.h +++ b/webkit/glue/plugins/mac_gpu_plugin_container.h @@ -30,6 +30,7 @@ #include "app/gfx/native_widget_types.h" #include "base/basictypes.h" +#include "base/gfx/rect.h" namespace webkit_glue { struct WebPluginGeometry; @@ -67,8 +68,6 @@ class MacGPUPluginContainer { // will work on Leopard. // The x and y coordinates of the plugin window on the web page. - // TODO(kbr): see whether additional clipping information is - // necessary. int x_; int y_; @@ -84,6 +83,9 @@ class MacGPUPluginContainer { int32 width_; int32 height_; + // The clip rectangle, relative to the (x_, y_) origin. + gfx::Rect clipRect_; + // The "live" OpenGL texture referring to this IOSurfaceRef. Note // that per the CGLTexImageIOSurface2D API we do not need to // explicitly update this texture's contents once created. All we |