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

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

Issue 1673193002: HBitmap can't be immutable Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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_CONTENT_LAYER_CLIENT_H_ 5 #ifndef CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_
6 #define CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_ 6 #define CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
14 #include "cc/layers/content_layer_client.h" 16 #include "cc/layers/content_layer_client.h"
15 #include "third_party/skia/include/core/SkPaint.h" 17 #include "third_party/skia/include/core/SkPaint.h"
16 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/rect_f.h" 19 #include "ui/gfx/geometry/rect_f.h"
18 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
19 21
20 class SkImage; 22 class SkImage;
21 23
22 namespace cc { 24 namespace cc {
23 25
26 class FakeOnPaintDelegate {
27 public:
28 FakeOnPaintDelegate() {}
29 virtual ~FakeOnPaintDelegate() {}
30 virtual void OnPaint(SkCanvas* canvas,
31 const gfx::Rect& invalidation) = 0;
32 private:
33 DISALLOW_COPY_AND_ASSIGN(FakeOnPaintDelegate);
34 };
35
24 class FakeContentLayerClient : public ContentLayerClient { 36 class FakeContentLayerClient : public ContentLayerClient {
25 public: 37 public:
26 struct ImageData { 38 struct ImageData {
27 ImageData(const SkImage* image, 39 ImageData(const SkImage* image,
28 const gfx::Point& point, 40 const gfx::Point& point,
29 const SkPaint& paint); 41 const SkPaint& paint);
30 ImageData(const SkImage* image, 42 ImageData(const SkImage* image,
31 const gfx::Transform& transform, 43 const gfx::Transform& transform,
32 const SkPaint& paint); 44 const SkPaint& paint);
33 ~ImageData(); 45 ~ImageData();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 96
85 void set_reported_memory_usage(size_t reported_memory_usage) { 97 void set_reported_memory_usage(size_t reported_memory_usage) {
86 reported_memory_usage_ = reported_memory_usage; 98 reported_memory_usage_ = reported_memory_usage;
87 } 99 }
88 100
89 void set_bounds(gfx::Size bounds) { 101 void set_bounds(gfx::Size bounds) {
90 bounds_ = bounds; 102 bounds_ = bounds;
91 bounds_set_ = true; 103 bounds_set_ = true;
92 } 104 }
93 105
106 void set_on_paint_delegate(scoped_ptr<FakeOnPaintDelegate> delegate) {
107 delegate_ = std::move(delegate);
108 }
109
94 private: 110 private:
95 typedef std::vector<std::pair<gfx::RectF, SkPaint>> RectPaintVector; 111 typedef std::vector<std::pair<gfx::RectF, SkPaint>> RectPaintVector;
96 typedef std::vector<ImageData> ImageVector; 112 typedef std::vector<ImageData> ImageVector;
97 113
98 bool display_list_use_cached_picture_; 114 bool display_list_use_cached_picture_;
99 bool fill_with_nonsolid_color_; 115 bool fill_with_nonsolid_color_;
100 RectPaintVector draw_rects_; 116 RectPaintVector draw_rects_;
101 ImageVector draw_images_; 117 ImageVector draw_images_;
102 SkCanvas* last_canvas_; 118 SkCanvas* last_canvas_;
103 PaintingControlSetting last_painting_control_; 119 PaintingControlSetting last_painting_control_;
104 size_t reported_memory_usage_; 120 size_t reported_memory_usage_;
105 gfx::Size bounds_; 121 gfx::Size bounds_;
106 bool bounds_set_; 122 bool bounds_set_;
123 scoped_ptr<FakeOnPaintDelegate> delegate_;
107 }; 124 };
108 125
109 } // namespace cc 126 } // namespace cc
110 127
111 #endif // CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_ 128 #endif // CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_
OLDNEW
« no previous file with comments | « cc/playback/display_list_raster_source_unittest.cc ('k') | cc/test/fake_content_layer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698