| Index: ui/gl/gl_image_surface_texture.cc
|
| diff --git a/ui/gl/gl_image_surface_texture.cc b/ui/gl/gl_image_surface_texture.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..84feb8c6b931c9a34e3da15e04fdbf8b43649c39
|
| --- /dev/null
|
| +++ b/ui/gl/gl_image_surface_texture.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/gl/gl_image_surface_texture.h"
|
| +
|
| +#include "base/debug/trace_event.h"
|
| +#include "base/process/process_handle.h"
|
| +#include "ui/gl/gl_bindings.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +GLImageSurfaceTexture::GLImageSurfaceTexture(gfx::Size size) : size_(size) {}
|
| +
|
| +GLImageSurfaceTexture::~GLImageSurfaceTexture() {
|
| + if (texture_id_)
|
| + glDeleteTextures(1, &texture_id_);
|
| + Destroy();
|
| +}
|
| +
|
| +bool GLImageSurfaceTexture::Initialize(gfx::GpuMemoryBufferHandle buffer) {
|
| + gfx::SurfaceTexture* surface_texture =
|
| + reinterpret_cast<gfx::SurfaceTexture*>(buffer.surface_texture_handle);
|
| + surface_texture_ = surface_texture;
|
| + texture_id_ = buffer.texture_id;
|
| + surface_texture->Release();
|
| + return true;
|
| +}
|
| +
|
| +void GLImageSurfaceTexture::Destroy() {}
|
| +
|
| +gfx::Size GLImageSurfaceTexture::GetSize() { return size_; }
|
| +
|
| +bool GLImageSurfaceTexture::BindTexImage(unsigned target) {
|
| + TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage");
|
| + return true;
|
| +}
|
| +
|
| +void GLImageSurfaceTexture::ReleaseTexImage(unsigned target) {}
|
| +
|
| +void GLImageSurfaceTexture::WillUseTexImage() {
|
| + surface_texture_->UpdateTexImage();
|
| +}
|
| +
|
| +void GLImageSurfaceTexture::DidUseTexImage() {}
|
| +
|
| +void GLImageSurfaceTexture::SetReleaseAfterUse() {}
|
| +} // namespace gfx
|
|
|