| OLD | NEW |
| 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> |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 DCHECK_EQ(software_compositor, plane_resource.mailbox().IsZero()); | 510 DCHECK_EQ(software_compositor, plane_resource.mailbox().IsZero()); |
| 511 | 511 |
| 512 if (!plane_resource.Matches(video_frame->unique_id(), 0)) { | 512 if (!plane_resource.Matches(video_frame->unique_id(), 0)) { |
| 513 // We need to transfer data from |video_frame| to the plane resource. | 513 // We need to transfer data from |video_frame| to the plane resource. |
| 514 if (software_compositor) { | 514 if (software_compositor) { |
| 515 if (!video_renderer_) | 515 if (!video_renderer_) |
| 516 video_renderer_.reset(new media::SkCanvasVideoRenderer); | 516 video_renderer_.reset(new media::SkCanvasVideoRenderer); |
| 517 | 517 |
| 518 ResourceProvider::ScopedWriteLockSoftware lock( | 518 ResourceProvider::ScopedWriteLockSoftware lock( |
| 519 resource_provider_, plane_resource.resource_id()); | 519 resource_provider_, plane_resource.resource_id()); |
| 520 SkCanvas canvas(lock.sk_bitmap()); | 520 PaintCanvas canvas(lock.sk_bitmap()); |
| 521 // This is software path, so canvas and video_frame are always backed | 521 // This is software path, so canvas and video_frame are always backed |
| 522 // by software. | 522 // by software. |
| 523 video_renderer_->Copy(video_frame, &canvas, media::Context3D()); | 523 video_renderer_->Copy(video_frame, &canvas, media::Context3D()); |
| 524 } else { | 524 } else { |
| 525 size_t bytes_per_row = ResourceUtil::CheckedWidthInBytes<size_t>( | 525 size_t bytes_per_row = ResourceUtil::CheckedWidthInBytes<size_t>( |
| 526 video_frame->coded_size().width(), ResourceFormat::RGBA_8888); | 526 video_frame->coded_size().width(), ResourceFormat::RGBA_8888); |
| 527 size_t needed_size = bytes_per_row * video_frame->coded_size().height(); | 527 size_t needed_size = bytes_per_row * video_frame->coded_size().height(); |
| 528 if (upload_pixels_.size() < needed_size) | 528 if (upload_pixels_.size() < needed_size) |
| 529 upload_pixels_.resize(needed_size); | 529 upload_pixels_.resize(needed_size); |
| 530 | 530 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 if (lost_resource) { | 812 if (lost_resource) { |
| 813 resource_it->clear_refs(); | 813 resource_it->clear_refs(); |
| 814 updater->DeleteResource(resource_it); | 814 updater->DeleteResource(resource_it); |
| 815 return; | 815 return; |
| 816 } | 816 } |
| 817 | 817 |
| 818 resource_it->remove_ref(); | 818 resource_it->remove_ref(); |
| 819 } | 819 } |
| 820 | 820 |
| 821 } // namespace cc | 821 } // namespace cc |
| OLD | NEW |