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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2369093002: Fixing repeated pixels when drawing HTML5 video to canvas. (Closed)
Patch Set: Minor corrections in unit test. Created 4 years, 2 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
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/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 last_image_ = 780 last_image_ =
781 NewSkImageFromVideoFrameYUVTextures(video_frame.get(), context_3d); 781 NewSkImageFromVideoFrameYUVTextures(video_frame.get(), context_3d);
782 } else { 782 } else {
783 last_image_ = 783 last_image_ =
784 NewSkImageFromVideoFrameNative(video_frame.get(), context_3d); 784 NewSkImageFromVideoFrameNative(video_frame.get(), context_3d);
785 } 785 }
786 } else { 786 } else {
787 auto* video_generator = new VideoImageGenerator(video_frame); 787 auto* video_generator = new VideoImageGenerator(video_frame);
788 last_image_ = SkImage::MakeFromGenerator(video_generator); 788 last_image_ = SkImage::MakeFromGenerator(video_generator);
789 } 789 }
790 CorrectLastImageDimensions(gfx::RectToSkIRect(video_frame->visible_rect()));
790 if (!last_image_) // Couldn't create the SkImage. 791 if (!last_image_) // Couldn't create the SkImage.
791 return false; 792 return false;
792 last_timestamp_ = video_frame->timestamp(); 793 last_timestamp_ = video_frame->timestamp();
793 } 794 }
794 last_image_deleting_timer_.Reset(); 795 last_image_deleting_timer_.Reset();
795 DCHECK(!!last_image_); 796 DCHECK(!!last_image_);
796 return true; 797 return true;
797 } 798 }
798 799
800 void SkCanvasVideoRenderer::CorrectLastImageDimensions(
801 const SkIRect& visible_rect) {
802 last_image_dimensions_for_testing_ = visible_rect.size();
803 if (!last_image_)
804 return;
805 if (last_image_->dimensions() != visible_rect.size() &&
806 last_image_->bounds().contains(visible_rect)) {
807 last_image_ = last_image_->makeSubset(visible_rect);
808 }
809 }
810
811 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() {
812 return last_image_dimensions_for_testing_;
813 }
814
799 } // namespace media 815 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/skcanvas_video_renderer.h ('k') | media/renderers/skcanvas_video_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698