| 1042 | } |
| 1043 | |
| 1044 | void Bitmap::FlipBlit(int x, int y, Bitmap const& src, Rect const& src_rect, bool horizontal, bool vertical, Opacity const& opacity, Bitmap::BlendMode blend_mode) { |
| 1045 | if (opacity.IsTransparent()) { |
| 1046 | return; |
| 1047 | } |
| 1048 | |
| 1049 | bool has_xform = (horizontal || vertical); |
| 1050 | const auto img_w = src.GetWidth(); |
| 1051 | const auto img_h = src.GetHeight(); |
| 1052 | |
| 1053 | auto rect = src_rect; |
| 1054 | if (has_xform) { |
| 1055 | Transform xform = Transform::Scale(horizontal ? -1 : 1, vertical ? -1 : 1); |
| 1056 | xform *= Transform::Translation(horizontal ? -img_w : 0, vertical ? -img_h : 0); |
| 1057 | |
| 1058 | pixman_image_set_transform(src.bitmap.get(), &xform.matrix); |
| 1059 | const auto src_x = horizontal ? img_w - src_rect.x - src_rect.width : src_rect.x; |
| 1060 | const auto src_y = vertical ? img_h - src_rect.y - src_rect.height : src_rect.y; |
| 1061 | |
| 1062 | rect = Rect{ src_x, src_y, src_rect.width, src_rect.height }; |
| 1063 | } |
| 1064 | |
| 1065 | Blit(x, y, src, rect, opacity, blend_mode); |
| 1066 | |
| 1067 | if (has_xform) { |
| 1068 | pixman_image_set_transform(src.bitmap.get(), nullptr); |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | void Bitmap::Flip(bool horizontal, bool vertical) { |
| 1073 | if (!horizontal && !vertical) { |
no test coverage detected