| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/debug_border_draw_quad.h" | 5 #include "cc/debug_border_draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::create(const SharedQuadStat
e* sharedQuadState, const gfx::Rect& quadRect, SkColor color, int width) | 11 DebugBorderDrawQuad::DebugBorderDrawQuad() |
| 12 { | 12 : color(0), |
| 13 return make_scoped_ptr(new DebugBorderDrawQuad(sharedQuadState, quadRect, co
lor, width)); | 13 width(0) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 DebugBorderDrawQuad::DebugBorderDrawQuad(const SharedQuadState* sharedQuadState,
const gfx::Rect& quadRect, SkColor color, int width) | 16 scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::Create() { |
| 17 : m_color(color) | 17 return make_scoped_ptr(new DebugBorderDrawQuad); |
| 18 , m_width(width) | |
| 19 { | |
| 20 gfx::Rect opaqueRect; | |
| 21 gfx::Rect visibleRect = quadRect; | |
| 22 bool needsBlending = SkColorGetA(m_color) < 255; | |
| 23 DrawQuad::SetAll(sharedQuadState, DrawQuad::DEBUG_BORDER, quadRect, opaqueRe
ct, visibleRect, needsBlending); | |
| 24 } | 18 } |
| 25 | 19 |
| 26 const DebugBorderDrawQuad* DebugBorderDrawQuad::materialCast(const DrawQuad* qua
d) | 20 void DebugBorderDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 27 { | 21 gfx::Rect rect, |
| 28 DCHECK(quad->material == DrawQuad::DEBUG_BORDER); | 22 SkColor color, |
| 29 return static_cast<const DebugBorderDrawQuad*>(quad); | 23 int width) { |
| 24 gfx::Rect opaque_rect; |
| 25 gfx::Rect visible_rect = rect; |
| 26 bool needs_blending = SkColorGetA(color) < 255; |
| 27 DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect, |
| 28 visible_rect, needs_blending); |
| 29 this->color = color; |
| 30 this->width = width; |
| 31 } |
| 32 |
| 33 void DebugBorderDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 34 gfx::Rect rect, |
| 35 gfx::Rect opaque_rect, |
| 36 gfx::Rect visible_rect, |
| 37 bool needs_blending, |
| 38 SkColor color, |
| 39 int width) { |
| 40 DrawQuad::SetAll(shared_quad_state, DrawQuad::DEBUG_BORDER, rect, opaque_rect, |
| 41 visible_rect, needs_blending); |
| 42 this->color = color; |
| 43 this->width = width; |
| 44 } |
| 45 |
| 46 const DebugBorderDrawQuad* DebugBorderDrawQuad::MaterialCast( |
| 47 const DrawQuad* quad) { |
| 48 DCHECK(quad->material == DrawQuad::DEBUG_BORDER); |
| 49 return static_cast<const DebugBorderDrawQuad*>(quad); |
| 30 } | 50 } |
| 31 | 51 |
| 32 } // namespace cc | 52 } // namespace cc |
| OLD | NEW |