Skip to content

Commit 3e52a75

Browse files
committed
display/drm: Avoid unnecessary unsigned/signed conversions
1 parent be0dda2 commit 3e52a75

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/video_display/drm.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -768,29 +768,29 @@ static void draw_frame(Drm_framebuffer *dst, video_frame *src, bool center = tru
768768
auto dst_p = static_cast<char *>(dst->map.get());
769769
auto src_p = static_cast<char *>(src->tiles[0].data);
770770

771-
auto src_w = src->tiles[0].width;
772-
auto src_h = src->tiles[0].height;
771+
const auto src_w = src->tiles[0].width;
772+
const auto src_h = src->tiles[0].height;
773773

774-
unsigned x = 0;
775-
unsigned y = 0;
774+
unsigned pos_x = 0;
775+
unsigned pos_y = 0;
776776

777777
if(center){
778778
if(src_w < dst->width)
779-
x = (dst->width - src_w) / 2;
779+
pos_x = (dst->width - src_w) / 2;
780780
if(src_h < dst->height)
781-
y = (dst->height - src_h) / 2;
781+
pos_y = (dst->height - src_h) / 2;
782782
}
783783

784-
int width = std::min(src_w, dst->width - x);
785-
int height = std::min(src_h, dst->height - y);
784+
const auto width = std::min(src_w, dst->width - pos_x);
785+
const auto height = std::min(src_h, dst->height - pos_y);
786786

787-
auto src_pitch = vc_get_linesize(src_w, src->color_spec);
788-
auto linesize = vc_get_size(width, src->color_spec);
787+
const auto src_pitch = vc_get_linesize(src_w, src->color_spec);
788+
const auto linesize = vc_get_size(width, src->color_spec);
789789

790-
dst_p += dst->pitch * y;
791-
dst_p += vc_get_size(x, src->color_spec);
790+
dst_p += dst->pitch * pos_y;
791+
dst_p += vc_get_size(pos_x, src->color_spec);
792792

793-
for(int y = 0; y < height; y++){
793+
for(unsigned y = 0; y < height; y++){
794794
memcpy(dst_p, src_p, linesize);
795795
dst_p += dst->pitch;
796796
src_p += src_pitch;

0 commit comments

Comments
 (0)