summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/compositor_layer_resource.cc
diff options
context:
space:
mode:
authorpenghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 21:30:16 +0000
committerpenghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 21:30:16 +0000
commit748e647a09bf44eb993022f31495efd5b58e7d3d (patch)
tree1e6eff45da50fab026a4a6b1ffd33803cd399ad2 /ppapi/proxy/compositor_layer_resource.cc
parent032ed0d7869d3ad0569a2024eaa4946864cc7f9d (diff)
downloadchromium_src-748e647a09bf44eb993022f31495efd5b58e7d3d.zip
chromium_src-748e647a09bf44eb993022f31495efd5b58e7d3d.tar.gz
chromium_src-748e647a09bf44eb993022f31495efd5b58e7d3d.tar.bz2
[PPAPI] Add target param for CompositorLayer::SetTexture().
BUG=403504 Review URL: https://codereview.chromium.org/475123003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/compositor_layer_resource.cc')
-rw-r--r--ppapi/proxy/compositor_layer_resource.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/ppapi/proxy/compositor_layer_resource.cc b/ppapi/proxy/compositor_layer_resource.cc
index 17bc7b2..09a63b1 100644
--- a/ppapi/proxy/compositor_layer_resource.cc
+++ b/ppapi/proxy/compositor_layer_resource.cc
@@ -5,6 +5,7 @@
#include "ppapi/proxy/compositor_layer_resource.h"
#include "base/logging.h"
+#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "ppapi/proxy/compositor_resource.h"
@@ -121,8 +122,17 @@ int32_t CompositorLayerResource::SetColor(float red,
return PP_OK;
}
+int32_t CompositorLayerResource::SetTexture0_1(
+ PP_Resource context,
+ uint32_t texture,
+ const PP_Size* size,
+ const scoped_refptr<TrackedCallback>& release_callback) {
+ return SetTexture(context, GL_TEXTURE_2D, texture, size, release_callback);
+}
+
int32_t CompositorLayerResource::SetTexture(
PP_Resource context,
+ uint32_t target,
uint32_t texture,
const PP_Size* size,
const scoped_refptr<TrackedCallback>& release_callback) {
@@ -135,6 +145,12 @@ int32_t CompositorLayerResource::SetTexture(
if (enter.failed())
return PP_ERROR_BADRESOURCE;
+ if (target != GL_TEXTURE_2D &&
+ target != GL_TEXTURE_EXTERNAL_OES &&
+ target != GL_TEXTURE_RECTANGLE_ARB) {
+ return PP_ERROR_BADARGUMENT;
+ }
+
if (!size || size->width <= 0 || size->height <= 0)
return PP_ERROR_BADARGUMENT;
@@ -147,7 +163,7 @@ int32_t CompositorLayerResource::SetTexture(
gl->GenMailboxCHROMIUM(
reinterpret_cast<GLbyte*>(data_.texture->mailbox.name));
gl->ProduceTextureDirectCHROMIUM(
- texture, GL_TEXTURE_2D,
+ texture, target,
reinterpret_cast<const GLbyte*>(data_.texture->mailbox.name));
// Set the source size to (1, 1). It will be used to verify the source_rect
@@ -156,6 +172,7 @@ int32_t CompositorLayerResource::SetTexture(
data_.common.size = *size;
data_.common.resource_id = compositor_->GenerateResourceId();
+ data_.texture->target = target;
data_.texture->sync_point = gl->InsertSyncPointCHROMIUM();
data_.texture->source_rect.point = PP_MakeFloatPoint(0.0f, 0.0f);
data_.texture->source_rect.size = source_size_;