Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: cc/quads/checkerboard_draw_quad.cc

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/quads/checkerboard_draw_quad.h ('k') | cc/quads/content_draw_quad_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/quads/checkerboard_draw_quad.h" 5 #include "cc/quads/checkerboard_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0) {} 12 CheckerboardDrawQuad::CheckerboardDrawQuad() : color(0) {}
13 13
14 scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::Create() { 14 scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::Create() {
15 return make_scoped_ptr(new CheckerboardDrawQuad); 15 return make_scoped_ptr(new CheckerboardDrawQuad);
16 } 16 }
17 17
18 void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 18 void CheckerboardDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
19 gfx::Rect rect, 19 const gfx::Rect& rect,
20 SkColor color) { 20 SkColor color) {
21 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect(); 21 gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
22 gfx::Rect visible_rect = rect; 22 gfx::Rect visible_rect = rect;
23 bool needs_blending = false; 23 bool needs_blending = false;
24 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect, 24 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
25 visible_rect, needs_blending); 25 visible_rect, needs_blending);
26 this->color = color; 26 this->color = color;
27 } 27 }
28 28
29 void CheckerboardDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 29 void CheckerboardDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
30 gfx::Rect rect, 30 const gfx::Rect& rect,
31 gfx::Rect opaque_rect, 31 const gfx::Rect& opaque_rect,
32 gfx::Rect visible_rect, 32 const gfx::Rect& visible_rect,
33 bool needs_blending, 33 bool needs_blending,
34 SkColor color) { 34 SkColor color) {
35 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect, 35 DrawQuad::SetAll(shared_quad_state, DrawQuad::CHECKERBOARD, rect, opaque_rect,
36 visible_rect, needs_blending); 36 visible_rect, needs_blending);
37 this->color = color; 37 this->color = color;
38 } 38 }
39 39
40 void CheckerboardDrawQuad::IterateResources( 40 void CheckerboardDrawQuad::IterateResources(
41 const ResourceIteratorCallback& callback) {} 41 const ResourceIteratorCallback& callback) {}
42 42
43 const CheckerboardDrawQuad* CheckerboardDrawQuad::MaterialCast( 43 const CheckerboardDrawQuad* CheckerboardDrawQuad::MaterialCast(
44 const DrawQuad* quad) { 44 const DrawQuad* quad) {
45 DCHECK(quad->material == DrawQuad::CHECKERBOARD); 45 DCHECK(quad->material == DrawQuad::CHECKERBOARD);
46 return static_cast<const CheckerboardDrawQuad*>(quad); 46 return static_cast<const CheckerboardDrawQuad*>(quad);
47 } 47 }
48 48
49 void CheckerboardDrawQuad::ExtendValue(base::DictionaryValue* value) const { 49 void CheckerboardDrawQuad::ExtendValue(base::DictionaryValue* value) const {
50 value->SetInteger("color", color); 50 value->SetInteger("color", color);
51 } 51 }
52 52
53 } // namespace cc 53 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/checkerboard_draw_quad.h ('k') | cc/quads/content_draw_quad_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698