Roll WebRTC 8220:8247, Libjingle 8221:8245
[chromium-blink-merge.git] / cc / quads / solid_color_draw_quad.cc
blob8b856e0150559b9dde6363cd226e65c2b4c22549
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/trace_event/trace_event_argument.h"
9 #include "base/values.h"
11 namespace cc {
13 SolidColorDrawQuad::SolidColorDrawQuad()
14 : color(0), force_anti_aliasing_off(false) {}
16 void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
17 const gfx::Rect& rect,
18 const gfx::Rect& visible_rect,
19 SkColor color,
20 bool force_anti_aliasing_off) {
21 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
22 bool needs_blending = false;
23 DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
24 visible_rect, needs_blending);
25 this->color = color;
26 this->force_anti_aliasing_off = force_anti_aliasing_off;
29 void SolidColorDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
30 const gfx::Rect& rect,
31 const gfx::Rect& opaque_rect,
32 const gfx::Rect& visible_rect,
33 bool needs_blending,
34 SkColor color,
35 bool force_anti_aliasing_off) {
36 DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
37 visible_rect, needs_blending);
38 this->color = color;
39 this->force_anti_aliasing_off = force_anti_aliasing_off;
42 void SolidColorDrawQuad::IterateResources(
43 const ResourceIteratorCallback& callback) {}
45 const SolidColorDrawQuad* SolidColorDrawQuad::MaterialCast(
46 const DrawQuad* quad) {
47 DCHECK(quad->material == DrawQuad::SOLID_COLOR);
48 return static_cast<const SolidColorDrawQuad*>(quad);
51 void SolidColorDrawQuad::ExtendValue(base::debug::TracedValue* value) const {
52 value->SetInteger("color", color);
53 value->SetBoolean("force_anti_aliasing_off", force_anti_aliasing_off);
56 } // namespace cc