Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(478)

Unified Diff: src/libframe/frinit.c

Issue 6850102: code review 6850102: libframe: auto scale tick for retina (Closed)
Patch Set: diff -r c386d69a984b https://code.google.com/p/plan9port Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/libframe/frdraw.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libframe/frinit.c
===================================================================
--- a/src/libframe/frinit.c
+++ b/src/libframe/frinit.c
@@ -31,11 +31,14 @@
Image *b;
Font *ft;
+ if(f->cols[BACK] == nil || f->display == nil)
+ return;
+ f->tickscale = scalesize(f->display, 1);
b = f->display->screenimage;
ft = f->font;
if(f->tick)
freeimage(f->tick);
- f->tick = allocimage(f->display, Rect(0, 0, FRTICKW, ft->height), b->chan, 0, DWhite);
+ f->tick = allocimage(f->display, Rect(0, 0, f->tickscale*FRTICKW, ft->height), b->chan, 0, DWhite);
if(f->tick == nil)
return;
if(f->tickback)
@@ -49,10 +52,10 @@
/* background color */
draw(f->tick, f->tick->r, f->cols[BACK], nil, ZP);
/* vertical line */
- draw(f->tick, Rect(FRTICKW/2, 0, FRTICKW/2+1, ft->height), f->display->black, nil, ZP);
+ draw(f->tick, Rect(f->tickscale*(FRTICKW/2), 0, f->tickscale*(FRTICKW/2+1), ft->height), f->display->black, nil, ZP);
/* box on each end */
- draw(f->tick, Rect(0, 0, FRTICKW, FRTICKW), f->cols[TEXT], nil, ZP);
- draw(f->tick, Rect(0, ft->height-FRTICKW, FRTICKW, ft->height), f->cols[TEXT], nil, ZP);
+ draw(f->tick, Rect(0, 0, f->tickscale*FRTICKW, f->tickscale*FRTICKW), f->cols[TEXT], nil, ZP);
+ draw(f->tick, Rect(0, ft->height-f->tickscale*FRTICKW, f->tickscale*FRTICKW, ft->height), f->cols[TEXT], nil, ZP);
}
void
« no previous file with comments | « src/libframe/frdraw.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b