@@ -1041,160 +1041,6 @@ TEST_P(AiksTest, GuassianBlurUpdatesMipmapContents) {
1041
1041
ASSERT_TRUE (OpenPlaygroundHere (callback));
1042
1042
}
1043
1043
1044
- TEST_P (AiksTest, GaussianBlurSetsMipCountOnPass) {
1045
- Canvas canvas;
1046
- canvas.DrawCircle ({100 , 100 }, 50 , {.color = Color::CornflowerBlue ()});
1047
- canvas.SaveLayer ({}, std::nullopt,
1048
- ImageFilter::MakeBlur (Sigma (3 ), Sigma (3 ),
1049
- FilterContents::BlurStyle::kNormal ,
1050
- Entity::TileMode::kClamp ));
1051
- canvas.Restore ();
1052
-
1053
- Picture picture = canvas.EndRecordingAsPicture ();
1054
- EXPECT_EQ (4 , picture.pass ->GetRequiredMipCount ());
1055
- }
1056
-
1057
- TEST_P (AiksTest, GaussianBlurAllocatesCorrectMipCountRenderTarget) {
1058
- size_t blur_required_mip_count =
1059
- GetParam () == PlaygroundBackend::kOpenGLES ? 1 : 4 ;
1060
-
1061
- Canvas canvas;
1062
- canvas.DrawCircle ({100 , 100 }, 50 , {.color = Color::CornflowerBlue ()});
1063
- canvas.SaveLayer ({}, std::nullopt,
1064
- ImageFilter::MakeBlur (Sigma (3 ), Sigma (3 ),
1065
- FilterContents::BlurStyle::kNormal ,
1066
- Entity::TileMode::kClamp ));
1067
- canvas.Restore ();
1068
-
1069
- Picture picture = canvas.EndRecordingAsPicture ();
1070
- std::shared_ptr<RenderTargetCache> cache =
1071
- std::make_shared<RenderTargetCache>(GetContext ()->GetResourceAllocator ());
1072
- AiksContext aiks_context (GetContext (), nullptr , cache);
1073
- picture.ToImage (aiks_context, {100 , 100 });
1074
-
1075
- size_t max_mip_count = 0 ;
1076
- for (auto it = cache->GetRenderTargetDataBegin ();
1077
- it != cache->GetRenderTargetDataEnd (); ++it) {
1078
- max_mip_count = std::max (it->config .mip_count , max_mip_count);
1079
- }
1080
- EXPECT_EQ (max_mip_count, blur_required_mip_count);
1081
- }
1082
-
1083
- TEST_P (AiksTest, GaussianBlurMipMapNestedLayer) {
1084
- fml::testing::LogCapture log_capture;
1085
- size_t blur_required_mip_count =
1086
- GetParam () == PlaygroundBackend::kOpenGLES ? 1 : 4 ;
1087
-
1088
- Canvas canvas;
1089
- canvas.DrawPaint ({.color = Color::Wheat ()});
1090
- canvas.SaveLayer ({.blend_mode = BlendMode::kMultiply });
1091
- canvas.DrawCircle ({100 , 100 }, 50 , {.color = Color::CornflowerBlue ()});
1092
- canvas.SaveLayer ({}, std::nullopt,
1093
- ImageFilter::MakeBlur (Sigma (30 ), Sigma (30 ),
1094
- FilterContents::BlurStyle::kNormal ,
1095
- Entity::TileMode::kClamp ));
1096
- canvas.DrawCircle ({200 , 200 }, 50 , {.color = Color::Chartreuse ()});
1097
-
1098
- Picture picture = canvas.EndRecordingAsPicture ();
1099
- std::shared_ptr<RenderTargetCache> cache =
1100
- std::make_shared<RenderTargetCache>(GetContext ()->GetResourceAllocator ());
1101
- AiksContext aiks_context (GetContext (), nullptr , cache);
1102
- picture.ToImage (aiks_context, {100 , 100 });
1103
-
1104
- size_t max_mip_count = 0 ;
1105
- for (auto it = cache->GetRenderTargetDataBegin ();
1106
- it != cache->GetRenderTargetDataEnd (); ++it) {
1107
- max_mip_count = std::max (it->config .mip_count , max_mip_count);
1108
- }
1109
- EXPECT_EQ (max_mip_count, blur_required_mip_count);
1110
- // The log is FML_DLOG, so only check in debug builds.
1111
- #ifndef NDEBUG
1112
- if (GetParam () != PlaygroundBackend::kOpenGLES ) {
1113
- EXPECT_EQ (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1114
- std::string::npos);
1115
- } else {
1116
- EXPECT_NE (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1117
- std::string::npos);
1118
- }
1119
- #endif
1120
- }
1121
-
1122
- TEST_P (AiksTest, GaussianBlurMipMapImageFilter) {
1123
- size_t blur_required_mip_count =
1124
- GetParam () == PlaygroundBackend::kOpenGLES ? 1 : 4 ;
1125
- fml::testing::LogCapture log_capture;
1126
- Canvas canvas;
1127
- canvas.SaveLayer (
1128
- {.image_filter = ImageFilter::MakeBlur (Sigma (30 ), Sigma (30 ),
1129
- FilterContents::BlurStyle::kNormal ,
1130
- Entity::TileMode::kClamp )});
1131
- canvas.DrawCircle ({200 , 200 }, 50 , {.color = Color::Chartreuse ()});
1132
-
1133
- Picture picture = canvas.EndRecordingAsPicture ();
1134
- std::shared_ptr<RenderTargetCache> cache =
1135
- std::make_shared<RenderTargetCache>(GetContext ()->GetResourceAllocator ());
1136
- AiksContext aiks_context (GetContext (), nullptr , cache);
1137
- picture.ToImage (aiks_context, {1024 , 768 });
1138
-
1139
- size_t max_mip_count = 0 ;
1140
- for (auto it = cache->GetRenderTargetDataBegin ();
1141
- it != cache->GetRenderTargetDataEnd (); ++it) {
1142
- max_mip_count = std::max (it->config .mip_count , max_mip_count);
1143
- }
1144
- EXPECT_EQ (max_mip_count, blur_required_mip_count);
1145
- // The log is FML_DLOG, so only check in debug builds.
1146
- #ifndef NDEBUG
1147
- if (GetParam () != PlaygroundBackend::kOpenGLES ) {
1148
- EXPECT_EQ (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1149
- std::string::npos);
1150
- } else {
1151
- EXPECT_NE (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1152
- std::string::npos);
1153
- }
1154
- #endif
1155
- }
1156
-
1157
- TEST_P (AiksTest, GaussianBlurMipMapSolidColor) {
1158
- size_t blur_required_mip_count =
1159
- GetParam () == PlaygroundBackend::kOpenGLES ? 1 : 4 ;
1160
- fml::testing::LogCapture log_capture;
1161
- Canvas canvas;
1162
- canvas.DrawPath (PathBuilder{}
1163
- .MoveTo ({100 , 100 })
1164
- .LineTo ({200 , 100 })
1165
- .LineTo ({150 , 200 })
1166
- .LineTo ({50 , 200 })
1167
- .Close ()
1168
- .TakePath (),
1169
- {.color = Color::Chartreuse (),
1170
- .image_filter = ImageFilter::MakeBlur (
1171
- Sigma (30 ), Sigma (30 ), FilterContents::BlurStyle::kNormal ,
1172
- Entity::TileMode::kClamp )});
1173
-
1174
- Picture picture = canvas.EndRecordingAsPicture ();
1175
- std::shared_ptr<RenderTargetCache> cache =
1176
- std::make_shared<RenderTargetCache>(GetContext ()->GetResourceAllocator ());
1177
- AiksContext aiks_context (GetContext (), nullptr , cache);
1178
- picture.ToImage (aiks_context, {1024 , 768 });
1179
-
1180
- size_t max_mip_count = 0 ;
1181
- for (auto it = cache->GetRenderTargetDataBegin ();
1182
- it != cache->GetRenderTargetDataEnd (); ++it) {
1183
- max_mip_count = std::max (it->config .mip_count , max_mip_count);
1184
- }
1185
- EXPECT_EQ (max_mip_count, blur_required_mip_count);
1186
- // The log is FML_DLOG, so only check in debug builds.
1187
- #ifndef NDEBUG
1188
- if (GetParam () != PlaygroundBackend::kOpenGLES ) {
1189
- EXPECT_EQ (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1190
- std::string::npos);
1191
- } else {
1192
- EXPECT_NE (log_capture.str ().find (GaussianBlurFilterContents::kNoMipsError ),
1193
- std::string::npos);
1194
- }
1195
- #endif
1196
- }
1197
-
1198
1044
TEST_P (AiksTest, MaskBlurDoesntStretchContents) {
1199
1045
Scalar sigma = 70 ;
1200
1046
auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
0 commit comments