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

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

Issue 903273002: Update from https://crrev.com/315085 (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_content_layer_client.h ('k') | cc/test/fake_layer_tree_host_client.h » ('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 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 #include "cc/test/fake_content_layer_client.h" 5 #include "cc/test/fake_content_layer_client.h"
6 6
7 #include "cc/resources/clip_display_item.h" 7 #include "cc/resources/clip_display_item.h"
8 #include "cc/resources/drawing_display_item.h" 8 #include "cc/resources/drawing_display_item.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPictureRecorder.h" 10 #include "third_party/skia/include/core/SkPictureRecorder.h"
11 #include "ui/gfx/skia_util.h" 11 #include "ui/gfx/skia_util.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 FakeContentLayerClient::FakeContentLayerClient() 15 FakeContentLayerClient::FakeContentLayerClient()
16 : fill_with_nonsolid_color_(false), last_canvas_(NULL) { 16 : fill_with_nonsolid_color_(false), last_canvas_(NULL) {
17 } 17 }
18 18
19 FakeContentLayerClient::~FakeContentLayerClient() { 19 FakeContentLayerClient::~FakeContentLayerClient() {
20 } 20 }
21 21
22 void FakeContentLayerClient::PaintContents( 22 void FakeContentLayerClient::PaintContents(
23 SkCanvas* canvas, 23 SkCanvas* canvas,
24 const gfx::Rect& paint_rect, 24 const gfx::Rect& paint_rect,
25 ContentLayerClient::GraphicsContextStatus gc_status) { 25 PaintingControlSetting painting_control) {
26 last_canvas_ = canvas; 26 last_canvas_ = canvas;
27 last_context_status_ = gc_status; 27 last_painting_control_ = painting_control;
28 28
29 canvas->clipRect(gfx::RectToSkRect(paint_rect)); 29 canvas->clipRect(gfx::RectToSkRect(paint_rect));
30 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 30 for (RectPaintVector::const_iterator it = draw_rects_.begin();
31 it != draw_rects_.end(); ++it) { 31 it != draw_rects_.end(); ++it) {
32 const gfx::RectF& draw_rect = it->first; 32 const gfx::RectF& draw_rect = it->first;
33 const SkPaint& paint = it->second; 33 const SkPaint& paint = it->second;
34 canvas->drawRectCoords(draw_rect.x(), 34 canvas->drawRectCoords(draw_rect.x(),
35 draw_rect.y(), 35 draw_rect.y(),
36 draw_rect.right(), 36 draw_rect.right(),
37 draw_rect.bottom(), 37 draw_rect.bottom(),
(...skipping 13 matching lines...) Expand all
51 paint.setColor(red ? SK_ColorRED : SK_ColorBLUE); 51 paint.setColor(red ? SK_ColorRED : SK_ColorBLUE);
52 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); 52 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint);
53 draw_rect.Inset(1, 1); 53 draw_rect.Inset(1, 1);
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 scoped_refptr<DisplayItemList> 58 scoped_refptr<DisplayItemList>
59 FakeContentLayerClient::PaintContentsToDisplayList( 59 FakeContentLayerClient::PaintContentsToDisplayList(
60 const gfx::Rect& clip, 60 const gfx::Rect& clip,
61 GraphicsContextStatus gc_status) { 61 PaintingControlSetting painting_control) {
62 SkPictureRecorder recorder; 62 SkPictureRecorder recorder;
63 skia::RefPtr<SkCanvas> canvas; 63 skia::RefPtr<SkCanvas> canvas;
64 skia::RefPtr<SkPicture> picture; 64 skia::RefPtr<SkPicture> picture;
65 scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); 65 scoped_refptr<DisplayItemList> list = DisplayItemList::Create();
66 list->AppendItem(ClipDisplayItem::Create(clip, std::vector<SkRRect>())); 66 list->AppendItem(ClipDisplayItem::Create(clip, std::vector<SkRRect>()));
67 67
68 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 68 for (RectPaintVector::const_iterator it = draw_rects_.begin();
69 it != draw_rects_.end(); ++it) { 69 it != draw_rects_.end(); ++it) {
70 const gfx::RectF& draw_rect = it->first; 70 const gfx::RectF& draw_rect = it->first;
71 const SkPaint& paint = it->second; 71 const SkPaint& paint = it->second;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 } 104 }
105 105
106 list->AppendItem(EndClipDisplayItem::Create()); 106 list->AppendItem(EndClipDisplayItem::Create());
107 return list; 107 return list;
108 } 108 }
109 109
110 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 110 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
111 111
112 } // namespace cc 112 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698