Skip to content

Commit

Permalink
fixup! backend: gl: support scale_x/scale_y blit parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui committed May 11, 2024
1 parent 6a00399 commit 47a8fd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ static int gl_lower_blit_args(struct gl_data *gd, ivec2 origin, struct backend_b
ivec2 mask_origin = args->mask->origin;
*coord = ccalloc(nrects * 16, GLfloat);

Check warning on line 541 in src/backend/gl/gl_common.c

View check run for this annotation

Codecov / codecov/patch

src/backend/gl/gl_common.c#L540-L541

Added lines #L540 - L541 were not covered by tests
*indices = ccalloc(nrects * 6, GLuint);
gl_mask_rects_to_coords(origin, mask_origin, nrects, rects, args->scale_x,
args->scale_y, *coord, *indices);
gl_mask_rects_to_coords(origin, mask_origin, nrects, rects, args->scale.x,

Check warning on line 543 in src/backend/gl/gl_common.c

View check run for this annotation

Codecov / codecov/patch

src/backend/gl/gl_common.c#L543

Added line #L543 was not covered by tests
args->scale.y, *coord, *indices);
if (!img->y_inverted) {
gl_y_flip_texture(nrects, *coord, img->height);
}
Expand All @@ -561,7 +561,7 @@ static int gl_lower_blit_args(struct gl_data *gd, ivec2 origin, struct backend_b
border_width = 0;
}
// clang-format off
auto tex_sampler = args->scale_x == 1.0 && args->scale_y == 1.0 ?
auto tex_sampler = vec2_eq(args->scale, SCALE_IDENTITY) ?
gd->samplers[GL_SAMPLER_REPEAT] : gd->samplers[GL_SAMPLER_REPEAT_SCALE];

Check warning on line 565 in src/backend/gl/gl_common.c

View check run for this annotation

Codecov / codecov/patch

src/backend/gl/gl_common.c#L564-L565

Added lines #L564 - L565 were not covered by tests
struct gl_uniform_value from_uniforms[] = {
[UNIFORM_OPACITY_LOC] = {.type = GL_FLOAT, .f = (float)args->opacity},
Expand Down
4 changes: 4 additions & 0 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,9 @@ static inline ivec2 ivec2_neg(ivec2 a) {
};
}

static inline bool vec2_eq(vec2 a, vec2 b) {
return a.x == b.x && a.y == b.y;

Check warning on line 82 in src/types.h

View check run for this annotation

Codecov / codecov/patch

src/types.h#L81-L82

Added lines #L81 - L82 were not covered by tests
}

#define MARGIN_INIT \
{ 0, 0, 0, 0 }

0 comments on commit 47a8fd1

Please sign in to comment.