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

Unified Diff: media/filters/skcanvas_video_renderer.cc

Issue 402133005: Video Orientation in Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test cleanup and formatting Created 6 years, 4 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 | « media/filters/skcanvas_video_renderer.h ('k') | media/filters/skcanvas_video_renderer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/skcanvas_video_renderer.cc
diff --git a/media/filters/skcanvas_video_renderer.cc b/media/filters/skcanvas_video_renderer.cc
index 062e317b71da03476438e156bb2f5d2cedc47b00..fe1bfde044ec91a71ac05b5b88b210189d8483e2 100644
--- a/media/filters/skcanvas_video_renderer.cc
+++ b/media/filters/skcanvas_video_renderer.cc
@@ -9,6 +9,7 @@
#include "media/base/yuv_convert.h"
#include "third_party/libyuv/include/libyuv.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/skbitmap_operations.h"
// Skia internal format depends on a platform. On Android it is ABGR, on others
// it is ARGB.
@@ -188,7 +189,8 @@ SkCanvasVideoRenderer::~SkCanvasVideoRenderer() {}
void SkCanvasVideoRenderer::Paint(media::VideoFrame* video_frame,
SkCanvas* canvas,
const gfx::RectF& dest_rect,
- uint8 alpha) {
+ uint8 alpha,
+ VideoRotation video_rotation) {
if (alpha == 0) {
return;
}
@@ -210,6 +212,24 @@ void SkCanvasVideoRenderer::Paint(media::VideoFrame* video_frame,
if (last_frame_.isNull() ||
video_frame->timestamp() != last_frame_timestamp_) {
ConvertVideoFrameToBitmap(video_frame, &last_frame_);
+
+ switch (video_rotation) {
+ case VIDEO_ROTATION_0:
+ break;
+ case VIDEO_ROTATION_90:
+ last_frame_ = SkBitmapOperations::Rotate(
+ last_frame_, SkBitmapOperations::ROTATION_90_CW);
+ break;
+ case VIDEO_ROTATION_180:
+ last_frame_ = SkBitmapOperations::Rotate(
+ last_frame_, SkBitmapOperations::ROTATION_180_CW);
+ break;
+ case VIDEO_ROTATION_270:
+ last_frame_ = SkBitmapOperations::Rotate(
+ last_frame_, SkBitmapOperations::ROTATION_270_CW);
+ break;
+ }
+
last_frame_timestamp_ = video_frame->timestamp();
}
« no previous file with comments | « media/filters/skcanvas_video_renderer.h ('k') | media/filters/skcanvas_video_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698