Mercurial > hg > xemacs-beta
comparison src/redisplay-output.c @ 819:6504113e7c2d
[xemacs-hg @ 2002-04-25 18:03:23 by andyp]
sync up windows branch from 21.4
author | andyp |
---|---|
date | Thu, 25 Apr 2002 18:04:24 +0000 |
parents | a5954632b187 |
children | 6728e641994e |
comparison
equal
deleted
inserted
replaced
818:accc481aef34 | 819:6504113e7c2d |
---|---|
230 crb->object.hline.yoffset != drb->object.hline.yoffset)) | 230 crb->object.hline.yoffset != drb->object.hline.yoffset)) |
231 return 0; | 231 return 0; |
232 else if (crb->type == RUNE_DGLYPH && | 232 else if (crb->type == RUNE_DGLYPH && |
233 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) || | 233 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) || |
234 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || | 234 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || |
235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset)) | 235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset || |
236 crb->object.dglyph.yoffset != drb->object.dglyph.yoffset || | |
237 crb->object.dglyph.ascent != drb->object.dglyph.ascent || | |
238 crb->object.dglyph.descent != drb->object.dglyph.descent)) | |
236 return 0; | 239 return 0; |
237 /* Only check dirtiness if we know something has changed. */ | 240 /* Only check dirtiness if we know something has changed. */ |
238 else if (crb->type == RUNE_DGLYPH && | 241 else if (crb->type == RUNE_DGLYPH && |
239 (XGLYPH_DIRTYP (crb->object.dglyph.glyph) || | 242 (XGLYPH_DIRTYP (crb->object.dglyph.glyph) || |
240 crb->findex != drb->findex)) | 243 crb->findex != drb->findex)) |
1546 | 1549 |
1547 | 1550 |
1548 dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p); | 1551 dga->height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p); |
1549 dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); | 1552 dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); |
1550 | 1553 |
1554 #ifdef DEBUG_REDISPLAY | |
1555 printf ("redisplay_output_pixmap(request) \ | |
1556 [%dx%d@%d+%d] in [%dx%d@%d+%d]\n", | |
1557 db->width, db->height, db->xpos, db->ypos, | |
1558 dga->width, dga->height, dga->xoffset, dga->yoffset); | |
1559 #endif | |
1560 | |
1551 /* This makes the glyph area fit into the display area. */ | 1561 /* This makes the glyph area fit into the display area. */ |
1552 if (!redisplay_normalize_glyph_area (db, dga)) | 1562 if (!redisplay_normalize_glyph_area (db, dga)) |
1553 return; | 1563 return; |
1564 | |
1565 #ifdef DEBUG_REDISPLAY | |
1566 printf ("redisplay_output_pixmap(normalized) \ | |
1567 [%dx%d@%d+%d] in [%dx%d@%d+%d]\n", | |
1568 db->width, db->height, db->xpos, db->ypos, | |
1569 dga->width, dga->height, dga->xoffset, dga->yoffset); | |
1570 #endif | |
1554 | 1571 |
1555 /* Clear the area the pixmap is going into. The pixmap itself will | 1572 /* Clear the area the pixmap is going into. The pixmap itself will |
1556 always take care of the full width. We don't want to clear where | 1573 always take care of the full width. We don't want to clear where |
1557 it is going to go in order to avoid flicker. So, all we have to | 1574 it is going to go in order to avoid flicker. So, all we have to |
1558 take care of is any area above or below the pixmap. If the pixmap | 1575 take care of is any area above or below the pixmap. If the pixmap |
1743 | 1760 |
1744 /***************************************************************************** | 1761 /***************************************************************************** |
1745 redisplay_normalize_glyph_area | 1762 redisplay_normalize_glyph_area |
1746 redisplay_normalize_display_box | 1763 redisplay_normalize_display_box |
1747 | 1764 |
1748 Calculate the visible box for displaying src in dest. | 1765 Calculate the visible box for displaying glyphsrc in dest. |
1766 | |
1767 display_box and display_glyph_area are used to represent an area to | |
1768 displayed and where to display it. Using these two structures all | |
1769 combinations of clipping and position can be accommodated. | |
1770 | |
1771 dest - display_box | |
1772 | |
1773 xpos - absolute horizontal position of area. | |
1774 | |
1775 ypos - absolute vertical position of area. | |
1776 | |
1777 glyphsrc - display_glyph_area | |
1778 | |
1779 xoffset - horizontal offset of the glyph, +ve means display | |
1780 the glyph with the x position offset by xoffset, -ve means | |
1781 display starting xoffset into the glyph. | |
1782 | |
1783 yoffset - vertical offset of the glyph, +ve means display the | |
1784 glyph with y position offset by yoffset, -ve means display | |
1785 starting xoffset into the glyph. | |
1786 | |
1749 ****************************************************************************/ | 1787 ****************************************************************************/ |
1750 int | 1788 int |
1751 redisplay_normalize_glyph_area (struct display_box* dest, | 1789 redisplay_normalize_glyph_area (struct display_box* dest, |
1752 struct display_glyph_area* glyphsrc) | 1790 struct display_glyph_area* glyphsrc) |
1753 { | 1791 { |
1771 { | 1809 { |
1772 /* It's all clipped out */ | 1810 /* It's all clipped out */ |
1773 return 0; | 1811 return 0; |
1774 } | 1812 } |
1775 | 1813 |
1776 /* Horizontal offsets. This works because xoffset can be -ve as well as +ve */ | 1814 /* Horizontal offsets. This works because xoffset can be -ve as well |
1815 as +ve. When we enter this function the glyphsrc width and | |
1816 height are set to the actual glyph width and height irrespective | |
1817 of how much can be displayed. We are trying to clip both the | |
1818 offset into the image and the rightmost bounding box. Its | |
1819 possible for the glyph width to be much larger than the area we | |
1820 are displaying into (e.g. a large glyph in a small frame). */ | |
1777 if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width) | 1821 if (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width) |
1778 { | 1822 { |
1823 /* glyphsrc offset is +ve we are trying to display offset from the | |
1824 origin (the bounding box contains some space and then the | |
1825 glyph). At most the width we want to display is dest->width - | |
1826 glyphsrc->xoffset. */ | |
1779 if (glyphsrc->xoffset > 0) | 1827 if (glyphsrc->xoffset > 0) |
1780 glyphsrc->width = dest->width - glyphsrc->xoffset; | 1828 glyphsrc->width = dest->width - glyphsrc->xoffset; |
1829 /* glyphsrc offset is -ve we are trying to display hard up | |
1830 against the dest corner inset into the glyphsrc by | |
1831 xoffset.*/ | |
1832 else if (glyphsrc->xoffset < 0) | |
1833 { | |
1834 glyphsrc->width += glyphsrc->xoffset; | |
1835 glyphsrc->width = min (glyphsrc->width, dest->width); | |
1836 } | |
1781 else | 1837 else |
1782 glyphsrc->width = dest->width; | 1838 glyphsrc->width = dest->width; |
1783 } | 1839 } |
1784 | 1840 |
1785 if (glyphsrc->xoffset < 0) | 1841 else if (glyphsrc->xoffset < 0) |
1786 glyphsrc->width += glyphsrc->xoffset; | 1842 glyphsrc->width += glyphsrc->xoffset; |
1787 | 1843 |
1788 /* Vertical offsets. This works because yoffset can be -ve as well as +ve */ | 1844 /* Vertical offsets. This works because yoffset can be -ve as well as +ve */ |
1789 if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height) | 1845 if (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height) |
1790 { | 1846 { |
1791 if (glyphsrc->yoffset > 0) | 1847 if ((glyphsrc->yoffset > 0) && (dest->height > glyphsrc->yoffset)) |
1792 glyphsrc->height = dest->height - glyphsrc->yoffset; | 1848 glyphsrc->height = dest->height - glyphsrc->yoffset; |
1849 else if (glyphsrc->yoffset < 0) | |
1850 { | |
1851 glyphsrc->height += glyphsrc->yoffset; | |
1852 glyphsrc->height = min (glyphsrc->height, dest->height); | |
1853 } | |
1793 else | 1854 else |
1794 glyphsrc->height = dest->height; | 1855 glyphsrc->height = dest->height; |
1795 } | 1856 } |
1796 | 1857 |
1797 if (glyphsrc->yoffset < 0) | 1858 else if (glyphsrc->yoffset < 0) |
1798 glyphsrc->height += glyphsrc->yoffset; | 1859 glyphsrc->height += glyphsrc->yoffset; |
1799 | 1860 |
1800 return 1; | 1861 return 1; |
1801 } | 1862 } |
1802 | 1863 |
1877 Convert from rune/display_line co-ordinates to display_box | 1938 Convert from rune/display_line co-ordinates to display_box |
1878 co-ordinates. | 1939 co-ordinates. |
1879 ****************************************************************************/ | 1940 ****************************************************************************/ |
1880 int | 1941 int |
1881 redisplay_calculate_display_boxes (struct display_line *dl, int xpos, | 1942 redisplay_calculate_display_boxes (struct display_line *dl, int xpos, |
1882 int xoffset, int start_pixpos, int width, | 1943 int xoffset, int yoffset, int start_pixpos, |
1883 struct display_box* dest, | 1944 int width, struct display_box* dest, |
1884 struct display_glyph_area* src) | 1945 struct display_glyph_area* src) |
1885 { | 1946 { |
1886 dest->xpos = xpos; | 1947 dest->xpos = xpos; |
1887 dest->ypos = DISPLAY_LINE_YPOS (dl); | 1948 dest->ypos = DISPLAY_LINE_YPOS (dl); |
1888 dest->width = width; | 1949 dest->width = width; |
1889 dest->height = DISPLAY_LINE_HEIGHT (dl); | 1950 dest->height = DISPLAY_LINE_HEIGHT (dl); |
1890 | 1951 |
1891 src->xoffset = -xoffset; | 1952 src->xoffset = -xoffset; |
1892 src->yoffset = -dl->top_clip; | |
1893 src->width = 0; | 1953 src->width = 0; |
1894 src->height = 0; | 1954 src->height = 0; |
1955 | |
1956 src->yoffset = -dl->top_clip + yoffset; | |
1895 | 1957 |
1896 if (start_pixpos >=0 && start_pixpos > xpos) | 1958 if (start_pixpos >=0 && start_pixpos > xpos) |
1897 { | 1959 { |
1898 /* Oops, we're asking for a start outside of the displayable | 1960 /* Oops, we're asking for a start outside of the displayable |
1899 area. */ | 1961 area. */ |