summaryrefslogtreecommitdiffstats
path: root/cc/yuv_video_draw_quad.cc
blob: 2bff6c276d387757310676887f0544fc6803ed5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/yuv_video_draw_quad.h"

#include "base/logging.h"

namespace cc {

scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::create(
    const SharedQuadState* sharedQuadState,
    const gfx::Rect& quadRect,
    const gfx::Rect& opaqueRect,
    const gfx::SizeF& texScale,
    const VideoLayerImpl::FramePlane& yPlane,
    const VideoLayerImpl::FramePlane& uPlane,
    const VideoLayerImpl::FramePlane& vPlane)
{
    return make_scoped_ptr(new YUVVideoDrawQuad(sharedQuadState,
                                                quadRect, opaqueRect, texScale,
                                                yPlane, uPlane, vPlane));
}

YUVVideoDrawQuad::YUVVideoDrawQuad(
    const SharedQuadState* sharedQuadState,
    const gfx::Rect& quadRect,
    const gfx::Rect& opaqueRect,
    const gfx::SizeF& texScale,
    const VideoLayerImpl::FramePlane& yPlane,
    const VideoLayerImpl::FramePlane& uPlane,
    const VideoLayerImpl::FramePlane& vPlane)
    : DrawQuad(sharedQuadState, DrawQuad::YUV_VIDEO_CONTENT, quadRect, opaqueRect)
    , m_texScale(texScale)
    , m_yPlane(yPlane)
    , m_uPlane(uPlane)
    , m_vPlane(vPlane)
{
}

YUVVideoDrawQuad::~YUVVideoDrawQuad()
{
}

const YUVVideoDrawQuad* YUVVideoDrawQuad::materialCast(const DrawQuad* quad)
{
    DCHECK(quad->material() == DrawQuad::YUV_VIDEO_CONTENT);
    return static_cast<const YUVVideoDrawQuad*>(quad);
}

}  // namespace cc