summaryrefslogtreecommitdiffstats
path: root/cc/CCSolidColorDrawQuad.cpp
blob: 26f0d8a3f3518590e210ebaf5c508a416f22e877 (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 "config.h"

#include "CCSolidColorDrawQuad.h"

namespace WebCore {

PassOwnPtr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
{
    return adoptPtr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color));
}

CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
    : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect)
    , m_color(color)
{
    if (SkColorGetA(m_color) < 255)
        m_quadOpaque = false;
    else
        m_opaqueRect = quadRect;
}

const CCSolidColorDrawQuad* CCSolidColorDrawQuad::materialCast(const CCDrawQuad* quad)
{
    ASSERT(quad->material() == CCDrawQuad::SolidColor);
    return static_cast<const CCSolidColorDrawQuad*>(quad);
}

}