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

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

Issue 2880813002: Revert of Add stable id to PaintImage. (Closed)
Patch Set: Created 3 years, 7 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 <GLES3/gl3.h> 7 #include <GLES3/gl3.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 scoped_refptr<VideoFrame> frame_; 337 scoped_refptr<VideoFrame> frame_;
338 338
339 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoImageGenerator); 339 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoImageGenerator);
340 }; 340 };
341 341
342 SkCanvasVideoRenderer::SkCanvasVideoRenderer() 342 SkCanvasVideoRenderer::SkCanvasVideoRenderer()
343 : last_image_deleting_timer_( 343 : last_image_deleting_timer_(
344 FROM_HERE, 344 FROM_HERE,
345 base::TimeDelta::FromSeconds(kTemporaryResourceDeletionDelay), 345 base::TimeDelta::FromSeconds(kTemporaryResourceDeletionDelay),
346 this, 346 this,
347 &SkCanvasVideoRenderer::ResetCache), 347 &SkCanvasVideoRenderer::ResetCache) {}
348 renderer_stable_id_(cc::PaintImage::GetNextId()) {}
349 348
350 SkCanvasVideoRenderer::~SkCanvasVideoRenderer() { 349 SkCanvasVideoRenderer::~SkCanvasVideoRenderer() {
351 ResetCache(); 350 ResetCache();
352 } 351 }
353 352
354 void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame, 353 void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
355 cc::PaintCanvas* canvas, 354 cc::PaintCanvas* canvas,
356 const gfx::RectF& dest_rect, 355 const gfx::RectF& dest_rect,
357 cc::PaintFlags& flags, 356 cc::PaintFlags& flags,
358 VideoRotation video_rotation, 357 VideoRotation video_rotation,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // safe to access on another thread or GL context. So if we're drawing into a 430 // safe to access on another thread or GL context. So if we're drawing into a
432 // recording canvas we read the texture back into CPU memory and record that 431 // recording canvas we read the texture back into CPU memory and record that
433 // sw image into the SkPicture. The long term solution is for Skia to provide 432 // sw image into the SkPicture. The long term solution is for Skia to provide
434 // a SkPicture filter that makes a picture safe for multiple CPU raster 433 // a SkPicture filter that makes a picture safe for multiple CPU raster
435 // threads. (skbug.com/4321). 434 // threads. (skbug.com/4321).
436 sk_sp<SkImage> image; 435 sk_sp<SkImage> image;
437 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) 436 if (canvas->imageInfo().colorType() == kUnknown_SkColorType)
438 image = last_image_->makeNonTextureImage(); 437 image = last_image_->makeNonTextureImage();
439 else 438 else
440 image = last_image_; 439 image = last_image_;
441 canvas->drawImage(cc::PaintImage(renderer_stable_id_, std::move(image), 440 canvas->drawImage(
442 cc::PaintImage::AnimationType::VIDEO, 441 cc::PaintImage(std::move(image), cc::PaintImage::AnimationType::VIDEO,
443 cc::PaintImage::CompletionState::DONE), 442 cc::PaintImage::CompletionState::DONE),
444 0, 0, &video_flags); 443 0, 0, &video_flags);
445 444
446 if (need_transform) 445 if (need_transform)
447 canvas->restore(); 446 canvas->restore();
448 // Make sure to flush so we can remove the videoframe from the generator. 447 // Make sure to flush so we can remove the videoframe from the generator.
449 canvas->flush(); 448 canvas->flush();
450 449
451 if (video_frame->HasTextures()) { 450 if (video_frame->HasTextures()) {
452 DCHECK(gl); 451 DCHECK(gl);
453 SyncTokenClientImpl client(gl); 452 SyncTokenClientImpl client(gl);
454 video_frame->UpdateReleaseSyncToken(&client); 453 video_frame->UpdateReleaseSyncToken(&client);
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 last_image_->bounds().contains(visible_rect)) { 1084 last_image_->bounds().contains(visible_rect)) {
1086 last_image_ = last_image_->makeSubset(visible_rect); 1085 last_image_ = last_image_->makeSubset(visible_rect);
1087 } 1086 }
1088 } 1087 }
1089 1088
1090 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { 1089 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() {
1091 return last_image_dimensions_for_testing_; 1090 return last_image_dimensions_for_testing_;
1092 } 1091 }
1093 1092
1094 } // namespace media 1093 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/skcanvas_video_renderer.h ('k') | third_party/WebKit/Source/platform/DragImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698