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

Unified Diff: chrome/browser/renderer_host/accelerated_surface_container_mac.cc

Issue 1166002: Fix handling of Mac accelerated plugin layers across tab switch. (Closed)
Patch Set: Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/accelerated_surface_container_mac.cc
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_mac.cc b/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
index 66e8b4c0fb5d2a6a3bfeee6b119bd358e29c40ee..d0d6d5972e14d95ee5404e79d9d615f24ad82fd4 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
+++ b/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
@@ -15,7 +15,8 @@ AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac()
surface_(NULL),
width_(0),
height_(0),
- texture_(0) {
+ texture_(0),
+ texture_needs_upload_(true) {
}
AcceleratedSurfaceContainerMac::~AcceleratedSurfaceContainerMac() {
@@ -77,22 +78,7 @@ void AcceleratedSurfaceContainerMac::Draw(CGLContextObj context) {
glBindTexture(target, texture_);
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- // When using an IOSurface, the texture does not need to be repeatedly
- // uploaded, so bind the IOSurface once during texture gen in this case.
- if (io_surface_support) {
- DCHECK(surface_);
- // Don't think we need to identify a plane.
- GLuint plane = 0;
- io_surface_support->CGLTexImageIOSurface2D(context,
- target,
- GL_RGBA,
- width_,
- height_,
- GL_BGRA,
- GL_UNSIGNED_INT_8_8_8_8_REV,
- surface_,
- plane);
- } else {
+ if (!io_surface_support) {
// Reserve space on the card for the actual texture upload, done with the
// glTexSubImage2D() call, below.
glTexImage2D(target,
@@ -107,6 +93,24 @@ void AcceleratedSurfaceContainerMac::Draw(CGLContextObj context) {
}
}
+ // When using an IOSurface, the texture does not need to be repeatedly
+ // uploaded, just when we've been told we have to.
+ if (io_surface_support && texture_needs_upload_) {
+ DCHECK(surface_);
+ glBindTexture(target, texture_);
+ // Don't think we need to identify a plane.
+ GLuint plane = 0;
+ io_surface_support->CGLTexImageIOSurface2D(context,
+ target,
+ GL_RGBA,
+ width_,
+ height_,
+ GL_BGRA,
+ GL_UNSIGNED_INT_8_8_8_8_REV,
+ surface_,
+ plane);
+ texture_needs_upload_ = false;
+ }
// If using TransportDIBs, the texture needs to be uploaded every frame.
if (transport_dib_.get() != NULL) {
void* pixel_memory = transport_dib_->memory();

Powered by Google App Engine
This is Rietveld 408576698