Chromium Code Reviews| Index: ui/gfx/surface/accelerated_surface_mac.cc |
| =================================================================== |
| --- ui/gfx/surface/accelerated_surface_mac.cc (revision 111400) |
| +++ ui/gfx/surface/accelerated_surface_mac.cc (working copy) |
| @@ -87,9 +87,9 @@ |
| if (allocate_fbo_) { |
| // Bind and unbind the framebuffer to make changes to the |
| // IOSurface show up in the other process. |
| - glFlush(); |
| glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
| glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_); |
| + glFlush(); |
| } else { |
| // Copy the current framebuffer's contents into our "live" texture. |
| // Note that the current GL context might not be ours at this point! |
| @@ -146,16 +146,22 @@ |
| CFDictionaryAddValue(dictionary, key, number.get()); |
| } |
| +static GLuint CreateTexture(GLenum target) { |
|
stuartmorgan
2011/11/28 10:09:04
Needs a method-level comment (which should probabl
Ken Russell (switch to Gerrit)
2011/11/28 23:40:15
Done.
|
| + GLuint texture = 0; |
| + glGenTextures(1, &texture); |
| + glBindTexture(target, texture); |
| + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| + glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| + glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| + return texture; |
| +} |
| + |
| void AcceleratedSurface::AllocateRenderBuffers(GLenum target, |
| const gfx::Size& size) { |
| if (!texture_) { |
| // Generate the texture object. |
| - glGenTextures(1, &texture_); |
| - glBindTexture(target, texture_); |
| - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| - glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| - glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| + texture_ = CreateTexture(target); |
| // Generate and bind the framebuffer object. |
| glGenFramebuffersEXT(1, &fbo_); |
| glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_); |
| @@ -225,7 +231,7 @@ |
| glClear(GL_COLOR_BUFFER_BIT); |
| } |
| -uint64 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) { |
| +uint32 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) { |
| if (surface_size_ == size) { |
| // Return 0 to indicate to the caller that no new backing store |
| // allocation occurred. |
| @@ -255,12 +261,7 @@ |
| AllocateRenderBuffers(target, clamped_size); |
| } else if (!texture_) { |
| // Generate the texture object. |
| - glGenTextures(1, &texture_); |
| - glBindTexture(target, texture_); |
| - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| - glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| - glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| + texture_ = CreateTexture(target); |
| } |
| // Allocate a new IOSurface, which is the GPU resource that can be |
| @@ -315,7 +316,7 @@ |
| return io_surface_id_; |
| } |
| -uint64 AcceleratedSurface::GetSurfaceId() { |
| +uint32 AcceleratedSurface::GetSurfaceId() { |
| return io_surface_id_; |
| } |