summaryrefslogtreecommitdiffstats
path: root/cc/io_surface_draw_quad.cc
blob: 35ab66e0a3e26ed0dffd4ab7655905df7198c9df (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
// 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/io_surface_draw_quad.h"

#include "base/logging.h"

namespace cc {

scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
{
    return make_scoped_ptr(new IOSurfaceDrawQuad(sharedQuadState, quadRect, opaqueRect, ioSurfaceSize, ioSurfaceTextureId, orientation));
}

IOSurfaceDrawQuad::IOSurfaceDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
    : m_ioSurfaceSize(ioSurfaceSize)
    , m_ioSurfaceTextureId(ioSurfaceTextureId)
    , m_orientation(orientation)
{
    gfx::Rect visibleRect = quadRect;
    bool needsBlending = false;
    DrawQuad::SetAll(sharedQuadState, DrawQuad::IO_SURFACE_CONTENT, quadRect, opaqueRect, visibleRect, needsBlending);
}

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

}  // namespace cc