RenderText: handle center-aligned text in UpdateCachedBoundsAndOffset()
[chromium-blink-merge.git] / cc / quads / checkerboard_draw_quad.cc
blobb6c5f826a6a98fcacda36b9570c20d96161d36d8
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/logging.h"
8 #include "base/values.h"
10 namespace cc {
12 CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0) {}
14 void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
15 const gfx::Rect& rect,
16 const gfx::Rect& visible_rect,
17 SkColor color) {
18 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
19 bool needs_blending = false;
20 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
21 visible_rect, needs_blending);
22 this->color = color;
25 void CheckerboardDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
26 const gfx::Rect& rect,
27 const gfx::Rect& opaque_rect,
28 const gfx::Rect& visible_rect,
29 bool needs_blending,
30 SkColor color) {
31 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
32 visible_rect, needs_blending);
33 this->color = color;
36 void CheckerboardDrawQuad::IterateResources(
37 const ResourceIteratorCallback& callback) {}
39 const CheckerboardDrawQuad* CheckerboardDrawQuad::MaterialCast(
40 const DrawQuad* quad) {
41 DCHECK(quad->material == DrawQuad::CHECKERBOARD);
42 return static_cast<const CheckerboardDrawQuad*>(quad);
45 void CheckerboardDrawQuad::ExtendValue(base::DictionaryValue* value) const {
46 value->SetInteger("color", color);
49 } // namespace cc