1 // Copyright 2013 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 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/resources/picture_pile_impl.h"
10 #include "cc/test/fake_content_layer_client.h"
14 class FakePicturePileImpl : public PicturePileImpl {
16 static scoped_refptr<FakePicturePileImpl> CreateFilledPile(
18 gfx::Size layer_bounds);
20 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile(
22 gfx::Size layer_bounds);
24 static scoped_refptr<FakePicturePileImpl> CreatePile();
26 TilingData& tiling() { return tiling_; }
28 void AddRecordingAt(int x, int y);
29 void RemoveRecordingAt(int x, int y);
32 void add_draw_rect(const gfx::RectF& rect) {
33 client_.add_draw_rect(rect, default_paint_);
36 void add_draw_bitmap(const SkBitmap& bitmap, gfx::Point point) {
37 client_.add_draw_bitmap(bitmap, point, default_paint_);
40 void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) {
41 client_.add_draw_rect(rect, paint);
44 void add_draw_bitmap_with_paint(const SkBitmap& bitmap,
46 const SkPaint& paint) {
47 client_.add_draw_bitmap(bitmap, point, paint);
50 void set_default_paint(const SkPaint& paint) {
51 default_paint_ = paint;
54 void set_background_color(SkColor color) {
55 background_color_ = color;
58 void set_contents_opaque(bool contents_opaque) {
59 contents_opaque_ = contents_opaque;
62 void set_clear_canvas_with_debug_color(bool clear) {
63 clear_canvas_with_debug_color_ = clear;
67 FakePicturePileImpl();
68 virtual ~FakePicturePileImpl();
70 FakeContentLayerClient client_;
71 SkPaint default_paint_;
76 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_