MCPcopy Create free account
hub / github.com/EasyRPG/Player / EdgeMirrorBlit

Method EdgeMirrorBlit

src/bitmap.cpp:1273–1307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1271}
1272
1273void 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

Callers 1

DrawParticlesMethod · 0.80

Calls 4

CreateMaskFunction · 0.85
GetOperatorMethod · 0.80
IsTransparentMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected