Just some atom-beautify to make code look better

This commit is contained in:
Thomas Buckley-Houston 2016-05-21 14:47:02 +09:00
parent 8c7071f8e0
commit 09168fc8ea
4 changed files with 109 additions and 103 deletions

View file

@ -2,14 +2,14 @@ package main
import ( import (
"fmt" "fmt"
"strings" "github.com/tombh/termbox-go"
"strconv" "math"
"path/filepath"
"time"
"os" "os"
"os/exec" "os/exec"
"math" "path/filepath"
"github.com/tombh/termbox-go" "strconv"
"strings"
"time"
) )
// Import the xzoom C code that creates an X window that zooms // Import the xzoom C code that creates an X window that zooms
@ -201,8 +201,8 @@ func zoom(direction string) {
C.magnification-- C.magnification--
} }
} }
C.width[C.SRC] = (C.desktop_width + C.magnification - 1) / C.magnification; C.width[C.SRC] = (C.desktop_width + C.magnification - 1) / C.magnification
C.height[C.SRC] = (C.desktop_height + C.magnification - 1) / C.magnification; C.height[C.SRC] = (C.desktop_height + C.magnification - 1) / C.magnification
moveViewportForZoom(oldZoom) moveViewportForZoom(oldZoom)
keepViewportInDesktop() keepViewportInDesktop()
@ -294,7 +294,6 @@ func mouseEvent() {
} }
} }
func pan() { func pan() {
if panNeedsSetup { if panNeedsSetup {
panStartingX = desktopXFloat panStartingX = desktopXFloat

View file

@ -10,6 +10,7 @@
/* copy scaled lines from SRC to DST */ /* copy scaled lines from SRC to DST */
j = height[SRC] - 1; j = height[SRC] - 1;
do { do {
T *p1; T *p1;
T *p2; T *p2;
@ -19,13 +20,17 @@
/* p1 point to begining of scanline j*magnification in DST */ /* p1 point to begining of scanline j*magnification in DST */
p1 = getP(DST, 0, j * magnification); p1 = getP(DST, 0, j * magnification);
p1_save = p1; p1_save = p1;
/* p2 point to begining of scanline j in SRC */ /* p2 point to begining of scanline j in SRC */
p2 = getP(SRC, 0, j); p2 = getP(SRC, 0, j);
i = width[SRC]; i = width[SRC];
do { do {
T c = *p2++; T c = *p2++;
k = magnification; do *p1++ = c; while (--k > 0); k = magnification;
do *p1++ = c; while (--k > 0);
} while (--i > 0); } while (--i > 0);
/* duplicate that line as needed */ /* duplicate that line as needed */
@ -33,12 +38,14 @@
{ {
/* p1 point to begining of scanline j*magnification in DST */ /* p1 point to begining of scanline j*magnification in DST */
p1 = p1_save; p1 = p1_save;
/* p2 points to begining of next line */ /* p2 points to begining of next line */
p2 = p1; p2 = p1;
p2step = ximage[DST]->bytes_per_line / sizeof(T); p2step = ximage[DST]->bytes_per_line / sizeof(T);
i = width[DST] * sizeof(T); i = width[DST] * sizeof(T);
k = magnification - 1; k = magnification - 1;
do { do {
p2 += p2step; p2 += p2step;
memcpy(p2, p1, i); memcpy(p2, p1, i);