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"
11 SolidColorDrawQuad::SolidColorDrawQuad()
12 : color(0), force_anti_aliasing_off(false) {}
14 scoped_ptr
<SolidColorDrawQuad
> SolidColorDrawQuad::Create() {
15 return make_scoped_ptr(new SolidColorDrawQuad
);
18 void SolidColorDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
21 bool force_anti_aliasing_off
) {
22 gfx::Rect opaque_rect
= SkColorGetA(color
) == 255 ? rect
: gfx::Rect();
23 gfx::Rect visible_rect
= rect
;
24 bool needs_blending
= false;
25 DrawQuad::SetAll(shared_quad_state
, DrawQuad::SOLID_COLOR
, rect
, opaque_rect
,
26 visible_rect
, needs_blending
);
28 this->force_anti_aliasing_off
= force_anti_aliasing_off
;
31 void SolidColorDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
33 gfx::Rect opaque_rect
,
34 gfx::Rect visible_rect
,
37 bool force_anti_aliasing_off
) {
38 DrawQuad::SetAll(shared_quad_state
, DrawQuad::SOLID_COLOR
, rect
, opaque_rect
,
39 visible_rect
, needs_blending
);
41 this->force_anti_aliasing_off
= force_anti_aliasing_off
;
44 void SolidColorDrawQuad::IterateResources(
45 const ResourceIteratorCallback
& callback
) {}
47 const SolidColorDrawQuad
* SolidColorDrawQuad::MaterialCast(
48 const DrawQuad
* quad
) {
49 DCHECK(quad
->material
== DrawQuad::SOLID_COLOR
);
50 return static_cast<const SolidColorDrawQuad
*>(quad
);