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

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: Converted constructors to row-major input 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"
(...skipping 11 matching lines...) Expand all
22 22
23 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, VideoFrameProvid er* provider) 23 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, VideoFrameProvid er* provider)
24 : LayerImpl(treeImpl, id) 24 : LayerImpl(treeImpl, id)
25 , m_provider(provider) 25 , m_provider(provider)
26 , m_frame(0) 26 , m_frame(0)
27 , m_format(GL_INVALID_VALUE) 27 , m_format(GL_INVALID_VALUE)
28 , m_convertYUV(false) 28 , m_convertYUV(false)
29 , m_externalTextureResource(0) 29 , m_externalTextureResource(0)
30 { 30 {
31 // This matrix is the default transformation for stream textures, and flips on the Y axis. 31 // This matrix is the default transformation for stream textures, and flips on the Y axis.
32 m_streamTextureMatrix = MathUtil::createGfxTransform( 32 m_streamTextureMatrix = gfx::Transform(
33 1, 0, 0, 0, 33 1, 0, 0, 0,
danakj 2013/01/11 04:14:12 nit: here too, .0 suffixes
34 0, -1, 0, 0, 34 0, -1, 0, 1,
35 0, 0, 1, 0, 35 0, 0, 1, 0,
36 0, 1, 0, 1); 36 0, 0, 0, 1);
37 37
38 // This only happens during a commit on the compositor thread while the main 38 // This only happens during a commit on the compositor thread while the main
39 // thread is blocked. That makes this a thread-safe call to set the video 39 // thread is blocked. That makes this a thread-safe call to set the video
40 // frame provider client that does not require a lock. The same is true of 40 // frame provider client that does not require a lock. The same is true of
41 // the call in the destructor. 41 // the call in the destructor.
42 m_provider->SetVideoFrameProviderClient(this); 42 m_provider->SetVideoFrameProviderClient(this);
43 } 43 }
44 44
45 VideoLayerImpl::~VideoLayerImpl() 45 VideoLayerImpl::~VideoLayerImpl()
46 { 46 {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 m_framePlanes[i].freeData(resourceProvider); 394 m_framePlanes[i].freeData(resourceProvider);
395 } 395 }
396 396
397 void VideoLayerImpl::DidReceiveFrame() 397 void VideoLayerImpl::DidReceiveFrame()
398 { 398 {
399 setNeedsRedraw(); 399 setNeedsRedraw();
400 } 400 }
401 401
402 void VideoLayerImpl::DidUpdateMatrix(const float matrix[16]) 402 void VideoLayerImpl::DidUpdateMatrix(const float matrix[16])
403 { 403 {
404 m_streamTextureMatrix = MathUtil::createGfxTransform( 404 m_streamTextureMatrix = gfx::Transform(
405 matrix[0], matrix[1], matrix[2], matrix[3], 405 matrix[0], matrix[4], matrix[8], matrix[12],
406 matrix[4], matrix[5], matrix[6], matrix[7], 406 matrix[1], matrix[5], matrix[9], matrix[13],
407 matrix[8], matrix[9], matrix[10], matrix[11], 407 matrix[2], matrix[6], matrix[10], matrix[14],
408 matrix[12], matrix[13], matrix[14], matrix[15]); 408 matrix[3], matrix[7], matrix[11], matrix[15]);
409 setNeedsRedraw(); 409 setNeedsRedraw();
410 } 410 }
411 411
412 void VideoLayerImpl::didLoseOutputSurface() 412 void VideoLayerImpl::didLoseOutputSurface()
413 { 413 {
414 freePlaneData(layerTreeImpl()->resource_provider()); 414 freePlaneData(layerTreeImpl()->resource_provider());
415 } 415 }
416 416
417 void VideoLayerImpl::setNeedsRedraw() 417 void VideoLayerImpl::setNeedsRedraw()
418 { 418 {
419 layerTreeImpl()->SetNeedsRedraw(); 419 layerTreeImpl()->SetNeedsRedraw();
420 } 420 }
421 421
422 const char* VideoLayerImpl::layerTypeAsString() const 422 const char* VideoLayerImpl::layerTypeAsString() const
423 { 423 {
424 return "VideoLayer"; 424 return "VideoLayer";
425 } 425 }
426 426
427 } // namespace cc 427 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698