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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (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/data/blue.png ('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"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
72 canvas = 72 canvas = skia::SharePtr(
73 skia::SharePtr(recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); 73 recorder.beginRecording(draw_rect.width(), draw_rect.height()));
74 canvas->drawRectCoords(0.f, 0.f, draw_rect.width(), draw_rect.height(), 74 canvas->drawRectCoords(0.f, 0.f, draw_rect.width(), draw_rect.height(),
75 paint); 75 paint);
76 picture = skia::AdoptRef(recorder.endRecording()); 76 picture = skia::AdoptRef(recorder.endRecording());
77 list->AppendItem(DrawingDisplayItem::Create(picture)); 77 list->AppendItem(DrawingDisplayItem::Create(
78 picture, gfx::PointF(draw_rect.x(), draw_rect.y())));
78 } 79 }
79 80
80 for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); 81 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
81 it != draw_bitmaps_.end(); ++it) { 82 it != draw_bitmaps_.end(); ++it) {
82 canvas = skia::SharePtr( 83 canvas = skia::SharePtr(
83 recorder.beginRecording(it->bitmap.width(), it->bitmap.height())); 84 recorder.beginRecording(it->bitmap.width(), it->bitmap.height()));
84 canvas->drawBitmap(it->bitmap, 0.f, 0.f, &it->paint); 85 canvas->drawBitmap(it->bitmap, 0.f, 0.f, &it->paint);
85 picture = skia::AdoptRef(recorder.endRecording()); 86 picture = skia::AdoptRef(recorder.endRecording());
86 list->AppendItem(DrawingDisplayItem::Create(picture)); 87 list->AppendItem(DrawingDisplayItem::Create(
88 picture, gfx::PointF(it->point.x(), it->point.y())));
87 } 89 }
88 90
89 if (fill_with_nonsolid_color_) { 91 if (fill_with_nonsolid_color_) {
90 gfx::RectF draw_rect = clip; 92 gfx::RectF draw_rect = clip;
91 bool red = true; 93 bool red = true;
92 while (!draw_rect.IsEmpty()) { 94 while (!draw_rect.IsEmpty()) {
93 SkPaint paint; 95 SkPaint paint;
94 paint.setColor(red ? SK_ColorRED : SK_ColorBLUE); 96 paint.setColor(red ? SK_ColorRED : SK_ColorBLUE);
95 canvas = skia::SharePtr( 97 canvas =
96 recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); 98 skia::SharePtr(recorder.beginRecording(clip.width(), clip.height()));
97 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); 99 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint);
98 picture = skia::AdoptRef(recorder.endRecording()); 100 picture = skia::AdoptRef(recorder.endRecording());
99 list->AppendItem(DrawingDisplayItem::Create(picture)); 101 list->AppendItem(DrawingDisplayItem::Create(picture, gfx::PointF()));
100 draw_rect.Inset(1, 1); 102 draw_rect.Inset(1, 1);
101 } 103 }
102 } 104 }
103 105
104 list->AppendItem(EndClipDisplayItem::Create()); 106 list->AppendItem(EndClipDisplayItem::Create());
105 return list; 107 return list;
106 } 108 }
107 109
108 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 110 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
109 111
110 } // namespace cc 112 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/data/blue.png ('k') | cc/test/fake_layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698