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

Side by Side Diff: cc/test/fake_content_layer_client.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/test/fake_content_layer_client.h ('k') | cc/test/fake_layer_tree_host_impl_client.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/test/fake_content_layer_client.h" 5 #include "cc/test/fake_content_layer_client.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h" 8 #include "ui/gfx/skia_util.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 FakeContentLayerClient::FakeContentLayerClient() 12 FakeContentLayerClient::FakeContentLayerClient()
13 : paint_all_opaque_(false) { 13 : paint_all_opaque_(false) {
14 } 14 }
15 15
16 FakeContentLayerClient::~FakeContentLayerClient() { 16 FakeContentLayerClient::~FakeContentLayerClient() {
17 } 17 }
18 18
19 void FakeContentLayerClient::PaintContents(SkCanvas* canvas, 19 void FakeContentLayerClient::PaintContents(SkCanvas* canvas,
20 gfx::Rect paint_rect, gfx::RectF* opaque_rect) { 20 const gfx::Rect& paint_rect, gfx::RectF* opaque_rect) {
21 if (paint_all_opaque_) 21 if (paint_all_opaque_)
22 *opaque_rect = paint_rect; 22 *opaque_rect = paint_rect;
23 23
24 canvas->clipRect(gfx::RectToSkRect(paint_rect)); 24 canvas->clipRect(gfx::RectToSkRect(paint_rect));
25 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 25 for (RectPaintVector::const_iterator it = draw_rects_.begin();
26 it != draw_rects_.end(); ++it) { 26 it != draw_rects_.end(); ++it) {
27 const gfx::RectF& draw_rect = it->first; 27 const gfx::RectF& draw_rect = it->first;
28 const SkPaint& paint = it->second; 28 const SkPaint& paint = it->second;
29 canvas->drawRectCoords(draw_rect.x(), 29 canvas->drawRectCoords(draw_rect.x(),
30 draw_rect.y(), 30 draw_rect.y(),
31 draw_rect.right(), 31 draw_rect.right(),
32 draw_rect.bottom(), 32 draw_rect.bottom(),
33 paint); 33 paint);
34 } 34 }
35 35
36 for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); 36 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
37 it != draw_bitmaps_.end(); ++it) { 37 it != draw_bitmaps_.end(); ++it) {
38 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); 38 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint);
39 } 39 }
40 } 40 }
41 41
42 } // namespace cc 42 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698