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

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10827052: Extract Scoped{FrameBuffer,Texture}Binder and clean up TFP in VAVDA. (Closed) Base URL: https://git.chromium.org/git/chromium/src@master
Patch Set: Created 8 years, 5 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
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/texture_image_transport_surface.cc
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index f118eaa4cbae6c6e033f8d87145069a3f043e0b4..e4db746c1ad613e5e330e0591cc615303b942485 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/command_line.h"
+#include "content/common/gpu/gl_scoped_binders.h"
#include "content/common/gpu/gpu_channel.h"
#include "content/common/gpu/gpu_channel_manager.h"
#include "content/common/gpu/gpu_messages.h"
@@ -21,40 +22,6 @@ using gpu::gles2::ContextGroup;
using gpu::gles2::TextureManager;
typedef TextureManager::TextureInfo TextureInfo;
-namespace {
-
-class ScopedFrameBufferBinder {
- public:
- explicit ScopedFrameBufferBinder(unsigned int fbo) {
- glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo_);
- glBindFramebufferEXT(GL_FRAMEBUFFER, fbo);
- }
-
- ~ScopedFrameBufferBinder() {
- glBindFramebufferEXT(GL_FRAMEBUFFER, old_fbo_);
- }
-
- private:
- int old_fbo_;
-};
-
-class ScopedTextureBinder {
- public:
- explicit ScopedTextureBinder(unsigned int id) {
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_id_);
- glBindTexture(GL_TEXTURE_2D, id);
- }
-
- ~ScopedTextureBinder() {
- glBindTexture(GL_TEXTURE_2D, old_id_);
- }
-
- private:
- int old_id_;
-};
-
-} // anonymous namespace
-
TextureImageTransportSurface::Texture::Texture()
: client_id(0),
sent_to_client(false) {
@@ -288,13 +255,13 @@ bool TextureImageTransportSurface::PostSubBuffer(
std::vector<gfx::Rect> regions_to_copy;
GetRegionsToCopy(previous_damage_rect_, new_damage_rect, &regions_to_copy);
- ScopedFrameBufferBinder fbo_binder(fbo_id_);
+ content::ScopedFrameBufferBinder fbo_binder(fbo_id_);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
front_texture_service_id,
0);
- ScopedTextureBinder texture_binder(back_texture_service_id);
+ content::ScopedTextureBinder texture_binder(back_texture_service_id);
for (size_t i = 0; i < regions_to_copy.size(); ++i) {
const gfx::Rect& region_to_copy = regions_to_copy[i];
@@ -392,7 +359,7 @@ void TextureImageTransportSurface::ReleaseBackTexture() {
info->SetServiceId(0);
{
- ScopedFrameBufferBinder fbo_binder(fbo_id_);
+ content::ScopedFrameBufferBinder fbo_binder(fbo_id_);
glDeleteTextures(1, &service_id);
}
glFlush();
@@ -435,7 +402,7 @@ void TextureImageTransportSurface::CreateBackTexture(const gfx::Size& size) {
}
{
- ScopedTextureBinder texture_binder(service_id);
+ content::ScopedTextureBinder texture_binder(service_id);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -461,7 +428,7 @@ void TextureImageTransportSurface::AttachBackTextureToFBO() {
return;
DCHECK(textures_[back()].info);
- ScopedFrameBufferBinder fbo_binder(fbo_id_);
+ content::ScopedFrameBufferBinder fbo_binder(fbo_id_);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698