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