Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: cc/video_layer_impl.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/video_layer_impl.h ('k') | content/common/cc_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_host_impl.h" 9 #include "cc/layer_tree_host_impl.h"
10 #include "cc/math_util.h"
10 #include "cc/quad_sink.h" 11 #include "cc/quad_sink.h"
11 #include "cc/resource_provider.h" 12 #include "cc/resource_provider.h"
12 #include "cc/stream_video_draw_quad.h" 13 #include "cc/stream_video_draw_quad.h"
13 #include "cc/texture_draw_quad.h" 14 #include "cc/texture_draw_quad.h"
14 #include "cc/yuv_video_draw_quad.h" 15 #include "cc/yuv_video_draw_quad.h"
15 #include "media/filters/skcanvas_video_renderer.h" 16 #include "media/filters/skcanvas_video_renderer.h"
16 #include "third_party/khronos/GLES2/gl2.h" 17 #include "third_party/khronos/GLES2/gl2.h"
17 #include "third_party/khronos/GLES2/gl2ext.h" 18 #include "third_party/khronos/GLES2/gl2ext.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
21 VideoLayerImpl::VideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provider, 22 VideoLayerImpl::VideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provider,
22 const FrameUnwrapper& unwrapper) 23 const FrameUnwrapper& unwrapper)
23 : LayerImpl(id) 24 : LayerImpl(id)
24 , m_provider(provider) 25 , m_provider(provider)
25 , m_unwrapper(unwrapper) 26 , m_unwrapper(unwrapper)
26 , m_webFrame(0) 27 , m_webFrame(0)
27 , m_frame(0) 28 , m_frame(0)
28 , m_format(GL_INVALID_VALUE) 29 , m_format(GL_INVALID_VALUE)
29 , m_convertYUV(false) 30 , m_convertYUV(false)
30 , m_externalTextureResource(0) 31 , m_externalTextureResource(0)
31 { 32 {
32 // This matrix is the default transformation for stream textures, and flips on the Y axis. 33 // This matrix is the default transformation for stream textures, and flips on the Y axis.
33 m_streamTextureMatrix = WebKit::WebTransformationMatrix( 34 m_streamTextureMatrix = MathUtil::createGfxTransform(
34 1, 0, 0, 0, 35 1, 0, 0, 0,
35 0, -1, 0, 0, 36 0, -1, 0, 0,
36 0, 0, 1, 0, 37 0, 0, 1, 0,
37 0, 1, 0, 1); 38 0, 1, 0, 1);
38 39
39 // This only happens during a commit on the compositor thread while the main 40 // This only happens during a commit on the compositor thread while the main
40 // thread is blocked. That makes this a thread-safe call to set the video 41 // thread is blocked. That makes this a thread-safe call to set the video
41 // frame provider client that does not require a lock. The same is true of 42 // frame provider client that does not require a lock. The same is true of
42 // the call in the destructor. 43 // the call in the destructor.
43 m_provider->setVideoFrameProviderClient(this); 44 m_provider->setVideoFrameProviderClient(this);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 246 }
246 case GL_TEXTURE_RECTANGLE_ARB: { 247 case GL_TEXTURE_RECTANGLE_ARB: {
247 gfx::Size visibleSize(visibleRect.width(), visibleRect.height()); 248 gfx::Size visibleSize(visibleRect.width(), visibleRect.height());
248 scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::Create( ); 249 scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::Create( );
249 ioSurfaceQuad->SetNew(sharedQuadState, quadRect, opaqueRect, visibleSize , m_frame->texture_id(), IOSurfaceDrawQuad::UNFLIPPED); 250 ioSurfaceQuad->SetNew(sharedQuadState, quadRect, opaqueRect, visibleSize , m_frame->texture_id(), IOSurfaceDrawQuad::UNFLIPPED);
250 quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData); 251 quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData);
251 break; 252 break;
252 } 253 }
253 case GL_TEXTURE_EXTERNAL_OES: { 254 case GL_TEXTURE_EXTERNAL_OES: {
254 // StreamTexture hardware decoder. 255 // StreamTexture hardware decoder.
255 WebKit::WebTransformationMatrix transform(m_streamTextureMatrix); 256 gfx::Transform transform(m_streamTextureMatrix);
256 transform.scaleNonUniform(texWidthScale, texHeightScale); 257 transform.Scale(texWidthScale, texHeightScale);
257 scoped_ptr<StreamVideoDrawQuad> streamVideoQuad = StreamVideoDrawQuad::C reate(); 258 scoped_ptr<StreamVideoDrawQuad> streamVideoQuad = StreamVideoDrawQuad::C reate();
258 streamVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, m_frame-> texture_id(), transform); 259 streamVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, m_frame-> texture_id(), transform);
259 quadSink.append(streamVideoQuad.PassAs<DrawQuad>(), appendQuadsData); 260 quadSink.append(streamVideoQuad.PassAs<DrawQuad>(), appendQuadsData);
260 break; 261 break;
261 } 262 }
262 default: 263 default:
263 NOTREACHED(); // Someone updated convertVFCFormatToGLenum above but upd ate this! 264 NOTREACHED(); // Someone updated convertVFCFormatToGLenum above but upd ate this!
264 break; 265 break;
265 } 266 }
266 } 267 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 m_framePlanes[i].freeData(resourceProvider); 395 m_framePlanes[i].freeData(resourceProvider);
395 } 396 }
396 397
397 void VideoLayerImpl::didReceiveFrame() 398 void VideoLayerImpl::didReceiveFrame()
398 { 399 {
399 setNeedsRedraw(); 400 setNeedsRedraw();
400 } 401 }
401 402
402 void VideoLayerImpl::didUpdateMatrix(const float matrix[16]) 403 void VideoLayerImpl::didUpdateMatrix(const float matrix[16])
403 { 404 {
404 m_streamTextureMatrix = WebKit::WebTransformationMatrix( 405 m_streamTextureMatrix = MathUtil::createGfxTransform(
405 matrix[0], matrix[1], matrix[2], matrix[3], 406 matrix[0], matrix[1], matrix[2], matrix[3],
406 matrix[4], matrix[5], matrix[6], matrix[7], 407 matrix[4], matrix[5], matrix[6], matrix[7],
407 matrix[8], matrix[9], matrix[10], matrix[11], 408 matrix[8], matrix[9], matrix[10], matrix[11],
408 matrix[12], matrix[13], matrix[14], matrix[15]); 409 matrix[12], matrix[13], matrix[14], matrix[15]);
409 setNeedsRedraw(); 410 setNeedsRedraw();
410 } 411 }
411 412
412 void VideoLayerImpl::didLoseContext() 413 void VideoLayerImpl::didLoseContext()
413 { 414 {
414 freePlaneData(layerTreeHostImpl()->resourceProvider()); 415 freePlaneData(layerTreeHostImpl()->resourceProvider());
415 } 416 }
416 417
417 void VideoLayerImpl::setNeedsRedraw() 418 void VideoLayerImpl::setNeedsRedraw()
418 { 419 {
419 layerTreeHostImpl()->setNeedsRedraw(); 420 layerTreeHostImpl()->setNeedsRedraw();
420 } 421 }
421 422
422 const char* VideoLayerImpl::layerTypeAsString() const 423 const char* VideoLayerImpl::layerTypeAsString() const
423 { 424 {
424 return "VideoLayer"; 425 return "VideoLayer";
425 } 426 }
426 427
427 } // namespace cc 428 } // namespace cc
OLDNEW
« no previous file with comments | « cc/video_layer_impl.h ('k') | content/common/cc_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698