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

Unified Diff: cc/paint/display_item_list_unittest.cc

Issue 2894843002: Revert of Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: rebase TestExpectations Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/paint/display_item_list.cc ('k') | cc/paint/drawing_display_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/display_item_list_unittest.cc
diff --git a/cc/paint/display_item_list_unittest.cc b/cc/paint/display_item_list_unittest.cc
index e4682f3bc56f03b16dce2bf78dad0364b6a51979..9e91c7464f18cf574cd44af1c08df778ae6a6c9c 100644
--- a/cc/paint/display_item_list_unittest.cc
+++ b/cc/paint/display_item_list_unittest.cc
@@ -102,13 +102,12 @@ void AppendFirstSerializationTestPicture(scoped_refptr<DisplayItemList> list,
PaintFlags red_paint;
red_paint.setColor(SK_ColorRED);
- SkRect bounds = SkRect::MakeXYWH(offset.x(), offset.y(), layer_size.width(),
- layer_size.height());
- PaintCanvas* canvas = recorder.beginRecording(bounds);
+ PaintCanvas* canvas = recorder.beginRecording(SkRect::MakeXYWH(
+ offset.x(), offset.y(), layer_size.width(), layer_size.height()));
canvas->translate(offset.x(), offset.y());
canvas->drawRect(SkRect::MakeWH(4, 4), red_paint);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(), bounds);
+ kVisualRect, recorder.finishRecordingAsPicture());
}
} // namespace
@@ -131,8 +130,7 @@ TEST(DisplayItemListTest, SingleDrawingItem) {
canvas->drawRect(SkRect::MakeLTRB(0.f, 0.f, 60.f, 60.f), red_paint);
canvas->drawRect(SkRect::MakeLTRB(50.f, 50.f, 75.f, 75.f), blue_flags);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(),
- gfx::RectFToSkRect(recording_rect));
+ kVisualRect, recorder.finishRecordingAsPicture());
list->Finalize();
DrawDisplayList(pixels, layer_rect, list);
@@ -172,8 +170,7 @@ TEST(DisplayItemListTest, ClipItem) {
canvas->translate(first_offset.x(), first_offset.y());
canvas->drawRect(SkRect::MakeWH(60, 60), red_paint);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(),
- gfx::RectFToSkRect(first_recording_rect));
+ kVisualRect, recorder.finishRecordingAsPicture());
gfx::Rect clip_rect(60, 60, 10, 10);
list->CreateAndAppendPairedBeginItem<ClipDisplayItem>(
@@ -186,8 +183,7 @@ TEST(DisplayItemListTest, ClipItem) {
canvas->translate(second_offset.x(), second_offset.y());
canvas->drawRect(SkRect::MakeLTRB(50.f, 50.f, 75.f, 75.f), blue_flags);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(),
- gfx::RectFToSkRect(second_recording_rect));
+ kVisualRect, recorder.finishRecordingAsPicture());
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
list->Finalize();
@@ -231,8 +227,7 @@ TEST(DisplayItemListTest, TransformItem) {
canvas->translate(first_offset.x(), first_offset.y());
canvas->drawRect(SkRect::MakeWH(60, 60), red_paint);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(),
- gfx::RectFToSkRect(first_recording_rect));
+ kVisualRect, recorder.finishRecordingAsPicture());
gfx::Transform transform;
transform.Rotate(45.0);
@@ -245,8 +240,7 @@ TEST(DisplayItemListTest, TransformItem) {
canvas->translate(second_offset.x(), second_offset.y());
canvas->drawRect(SkRect::MakeLTRB(50.f, 50.f, 75.f, 75.f), blue_flags);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, recorder.finishRecordingAsPicture(),
- gfx::RectFToSkRect(second_recording_rect));
+ kVisualRect, recorder.finishRecordingAsPicture());
list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
list->Finalize();
@@ -309,16 +303,14 @@ TEST(DisplayItemListTest, FilterItem) {
PaintFlags red_paint;
red_paint.setColor(SK_ColorRED);
- SkRect bounds =
- SkRect::MakeXYWH(0, 0, layer_rect.width(), layer_rect.height());
- PaintCanvas* canvas = recorder.beginRecording(bounds);
+ PaintCanvas* canvas = recorder.beginRecording(
+ SkRect::MakeXYWH(0, 0, layer_rect.width(), layer_rect.height()));
canvas->drawRect(
SkRect::MakeLTRB(filter_bounds.x(), filter_bounds.y(),
filter_bounds.right(), filter_bounds.bottom()),
red_paint);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- ToNearestRect(filter_bounds), recorder.finishRecordingAsPicture(),
- bounds);
+ ToNearestRect(filter_bounds), recorder.finishRecordingAsPicture());
}
list->CreateAndAppendPairedEndItem<EndFilterDisplayItem>();
@@ -356,8 +348,7 @@ TEST(DisplayItemListTest, ApproximateMemoryUsage) {
ASSERT_GE(record_size, kNumCommandsInTestSkPicture * sizeof(SkRect));
auto list = make_scoped_refptr(new DisplayItemList);
- list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, record, gfx::RectToSkRect(layer_rect));
+ list->CreateAndAppendDrawingItem<DrawingDisplayItem>(kVisualRect, record);
list->Finalize();
memory_usage = list->ApproximateMemoryUsage();
EXPECT_GE(memory_usage, record_size);
@@ -417,8 +408,7 @@ TEST(DisplayItemListTest, SizeOne) {
auto list = make_scoped_refptr(new DisplayItemList);
gfx::Rect drawing_bounds(5, 6, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_bounds, CreateRectPicture(drawing_bounds),
- gfx::RectToSkRect(drawing_bounds));
+ drawing_bounds, CreateRectPicture(drawing_bounds));
EXPECT_EQ(1u, list->size());
}
@@ -438,8 +428,7 @@ TEST(DisplayItemListTest, AppendVisualRectSimple) {
gfx::Rect drawing_bounds(5, 6, 7, 8);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_bounds, CreateRectPicture(drawing_bounds),
- gfx::RectToSkRect(drawing_bounds));
+ drawing_bounds, CreateRectPicture(drawing_bounds));
EXPECT_EQ(1u, list->size());
EXPECT_RECT_EQ(drawing_bounds, list->VisualRectForTesting(0));
@@ -491,8 +480,7 @@ TEST(DisplayItemListTest, AppendVisualRectBlockContainingDrawing) {
gfx::Rect drawing_bounds(5, 6, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_bounds, CreateRectPicture(drawing_bounds),
- gfx::RectToSkRect(drawing_bounds));
+ drawing_bounds, CreateRectPicture(drawing_bounds));
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -513,8 +501,7 @@ TEST(DisplayItemListTest, AppendVisualRectBlockContainingEscapedDrawing) {
gfx::Rect drawing_bounds(1, 2, 3, 4);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_bounds, CreateRectPicture(drawing_bounds),
- gfx::RectToSkRect(drawing_bounds));
+ drawing_bounds, CreateRectPicture(drawing_bounds));
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -533,8 +520,7 @@ TEST(DisplayItemListTest,
gfx::Rect drawing_a_bounds(1, 2, 3, 4);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_a_bounds, CreateRectPicture(drawing_a_bounds),
- gfx::RectToSkRect(drawing_a_bounds));
+ drawing_a_bounds, CreateRectPicture(drawing_a_bounds));
gfx::Rect clip_bounds(5, 6, 7, 8);
list->CreateAndAppendPairedBeginItem<ClipDisplayItem>(
@@ -542,8 +528,7 @@ TEST(DisplayItemListTest,
gfx::Rect drawing_b_bounds(13, 14, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_b_bounds, CreateRectPicture(drawing_b_bounds),
- gfx::RectToSkRect(drawing_b_bounds));
+ drawing_b_bounds, CreateRectPicture(drawing_b_bounds));
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -565,15 +550,13 @@ TEST(DisplayItemListTest, AppendVisualRectTwoBlocksTwoDrawings) {
gfx::Rect drawing_a_bounds(5, 6, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_a_bounds, CreateRectPicture(drawing_a_bounds),
- gfx::RectToSkRect(drawing_a_bounds));
+ drawing_a_bounds, CreateRectPicture(drawing_a_bounds));
list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(gfx::Transform());
gfx::Rect drawing_b_bounds(7, 8, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_b_bounds, CreateRectPicture(drawing_b_bounds),
- gfx::RectToSkRect(drawing_b_bounds));
+ drawing_b_bounds, CreateRectPicture(drawing_b_bounds));
list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -602,15 +585,13 @@ TEST(DisplayItemListTest,
gfx::Rect drawing_a_bounds(5, 6, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_a_bounds, CreateRectPicture(drawing_a_bounds),
- gfx::RectToSkRect(drawing_a_bounds));
+ drawing_a_bounds, CreateRectPicture(drawing_a_bounds));
list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(gfx::Transform());
gfx::Rect drawing_b_bounds(1, 2, 3, 4);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_b_bounds, CreateRectPicture(drawing_b_bounds),
- gfx::RectToSkRect(drawing_b_bounds));
+ drawing_b_bounds, CreateRectPicture(drawing_b_bounds));
list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -639,15 +620,13 @@ TEST(DisplayItemListTest,
gfx::Rect drawing_a_bounds(1, 2, 3, 4);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_a_bounds, CreateRectPicture(drawing_a_bounds),
- gfx::RectToSkRect(drawing_a_bounds));
+ drawing_a_bounds, CreateRectPicture(drawing_a_bounds));
list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(gfx::Transform());
gfx::Rect drawing_b_bounds(7, 8, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_b_bounds, CreateRectPicture(drawing_b_bounds),
- gfx::RectToSkRect(drawing_b_bounds));
+ drawing_b_bounds, CreateRectPicture(drawing_b_bounds));
list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -676,15 +655,13 @@ TEST(DisplayItemListTest,
gfx::Rect drawing_a_bounds(13, 14, 1, 1);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_a_bounds, CreateRectPicture(drawing_a_bounds),
- gfx::RectToSkRect(drawing_a_bounds));
+ drawing_a_bounds, CreateRectPicture(drawing_a_bounds));
list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(gfx::Transform());
gfx::Rect drawing_b_bounds(1, 2, 3, 4);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- drawing_b_bounds, CreateRectPicture(drawing_b_bounds),
- gfx::RectToSkRect(drawing_b_bounds));
+ drawing_b_bounds, CreateRectPicture(drawing_b_bounds));
list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
list->CreateAndAppendPairedEndItem<EndClipDisplayItem>();
@@ -750,8 +727,7 @@ TEST(DisplayItemListTest, SaveDrawRestore) {
list->CreateAndAppendPairedBeginItem<CompositingDisplayItem>(
80, SkBlendMode::kSrcOver, nullptr, nullptr, false);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, CreateRectPictureWithAlpha(kVisualRect, 40),
- gfx::RectToSkRect(kVisualRect));
+ kVisualRect, CreateRectPictureWithAlpha(kVisualRect, 40));
list->CreateAndAppendPairedEndItem<EndCompositingDisplayItem>();
list->Finalize();
@@ -801,8 +777,7 @@ TEST(DisplayItemListTest, SaveDrawRestoreFail_BadSaveFlags) {
list->CreateAndAppendPairedBeginItem<CompositingDisplayItem>(
80, SkBlendMode::kSrc, nullptr, nullptr, false);
list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, CreateRectPictureWithAlpha(kVisualRect, 40),
- gfx::RectToSkRect(kVisualRect));
+ kVisualRect, CreateRectPictureWithAlpha(kVisualRect, 40));
list->CreateAndAppendPairedEndItem<EndCompositingDisplayItem>();
list->Finalize();
@@ -818,10 +793,10 @@ TEST(DisplayItemListTest, SaveDrawRestoreFail_BadSaveFlags) {
// The same as SaveDrawRestore, but with too many ops in the PaintRecord.
TEST(DisplayItemListTest, SaveDrawRestoreFail_TooManyOps) {
sk_sp<const PaintRecord> record;
- SkRect bounds = SkRect::MakeWH(kVisualRect.width(), kVisualRect.height());
{
PaintRecorder recorder;
- PaintCanvas* canvas = recorder.beginRecording(bounds);
+ PaintCanvas* canvas =
+ recorder.beginRecording(kVisualRect.width(), kVisualRect.height());
PaintFlags flags;
flags.setAlpha(40);
canvas->drawRect(gfx::RectToSkRect(kVisualRect), flags);
@@ -835,8 +810,8 @@ TEST(DisplayItemListTest, SaveDrawRestoreFail_TooManyOps) {
list->CreateAndAppendPairedBeginItem<CompositingDisplayItem>(
80, SkBlendMode::kSrcOver, nullptr, nullptr, false);
- list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
- kVisualRect, std::move(record), bounds);
+ list->CreateAndAppendDrawingItem<DrawingDisplayItem>(kVisualRect,
+ std::move(record));
list->CreateAndAppendPairedEndItem<EndCompositingDisplayItem>();
list->Finalize();
« no previous file with comments | « cc/paint/display_item_list.cc ('k') | cc/paint/drawing_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698