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

Side by Side Diff: media/base/video_util.cc

Issue 388363002: Use SkSrc_Mode in SkCanvasVideoRenderer, to prevent transparent video frames from blending with reu… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: static_cast<SkColor> instead of (unsigned int) Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/video_util.h ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/video_util.h" 5 #include "media/base/video_util.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int u_row_bytes = frame->row_bytes(VideoFrame::kUPlane); 89 int u_row_bytes = frame->row_bytes(VideoFrame::kUPlane);
90 int v_row_bytes = frame->row_bytes(VideoFrame::kVPlane); 90 int v_row_bytes = frame->row_bytes(VideoFrame::kVPlane);
91 for (int i = 0; i < uv_rows; ++i) { 91 for (int i = 0; i < uv_rows; ++i) {
92 memset(u_plane, u, u_row_bytes); 92 memset(u_plane, u, u_row_bytes);
93 memset(v_plane, v, v_row_bytes); 93 memset(v_plane, v, v_row_bytes);
94 u_plane += frame->stride(VideoFrame::kUPlane); 94 u_plane += frame->stride(VideoFrame::kUPlane);
95 v_plane += frame->stride(VideoFrame::kVPlane); 95 v_plane += frame->stride(VideoFrame::kVPlane);
96 } 96 }
97 } 97 }
98 98
99 void FillYUVA(VideoFrame* frame, uint8 y, uint8 u, uint8 v, uint8 a) {
100 // Fill Y, U and V planes.
101 FillYUV(frame, y, u, v);
102
103 // Fill the A plane.
104 uint8* a_plane = frame->data(VideoFrame::kAPlane);
105 int a_rows = frame->rows(VideoFrame::kAPlane);
106 int a_row_bytes = frame->row_bytes(VideoFrame::kAPlane);
107 for (int i = 0; i < a_rows; ++i) {
108 memset(a_plane, a, a_row_bytes);
109 a_plane += frame->stride(VideoFrame::kAPlane);
110 }
111 }
112
99 static void LetterboxPlane(VideoFrame* frame, 113 static void LetterboxPlane(VideoFrame* frame,
100 int plane, 114 int plane,
101 const gfx::Rect& view_area, 115 const gfx::Rect& view_area,
102 uint8 fill_byte) { 116 uint8 fill_byte) {
103 uint8* ptr = frame->data(plane); 117 uint8* ptr = frame->data(plane);
104 const int rows = frame->rows(plane); 118 const int rows = frame->rows(plane);
105 const int row_bytes = frame->row_bytes(plane); 119 const int row_bytes = frame->row_bytes(plane);
106 const int stride = frame->stride(plane); 120 const int stride = frame->stride(plane);
107 121
108 CHECK_GE(stride, row_bytes); 122 CHECK_GE(stride, row_bytes);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 frame->data(kU) + uv_offset, 314 frame->data(kU) + uv_offset,
301 frame->data(kV) + uv_offset, 315 frame->data(kV) + uv_offset,
302 region_in_frame.width(), 316 region_in_frame.width(),
303 region_in_frame.height(), 317 region_in_frame.height(),
304 stride, 318 stride,
305 frame->stride(kY), 319 frame->stride(kY),
306 uv_stride); 320 uv_stride);
307 } 321 }
308 322
309 } // namespace media 323 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_util.h ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698