diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/page/view.c | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/page/view.c')
-rw-r--r-- | src/cmd/page/view.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/cmd/page/view.c b/src/cmd/page/view.c index 315a22a8..2696f01f 100644 --- a/src/cmd/page/view.c +++ b/src/cmd/page/view.c @@ -33,25 +33,25 @@ void plumbproc(void*); Cursor reading={ {-1, -1}, - {0xff, 0x80, 0xff, 0x80, 0xff, 0x00, 0xfe, 0x00, - 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xef, 0xe0, - 0xc7, 0xf0, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0xc0, + {0xff, 0x80, 0xff, 0x80, 0xff, 0x00, 0xfe, 0x00, + 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xef, 0xe0, + 0xc7, 0xf0, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0xc0, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, }, - {0x00, 0x00, 0x7f, 0x00, 0x7e, 0x00, 0x7c, 0x00, - 0x7e, 0x00, 0x7f, 0x00, 0x6f, 0x80, 0x47, 0xc0, - 0x03, 0xe0, 0x01, 0xf0, 0x00, 0xe0, 0x00, 0x40, + {0x00, 0x00, 0x7f, 0x00, 0x7e, 0x00, 0x7c, 0x00, + 0x7e, 0x00, 0x7f, 0x00, 0x6f, 0x80, 0x47, 0xc0, + 0x03, 0xe0, 0x01, 0xf0, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x01, 0xb6, 0x01, 0xb6, 0x00, 0x00, } }; Cursor query = { {-7,-7}, - {0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, - 0x7c, 0x7e, 0x78, 0x7e, 0x00, 0xfc, 0x01, 0xf8, - 0x03, 0xf0, 0x07, 0xe0, 0x07, 0xc0, 0x07, 0xc0, + {0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, + 0x7c, 0x7e, 0x78, 0x7e, 0x00, 0xfc, 0x01, 0xf8, + 0x03, 0xf0, 0x07, 0xe0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, }, - {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xf8, 0x3c, 0x3c, - 0x38, 0x1c, 0x00, 0x3c, 0x00, 0x78, 0x00, 0xf0, - 0x01, 0xe0, 0x03, 0xc0, 0x03, 0x80, 0x03, 0x80, + {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xf8, 0x3c, 0x3c, + 0x38, 0x1c, 0x00, 0x3c, 0x00, 0x78, 0x00, 0xf0, + 0x01, 0xe0, 0x03, 0xc0, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, } }; @@ -79,13 +79,13 @@ unhide(void) USED(nil); } -int +int max(int a, int b) { return a > b ? a : b; } -int +int min(int a, int b) { return a < b ? a : b; @@ -130,7 +130,7 @@ showpage(int page, Menu *m) m->lasthit = 0; /* this page */ else m->lasthit = reverse ? doc->npage-1-page : page; - + setcursor(mc, &reading); delayfreeimage(nil); im = cachedpage(doc, angle, page); @@ -178,7 +178,7 @@ writebitmap(void) q = basename; if(p = strchr(q, '.')) *p = 0; - + memset(name, 0, sizeof name); snprint(name, sizeof(name)-1, "%s.%d.bit", q, page+1); if(access(name, 0) >= 0) { @@ -241,7 +241,7 @@ enum{ Empty3, Exit, }; - + void viewer(Document *dd) { @@ -269,13 +269,13 @@ viewer(Document *dd) "next", "prev", "zerox", - "", + "", "reverse", "discard", "write", - "", - "quit", - 0 + "", + "quit", + 0 }; char *s; enum { @@ -287,7 +287,7 @@ viewer(Document *dd) }; Alt alts[CN+1]; Plumbmsg *pm; - + cp = chancreate(sizeof pm, 0); assert(cp); @@ -483,7 +483,7 @@ viewer(Document *dd) setcursor(mc, &query); sleep(1000); setcursor(mc, nil); - break; + break; } break; @@ -494,7 +494,7 @@ viewer(Document *dd) xy0 = oxy; do { dxy = subpt(m.xy, oxy); - oxy = m.xy; + oxy = m.xy; translate(dxy); recv(mc->c, &m); } while(m.buttons == Left); @@ -503,7 +503,7 @@ viewer(Document *dd) translate(dxy); } break; - + case Middle: if(doc->npage == 0) break; @@ -524,7 +524,7 @@ viewer(Document *dd) if((page >= doc->npage) && !doc->fwdonly) return; - + showpage(page, &menu); nxt = 0; break; @@ -540,7 +540,7 @@ viewer(Document *dd) if((page >= doc->npage) && !doc->fwdonly && !reverse) return; - + showpage(page, &menu); nxt = 0; break; @@ -565,7 +565,7 @@ viewer(Document *dd) showpage(page, &menu); } break; - } + } else{ /* image */ double delta; Rectangle r; @@ -581,8 +581,8 @@ viewer(Document *dd) delta = (double)Dy(im->r)/(double)Dy(r); setcursor(mc, &reading); - tmp = xallocimage(display, - Rect(0, 0, (int)((double)Dx(im->r)*delta), (int)((double)Dy(im->r)*delta)), + tmp = xallocimage(display, + Rect(0, 0, (int)((double)Dx(im->r)*delta), (int)((double)Dy(im->r)*delta)), im->chan, 0, DBlack); if(tmp == nil) { fprint(2, "out of memory during zoom: %r\n"); @@ -639,7 +639,7 @@ viewer(Document *dd) break; reverse = !reverse; menu.lasthit = doc->npage-1-menu.lasthit; - + if(page == 0 || page == doc->npage-1) { page = doc->npage-1-page; showpage(page, &menu); @@ -672,10 +672,10 @@ viewer(Document *dd) case Empty3: break; - }; + }; + + - - case Right: if(doc->npage == 0) break; @@ -684,7 +684,7 @@ viewer(Document *dd) n = menuhit(RMenu, mc, &menu, nil); if(n == -1) break; - + if(doc->fwdonly) { switch(n){ case 0: /* this page */ @@ -697,12 +697,12 @@ viewer(Document *dd) } break; } - + if(n == doc->npage) return; else page = reverse ? doc->npage-1-n : n; - + if(oldpage != page) showpage(page, &menu); nxt = 0; @@ -753,7 +753,7 @@ Image *gray; * mp and sp get aligned with bot.min. */ static void -gendrawdiff(Image *dst, Rectangle bot, Rectangle top, +gendrawdiff(Image *dst, Rectangle bot, Rectangle top, Image *src, Point sp, Image *mask, Point mp, int op) { Rectangle r; @@ -890,7 +890,7 @@ redraw(Image *screen) } } border(screen, r, -4000, gray, ZP); -// flushimage(display, 0); +// flushimage(display, 0); } /* clip p to be in r */ @@ -911,7 +911,7 @@ pclip(Point p, Rectangle r) } /* - * resize is perhaps a misnomer. + * resize is perhaps a misnomer. * this really just grows the window to be at least dx across * and dy high. if the window hits the bottom or right edge, * it is backed up until it hits the top or left edge. |