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

Side by Side Diff: cc/playback/display_item_list_unittest.cc

Issue 2090203002: Remove antialiasing from views bounds rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: std::max is bad apparently Created 4 years, 6 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/playback/clip_display_item.cc ('k') | cc/playback/largest_display_item.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/playback/display_item_list.h" 5 #include "cc/playback/display_item_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 scoped_refptr<DisplayItemList> list = 136 scoped_refptr<DisplayItemList> list =
137 DisplayItemList::Create(gfx::Rect(layer_size), settings); 137 DisplayItemList::Create(gfx::Rect(layer_size), settings);
138 138
139 // Build the DrawingDisplayItem. 139 // Build the DrawingDisplayItem.
140 AppendFirstSerializationTestPicture(list, layer_size); 140 AppendFirstSerializationTestPicture(list, layer_size);
141 141
142 // Build the ClipDisplayItem. 142 // Build the ClipDisplayItem.
143 gfx::Rect clip_rect(6, 6, 1, 1); 143 gfx::Rect clip_rect(6, 6, 1, 1);
144 std::vector<SkRRect> rrects; 144 std::vector<SkRRect> rrects;
145 rrects.push_back(SkRRect::MakeOval(SkRect::MakeXYWH(5.f, 5.f, 4.f, 4.f))); 145 rrects.push_back(SkRRect::MakeOval(SkRect::MakeXYWH(5.f, 5.f, 4.f, 4.f)));
146 list->CreateAndAppendItem<ClipDisplayItem>(kVisualRect, clip_rect, rrects); 146 list->CreateAndAppendItem<ClipDisplayItem>(kVisualRect, clip_rect, rrects,
147 true);
147 148
148 // Build the second DrawingDisplayItem. 149 // Build the second DrawingDisplayItem.
149 AppendSecondSerializationTestPicture(list, layer_size); 150 AppendSecondSerializationTestPicture(list, layer_size);
150 151
151 // Build the EndClipDisplayItem. 152 // Build the EndClipDisplayItem.
152 list->CreateAndAppendItem<EndClipDisplayItem>(kVisualRect); 153 list->CreateAndAppendItem<EndClipDisplayItem>(kVisualRect);
153 154
154 ValidateDisplayItemListSerialization(layer_size, list); 155 ValidateDisplayItemListSerialization(layer_size, list);
155 } 156 }
156 157
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 gfx::RectF first_recording_rect(first_offset, gfx::SizeF(layer_rect.size())); 313 gfx::RectF first_recording_rect(first_offset, gfx::SizeF(layer_rect.size()));
313 canvas = sk_ref_sp( 314 canvas = sk_ref_sp(
314 recorder.beginRecording(gfx::RectFToSkRect(first_recording_rect))); 315 recorder.beginRecording(gfx::RectFToSkRect(first_recording_rect)));
315 canvas->translate(first_offset.x(), first_offset.y()); 316 canvas->translate(first_offset.x(), first_offset.y());
316 canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); 317 canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint);
317 list->CreateAndAppendItem<DrawingDisplayItem>( 318 list->CreateAndAppendItem<DrawingDisplayItem>(
318 kVisualRect, recorder.finishRecordingAsPicture()); 319 kVisualRect, recorder.finishRecordingAsPicture());
319 320
320 gfx::Rect clip_rect(60, 60, 10, 10); 321 gfx::Rect clip_rect(60, 60, 10, 10);
321 list->CreateAndAppendItem<ClipDisplayItem>(kVisualRect, clip_rect, 322 list->CreateAndAppendItem<ClipDisplayItem>(kVisualRect, clip_rect,
322 std::vector<SkRRect>()); 323 std::vector<SkRRect>(), true);
323 324
324 gfx::PointF second_offset(2.f, 3.f); 325 gfx::PointF second_offset(2.f, 3.f);
325 gfx::RectF second_recording_rect(second_offset, 326 gfx::RectF second_recording_rect(second_offset,
326 gfx::SizeF(layer_rect.size())); 327 gfx::SizeF(layer_rect.size()));
327 canvas = sk_ref_sp( 328 canvas = sk_ref_sp(
328 recorder.beginRecording(gfx::RectFToSkRect(second_recording_rect))); 329 recorder.beginRecording(gfx::RectFToSkRect(second_recording_rect)));
329 canvas->translate(second_offset.x(), second_offset.y()); 330 canvas->translate(second_offset.x(), second_offset.y());
330 canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); 331 canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint);
331 list->CreateAndAppendItem<DrawingDisplayItem>( 332 list->CreateAndAppendItem<DrawingDisplayItem>(
332 kVisualRect, recorder.finishRecordingAsPicture()); 333 kVisualRect, recorder.finishRecordingAsPicture());
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 628
628 value = list->AsValue(false)->ToString(); 629 value = list->AsValue(false)->ToString();
629 EXPECT_EQ(value.find("\"items\":"), std::string::npos); 630 EXPECT_EQ(value.find("\"items\":"), std::string::npos);
630 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos); 631 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos);
631 // There should be no skp64 entry present as the items aren't included and the 632 // There should be no skp64 entry present as the items aren't included and the
632 // layer rect is empty. 633 // layer rect is empty.
633 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos); 634 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos);
634 } 635 }
635 636
636 } // namespace cc 637 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/clip_display_item.cc ('k') | cc/playback/largest_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698