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), last_canvas_(NULL
) {}
15 FakeContentLayerClient::~FakeContentLayerClient() {
18 void FakeContentLayerClient::PaintContents(SkCanvas
* canvas
,
19 const gfx::Rect
& paint_rect
, gfx::RectF
* opaque_rect
) {
20 last_canvas_
= canvas
;
24 if (paint_all_opaque_
)
25 *opaque_rect
= paint_rect
;
27 canvas
->clipRect(gfx::RectToSkRect(paint_rect
));
28 for (RectPaintVector::const_iterator it
= draw_rects_
.begin();
29 it
!= draw_rects_
.end(); ++it
) {
30 const gfx::RectF
& draw_rect
= it
->first
;
31 const SkPaint
& paint
= it
->second
;
32 canvas
->drawRectCoords(draw_rect
.x(),
39 for (BitmapVector::const_iterator it
= draw_bitmaps_
.begin();
40 it
!= draw_bitmaps_
.end(); ++it
) {
41 canvas
->drawBitmap(it
->bitmap
, it
->point
.x(), it
->point
.y(), &it
->paint
);
45 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }