blob: c8e30218d56bebff90c4b3db810b1c58713b514c (
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
|
// 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/checkerboard_draw_quad.h"
#include "base/logging.h"
namespace cc {
scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, SkColor color)
{
return make_scoped_ptr(new CheckerboardDrawQuad(sharedQuadState, quadRect, color));
}
CheckerboardDrawQuad::CheckerboardDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, SkColor color)
: DrawQuad(sharedQuadState, DrawQuad::CHECKERBOARD, quadRect, quadRect)
, m_color(color)
{
if (SkColorGetA(m_color) < 255)
m_opaqueRect = gfx::Rect();
}
const CheckerboardDrawQuad* CheckerboardDrawQuad::materialCast(const DrawQuad* quad)
{
DCHECK(quad->material() == DrawQuad::CHECKERBOARD);
return static_cast<const CheckerboardDrawQuad*>(quad);
}
} // namespace cc
|