Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of pt=ptss or pt=ptls #6

Open
cubicdaiya opened this issue Sep 19, 2016 · 0 comments
Open

Behavior of pt=ptss or pt=ptls #6

cubicdaiya opened this issue Sep 19, 2016 · 0 comments

Comments

@cubicdaiya
Copy link
Contributor

cubicdaiya commented Sep 19, 2016

The behavior of pt is described in README.

    pt        pass through control [char]
              (ptss:pass through when size of src-image < dest
               ptls:pass through when size of src-image > dest
               n:none default:n)

But the size of src-image is compared with not dest but canvas in real code.

    char *pt = (char *)apr_table_get(ctx->prm, "pt");
    if (pt[0] == '\0' || strcmp(pt, "ptss") == 0) {
        if (sz->sw < sz->cw && sz->sh < sz->ch) {
            pt_flg = 1;
        }
    } else if (strcmp(pt, "ptls") == 0) {
        if (sz->sw > sz->cw || sz->sh > sz->ch) {
            pt_flg = 1;
        }
    }

Though I believe this comparison should be changed like below, what do you think?

--- a/mod_small_light.c
+++ b/mod_small_light.c
@@ -601,11 +601,11 @@ void small_light_calc_image_size(
     int pt_flg = 0;
     char *pt = (char *)apr_table_get(ctx->prm, "pt");
     if (pt[0] == '\0' || strcmp(pt, "ptss") == 0) {
-        if (sz->sw < sz->cw && sz->sh < sz->ch) {
+        if (sz->sw < sz->dw && sz->sh < sz->dh) {
             pt_flg = 1;
         }
     } else if (strcmp(pt, "ptls") == 0) {
-        if (sz->sw > sz->cw || sz->sh > sz->ch) {
+        if (sz->sw > sz->dw || sz->sh > sz->dh) {
             pt_flg = 1;
         }
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant