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

Method Flip

src/bitmap.cpp:1072–1094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070}
1071
1072void Bitmap::Flip(bool horizontal, bool vertical) {
1073 if (!horizontal && !vertical) {
1074 return;
1075 }
1076 const auto w = GetWidth();
1077 const auto h = GetHeight();
1078 const auto p = pitch();
1079
1080 auto temp = PixmanImagePtr{ pixman_image_create_bits(pixman_format, w, h, nullptr, p) };
1081
1082 std::memcpy(pixman_image_get_data(temp.get()),
1083 pixman_image_get_data(bitmap.get()),
1084 p * h);
1085
1086 Transform xform = Transform::Scale(horizontal ? -1 : 1, vertical ? -1 : 1);
1087 xform *= Transform::Translation(horizontal ? -w : 0, vertical ? -h : 0);
1088
1089 pixman_image_set_transform(temp.get(), &xform.matrix);
1090
1091 pixman_image_composite32(PIXMAN_OP_SRC,
1092 temp.get(), nullptr, bitmap.get(),
1093 0, 0, 0, 0, 0, 0, w, h);
1094}
1095
1096void Bitmap::MaskedBlit(Rect const& dst_rect, Bitmap const& mask, int mx, int my, Color const& color) {
1097 pixman_color_t tcolor = {

Callers 6

DoSwitchMethod · 0.45
SpriteEffectMethod · 0.45
switches.cppFile · 0.45
BM_SwitchFlipFunction · 0.45
BM_FlipFunction · 0.45

Calls 2

TranslationClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected