GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / cc / quads / checkerboard_draw_quad.cc
blobdb6ad1ea3569cf2a8370af7541093e3217d16146
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/trace_event/trace_event_argument.h"
9 #include "base/values.h"
11 namespace cc {
13 CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0), scale(0.f) {
16 void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
17 const gfx::Rect& rect,
18 const gfx::Rect& visible_rect,
19 SkColor color,
20 float scale) {
21 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
22 bool needs_blending = false;
23 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
24 visible_rect, needs_blending);
25 this->color = color;
26 this->scale = scale;
29 void CheckerboardDrawQuad::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 float scale) {
36 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
37 visible_rect, needs_blending);
38 this->color = color;
39 this->scale = scale;
42 void CheckerboardDrawQuad::IterateResources(
43 const ResourceIteratorCallback& callback) {}
45 const CheckerboardDrawQuad* CheckerboardDrawQuad::MaterialCast(
46 const DrawQuad* quad) {
47 DCHECK(quad->material == DrawQuad::CHECKERBOARD);
48 return static_cast<const CheckerboardDrawQuad*>(quad);
51 void CheckerboardDrawQuad::ExtendValue(
52 base::trace_event::TracedValue* value) const {
53 value->SetInteger("color", color);
54 value->SetDouble("scale", scale);
57 } // namespace cc