RenderText: handle center-aligned text in UpdateCachedBoundsAndOffset()
[chromium-blink-merge.git] / cc / quads / debug_border_draw_quad.cc
blob4254e02f8488fbc2a194f08fd82a5903931c26ee
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/debug_border_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/values.h"
10 namespace cc {
12 DebugBorderDrawQuad::DebugBorderDrawQuad()
13 : color(0),
14 width(0) {
17 void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
18 const gfx::Rect& rect,
19 const gfx::Rect& visible_rect,
20 SkColor color,
21 int width) {
22 gfx::Rect opaque_rect;
23 bool needs_blending = SkColorGetA(color) < 255;
24 DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect,
25 visible_rect, needs_blending);
26 this->color = color;
27 this->width = width;
30 void DebugBorderDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
31 const gfx::Rect& rect,
32 const gfx::Rect& opaque_rect,
33 const gfx::Rect& visible_rect,
34 bool needs_blending,
35 SkColor color,
36 int width) {
37 DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect,
38 visible_rect, needs_blending);
39 this->color = color;
40 this->width = width;
43 void DebugBorderDrawQuad::IterateResources(
44 const ResourceIteratorCallback& callback) {}
46 const DebugBorderDrawQuad* DebugBorderDrawQuad::MaterialCast(
47 const DrawQuad* quad) {
48 DCHECK(quad->material == DrawQuad::DEBUG_BORDER);
49 return static_cast<const DebugBorderDrawQuad*>(quad);
52 void DebugBorderDrawQuad::ExtendValue(base::DictionaryValue* value) const {
53 value->SetInteger("color", color);
54 value->SetInteger("width", width);
57 } // namespace cc