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

Side by Side Diff: cc/video_layer_impl.cc

Issue 11774005: Migrate more functions from MathUtil to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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
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_impl.h" 9 #include "cc/layer_tree_impl.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
11 #include "cc/quad_sink.h" 11 #include "cc/quad_sink.h"
12 #include "cc/renderer.h" 12 #include "cc/renderer.h"
13 #include "cc/resource_provider.h" 13 #include "cc/resource_provider.h"
14 #include "cc/stream_video_draw_quad.h" 14 #include "cc/stream_video_draw_quad.h"
15 #include "cc/texture_draw_quad.h" 15 #include "cc/texture_draw_quad.h"
16 #include "cc/yuv_video_draw_quad.h" 16 #include "cc/yuv_video_draw_quad.h"
17 #include "media/filters/skcanvas_video_renderer.h" 17 #include "media/filters/skcanvas_video_renderer.h"
18 #include "third_party/khronos/GLES2/gl2.h" 18 #include "third_party/khronos/GLES2/gl2.h"
19 #include "third_party/khronos/GLES2/gl2ext.h" 19 #include "third_party/khronos/GLES2/gl2ext.h"
20 #include "ui/gfx/transform_util.h"
20 21
21 namespace cc { 22 namespace cc {
22 23
23 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, WebKit::WebVideo FrameProvider* provider, 24 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, WebKit::WebVideo FrameProvider* provider,
24 const FrameUnwrapper& unwrapper) 25 const FrameUnwrapper& unwrapper)
25 : LayerImpl(treeImpl, id) 26 : LayerImpl(treeImpl, id)
26 , m_provider(provider) 27 , m_provider(provider)
27 , m_unwrapper(unwrapper) 28 , m_unwrapper(unwrapper)
28 , m_webFrame(0) 29 , m_webFrame(0)
29 , m_frame(0) 30 , m_frame(0)
30 , m_format(GL_INVALID_VALUE) 31 , m_format(GL_INVALID_VALUE)
31 , m_convertYUV(false) 32 , m_convertYUV(false)
32 , m_externalTextureResource(0) 33 , m_externalTextureResource(0)
33 { 34 {
34 // This matrix is the default transformation for stream textures, and flips on the Y axis. 35 // This matrix is the default transformation for stream textures, and flips on the Y axis.
35 m_streamTextureMatrix = MathUtil::createGfxTransform( 36 m_streamTextureMatrix = gfx::CreateGfxTransform(
36 1, 0, 0, 0, 37 1, 0, 0, 0,
37 0, -1, 0, 0, 38 0, -1, 0, 0,
38 0, 0, 1, 0, 39 0, 0, 1, 0,
39 0, 1, 0, 1); 40 0, 1, 0, 1);
40 41
41 // This only happens during a commit on the compositor thread while the main 42 // This only happens during a commit on the compositor thread while the main
42 // thread is blocked. That makes this a thread-safe call to set the video 43 // thread is blocked. That makes this a thread-safe call to set the video
43 // frame provider client that does not require a lock. The same is true of 44 // frame provider client that does not require a lock. The same is true of
44 // the call in the destructor. 45 // the call in the destructor.
45 m_provider->setVideoFrameProviderClient(this); 46 m_provider->setVideoFrameProviderClient(this);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 m_framePlanes[i].freeData(resourceProvider); 399 m_framePlanes[i].freeData(resourceProvider);
399 } 400 }
400 401
401 void VideoLayerImpl::didReceiveFrame() 402 void VideoLayerImpl::didReceiveFrame()
402 { 403 {
403 setNeedsRedraw(); 404 setNeedsRedraw();
404 } 405 }
405 406
406 void VideoLayerImpl::didUpdateMatrix(const float matrix[16]) 407 void VideoLayerImpl::didUpdateMatrix(const float matrix[16])
407 { 408 {
408 m_streamTextureMatrix = MathUtil::createGfxTransform( 409 m_streamTextureMatrix = gfx::CreateGfxTransform(
409 matrix[0], matrix[1], matrix[2], matrix[3], 410 matrix[0], matrix[1], matrix[2], matrix[3],
410 matrix[4], matrix[5], matrix[6], matrix[7], 411 matrix[4], matrix[5], matrix[6], matrix[7],
411 matrix[8], matrix[9], matrix[10], matrix[11], 412 matrix[8], matrix[9], matrix[10], matrix[11],
412 matrix[12], matrix[13], matrix[14], matrix[15]); 413 matrix[12], matrix[13], matrix[14], matrix[15]);
413 setNeedsRedraw(); 414 setNeedsRedraw();
414 } 415 }
415 416
416 void VideoLayerImpl::didLoseOutputSurface() 417 void VideoLayerImpl::didLoseOutputSurface()
417 { 418 {
418 freePlaneData(layerTreeImpl()->resource_provider()); 419 freePlaneData(layerTreeImpl()->resource_provider());
419 } 420 }
420 421
421 void VideoLayerImpl::setNeedsRedraw() 422 void VideoLayerImpl::setNeedsRedraw()
422 { 423 {
423 layerTreeImpl()->SetNeedsRedraw(); 424 layerTreeImpl()->SetNeedsRedraw();
424 } 425 }
425 426
426 const char* VideoLayerImpl::layerTypeAsString() const 427 const char* VideoLayerImpl::layerTypeAsString() const
427 { 428 {
428 return "VideoLayer"; 429 return "VideoLayer";
429 } 430 }
430 431
431 } // namespace cc 432 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698