| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "media/video/picture.h" | 6 #include "media/video/picture.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 PictureBuffer::PictureBuffer(int32_t id, | 10 PictureBuffer::PictureBuffer(int32_t id, const gfx::Size& size) |
| 11 gfx::Size size, | 11 : id_(id), size_(size) {} |
| 12 const TextureIds& client_texture_ids) | |
| 13 : id_(id), size_(size), client_texture_ids_(client_texture_ids) {} | |
| 14 | 12 |
| 15 PictureBuffer::PictureBuffer(int32_t id, | 13 PictureBuffer::PictureBuffer(int32_t id, |
| 16 gfx::Size size, | 14 const gfx::Size& size, |
| 15 const TextureIds& client_texture_ids) |
| 16 : id_(id), size_(size), client_texture_ids_(client_texture_ids) { |
| 17 DCHECK(!client_texture_ids_.empty()); |
| 18 } |
| 19 |
| 20 PictureBuffer::PictureBuffer(int32_t id, |
| 21 const gfx::Size& size, |
| 17 const TextureIds& client_texture_ids, | 22 const TextureIds& client_texture_ids, |
| 18 const TextureIds& service_texture_ids) | 23 const TextureIds& service_texture_ids) |
| 19 : id_(id), | 24 : id_(id), |
| 20 size_(size), | 25 size_(size), |
| 21 client_texture_ids_(client_texture_ids), | 26 client_texture_ids_(client_texture_ids), |
| 22 service_texture_ids_(service_texture_ids) { | 27 service_texture_ids_(service_texture_ids) { |
| 23 DCHECK_EQ(client_texture_ids.size(), service_texture_ids.size()); | 28 DCHECK(!service_texture_ids_.empty()); |
| 29 // We either not have client texture ids at all, or if we do, then their |
| 30 // number must be the same as the number of service texture ids. |
| 31 DCHECK(client_texture_ids_.empty() || |
| 32 client_texture_ids_.size() == service_texture_ids_.size()); |
| 24 } | 33 } |
| 25 | 34 |
| 26 PictureBuffer::PictureBuffer(int32_t id, | 35 PictureBuffer::PictureBuffer(int32_t id, |
| 27 gfx::Size size, | 36 const gfx::Size& size, |
| 28 const TextureIds& client_texture_ids, | 37 const TextureIds& client_texture_ids, |
| 29 const std::vector<gpu::Mailbox>& texture_mailboxes) | 38 const std::vector<gpu::Mailbox>& texture_mailboxes) |
| 30 : id_(id), | 39 : id_(id), |
| 31 size_(size), | 40 size_(size), |
| 32 client_texture_ids_(client_texture_ids), | 41 client_texture_ids_(client_texture_ids), |
| 33 texture_mailboxes_(texture_mailboxes) { | 42 texture_mailboxes_(texture_mailboxes) { |
| 34 DCHECK_EQ(client_texture_ids.size(), texture_mailboxes.size()); | 43 DCHECK_EQ(client_texture_ids.size(), texture_mailboxes.size()); |
| 35 } | 44 } |
| 36 | 45 |
| 37 PictureBuffer::PictureBuffer(const PictureBuffer& other) = default; | 46 PictureBuffer::PictureBuffer(const PictureBuffer& other) = default; |
| 38 | 47 |
| 39 PictureBuffer::~PictureBuffer() {} | 48 PictureBuffer::~PictureBuffer() {} |
| 40 | 49 |
| 50 gpu::Mailbox PictureBuffer::texture_mailbox(size_t plane) const { |
| 51 if (plane >= texture_mailboxes_.size()) { |
| 52 LOG(ERROR) << "No mailbox for plane " << plane; |
| 53 return gpu::Mailbox(); |
| 54 } |
| 55 |
| 56 return texture_mailboxes_[plane]; |
| 57 } |
| 58 |
| 41 Picture::Picture(int32_t picture_buffer_id, | 59 Picture::Picture(int32_t picture_buffer_id, |
| 42 int32_t bitstream_buffer_id, | 60 int32_t bitstream_buffer_id, |
| 43 const gfx::Rect& visible_rect, | 61 const gfx::Rect& visible_rect, |
| 44 const gfx::ColorSpace& color_space, | 62 const gfx::ColorSpace& color_space, |
| 45 bool allow_overlay) | 63 bool allow_overlay) |
| 46 : picture_buffer_id_(picture_buffer_id), | 64 : picture_buffer_id_(picture_buffer_id), |
| 47 bitstream_buffer_id_(bitstream_buffer_id), | 65 bitstream_buffer_id_(bitstream_buffer_id), |
| 48 visible_rect_(visible_rect), | 66 visible_rect_(visible_rect), |
| 49 color_space_(color_space), | 67 color_space_(color_space), |
| 50 allow_overlay_(allow_overlay), | 68 allow_overlay_(allow_overlay), |
| 51 size_changed_(false) {} | 69 size_changed_(false) {} |
| 52 | 70 |
| 53 } // namespace media | 71 } // namespace media |
| OLD | NEW |