| Index: cc/output/filter_operations_unittest.cc
|
| diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc
|
| index e97379cbd2a6c38b53cb97bb7802997ffd700833..4bbf3dd7442a85be4052e232b26bdda188ab2072 100644
|
| --- a/cc/output/filter_operations_unittest.cc
|
| +++ b/cc/output/filter_operations_unittest.cc
|
| @@ -140,6 +140,35 @@ TEST(FilterOperationsTest, SaveAndRestore) {
|
| SAVE_RESTORE_AMOUNT_INSET(Zoom, ZOOM, 0.5f, 32);
|
| }
|
|
|
| +TEST(FilterOperationsTest, SaveAndRestoreAlphaThreshold) {
|
| + SkRegion region(SkIRect::MakeLTRB(20, 10, 300, 200));
|
| + float inner = 0.6f;
|
| + float outer = 0.3f;
|
| +
|
| + FilterOperation op =
|
| + FilterOperation::CreateAlphaThresholdFilter(region, inner, outer);
|
| + EXPECT_EQ(FilterOperation::ALPHA_THRESHOLD, op.type());
|
| + EXPECT_EQ(region, op.region());
|
| + EXPECT_EQ(inner, op.amount());
|
| + EXPECT_EQ(outer, op.outer_threshold());
|
| +
|
| + FilterOperation op2 = FilterOperation::CreateEmptyFilter();
|
| + op2.set_type(FilterOperation::ALPHA_THRESHOLD);
|
| +
|
| + EXPECT_NE(region, op2.region());
|
| + EXPECT_NE(inner, op2.amount());
|
| + EXPECT_NE(outer, op2.outer_threshold());
|
| +
|
| + op2.set_region(region);
|
| + op2.set_amount(inner);
|
| + op2.set_outer_threshold(outer);
|
| +
|
| + EXPECT_EQ(FilterOperation::ALPHA_THRESHOLD, op2.type());
|
| + EXPECT_EQ(region, op2.region());
|
| + EXPECT_EQ(inner, op2.amount());
|
| + EXPECT_EQ(outer, op2.outer_threshold());
|
| +}
|
| +
|
| TEST(FilterOperationsTest, BlendGrayscaleFilters) {
|
| FilterOperation from = FilterOperation::CreateGrayscaleFilter(0.25f);
|
| FilterOperation to = FilterOperation::CreateGrayscaleFilter(0.75f);
|
| @@ -543,6 +572,35 @@ TEST(FilterOperationsTest, BlendReferenceWithNull) {
|
| EXPECT_EQ(filter, blended);
|
| }
|
|
|
| +TEST(FilterOperationsTest, BlendAlphaThresholdFilters) {
|
| + SkRegion start_region(SkIRect::MakeLTRB(15, 5, 200, 100));
|
| + SkRegion end_region(SkIRect::MakeLTRB(20, 10, 300, 200));
|
| +
|
| + FilterOperation from =
|
| + FilterOperation::CreateAlphaThresholdFilter(start_region, 0.25f, 0.25f);
|
| + FilterOperation to =
|
| + FilterOperation::CreateAlphaThresholdFilter(end_region, 0.75f, 0.75f);
|
| +
|
| + FilterOperation blended = FilterOperation::Blend(&from, &to, -0.75);
|
| + FilterOperation expected =
|
| + FilterOperation::CreateAlphaThresholdFilter(start_region, 0.f, 0.f);
|
| + EXPECT_EQ(expected, blended);
|
| +
|
| + blended = FilterOperation::Blend(&from, &to, 0.25);
|
| + expected =
|
| + FilterOperation::CreateAlphaThresholdFilter(start_region, 0.375f, 0.375f);
|
| + EXPECT_EQ(expected, blended);
|
| +
|
| + blended = FilterOperation::Blend(&from, &to, 0.75);
|
| + expected =
|
| + FilterOperation::CreateAlphaThresholdFilter(end_region, 0.625f, 0.625f);
|
| + EXPECT_EQ(expected, blended);
|
| +
|
| + blended = FilterOperation::Blend(&from, &to, 1.8);
|
| + expected = FilterOperation::CreateAlphaThresholdFilter(end_region, 1.f, 1.f);
|
| + EXPECT_EQ(expected, blended);
|
| +}
|
| +
|
| // Tests blending non-empty sequences that have the same length and matching
|
| // operations.
|
| TEST(FilterOperationsTest, BlendMatchingSequences) {
|
|
|