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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 2752593002: cc: Make PaintCanvas abstract (Closed)
Patch Set: Remove default parameters on virtual functions Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bit_cast.h" 13 #include "base/bit_cast.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "cc/base/math_util.h" 15 #include "cc/base/math_util.h"
16 #include "cc/output/gl_renderer.h" 16 #include "cc/output/gl_renderer.h"
17 #include "cc/paint/skia_paint_canvas.h"
17 #include "cc/resources/resource_provider.h" 18 #include "cc/resources/resource_provider.h"
18 #include "cc/resources/resource_util.h" 19 #include "cc/resources/resource_util.h"
19 #include "gpu/GLES2/gl2extchromium.h" 20 #include "gpu/GLES2/gl2extchromium.h"
20 #include "gpu/command_buffer/client/gles2_interface.h" 21 #include "gpu/command_buffer/client/gles2_interface.h"
21 #include "media/base/video_frame.h" 22 #include "media/base/video_frame.h"
22 #include "media/renderers/skcanvas_video_renderer.h" 23 #include "media/renderers/skcanvas_video_renderer.h"
23 #include "third_party/khronos/GLES2/gl2.h" 24 #include "third_party/khronos/GLES2/gl2.h"
24 #include "third_party/khronos/GLES2/gl2ext.h" 25 #include "third_party/khronos/GLES2/gl2ext.h"
25 #include "third_party/libyuv/include/libyuv.h" 26 #include "third_party/libyuv/include/libyuv.h"
26 #include "third_party/skia/include/core/SkCanvas.h" 27 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 DCHECK_EQ(software_compositor, plane_resource.mailbox().IsZero()); 512 DCHECK_EQ(software_compositor, plane_resource.mailbox().IsZero());
512 513
513 if (!plane_resource.Matches(video_frame->unique_id(), 0)) { 514 if (!plane_resource.Matches(video_frame->unique_id(), 0)) {
514 // We need to transfer data from |video_frame| to the plane resource. 515 // We need to transfer data from |video_frame| to the plane resource.
515 if (software_compositor) { 516 if (software_compositor) {
516 if (!video_renderer_) 517 if (!video_renderer_)
517 video_renderer_.reset(new media::SkCanvasVideoRenderer); 518 video_renderer_.reset(new media::SkCanvasVideoRenderer);
518 519
519 ResourceProvider::ScopedWriteLockSoftware lock( 520 ResourceProvider::ScopedWriteLockSoftware lock(
520 resource_provider_, plane_resource.resource_id()); 521 resource_provider_, plane_resource.resource_id());
521 PaintCanvas canvas(lock.sk_bitmap()); 522 SkiaPaintCanvas canvas(lock.sk_bitmap());
522 // This is software path, so canvas and video_frame are always backed 523 // This is software path, so canvas and video_frame are always backed
523 // by software. 524 // by software.
524 video_renderer_->Copy(video_frame, &canvas, media::Context3D()); 525 video_renderer_->Copy(video_frame, &canvas, media::Context3D());
525 } else { 526 } else {
526 size_t bytes_per_row = ResourceUtil::CheckedWidthInBytes<size_t>( 527 size_t bytes_per_row = ResourceUtil::CheckedWidthInBytes<size_t>(
527 video_frame->coded_size().width(), ResourceFormat::RGBA_8888); 528 video_frame->coded_size().width(), ResourceFormat::RGBA_8888);
528 size_t needed_size = bytes_per_row * video_frame->coded_size().height(); 529 size_t needed_size = bytes_per_row * video_frame->coded_size().height();
529 if (upload_pixels_.size() < needed_size) 530 if (upload_pixels_.size() < needed_size)
530 upload_pixels_.resize(needed_size); 531 upload_pixels_.resize(needed_size);
531 532
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (lost_resource) { 819 if (lost_resource) {
819 resource_it->clear_refs(); 820 resource_it->clear_refs();
820 updater->DeleteResource(resource_it); 821 updater->DeleteResource(resource_it);
821 return; 822 return;
822 } 823 }
823 824
824 resource_it->remove_ref(); 825 resource_it->remove_ref();
825 } 826 }
826 827
827 } // namespace cc 828 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_item_list_unittest.cc ('k') | content/browser/renderer_host/render_widget_host_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698