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

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

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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 <vector> 7 #include <vector>
8 8
9 #include "cc/output/filter_operation.h" 9 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 10 #include "cc/output/filter_operations.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 TEST(DisplayItemListTest, ApproximateMemoryUsage) { 414 TEST(DisplayItemListTest, ApproximateMemoryUsage) {
415 const int kNumCommandsInTestSkPicture = 1000; 415 const int kNumCommandsInTestSkPicture = 1000;
416 scoped_refptr<DisplayItemList> list; 416 scoped_refptr<DisplayItemList> list;
417 size_t memory_usage; 417 size_t memory_usage;
418 418
419 // Make an SkPicture whose size is known. 419 // Make an SkPicture whose size is known.
420 gfx::Rect layer_rect(100, 100); 420 gfx::Rect layer_rect(100, 100);
421 SkPictureRecorder recorder; 421 SkPictureRecorder recorder;
422 SkPaint blue_paint; 422 SkPaint blue_paint;
423 blue_paint.setColor(SK_ColorBLUE); 423 blue_paint.setColor(SK_ColorBLUE);
424 SkCanvas* canvas = recorder.beginRecording(gfx::RectFToSkRect(layer_rect)); 424 SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(layer_rect));
425 for (int i = 0; i < kNumCommandsInTestSkPicture; i++) 425 for (int i = 0; i < kNumCommandsInTestSkPicture; i++)
426 canvas->drawPaint(blue_paint); 426 canvas->drawPaint(blue_paint);
427 skia::RefPtr<SkPicture> picture = 427 skia::RefPtr<SkPicture> picture =
428 skia::AdoptRef(recorder.endRecordingAsPicture()); 428 skia::AdoptRef(recorder.endRecordingAsPicture());
429 size_t picture_size = SkPictureUtils::ApproximateBytesUsed(picture.get()); 429 size_t picture_size = SkPictureUtils::ApproximateBytesUsed(picture.get());
430 ASSERT_GE(picture_size, kNumCommandsInTestSkPicture * sizeof(blue_paint)); 430 ASSERT_GE(picture_size, kNumCommandsInTestSkPicture * sizeof(blue_paint));
431 431
432 // Using a cached picture, we should get about the right size. 432 // Using a cached picture, we should get about the right size.
433 list = DisplayItemList::Create(layer_rect, true); 433 list = DisplayItemList::Create(layer_rect, true);
434 auto* item = list->CreateAndAppendItem<DrawingDisplayItem>(); 434 auto* item = list->CreateAndAppendItem<DrawingDisplayItem>();
(...skipping 19 matching lines...) Expand all
454 settings.use_cached_picture = true; 454 settings.use_cached_picture = true;
455 list = new DisplayItemList(layer_rect, settings, true); 455 list = new DisplayItemList(layer_rect, settings, true);
456 item = list->CreateAndAppendItem<DrawingDisplayItem>(); 456 item = list->CreateAndAppendItem<DrawingDisplayItem>();
457 item->SetNew(picture); 457 item->SetNew(picture);
458 list->Finalize(); 458 list->Finalize();
459 memory_usage = list->ApproximateMemoryUsage(); 459 memory_usage = list->ApproximateMemoryUsage();
460 EXPECT_EQ(static_cast<size_t>(0), memory_usage); 460 EXPECT_EQ(static_cast<size_t>(0), memory_usage);
461 } 461 }
462 462
463 } // namespace cc 463 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698