diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-27 16:16:40 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-27 16:16:54 -0500 |
commit | 9b62a98f3e104a6566891ecf491dd15327db443f (patch) | |
tree | 2f8f193f4b346801cf7eed3420f09def6bb015b0 /CONTRIBUTING.md | |
parent | 392bfcbfb7be60a437167202db6c3ae9e618425a (diff) |
Style fixes in swaybg
CONTRIBUTING.md's code example is sourced from this file, so I updated
it as well.
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff2b8b5e..cc29dad0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,57 +106,57 @@ int main(int argc, const char **argv) { cairo_set_source_surface(window->cairo, image, 0, 0); break; case SCALING_MODE_FILL: - { - double window_ratio = (double) window->width / window->height; - double bg_ratio = width / height; - - if (window_ratio > bg_ratio) { - double scale = (double) window->width / width; - cairo_scale(window->cairo, scale, scale); - cairo_set_source_surface(window->cairo, image, - 0, - (double) window->height/2 / scale - height/2); - } else { - double scale = (double) window->height / height; - cairo_scale(window->cairo, scale, scale); - cairo_set_source_surface(window->cairo, image, - (double) window->width/2 / scale - width/2, - 0); - } + { + double window_ratio = (double) window->width / window->height; + double bg_ratio = width / height; + + if (window_ratio > bg_ratio) { + double scale = (double) window->width / width; + cairo_scale(window->cairo, scale, scale); + cairo_set_source_surface(window->cairo, image, + 0, + (double) window->height/2 / scale - height/2); + } else { + double scale = (double) window->height / height; + cairo_scale(window->cairo, scale, scale); + cairo_set_source_surface(window->cairo, image, + (double) window->width/2 / scale - width/2, + 0); } break; + } case SCALING_MODE_FIT: - { - double window_ratio = (double) window->width / window->height; - double bg_ratio = width / height; - - if (window_ratio > bg_ratio) { - double scale = (double) window->height / height; - cairo_scale(window->cairo, scale, scale); - cairo_set_source_surface(window->cairo, image, - (double) window->width/2 / scale - width/2, - 0); - } else { - double scale = (double) window->width / width; - cairo_scale(window->cairo, scale, scale); - cairo_set_source_surface(window->cairo, image, - 0, - (double) window->height/2 / scale - height/2); - } + { + double window_ratio = (double) window->width / window->height; + double bg_ratio = width / height; + + if (window_ratio > bg_ratio) { + double scale = (double) window->height / height; + cairo_scale(window->cairo, scale, scale); + cairo_set_source_surface(window->cairo, image, + (double) window->width/2 / scale - width/2, + 0); + } else { + double scale = (double) window->width / width; + cairo_scale(window->cairo, scale, scale); + cairo_set_source_surface(window->cairo, image, + 0, + (double) window->height/2 / scale - height/2); } break; + } case SCALING_MODE_CENTER: cairo_set_source_surface(window->cairo, image, (double) window->width/2 - width/2, (double) window->height/2 - height/2); break; case SCALING_MODE_TILE: - { - cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image); - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); - cairo_set_source(window->cairo, pattern); - } + { + cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); + cairo_set_source(window->cairo, pattern); break; + } default: sway_abort("Scaling mode '%s' not implemented yet!", scaling_mode_str); } |