Make chrome.power sample extension work across updates.
[chromium-blink-merge.git] / cc / quads / checkerboard_draw_quad.cc
blob1451766645211e220decb8b907b2c14633116025
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"
11 namespace cc {
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,
18 SkColor color) {
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);
23 this->color = color;
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,
30 bool needs_blending,
31 SkColor color) {
32 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
33 visible_rect, needs_blending);
34 this->color = color;
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);
50 } // namespace cc