1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/quads/checkerboard_draw_quad.h"
7 #include "base/debug/trace_event_argument.h"
8 #include "base/logging.h"
9 #include "base/values.h"
13 CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0) {}
15 void CheckerboardDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
16 const gfx::Rect
& rect
,
17 const gfx::Rect
& visible_rect
,
19 gfx::Rect opaque_rect
= SkColorGetA(color
) == 255 ? rect
: gfx::Rect();
20 bool needs_blending
= false;
21 DrawQuad::SetAll(shared_quad_state
, DrawQuad::CHECKERBOARD
, rect
, opaque_rect
,
22 visible_rect
, needs_blending
);
26 void CheckerboardDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
27 const gfx::Rect
& rect
,
28 const gfx::Rect
& opaque_rect
,
29 const gfx::Rect
& visible_rect
,
32 DrawQuad::SetAll(shared_quad_state
, DrawQuad::CHECKERBOARD
, rect
, opaque_rect
,
33 visible_rect
, needs_blending
);
37 void CheckerboardDrawQuad::IterateResources(
38 const ResourceIteratorCallback
& callback
) {}
40 const CheckerboardDrawQuad
* CheckerboardDrawQuad::MaterialCast(
41 const DrawQuad
* quad
) {
42 DCHECK(quad
->material
== DrawQuad::CHECKERBOARD
);
43 return static_cast<const CheckerboardDrawQuad
*>(quad
);
46 void CheckerboardDrawQuad::ExtendValue(base::debug::TracedValue
* value
) const {
47 value
->SetInteger("color", color
);