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/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 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 FakeContentLayerClient::FakeContentLayerClient() | 11 FakeContentLayerClient::FakeContentLayerClient() |
12 : paint_all_opaque_(false) { | 12 : paint_all_opaque_(false) { |
13 } | 13 } |
14 | 14 |
15 FakeContentLayerClient::~FakeContentLayerClient() { | 15 FakeContentLayerClient::~FakeContentLayerClient() { |
16 } | 16 } |
17 | 17 |
18 void FakeContentLayerClient::PaintContents(SkCanvas* canvas, | 18 void FakeContentLayerClient::PaintContents(SkCanvas* canvas, |
19 gfx::Rect rect, gfx::RectF* opaque_rect) { | 19 gfx::Rect rect, gfx::RectF* opaque_rect) { |
20 if (paint_all_opaque_) | 20 if (paint_all_opaque_) |
21 *opaque_rect = rect; | 21 *opaque_rect = rect; |
22 | 22 |
23 SkPaint paint; | 23 for (RectPaintVector::const_iterator it = draw_rects_.begin(); |
24 for (RectVector::const_iterator rect_it = draw_rects_.begin(); | 24 it < draw_rects_.end(); ++it) { |
25 rect_it < draw_rects_.end(); rect_it++) { | 25 gfx::Rect rect = it->first; |
26 SkRect draw_rect = SkRect::MakeXYWH(rect_it->x(), rect_it->y(), | 26 SkPaint paint = it->second; |
27 rect_it->width(), rect_it->height()); | 27 SkRect draw_rect = SkRect::MakeXYWH( |
| 28 rect.x(), |
| 29 rect.y(), |
| 30 rect.width(), |
| 31 rect.height()); |
28 canvas->drawRect(draw_rect, paint); | 32 canvas->drawRect(draw_rect, paint); |
29 } | 33 } |
30 } | 34 } |
31 | 35 |
32 } // namespace cc | 36 } // namespace cc |
OLD | NEW |