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

Unified Diff: cc/raster/raster_source_unittest.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: nits Created 3 years, 6 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
Index: cc/raster/raster_source_unittest.cc
diff --git a/cc/raster/raster_source_unittest.cc b/cc/raster/raster_source_unittest.cc
index 5cb06aaf7c32adf2f08d32b56df0e04a17a341c2..364f80d6aedd494753e834ca6172fd5906eeb833 100644
--- a/cc/raster/raster_source_unittest.cc
+++ b/cc/raster/raster_source_unittest.cc
@@ -53,7 +53,8 @@ TEST(RasterSourceTest, AnalyzeIsSolidUnscaled) {
for (int y = 0; y <= 300; y += 100) {
for (int x = 0; x <= 300; x += 100) {
gfx::Rect rect(x, y, 100, 100);
- is_solid_color = raster->PerformSolidColorAnalysis(rect, 1.f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ rect, gfx::AxisTransform2d(1.f, gfx::Vector2dF()), &color);
EXPECT_TRUE(is_solid_color) << rect.ToString();
EXPECT_EQ(solid_color, color) << rect.ToString();
}
@@ -67,32 +68,37 @@ TEST(RasterSourceTest, AnalyzeIsSolidUnscaled) {
RasterSource::CreateFromRecordingSource(recording_source.get(), false);
color = SK_ColorTRANSPARENT;
- is_solid_color =
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 100, 100), 1.f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 100, 100), gfx::AxisTransform2d(1.f, gfx::Vector2dF()),
+ &color);
EXPECT_FALSE(is_solid_color);
color = SK_ColorTRANSPARENT;
is_solid_color = raster->PerformSolidColorAnalysis(
- gfx::Rect(100, 0, 100, 100), 1.f, &color);
+ gfx::Rect(100, 0, 100, 100), gfx::AxisTransform2d(1.f, gfx::Vector2dF()),
+ &color);
EXPECT_TRUE(is_solid_color);
EXPECT_EQ(solid_color, color);
// Boundaries should be clipped.
color = SK_ColorTRANSPARENT;
is_solid_color = raster->PerformSolidColorAnalysis(
- gfx::Rect(350, 0, 100, 100), 1.f, &color);
+ gfx::Rect(350, 0, 100, 100), gfx::AxisTransform2d(1.f, gfx::Vector2dF()),
+ &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.f, &color);
+ gfx::Rect(0, 350, 100, 100), gfx::AxisTransform2d(1.f, gfx::Vector2dF()),
+ &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.f, &color);
+ gfx::Rect(350, 350, 100, 100),
+ gfx::AxisTransform2d(1.f, gfx::Vector2dF()), &color);
EXPECT_TRUE(is_solid_color);
EXPECT_EQ(solid_color, color);
}
@@ -124,7 +130,8 @@ TEST(RasterSourceTest, AnalyzeIsSolidScaled) {
for (int y = 0; y <= 30; y += 10) {
for (int x = 0; x <= 30; x += 10) {
gfx::Rect rect(x, y, 10, 10);
- is_solid_color = raster->PerformSolidColorAnalysis(rect, 0.1f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ rect, gfx::AxisTransform2d(0.1f, gfx::Vector2dF()), &color);
EXPECT_TRUE(is_solid_color) << rect.ToString();
EXPECT_EQ(color, solid_color) << rect.ToString();
}
@@ -138,32 +145,37 @@ TEST(RasterSourceTest, AnalyzeIsSolidScaled) {
RasterSource::CreateFromRecordingSource(recording_source.get(), false);
color = SK_ColorTRANSPARENT;
- is_solid_color =
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 10, 10), 0.1f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 10, 10), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &color);
EXPECT_FALSE(is_solid_color);
color = SK_ColorTRANSPARENT;
- is_solid_color =
- raster->PerformSolidColorAnalysis(gfx::Rect(10, 0, 10, 10), 0.1f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(10, 0, 10, 10), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &color);
EXPECT_TRUE(is_solid_color);
EXPECT_EQ(color, solid_color);
// Boundaries should be clipped.
color = SK_ColorTRANSPARENT;
- is_solid_color =
- raster->PerformSolidColorAnalysis(gfx::Rect(35, 0, 10, 10), 0.1f, &color);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(35, 0, 10, 10), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &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);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(0, 35, 10, 10), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &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);
+ is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(35, 35, 10, 10), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &color);
EXPECT_TRUE(is_solid_color);
EXPECT_EQ(color, solid_color);
}
@@ -179,8 +191,9 @@ TEST(RasterSourceTest, AnalyzeIsSolidEmpty) {
RasterSource::CreateFromRecordingSource(recording_source.get(), false);
SkColor color = SK_ColorTRANSPARENT;
- bool is_solid_color =
- raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 400, 400), 1.f, &color);
+ bool is_solid_color = raster->PerformSolidColorAnalysis(
+ gfx::Rect(0, 0, 400, 400), gfx::AxisTransform2d(0.1f, gfx::Vector2dF()),
+ &color);
EXPECT_TRUE(is_solid_color);
EXPECT_EQ(color, SkColorSetARGB(0, 0, 0, 0));

Powered by Google App Engine
This is Rietveld 408576698