| 1271 | } |
| 1272 | |
| 1273 | void Bitmap::EdgeMirrorBlit(int x, int y, Bitmap const& src, Rect const& src_rect, bool mirror_x, bool mirror_y, Opacity const& opacity) { |
| 1274 | if (opacity.IsTransparent()) |
| 1275 | return; |
| 1276 | |
| 1277 | auto mask = CreateMask(opacity, src_rect); |
| 1278 | |
| 1279 | const auto dst_rect = GetRect(); |
| 1280 | |
| 1281 | auto draw = [&](int x, int y) { |
| 1282 | pixman_image_composite32(src.GetOperator(mask.get()), |
| 1283 | src.bitmap.get(), |
| 1284 | mask.get(), bitmap.get(), |
| 1285 | src_rect.x, src_rect.y, |
| 1286 | 0, 0, |
| 1287 | x, y, |
| 1288 | src_rect.width, src_rect.height); |
| 1289 | }; |
| 1290 | |
| 1291 | draw(x, y); |
| 1292 | |
| 1293 | const bool clone_x = (mirror_x && x + src_rect.width > dst_rect.width); |
| 1294 | const bool clone_y = (mirror_y && y + src_rect.height > dst_rect.height); |
| 1295 | |
| 1296 | if (clone_x) { |
| 1297 | draw(x - dst_rect.width, y); |
| 1298 | } |
| 1299 | |
| 1300 | if (clone_y) { |
| 1301 | draw(x, y - dst_rect.height); |
| 1302 | } |
| 1303 | |
| 1304 | if (clone_x && clone_y) { |
| 1305 | draw(x - dst_rect.width, y - dst_rect.height); |
| 1306 | } |
| 1307 | } |
| 1308 |
no test coverage detected