summaryrefslogtreecommitdiffstats
path: root/cc/debug_border_draw_quad.cc
blob: fd0f5b3662bf26f5d95e5afe487fcafe51ec4a2d (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
// 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 "CCDebugBorderDrawQuad.h"

#include "base/logging.h"

namespace cc {

scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::create(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
{
    return make_scoped_ptr(new DebugBorderDrawQuad(sharedQuadState, quadRect, color, width));
}

DebugBorderDrawQuad::DebugBorderDrawQuad(const SharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
    : DrawQuad(sharedQuadState, DrawQuad::DebugBorder, quadRect)
    , m_color(color)
    , m_width(width)
{
    m_quadOpaque = false;
    if (SkColorGetA(m_color) < 255)
        m_needsBlending = true;
}

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

}  // namespace cc