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

Side by Side Diff: cc/paint/paint_op_buffer_unittest.cc

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all 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 unified diff | Download patch
« no previous file with comments | « cc/paint/paint_op_buffer.cc ('k') | cc/paint/paint_record.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/paint/paint_op_buffer.h" 5 #include "cc/paint/paint_op_buffer.h"
6 #include "cc/paint/display_item_list.h" 6 #include "cc/paint/display_item_list.h"
7 #include "cc/test/skia_common.h" 7 #include "cc/test/skia_common.h"
8 #include "cc/test/test_skcanvas.h" 8 #include "cc/test/test_skcanvas.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/effects/SkDashPathEffect.h" 10 #include "third_party/skia/include/effects/SkDashPathEffect.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 PaintImage image = PaintImage(PaintImage::GetNextId(), 422 PaintImage image = PaintImage(PaintImage::GetNextId(),
423 CreateDiscardableImage(gfx::Size(100, 100))); 423 CreateDiscardableImage(gfx::Size(100, 100)));
424 record->push<DrawImageOp>(image, SkIntToScalar(0), SkIntToScalar(0), nullptr); 424 record->push<DrawImageOp>(image, SkIntToScalar(0), SkIntToScalar(0), nullptr);
425 425
426 PaintOpBuffer buffer; 426 PaintOpBuffer buffer;
427 buffer.push<DrawRecordOp>(record); 427 buffer.push<DrawRecordOp>(record);
428 EXPECT_TRUE(buffer.HasDiscardableImages()); 428 EXPECT_TRUE(buffer.HasDiscardableImages());
429 429
430 scoped_refptr<DisplayItemList> list = new DisplayItemList; 430 scoped_refptr<DisplayItemList> list = new DisplayItemList;
431 list->CreateAndAppendDrawingItem<DrawingDisplayItem>( 431 list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
432 gfx::Rect(0, 0, 100, 100), record); 432 gfx::Rect(100, 100), record, SkRect::MakeWH(100, 100));
433 list->Finalize(); 433 list->Finalize();
434 PaintOpBuffer new_buffer; 434 PaintOpBuffer new_buffer;
435 new_buffer.push<DrawDisplayItemListOp>(list); 435 new_buffer.push<DrawDisplayItemListOp>(list);
436 EXPECT_TRUE(new_buffer.HasDiscardableImages()); 436 EXPECT_TRUE(new_buffer.HasDiscardableImages());
437 } 437 }
438 438
439 TEST(PaintOpBufferTest, DiscardableImagesTracking_OpWithFlags) { 439 TEST(PaintOpBufferTest, DiscardableImagesTracking_OpWithFlags) {
440 PaintOpBuffer buffer; 440 PaintOpBuffer buffer;
441 PaintFlags flags; 441 PaintFlags flags;
442 sk_sp<SkImage> image = CreateDiscardableImage(gfx::Size(100, 100)); 442 sk_sp<SkImage> image = CreateDiscardableImage(gfx::Size(100, 100));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 // Drawing a record with slow paths into another adds the same 491 // Drawing a record with slow paths into another adds the same
492 // number of slow paths as the record. 492 // number of slow paths as the record.
493 auto buffer2 = sk_make_sp<PaintOpBuffer>(); 493 auto buffer2 = sk_make_sp<PaintOpBuffer>();
494 EXPECT_EQ(buffer2->numSlowPaths(), 0); 494 EXPECT_EQ(buffer2->numSlowPaths(), 0);
495 buffer2->push<DrawRecordOp>(buffer); 495 buffer2->push<DrawRecordOp>(buffer);
496 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths()); 496 EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths());
497 } 497 }
498 498
499 } // namespace cc 499 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/paint_op_buffer.cc ('k') | cc/paint/paint_record.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698