RenderText: handle center-aligned text in UpdateCachedBoundsAndOffset()
[chromium-blink-merge.git] / cc / quads / solid_color_draw_quad.cc
blob333ee17872eaae801a4780acde55e0c594b7fd0e
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/solid_color_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/values.h"
10 namespace cc {
12 SolidColorDrawQuad::SolidColorDrawQuad()
13 : color(0), force_anti_aliasing_off(false) {}
15 void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
16 const gfx::Rect& rect,
17 const gfx::Rect& visible_rect,
18 SkColor color,
19 bool force_anti_aliasing_off) {
20 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
21 bool needs_blending = false;
22 DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
23 visible_rect, needs_blending);
24 this->color = color;
25 this->force_anti_aliasing_off = force_anti_aliasing_off;
28 void SolidColorDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
29 const gfx::Rect& rect,
30 const gfx::Rect& opaque_rect,
31 const gfx::Rect& visible_rect,
32 bool needs_blending,
33 SkColor color,
34 bool force_anti_aliasing_off) {
35 DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
36 visible_rect, needs_blending);
37 this->color = color;
38 this->force_anti_aliasing_off = force_anti_aliasing_off;
41 void SolidColorDrawQuad::IterateResources(
42 const ResourceIteratorCallback& callback) {}
44 const SolidColorDrawQuad* SolidColorDrawQuad::MaterialCast(
45 const DrawQuad* quad) {
46 DCHECK(quad->material == DrawQuad::SOLID_COLOR);
47 return static_cast<const SolidColorDrawQuad*>(quad);
50 void SolidColorDrawQuad::ExtendValue(base::DictionaryValue* value) const {
51 value->SetInteger("color", color);
52 value->SetBoolean("force_anti_aliasing_off", force_anti_aliasing_off);
55 } // namespace cc