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

Unified Diff: media/renderers/skcanvas_video_renderer.cc

Issue 1508903002: Use GrGLTextureInfo for Skia texture handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ignore_gl_target
Patch Set: update assertions Created 5 years 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 | « cc/resources/resource_provider.cc ('k') | skia/config/SkUserConfig.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/skcanvas_video_renderer.cc
diff --git a/media/renderers/skcanvas_video_renderer.cc b/media/renderers/skcanvas_video_renderer.cc
index ec093da0a70feb3702507e4f1831e50cb616fa17..d35a61d2ffb9066f316457a0b8e8c41d0e603538 100644
--- a/media/renderers/skcanvas_video_renderer.cc
+++ b/media/renderers/skcanvas_video_renderer.cc
@@ -21,6 +21,7 @@
#include "third_party/skia/include/gpu/GrTexture.h"
#include "third_party/skia/include/gpu/GrTextureProvider.h"
#include "third_party/skia/include/gpu/SkGr.h"
+#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/skia_util.h"
@@ -94,7 +95,7 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
gfx::Size uv_tex_size((ya_tex_size.width() + 1) / 2,
(ya_tex_size.height() + 1) / 2);
- unsigned source_textures[3] = {0};
+ GrGLTextureInfo source_textures[] = {{0, 0}, {0, 0}, {0, 0}};
for (size_t i = 0; i < media::VideoFrame::NumPlanes(video_frame->format());
++i) {
// Get the texture from the mailbox and wrap it in a GrTexture.
@@ -103,7 +104,7 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES ||
mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB);
gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
- source_textures[i] = gl->CreateAndConsumeTextureCHROMIUM(
+ source_textures[i].fID = gl->CreateAndConsumeTextureCHROMIUM(
mailbox_holder.texture_target, mailbox_holder.mailbox.name);
// TODO(dcastagna): avoid this copy once Skia supports native textures
@@ -114,22 +115,25 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
gl->GenTextures(1, &texture_copy);
DCHECK(texture_copy);
gl->BindTexture(GL_TEXTURE_2D, texture_copy);
- gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_textures[i], texture_copy,
- GL_RGB, GL_UNSIGNED_BYTE, false, true, false);
+ gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_textures[i].fID,
+ texture_copy, GL_RGB, GL_UNSIGNED_BYTE, false,
+ true, false);
- gl->DeleteTextures(1, &source_textures[i]);
- source_textures[i] = texture_copy;
+ gl->DeleteTextures(1, &source_textures[i].fID);
+ source_textures[i].fID = texture_copy;
+ source_textures[i].fTarget = GL_TEXTURE_2D;
}
}
- DCHECK_LE(source_textures[0],
+ DCHECK_LE(source_textures[0].fID,
Daniele Castagna 2015/12/16 17:25:51 We can get rid of these DCHECKs since fID is unsig
bsalomon 2015/12/16 18:09:02 Done.
static_cast<unsigned>(std::numeric_limits<int>::max()));
- DCHECK_LE(source_textures[1],
+ DCHECK_LE(source_textures[1].fID,
static_cast<unsigned>(std::numeric_limits<int>::max()));
- DCHECK_LE(source_textures[2],
+ DCHECK_LE(source_textures[2].fID,
static_cast<unsigned>(std::numeric_limits<int>::max()));
- GrBackendObject handles[3] = {static_cast<int>(source_textures[0]),
- static_cast<int>(source_textures[1]),
- static_cast<int>(source_textures[2])};
+ GrBackendObject handles[3] = {
+ reinterpret_cast<GrBackendObject>(&source_textures[0]),
+ reinterpret_cast<GrBackendObject>(&source_textures[1]),
+ reinterpret_cast<GrBackendObject>(&source_textures[2])};
SkISize yuvSizes[] = {
{ya_tex_size.width(), ya_tex_size.height()},
@@ -146,7 +150,10 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
SkImage* img = SkImage::NewFromYUVTexturesCopy(context_3d.gr_context,
color_space, handles, yuvSizes,
Daniele Castagna 2015/12/16 17:25:51 Can't we just have NewFromYUVTexturesCopy take a G
bsalomon 2015/12/16 18:09:02 We could do that (and similar for all other uses o
Daniele Castagna 2015/12/16 19:30:18 Acknowledged.
kTopLeft_GrSurfaceOrigin);
- gl->DeleteTextures(3, source_textures);
+ for (size_t i = 0; i < media::VideoFrame::NumPlanes(video_frame->format());
+ ++i) {
+ gl->DeleteTextures(1, &source_textures[i].fID);
+ }
return skia::AdoptRef(img);
}
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | skia/config/SkUserConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698