blob: 1b35ecfcad70228bcb02a7ec2247effe79a5f391 [file] [log] [blame]
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +01001// 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.
4
5#ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
6#define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
7
8#include "base/memory/ref_counted.h"
9#include "cc/resources/picture_pile_impl.h"
10#include "cc/test/fake_content_layer_client.h"
11
12namespace cc {
13
14class FakePicturePileImpl : public PicturePileImpl {
15 public:
16 static scoped_refptr<FakePicturePileImpl> CreateFilledPile(
17 gfx::Size tile_size,
18 gfx::Size layer_bounds);
19
20 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile(
21 gfx::Size tile_size,
22 gfx::Size layer_bounds);
23
Ben Murdochbb1529c2013-08-08 10:24:53 +010024 static scoped_refptr<FakePicturePileImpl> CreatePile();
25
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010026 TilingData& tiling() { return tiling_; }
27
28 void AddRecordingAt(int x, int y);
29 void RemoveRecordingAt(int x, int y);
30 void RerecordPile();
31
32 void AddPictureToRecording(
33 int x,
34 int y,
35 scoped_refptr<Picture> picture);
36
37 void add_draw_rect(const gfx::RectF& rect) {
38 client_.add_draw_rect(rect, default_paint_);
39 }
40
41 void add_draw_bitmap(const SkBitmap& bitmap, gfx::Point point) {
42 client_.add_draw_bitmap(bitmap, point);
43 }
44
45 void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) {
46 client_.add_draw_rect(rect, paint);
47 }
48
49 void set_default_paint(const SkPaint& paint) {
50 default_paint_ = paint;
51 }
52
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010053 void set_background_color(SkColor color) {
54 background_color_ = color;
55 }
56
57 void set_contents_opaque(bool contents_opaque) {
58 contents_opaque_ = contents_opaque;
59 }
60
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010061 protected:
62 FakePicturePileImpl();
63 virtual ~FakePicturePileImpl();
64
65 FakeContentLayerClient client_;
66 SkPaint default_paint_;
67};
68
69} // namespace cc
70
71#endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_