5d028b1ce2b846df0794e25f6d101620fe6a8828 angie Fri Jul 1 16:12:49 2011 -0700 While working on VCF, caught a couple little bugs in pgSnpTextRight: 1. When restoring the clipping rectangle after snapping a label to the left, pgSnpTextRight thought it was using the track y offset -- but the DrawAt routine only gets the item y, not track y. So when an item on row N had a label that snapped left, the restored clipping rectangle clips out any subsequent items on rows 0..N-1. The top row(s) looks suspiciously empty, as if the packer hadn't fully utilized the row, but it's only that those items are made invisible. The fix was to get the real y clipping coords before clipping for left text, so they could be restored correctly. 2. The text width was subtracted twice from the item pixel start before the comparison with insideX (by the caller, and inside pgSnpTextRight). Thus snapLeft was triggered too easily, causing overwriting of left labels when items in the same row were close to each other and to the left edge. Fix: the caller doesn't subtract (width + 2); pgSnpTextRight uses textX, not x1, when drawing text. diff --git src/hg/inc/hvGfx.h src/hg/inc/hvGfx.h index 3c161d0..87840a1 100644 --- src/hg/inc/hvGfx.h +++ src/hg/inc/hvGfx.h @@ -133,30 +133,43 @@ INLINE void hvGfxSetClip(struct hvGfx *hvg, int x, int y, int width, int height) /* Set clipping rectangle. */ { // this should not be adjusted for RC hvg->clipMinX = x; hvg->clipMaxX = x + width; hvg->clipMinY = y; hvg->clipMaxY = y + height; // clipping region is reversed in actual vGfx if (hvg->rc) x = hvg->width - (x + width); vgSetClip(hvg->vg, x, y, width, height); } +INLINE void hvGfxGetClip(struct hvGfx *hvg, int *retX, int *retY, int *retWidth, int *retHeight) +/* Get clipping rectangle. */ +{ +if (retX != NULL) + *retX = hvg->clipMinX; +if (retY != NULL) + *retY = hvg->clipMinY; +if (retWidth != NULL) + *retWidth = (hvg->clipMaxX - hvg->clipMinX); +if (retHeight != NULL) + *retHeight = (hvg->clipMaxY - hvg->clipMinY); +} + INLINE void hvGfxUnclip(struct hvGfx *hvg) /* Set clipping rect cover full thing. */ { hvg->clipMinX = 0; hvg->clipMaxX = hvg->width; hvg->clipMinY = 0; hvg->clipMaxY = hvg->height; vgUnclip(hvg->vg); } INLINE void hvGfxVerticalSmear(struct hvGfx *hvg, int xOff, int yOff, int width, int height, Color *dots, boolean zeroClear) /* Put a series of one '8-bit pixel' width vertical lines. */ {