| 1070 | } |
| 1071 | |
| 1072 | void 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 | |
| 1096 | void Bitmap::MaskedBlit(Rect const& dst_rect, Bitmap const& mask, int mx, int my, Color const& color) { |
| 1097 | pixman_color_t tcolor = { |
no test coverage detected