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

Unified Diff: cc/resources/picture_pile_impl_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/resources/picture_pile_impl_perftest.cc ('k') | cc/resources/picture_pile_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_pile_impl_unittest.cc
diff --git a/cc/resources/picture_pile_impl_unittest.cc b/cc/resources/picture_pile_impl_unittest.cc
index 0ced279777d9433d8a7ab5509018151694d4bd13..bd796a51c3ec573887ea13a3ef483d9dcf2a2f39 100644
--- a/cc/resources/picture_pile_impl_unittest.cc
+++ b/cc/resources/picture_pile_impl_unittest.cc
@@ -37,9 +37,9 @@ TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) {
// Ensure everything is solid
for (int y = 0; y <= 300; y += 100) {
for (int x = 0; x <= 300; x += 100) {
- PicturePileImpl::Analysis analysis;
+ RasterSource::SolidColorAnalysis analysis;
gfx::Rect rect(x, y, 100, 100);
- pile->AnalyzeInRect(rect, 1.0, &analysis);
+ pile->PerformSolidColorAnalysis(rect, 1.0, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color) << rect.ToString();
EXPECT_EQ(analysis.solid_color, solid_color) << rect.ToString();
}
@@ -49,27 +49,32 @@ TEST(PicturePileImplTest, AnalyzeIsSolidUnscaled) {
pile->add_draw_rect_with_paint(gfx::Rect(50, 50, 1, 1), non_solid_paint);
pile->RerecordPile();
- PicturePileImpl::Analysis analysis;
- pile->AnalyzeInRect(gfx::Rect(0, 0, 100, 100), 1.0, &analysis);
+ RasterSource::SolidColorAnalysis analysis;
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 100, 100), 1.0, &analysis, nullptr);
EXPECT_FALSE(analysis.is_solid_color);
- pile->AnalyzeInRect(gfx::Rect(100, 0, 100, 100), 1.0, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(100, 0, 100, 100), 1.0, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
// Boundaries should be clipped
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(350, 0, 100, 100), 1.0, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(350, 0, 100, 100), 1.0, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(0, 350, 100, 100), 1.0, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(0, 350, 100, 100), 1.0, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(350, 350, 100, 100), 1.0, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(350, 350, 100, 100), 1.0, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
}
@@ -95,9 +100,9 @@ TEST(PicturePileImplTest, AnalyzeIsSolidScaled) {
// Ensure everything is solid
for (int y = 0; y <= 30; y += 10) {
for (int x = 0; x <= 30; x += 10) {
- PicturePileImpl::Analysis analysis;
+ RasterSource::SolidColorAnalysis analysis;
gfx::Rect rect(x, y, 10, 10);
- pile->AnalyzeInRect(rect, 0.1f, &analysis);
+ pile->PerformSolidColorAnalysis(rect, 0.1f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color) << rect.ToString();
EXPECT_EQ(analysis.solid_color, solid_color) << rect.ToString();
}
@@ -107,27 +112,32 @@ TEST(PicturePileImplTest, AnalyzeIsSolidScaled) {
pile->add_draw_rect_with_paint(gfx::Rect(50, 50, 1, 1), non_solid_paint);
pile->RerecordPile();
- PicturePileImpl::Analysis analysis;
- pile->AnalyzeInRect(gfx::Rect(0, 0, 10, 10), 0.1f, &analysis);
+ RasterSource::SolidColorAnalysis analysis;
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 10, 10), 0.1f, &analysis, nullptr);
EXPECT_FALSE(analysis.is_solid_color);
- pile->AnalyzeInRect(gfx::Rect(10, 0, 10, 10), 0.1f, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(10, 0, 10, 10), 0.1f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
// Boundaries should be clipped
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(35, 0, 10, 10), 0.1f, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(35, 0, 10, 10), 0.1f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(0, 35, 10, 10), 0.1f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
analysis.is_solid_color = false;
- pile->AnalyzeInRect(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(35, 35, 10, 10), 0.1f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, solid_color);
}
@@ -138,10 +148,11 @@ TEST(PicturePileImplTest, AnalyzeIsSolidEmpty) {
scoped_refptr<FakePicturePileImpl> pile =
FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
- PicturePileImpl::Analysis analysis;
+ RasterSource::SolidColorAnalysis analysis;
EXPECT_FALSE(analysis.is_solid_color);
- pile->AnalyzeInRect(gfx::Rect(0, 0, 400, 400), 1.f, &analysis);
+ pile->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 400, 400), 1.f, &analysis, nullptr);
EXPECT_TRUE(analysis.is_solid_color);
EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0));
@@ -687,10 +698,10 @@ TEST_P(FullContentsTest, RasterFullContents) {
FakeRenderingStatsInstrumentation rendering_stats_instrumentation;
- pile->RasterToBitmap(&canvas,
- canvas_rect,
- contents_scale,
- &rendering_stats_instrumentation);
+ pile->PlaybackToCanvas(&canvas,
+ canvas_rect,
+ contents_scale,
+ &rendering_stats_instrumentation);
SkColor* pixels = reinterpret_cast<SkColor*>(bitmap.getPixels());
int num_pixels = bitmap.width() * bitmap.height();
@@ -738,7 +749,7 @@ TEST(PicturePileImpl, RasterContentsTransparent) {
SkCanvas canvas(bitmap);
FakeRenderingStatsInstrumentation rendering_stats_instrumentation;
- pile->RasterToBitmap(
+ pile->PlaybackToCanvas(
&canvas, canvas_rect, contents_scale, &rendering_stats_instrumentation);
SkColor* pixels = reinterpret_cast<SkColor*>(bitmap.getPixels());
@@ -784,10 +795,10 @@ TEST_P(OverlapTest, NoOverlap) {
SkCanvas canvas(bitmap);
FakeRenderingStatsInstrumentation rendering_stats_instrumentation;
- pile->RasterToBitmap(&canvas,
- gfx::Rect(content_bounds),
- contents_scale,
- &rendering_stats_instrumentation);
+ pile->PlaybackToCanvas(&canvas,
+ gfx::Rect(content_bounds),
+ contents_scale,
+ &rendering_stats_instrumentation);
for (int y = 0; y < bitmap.height(); y++) {
for (int x = 0; x < bitmap.width(); x++) {
« no previous file with comments | « cc/resources/picture_pile_impl_perftest.cc ('k') | cc/resources/picture_pile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698