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

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

Issue 253013003: Enable disabling WebCore::GraphicsContext in telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 6 years, 7 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 | Annotate | Revision Log
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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "cc/layers/content_layer_client.h" 12 #include "cc/layers/content_layer_client.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "third_party/skia/include/core/SkPaint.h" 14 #include "third_party/skia/include/core/SkPaint.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 class FakeContentLayerClient : public ContentLayerClient { 19 class FakeContentLayerClient : public ContentLayerClient {
20 public: 20 public:
21 struct BitmapData { 21 struct BitmapData {
22 SkBitmap bitmap; 22 SkBitmap bitmap;
23 gfx::Point point; 23 gfx::Point point;
24 SkPaint paint; 24 SkPaint paint;
25 }; 25 };
26 26
27 FakeContentLayerClient(); 27 FakeContentLayerClient();
28 virtual ~FakeContentLayerClient(); 28 virtual ~FakeContentLayerClient();
29 29
30 virtual void PaintContents(SkCanvas* canvas, 30 virtual void PaintContents(
31 const gfx::Rect& rect, 31 SkCanvas* canvas,
32 gfx::RectF* opaque_rect) OVERRIDE; 32 const gfx::Rect& rect,
33 gfx::RectF* opaque_rect,
34 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE;
33 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} 35 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
34 virtual bool FillsBoundsCompletely() const OVERRIDE; 36 virtual bool FillsBoundsCompletely() const OVERRIDE;
35 37
36 void set_paint_all_opaque(bool opaque) { paint_all_opaque_ = opaque; } 38 void set_paint_all_opaque(bool opaque) { paint_all_opaque_ = opaque; }
37 39
38 void add_draw_rect(const gfx::RectF& rect, const SkPaint& paint) { 40 void add_draw_rect(const gfx::RectF& rect, const SkPaint& paint) {
39 draw_rects_.push_back(std::make_pair(rect, paint)); 41 draw_rects_.push_back(std::make_pair(rect, paint));
40 } 42 }
41 43
42 void add_draw_bitmap(const SkBitmap& bitmap, 44 void add_draw_bitmap(const SkBitmap& bitmap,
43 const gfx::Point& point, 45 const gfx::Point& point,
44 const SkPaint& paint) { 46 const SkPaint& paint) {
45 BitmapData data; 47 BitmapData data;
46 data.bitmap = bitmap; 48 data.bitmap = bitmap;
47 data.point = point; 49 data.point = point;
48 data.paint = paint; 50 data.paint = paint;
49 draw_bitmaps_.push_back(data); 51 draw_bitmaps_.push_back(data);
50 } 52 }
51 53
52 SkCanvas* last_canvas() const { return last_canvas_; } 54 SkCanvas* last_canvas() const { return last_canvas_; }
53 55
56 ContentLayerClient::GraphicsContextStatus last_context_status() const {
57 return last_context_status_;
58 }
59
54 private: 60 private:
55 typedef std::vector<std::pair<gfx::RectF, SkPaint> > RectPaintVector; 61 typedef std::vector<std::pair<gfx::RectF, SkPaint> > RectPaintVector;
56 typedef std::vector<BitmapData> BitmapVector; 62 typedef std::vector<BitmapData> BitmapVector;
57 63
58 bool paint_all_opaque_; 64 bool paint_all_opaque_;
59 RectPaintVector draw_rects_; 65 RectPaintVector draw_rects_;
60 BitmapVector draw_bitmaps_; 66 BitmapVector draw_bitmaps_;
61 SkCanvas* last_canvas_; 67 SkCanvas* last_canvas_;
68 ContentLayerClient::GraphicsContextStatus last_context_status_;
62 }; 69 };
63 70
64 } // namespace cc 71 } // namespace cc
65 72
66 #endif // CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_ 73 #endif // CC_TEST_FAKE_CONTENT_LAYER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698