summaryrefslogtreecommitdiffstats
path: root/chromium/cc/quads/debug_border_draw_quad.cc
blob: 9c575aada199e09b928414849ec9f78c7a332a64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/quads/debug_border_draw_quad.h"

#include "base/logging.h"
#include "base/values.h"

namespace cc {

DebugBorderDrawQuad::DebugBorderDrawQuad()
    : color(0),
      width(0) {
}

scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::Create() {
  return make_scoped_ptr(new DebugBorderDrawQuad);
}

void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
                                 const gfx::Rect& rect,
                                 const gfx::Rect& visible_rect,
                                 SkColor color,
                                 int width) {
  gfx::Rect opaque_rect;
  bool needs_blending = SkColorGetA(color) < 255;
  DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect,
                   visible_rect, needs_blending);
  this->color = color;
  this->width = width;
}

void DebugBorderDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
                                 const gfx::Rect& rect,
                                 const gfx::Rect& opaque_rect,
                                 const gfx::Rect& visible_rect,
                                 bool needs_blending,
                                 SkColor color,
                                 int width) {
  DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect,
                   visible_rect, needs_blending);
  this->color = color;
  this->width = width;
}

void DebugBorderDrawQuad::IterateResources(
    const ResourceIteratorCallback& callback) {}

const DebugBorderDrawQuad* DebugBorderDrawQuad::MaterialCast(
    const DrawQuad* quad) {
  DCHECK(quad->material == DrawQuad::DEBUG_BORDER);
  return static_cast<const DebugBorderDrawQuad*>(quad);
}

void DebugBorderDrawQuad::ExtendValue(base::DictionaryValue* value) const {
  value->SetInteger("color", color);
  value->SetInteger("width", width);
}

}  // namespace cc