| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 | 8 |
| 9 #include "CCVideoLayerImpl.h" | 9 #include "CCVideoLayerImpl.h" |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // otherwise synchonize use of all textures in the quad. | 168 // otherwise synchonize use of all textures in the quad. |
| 169 | 169 |
| 170 IntRect quadRect(IntPoint(), contentBounds()); | 170 IntRect quadRect(IntPoint(), contentBounds()); |
| 171 | 171 |
| 172 switch (m_format) { | 172 switch (m_format) { |
| 173 case GraphicsContext3D::LUMINANCE: { | 173 case GraphicsContext3D::LUMINANCE: { |
| 174 // YUV software decoder. | 174 // YUV software decoder. |
| 175 const FramePlane& yPlane = m_framePlanes[WebKit::WebVideoFrame::yPlane]; | 175 const FramePlane& yPlane = m_framePlanes[WebKit::WebVideoFrame::yPlane]; |
| 176 const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; | 176 const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; |
| 177 const FramePlane& vPlane = m_framePlanes[WebKit::WebVideoFrame::vPlane]; | 177 const FramePlane& vPlane = m_framePlanes[WebKit::WebVideoFrame::vPlane]; |
| 178 OwnPtr<CCYUVVideoDrawQuad> yuvVideoQuad = CCYUVVideoDrawQuad::create(sha
redQuadState, quadRect, yPlane, uPlane, vPlane); | 178 scoped_ptr<CCYUVVideoDrawQuad> yuvVideoQuad = CCYUVVideoDrawQuad::create
(sharedQuadState, quadRect, yPlane, uPlane, vPlane); |
| 179 quadSink.append(yuvVideoQuad.release(), appendQuadsData); | 179 quadSink.append(yuvVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 180 break; | 180 break; |
| 181 } | 181 } |
| 182 case GraphicsContext3D::RGBA: { | 182 case GraphicsContext3D::RGBA: { |
| 183 // RGBA software decoder. | 183 // RGBA software decoder. |
| 184 const FramePlane& plane = m_framePlanes[WebKit::WebVideoFrame::rgbPlane]
; | 184 const FramePlane& plane = m_framePlanes[WebKit::WebVideoFrame::rgbPlane]
; |
| 185 float widthScaleFactor = static_cast<float>(plane.visibleSize.width()) /
plane.size.width(); | 185 float widthScaleFactor = static_cast<float>(plane.visibleSize.width()) /
plane.size.width(); |
| 186 | 186 |
| 187 bool premultipliedAlpha = true; | 187 bool premultipliedAlpha = true; |
| 188 FloatRect uvRect(0, 0, widthScaleFactor, 1); | 188 FloatRect uvRect(0, 0, widthScaleFactor, 1); |
| 189 bool flipped = false; | 189 bool flipped = false; |
| 190 OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(shared
QuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); | 190 scoped_ptr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sh
aredQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); |
| 191 quadSink.append(textureQuad.release(), appendQuadsData); | 191 quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 192 break; | 192 break; |
| 193 } | 193 } |
| 194 case GraphicsContext3D::TEXTURE_2D: { | 194 case GraphicsContext3D::TEXTURE_2D: { |
| 195 // NativeTexture hardware decoder. | 195 // NativeTexture hardware decoder. |
| 196 bool premultipliedAlpha = true; | 196 bool premultipliedAlpha = true; |
| 197 FloatRect uvRect(0, 0, 1, 1); | 197 FloatRect uvRect(0, 0, 1, 1); |
| 198 bool flipped = false; | 198 bool flipped = false; |
| 199 OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(shared
QuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flip
ped); | 199 scoped_ptr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sh
aredQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect,
flipped); |
| 200 quadSink.append(textureQuad.release(), appendQuadsData); | 200 quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 201 break; | 201 break; |
| 202 } | 202 } |
| 203 case Extensions3D::TEXTURE_RECTANGLE_ARB: { | 203 case Extensions3D::TEXTURE_RECTANGLE_ARB: { |
| 204 IntSize textureSize(m_frame->width(), m_frame->height()); | 204 IntSize textureSize(m_frame->width(), m_frame->height()); |
| 205 OwnPtr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(
sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQua
d::Unflipped); | 205 scoped_ptr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::cre
ate(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDra
wQuad::Unflipped); |
| 206 quadSink.append(ioSurfaceQuad.release(), appendQuadsData); | 206 quadSink.append(ioSurfaceQuad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 207 break; | 207 break; |
| 208 } | 208 } |
| 209 case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { | 209 case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { |
| 210 // StreamTexture hardware decoder. | 210 // StreamTexture hardware decoder. |
| 211 OwnPtr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::c
reate(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); | 211 scoped_ptr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQua
d::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix
); |
| 212 quadSink.append(streamVideoQuad.release(), appendQuadsData); | 212 quadSink.append(streamVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 213 break; | 213 break; |
| 214 } | 214 } |
| 215 default: | 215 default: |
| 216 CRASH(); // Someone updated convertVFCFormatToGC3DFormat above but updat
e this! | 216 CRASH(); // Someone updated convertVFCFormatToGC3DFormat above but updat
e this! |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) | 220 void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) |
| 221 { | 221 { |
| 222 ASSERT(CCProxy::isImplThread()); | 222 ASSERT(CCProxy::isImplThread()); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 | 383 |
| 384 const char* CCVideoLayerImpl::layerTypeAsString() const | 384 const char* CCVideoLayerImpl::layerTypeAsString() const |
| 385 { | 385 { |
| 386 return "VideoLayer"; | 386 return "VideoLayer"; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } | 389 } |
| 390 | 390 |
| 391 #endif // USE(ACCELERATED_COMPOSITING) | 391 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |