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

Unified Diff: ui/gfx/surface/accelerated_surface_mac.cc

Issue 8678037: Render Core Animation plugins through WebKit's compositor rather than (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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: 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,24 @@
CFDictionaryAddValue(dictionary, key, number.get());
}
+// Creates a new OpenGL texture object bound to the given texture target.
+// Caller owns the returned texture.
+static GLuint CreateTexture(GLenum target) {
+ 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 +233,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 +263,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 +318,7 @@
return io_surface_id_;
}
-uint64 AcceleratedSurface::GetSurfaceId() {
+uint32 AcceleratedSurface::GetSurfaceId() {
return io_surface_id_;
}

Powered by Google App Engine
This is Rietveld 408576698