Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: cc/test/fake_picture_pile_impl.h

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_picture_pile.cc ('k') | cc/test/fake_picture_pile_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ 5 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ 6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "cc/resources/picture_pile_impl.h" 9 #include "cc/resources/picture_pile_impl.h"
10 #include "cc/test/fake_content_layer_client.h" 10 #include "cc/test/fake_picture_pile.h"
11 11
12 namespace base { 12 namespace base {
13 class WaitableEvent; 13 class WaitableEvent;
14 } 14 }
15 15
16 namespace cc { 16 namespace cc {
17 17
18 class FakePicturePileImpl : public PicturePileImpl { 18 class FakePicturePileImpl : public PicturePileImpl {
19 public: 19 public:
20 static scoped_refptr<FakePicturePileImpl> CreatePile(
21 const gfx::Size& tile_size,
22 const gfx::Size& layer_bounds,
23 bool is_filled);
24
20 static scoped_refptr<FakePicturePileImpl> CreateFilledPileWithDefaultTileSize( 25 static scoped_refptr<FakePicturePileImpl> CreateFilledPileWithDefaultTileSize(
21 const gfx::Size& layer_bounds) { 26 const gfx::Size& layer_bounds) {
22 return CreateFilledPile(gfx::Size(512, 512), layer_bounds); 27 return CreateFilledPile(gfx::Size(512, 512), layer_bounds);
23 } 28 }
24 static scoped_refptr<FakePicturePileImpl> CreateEmptyPileWithDefaultTileSize( 29 static scoped_refptr<FakePicturePileImpl> CreateEmptyPileWithDefaultTileSize(
25 const gfx::Size& layer_bounds) { 30 const gfx::Size& layer_bounds) {
26 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds); 31 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds);
27 } 32 }
28 static scoped_refptr<FakePicturePileImpl> CreateFilledPile( 33 static scoped_refptr<FakePicturePileImpl> CreateFilledPile(
29 const gfx::Size& tile_size, 34 const gfx::Size& tile_size,
30 const gfx::Size& layer_bounds); 35 const gfx::Size& layer_bounds);
31 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile( 36 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile(
32 const gfx::Size& tile_size, 37 const gfx::Size& tile_size,
33 const gfx::Size& layer_bounds); 38 const gfx::Size& layer_bounds);
34 static scoped_refptr<FakePicturePileImpl> 39 static scoped_refptr<FakePicturePileImpl>
35 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size& tile_size, 40 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size& tile_size,
36 const gfx::Size& layer_bounds); 41 const gfx::Size& layer_bounds,
42 bool is_solid_color);
37 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile(); 43 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile();
38 static scoped_refptr<FakePicturePileImpl> CreateFromPile( 44 static scoped_refptr<FakePicturePileImpl> CreateFromPile(
39 const PicturePile* other, 45 const PicturePile* other,
40 base::WaitableEvent* playback_allowed_event); 46 base::WaitableEvent* playback_allowed_event);
41 47
42 // Hi-jack the PlaybackToCanvas method to delay its completion. 48 // Hi-jack the PlaybackToCanvas method to delay its completion.
43 void PlaybackToCanvas(SkCanvas* canvas, 49 void PlaybackToCanvas(SkCanvas* canvas,
44 const gfx::Rect& canvas_rect, 50 const gfx::Rect& canvas_rect,
45 float contents_scale) const override; 51 float contents_scale) const override;
46 52
47 TilingData& tiling() { return tiling_; } 53 const TilingData& tiling() { return tiling_; }
48
49 void AddRecordingAt(int x, int y);
50 void RemoveRecordingAt(int x, int y);
51 void RerecordPile();
52
53 void add_draw_rect(const gfx::RectF& rect) {
54 client_.add_draw_rect(rect, default_paint_);
55 }
56
57 void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) {
58 client_.add_draw_bitmap(bitmap, point, default_paint_);
59 }
60
61 void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) {
62 client_.add_draw_rect(rect, paint);
63 }
64
65 void add_draw_bitmap_with_paint(const SkBitmap& bitmap,
66 const gfx::Point& point,
67 const SkPaint& paint) {
68 client_.add_draw_bitmap(bitmap, point, paint);
69 }
70
71 void set_default_paint(const SkPaint& paint) {
72 default_paint_ = paint;
73 }
74
75 void set_background_color(SkColor color) {
76 background_color_ = color;
77 }
78
79 void set_clear_canvas_with_debug_color(bool clear) {
80 clear_canvas_with_debug_color_ = clear;
81 }
82
83 void set_is_solid_color(bool is_solid_color) {
84 is_solid_color_ = is_solid_color;
85 }
86 54
87 bool HasRecordingAt(int x, int y) const; 55 bool HasRecordingAt(int x, int y) const;
88
89 int num_tiles_x() const { return tiling_.num_tiles_x(); } 56 int num_tiles_x() const { return tiling_.num_tiles_x(); }
90 int num_tiles_y() const { return tiling_.num_tiles_y(); } 57 int num_tiles_y() const { return tiling_.num_tiles_y(); }
91 58
92 void SetMinContentsScale(float scale);
93 void SetBufferPixels(int new_buffer_pixels);
94 void Clear();
95
96 protected: 59 protected:
97 FakePicturePileImpl(); 60 FakePicturePileImpl();
98 FakePicturePileImpl(const PicturePile* other, 61 FakePicturePileImpl(const PicturePile* other,
99 base::WaitableEvent* playback_allowed_event); 62 base::WaitableEvent* playback_allowed_event);
100 ~FakePicturePileImpl() override; 63 ~FakePicturePileImpl() override;
101 64
102 FakeContentLayerClient client_;
103 SkPaint default_paint_;
104 base::WaitableEvent* playback_allowed_event_; 65 base::WaitableEvent* playback_allowed_event_;
105 gfx::Size tile_grid_size_; 66 gfx::Size tile_grid_size_;
106 }; 67 };
107 68
108 } // namespace cc 69 } // namespace cc
109 70
110 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ 71 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/test/fake_picture_pile.cc ('k') | cc/test/fake_picture_pile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698