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

Unified Diff: media/renderers/skcanvas_video_renderer.cc

Issue 1504673003: don't rely on -Wno-narrowing in skcanvas_video_renderer.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: additional DCHECK_LE 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 | « no previous file | no next file » | 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 aa9321ad3d1a585d9502c371490074e67fa53e9a..ec093da0a70feb3702507e4f1831e50cb616fa17 100644
--- a/media/renderers/skcanvas_video_renderer.cc
+++ b/media/renderers/skcanvas_video_renderer.cc
@@ -4,6 +4,8 @@
#include "media/renderers/skcanvas_video_renderer.h"
+#include <limits>
+
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
@@ -119,8 +121,15 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameYUVTextures(
source_textures[i] = texture_copy;
}
}
- GrBackendObject handles[3] = {source_textures[0], source_textures[1],
- source_textures[2]};
+ DCHECK_LE(source_textures[0],
+ static_cast<unsigned>(std::numeric_limits<int>::max()));
+ DCHECK_LE(source_textures[1],
+ static_cast<unsigned>(std::numeric_limits<int>::max()));
+ DCHECK_LE(source_textures[2],
+ 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])};
SkISize yuvSizes[] = {
{ya_tex_size.width(), ya_tex_size.height()},
@@ -180,7 +189,9 @@ skia::RefPtr<SkImage> NewSkImageFromVideoFrameNative(
desc.fWidth = video_frame->coded_size().width();
desc.fHeight = video_frame->coded_size().height();
desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fTextureHandle = source_texture;
+ DCHECK_LE(source_texture,
+ static_cast<unsigned>(std::numeric_limits<int>::max()));
+ desc.fTextureHandle = static_cast<int>(source_texture);
return skia::AdoptRef(
SkImage::NewFromAdoptedTexture(context_3d.gr_context, desc));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698