OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/video_layer_impl.h" | 5 #include "cc/video_layer_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/io_surface_draw_quad.h" | 8 #include "cc/io_surface_draw_quad.h" |
9 #include "cc/layer_tree_impl.h" | 9 #include "cc/layer_tree_impl.h" |
10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 gfx::SizeF texScale(texWidthScale, texHeightScale); | 218 gfx::SizeF texScale(texWidthScale, texHeightScale); |
219 scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::Create(); | 219 scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::Create(); |
220 yuvVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, texScale, yP
lane, uPlane, vPlane); | 220 yuvVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, texScale, yP
lane, uPlane, vPlane); |
221 quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); | 221 quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); |
222 break; | 222 break; |
223 } | 223 } |
224 case GL_RGBA: { | 224 case GL_RGBA: { |
225 // RGBA software decoder. | 225 // RGBA software decoder. |
226 const FramePlane& plane = m_framePlanes[media::VideoFrame::kRGBPlane]; | 226 const FramePlane& plane = m_framePlanes[media::VideoFrame::kRGBPlane]; |
227 bool premultipliedAlpha = true; | 227 bool premultipliedAlpha = true; |
228 gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale); | 228 gfx::PointF uvTopLeft(0.f, 0.f); |
| 229 gfx::PointF uvBottomRight(texWidthScale, texHeightScale); |
229 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 230 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
230 bool flipped = false; | 231 bool flipped = false; |
231 scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::Create(); | 232 scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::Create(); |
232 textureQuad->SetNew(sharedQuadState, quadRect, opaqueRect, plane.resourc
eId, premultipliedAlpha, uvRect, opacity, flipped); | 233 textureQuad->SetNew(sharedQuadState, quadRect, opaqueRect, plane.resourc
eId, premultipliedAlpha, uvTopLeft, uvBottomRight, opacity, flipped); |
233 quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); | 234 quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); |
234 break; | 235 break; |
235 } | 236 } |
236 case GL_TEXTURE_2D: { | 237 case GL_TEXTURE_2D: { |
237 // NativeTexture hardware decoder. | 238 // NativeTexture hardware decoder. |
238 bool premultipliedAlpha = true; | 239 bool premultipliedAlpha = true; |
239 gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale); | 240 gfx::PointF uvTopLeft(0.f, 0.f); |
| 241 gfx::PointF uvBottomRight(texWidthScale, texHeightScale); |
240 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 242 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
241 bool flipped = false; | 243 bool flipped = false; |
242 scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::Create(); | 244 scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::Create(); |
243 textureQuad->SetNew(sharedQuadState, quadRect, opaqueRect, m_externalTex
tureResource, premultipliedAlpha, uvRect, opacity, flipped); | 245 textureQuad->SetNew(sharedQuadState, quadRect, opaqueRect, m_externalTex
tureResource, premultipliedAlpha, uvTopLeft, uvBottomRight, opacity, flipped); |
244 quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); | 246 quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData); |
245 break; | 247 break; |
246 } | 248 } |
247 case GL_TEXTURE_RECTANGLE_ARB: { | 249 case GL_TEXTURE_RECTANGLE_ARB: { |
248 gfx::Size visibleSize(visibleRect.width(), visibleRect.height()); | 250 gfx::Size visibleSize(visibleRect.width(), visibleRect.height()); |
249 scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::Create(
); | 251 scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::Create(
); |
250 ioSurfaceQuad->SetNew(sharedQuadState, quadRect, opaqueRect, visibleSize
, m_frame->texture_id(), IOSurfaceDrawQuad::UNFLIPPED); | 252 ioSurfaceQuad->SetNew(sharedQuadState, quadRect, opaqueRect, visibleSize
, m_frame->texture_id(), IOSurfaceDrawQuad::UNFLIPPED); |
251 quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData); | 253 quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData); |
252 break; | 254 break; |
253 } | 255 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 { | 421 { |
420 layerTreeImpl()->SetNeedsRedraw(); | 422 layerTreeImpl()->SetNeedsRedraw(); |
421 } | 423 } |
422 | 424 |
423 const char* VideoLayerImpl::layerTypeAsString() const | 425 const char* VideoLayerImpl::layerTypeAsString() const |
424 { | 426 { |
425 return "VideoLayer"; | 427 return "VideoLayer"; |
426 } | 428 } |
427 | 429 |
428 } // namespace cc | 430 } // namespace cc |
OLD | NEW |