Index: cc/playback/display_list_raster_source_unittest.cc |
diff --git a/cc/playback/display_list_raster_source_unittest.cc b/cc/playback/display_list_raster_source_unittest.cc |
index ca746fc58ed9a558a125533984595bce5a4ec0f2..2cf6f0694b43d3134840a732a96c9045e77572d8 100644 |
--- a/cc/playback/display_list_raster_source_unittest.cc |
+++ b/cc/playback/display_list_raster_source_unittest.cc |
@@ -29,7 +29,9 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { |
solid_paint.setColor(solid_color); |
SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
+ SkColor color = SK_ColorTRANSPARENT; |
SkPaint non_solid_paint; |
+ bool is_solid_color = false; |
non_solid_paint.setColor(non_solid_color); |
recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), |
@@ -43,11 +45,10 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { |
// Ensure everything is solid. |
for (int y = 0; y <= 300; y += 100) { |
for (int x = 0; x <= 300; x += 100) { |
- DisplayListRasterSource::SolidColorAnalysis analysis; |
gfx::Rect rect(x, y, 100, 100); |
- raster->PerformSolidColorAnalysis(rect, 1.0, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color) << rect.ToString(); |
- EXPECT_EQ(solid_color, analysis.solid_color) << rect.ToString(); |
+ is_solid_color = raster->PerformSolidColorAnalysis(rect, 1.0, &color); |
+ EXPECT_TRUE(is_solid_color) << rect.ToString(); |
+ EXPECT_EQ(solid_color, color) << rect.ToString(); |
} |
} |
@@ -58,33 +59,35 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { |
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( |
recording_source.get(), false); |
- DisplayListRasterSource::SolidColorAnalysis analysis; |
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 100, 100), 1.0, &analysis); |
- EXPECT_FALSE(analysis.is_solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 100, 100), 1.0, &color); |
+ EXPECT_FALSE(is_solid_color); |
- raster->PerformSolidColorAnalysis(gfx::Rect(100, 0, 100, 100), 1.0, |
- &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(solid_color, analysis.solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = raster->PerformSolidColorAnalysis( |
+ gfx::Rect(100, 0, 100, 100), 1.0, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(solid_color, color); |
// Boundaries should be clipped. |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(350, 0, 100, 100), 1.0, |
- &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(solid_color, analysis.solid_color); |
- |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 350, 100, 100), 1.0, |
- &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(solid_color, analysis.solid_color); |
- |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(350, 350, 100, 100), 1.0, |
- &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(solid_color, analysis.solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = raster->PerformSolidColorAnalysis( |
+ gfx::Rect(350, 0, 100, 100), 1.0, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(solid_color, color); |
+ |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = raster->PerformSolidColorAnalysis( |
+ gfx::Rect(0, 350, 100, 100), 1.0, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(solid_color, color); |
+ |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = raster->PerformSolidColorAnalysis( |
+ gfx::Rect(350, 350, 100, 100), 1.0, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(solid_color, color); |
} |
TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { |
@@ -94,7 +97,9 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { |
FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds); |
SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
+ SkColor color = SK_ColorTRANSPARENT; |
SkPaint solid_paint; |
+ bool is_solid_color = false; |
solid_paint.setColor(solid_color); |
SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
@@ -112,11 +117,10 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { |
// Ensure everything is solid. |
for (int y = 0; y <= 30; y += 10) { |
for (int x = 0; x <= 30; x += 10) { |
- DisplayListRasterSource::SolidColorAnalysis analysis; |
gfx::Rect rect(x, y, 10, 10); |
- raster->PerformSolidColorAnalysis(rect, 0.1f, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color) << rect.ToString(); |
- EXPECT_EQ(analysis.solid_color, solid_color) << rect.ToString(); |
+ is_solid_color = raster->PerformSolidColorAnalysis(rect, 0.1f, &color); |
+ EXPECT_TRUE(is_solid_color) << rect.ToString(); |
+ EXPECT_EQ(color, solid_color) << rect.ToString(); |
} |
} |
@@ -127,29 +131,35 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { |
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( |
recording_source.get(), false); |
- DisplayListRasterSource::SolidColorAnalysis analysis; |
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 10, 10), 0.1f, &analysis); |
- EXPECT_FALSE(analysis.is_solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 10, 10), 0.1f, &color); |
+ EXPECT_FALSE(is_solid_color); |
- raster->PerformSolidColorAnalysis(gfx::Rect(10, 0, 10, 10), 0.1f, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(analysis.solid_color, solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(10, 0, 10, 10), 0.1f, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(color, solid_color); |
// Boundaries should be clipped. |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(35, 0, 10, 10), 0.1f, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(analysis.solid_color, solid_color); |
- |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(analysis.solid_color, solid_color); |
- |
- analysis.is_solid_color = false; |
- raster->PerformSolidColorAnalysis(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(analysis.solid_color, solid_color); |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(35, 0, 10, 10), 0.1f, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(color, solid_color); |
+ |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(0, 35, 10, 10), 0.1f, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(color, solid_color); |
+ |
+ color = SK_ColorTRANSPARENT; |
+ is_solid_color = raster->PerformSolidColorAnalysis(gfx::Rect(35, 35, 10, 10), |
+ 0.1f, &color); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(color, solid_color); |
} |
TEST(DisplayListRasterSourceTest, AnalyzeIsSolidEmpty) { |
@@ -162,13 +172,13 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidEmpty) { |
scoped_refptr<DisplayListRasterSource> raster = |
DisplayListRasterSource::CreateFromDisplayListRecordingSource( |
recording_source.get(), false); |
- DisplayListRasterSource::SolidColorAnalysis analysis; |
- EXPECT_FALSE(analysis.is_solid_color); |
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 400, 400), 1.f, &analysis); |
+ SkColor color = SK_ColorTRANSPARENT; |
+ bool is_solid_color = |
+ raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 400, 400), 1.f, &color); |
- EXPECT_TRUE(analysis.is_solid_color); |
- EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0)); |
+ EXPECT_TRUE(is_solid_color); |
+ EXPECT_EQ(color, SkColorSetARGB(0, 0, 0, 0)); |
} |
TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { |