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

Side by Side Diff: media/filters/skcanvas_video_renderer.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.cc ('k') | media/filters/skcanvas_video_renderer_unittest.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/filters/skcanvas_video_renderer.h" 5 #include "media/filters/skcanvas_video_renderer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "media/base/yuv_convert.h" 9 #include "media/base/yuv_convert.h"
10 #include "third_party/libyuv/include/libyuv.h" 10 #include "third_party/libyuv/include/libyuv.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return; 206 return;
207 } 207 }
208 208
209 // Check if we should convert and update |last_frame_|. 209 // Check if we should convert and update |last_frame_|.
210 if (last_frame_.isNull() || 210 if (last_frame_.isNull() ||
211 video_frame->timestamp() != last_frame_timestamp_) { 211 video_frame->timestamp() != last_frame_timestamp_) {
212 ConvertVideoFrameToBitmap(video_frame, &last_frame_); 212 ConvertVideoFrameToBitmap(video_frame, &last_frame_);
213 last_frame_timestamp_ = video_frame->timestamp(); 213 last_frame_timestamp_ = video_frame->timestamp();
214 } 214 }
215 215
216 // Use SRC mode so we completely overwrite the buffer (in case we have alpha)
217 // this means we don't need the extra cost of clearing the buffer first.
218 paint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode));
219
216 // Paint using |last_frame_|. 220 // Paint using |last_frame_|.
217 paint.setFilterLevel(SkPaint::kLow_FilterLevel); 221 paint.setFilterLevel(SkPaint::kLow_FilterLevel);
218 canvas->drawBitmapRect(last_frame_, NULL, dest, &paint); 222 canvas->drawBitmapRect(last_frame_, NULL, dest, &paint);
219 } 223 }
220 224
221 } // namespace media 225 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_util.cc ('k') | media/filters/skcanvas_video_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698