| OLD | NEW |
| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return img; | 160 return img; |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Creates a SkImage from a |video_frame| backed by native resources. | 163 // Creates a SkImage from a |video_frame| backed by native resources. |
| 164 // The SkImage will take ownership of the underlying resource. | 164 // The SkImage will take ownership of the underlying resource. |
| 165 sk_sp<SkImage> NewSkImageFromVideoFrameNative(VideoFrame* video_frame, | 165 sk_sp<SkImage> NewSkImageFromVideoFrameNative(VideoFrame* video_frame, |
| 166 const Context3D& context_3d) { | 166 const Context3D& context_3d) { |
| 167 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() || | 167 DCHECK(PIXEL_FORMAT_ARGB == video_frame->format() || |
| 168 PIXEL_FORMAT_XRGB == video_frame->format() || | 168 PIXEL_FORMAT_XRGB == video_frame->format() || |
| 169 PIXEL_FORMAT_NV12 == video_frame->format() || | 169 PIXEL_FORMAT_NV12 == video_frame->format() || |
| 170 PIXEL_FORMAT_UYVY == video_frame->format()); | 170 PIXEL_FORMAT_UYVY == video_frame->format() || |
| 171 PIXEL_FORMAT_YUY2 == video_frame->format()); |
| 171 | 172 |
| 172 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); | 173 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0); |
| 173 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || | 174 DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D || |
| 174 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || | 175 mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB || |
| 175 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) | 176 mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) |
| 176 << mailbox_holder.texture_target; | 177 << mailbox_holder.texture_target; |
| 177 | 178 |
| 178 gpu::gles2::GLES2Interface* gl = context_3d.gl; | 179 gpu::gles2::GLES2Interface* gl = context_3d.gl; |
| 179 unsigned source_texture = 0; | 180 unsigned source_texture = 0; |
| 180 if (mailbox_holder.texture_target != GL_TEXTURE_2D) { | 181 if (mailbox_holder.texture_target != GL_TEXTURE_2D) { |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 last_image_->bounds().contains(visible_rect)) { | 958 last_image_->bounds().contains(visible_rect)) { |
| 958 last_image_ = last_image_->makeSubset(visible_rect); | 959 last_image_ = last_image_->makeSubset(visible_rect); |
| 959 } | 960 } |
| 960 } | 961 } |
| 961 | 962 |
| 962 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { | 963 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { |
| 963 return last_image_dimensions_for_testing_; | 964 return last_image_dimensions_for_testing_; |
| 964 } | 965 } |
| 965 | 966 |
| 966 } // namespace media | 967 } // namespace media |
| OLD | NEW |