summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-visual.c
Commit message (Collapse)AuthorAgeFilesLines
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-1/+1
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xlib: Unlike the visual when destroying itChris Wilson2013-06-031-0/+3
| | | | | | | Otherwise we leave dangling pointers in the visual list, leading to memory corruption when using low bitdepth servers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Fix build of xlib-xcbAndrea Canciani2011-06-161-0/+4
| | | | | | | | | 45665c0d48396af7bd653d546115a5f36cfa9ae1 breaks the build of cairo-xlib-xcb because it does not disable the compilation of cairo-xlib implementation files when cairo-xlib-xcb is enable. This results in collisions when linking. Reported-by: James Cloos <cloos@jhcloos.com>
* xlib: Remove reference counting for cairo_xlib_screen_tChris Wilson2010-05-061-1/+1
| | | | | | The screen is owned by the cairo_xlib_display_t device, so we can simplify and close the refleak by removing the surplus reference counting.
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+2
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-1/+1
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
* [xlib] Implement ditheringBehdad Esfahbod2008-06-191-32/+71
| | | | | | | | Remove the intermediate rgb333 for PseudoColor and work on the cube directly. Also upgrade to a 6x6x6 cube instead of 5x5x5. Do dithering on both PseudoColor and TrueColor, using a 4x4 pattern. This only affects X servers with no XRender.
* [xlib-visual] Make the 5x5x5 color cube better approximate the rgb333 spaceBehdad Esfahbod2008-06-121-1/+1
| | | | | | That is, instead of uniformly spreading the colors at 0/4, 1/4, 2/4, 3/4, 4/4 intensities, we do 0/7, 1.5/7, 3.5/7, 5.5/7, 7/7 now. Those better approximate the 0/7..7/7 of the rgb333 space that we first convert to.
* [xlib-visual] Allocate 8-entry gray ramp instead of 16-entryBehdad Esfahbod2008-06-121-5/+3
| | | | | We convert to rgb333 before doing pseudo-color lookup, so we cannot get more than 8 gray levels anyway.
* [cairo-xlib] Handle malloc failures for cairo_xlib_visual_info_t.Chris Wilson2008-04-021-4/+15
| | | | | | Tidy the error paths whilst handling visuals, in particular avoiding a couple of potential NULL deferences, missed status checks and fresh leaks.
* Quiet some trivial unused and potentially-uninitialized compiler warningsCarl Worth2008-04-011-1/+1
|
* Add support for 8-bit PseudoColor visualsCarl Worth2008-03-201-0/+137
This support involves allocating a 16-bit grayscale ramp as well as a 5x5x5 RGB color cube. Afterwards, the 256 colors are queried and an array is generated mapping from r3g3b3 colors to the closest available color. Both the queried colors and the reverse mapping are stored in a new visual-specific cairo_xlib_visual_info_t structure which hangs off of the cairo_xlib_screen_info_t. Both the color-cube allocation and the distance metric could be improved by someone sufficiently motivated, (for example, allocating and matching in a perceptually linear color space rather than just in RGB space). Also, making this work well in the face of a changing color map, or in the case of GrayScale, StaticGray, or DirectColor visuals are left entirely as exercises for the reader. StaticColor support should be fine as is, but is entirely untested.