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
3 // found in the LICENSE file.
5 #include "cc/test/fake_content_layer_client.h"
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h"
12 FakeContentLayerClient::FakeContentLayerClient()
13 : paint_all_opaque_(false) {
16 FakeContentLayerClient::~FakeContentLayerClient() {
19 void FakeContentLayerClient::PaintContents(SkCanvas
* canvas
,
20 gfx::Rect paint_rect
, gfx::RectF
* opaque_rect
) {
21 if (paint_all_opaque_
)
22 *opaque_rect
= paint_rect
;
24 canvas
->clipRect(gfx::RectToSkRect(paint_rect
));
25 for (RectPaintVector::const_iterator it
= draw_rects_
.begin();
26 it
!= draw_rects_
.end(); ++it
) {
27 const gfx::RectF
& draw_rect
= it
->first
;
28 const SkPaint
& paint
= it
->second
;
29 canvas
->drawRectCoords(draw_rect
.x(),
36 for (BitmapVector::const_iterator it
= draw_bitmaps_
.begin();
37 it
!= draw_bitmaps_
.end(); ++it
) {
38 canvas
->drawBitmap(it
->first
, it
->second
.x(), it
->second
.y());