Commit graph

5847 commits

Author SHA1 Message Date
Andrea Canciani
b6d593dc71 build: Clean up environment variables and flags for the win32 build
Avoid ovverriding LINK, as it has a special meaning for the MSVC build
tools.
2011-06-20 10:24:21 +02:00
Andrea Canciani
101fab7cd8 win32-font: Improve static data reset function
The hashtable is guaranteed to only contain font faces which are
currently referenced, hence there is no need to remove any font face
when it is reset (just like for toy-font).

This makes the function simpler and fixes the assertion

Assertion failed: predicate != NULL, file cairo-hash.c, line 373

hit by multiple tests (the first one being "clear").

See https://bugs.freedesktop.org/show_bug.cgi?id=38049
2011-06-20 10:24:21 +02:00
Andrea Canciani
94bc20da50 win32-font: Implement destroy function
Win32 font faces can be removed from the hashtable upon destruction.
Based on the toy-font destruction code.

See https://bugs.freedesktop.org/show_bug.cgi?id=38049
2011-06-20 10:24:20 +02:00
Andrea Canciani
94b14c929d win32-font: Do not return font in error status
If the hashtable cointains a font matching the font being created,
only reuse it if it is not in an error status. Otherwise, remove it
from teh hashtable and create a new one.
2011-06-20 10:24:20 +02:00
Andrea Canciani
b9d9ca281c Avoid deprecated functions on win32
Some POSIX functions are deprecated in MSVC and should instead be used
with an alternative name beginning with '_'.
2011-06-20 10:24:20 +02:00
Andrea Canciani
cbf11fa261 toy-font: Do not open-code cairo_font_face_reference ()
Since 03be41151d, it is safe to use
cairo_font_face_reference () to increment the reference count of a
font taken from the hashtable, because no mutex is being locked twice.
2011-06-20 10:24:20 +02:00
Andrea Canciani
5a79e9f536 script: Return status when flushing device
Since 92d7b1eee9 the flush vfunction
should return a cairo_status_t.

Silences the warning:

cairo-script-surface.c: At top level:
cairo-script-surface.c:3528:5: warning: initialization from
incompatible pointer type [enabled by default]
cairo-script-surface.c:3528:5: warning: (near initialization for
'_cairo_script_device_backend.flush') [enabled by default]
2011-06-20 09:44:49 +02:00
Andrea Canciani
ced061124d xlib-xcb: Implement cairo_xlib_device_debug_{g,s}et_precision
63bdae27a8 introduced a new public API
cairo_xlib_device_debug_set_precision(), exported by cairo-xlib.
cairo-xlib-xcb must implement it as well, because it must provide the
same public API.

Fixes the compilation of cairo-sphinx with --enable-tee
--enable-xlib-xcb --enable-script.

Reported-by: James Cloos <cloos@jhcloos.com>
2011-06-16 18:31:14 +02:00
Andrea Canciani
f409f74dec xlib: Fix build of xlib-xcb
45665c0d48 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>
2011-06-16 15:11:24 +02:00
Andrea Canciani
a2cd83a986 toy-font-face: Do not assume hash != 0
The assumption that no font face will hash to 0 is not correct.
Moreover, no special value is needed to mark fonts in error status, as
they can simply be detected upon lookup and destruction.
2011-06-16 12:17:33 +02:00
Andrea Canciani
a06668fabe path-stroke: Avoid mixing cap and join values
Silence the warning:

cairo-path-stroke.c: In function '_cairo_stroker_add_caps':
cairo-path-stroke.c:861:29: warning: comparison between
'cairo_line_cap_t' and 'enum _cairo_line_join' [-Wenum-compare]

CAIRO_LINE_JOIN_ROUND and CAIRO_LINE_CAP_ROUND have the same value,
hence this defect went unnoticed so far.
2011-06-16 09:48:30 +02:00
Taekyun Kim
8e7589abcc tessellator: Fixed to produce an output box with x1 <= x2 for single box input
Winding of a box is toggled by swapping x1, x2 coordinates. So
we have to swap those coordinate rather than just copying.

Many routines assume that boxes are left-top to right-bottom
convention. So tessellator should produce such output boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-15 16:13:15 +01:00
Andrea Canciani
45665c0d48 Remove if's from Makefile.sources
make on win32 complains that:

make[1]: Entering directory `/home/ranma42/Code/fdo/cairo/src'
../src/Makefile.sources:220: *** missing separator.  Stop.

Makefile.sources should not contain if's, which are aoutomake-only
conditionals.  The correct way to conditionally include files is to
enable/disable them using C preprocessor macros.
2011-06-14 15:25:08 +02:00
Uli Schlachter
9d256b7db9 xcb: Fallback to image surface for create similar
We can't use an X11 surface in create_similar if the specified coordinates are
too small/large. However, we can still use SHM-backed memory for the image
surface which will be used instead.

Thanks to Chris Wilson for the hint.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-12 15:42:01 +02:00
Uli Schlachter
fb0a40fc10 XCB: Implement PDF blend operators natively
The PDF blend operators, as offered by cairo, where added in RENDER 0.11. This
commit makes the XCB backend use them, if they are available.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-11 21:32:29 +02:00
Uli Schlachter
ad01d571dd Revert "xcb: Never return NULL from create_similar"
This reverts commit f6e6891b59.

Returning NULL in these cases is actually the right thing to do, because the
caller expects and handles this case.

cairo_surface_create_similar() won't return NULL due to this, because
_cairo_surface_create_similar_solid() will fall back to an image surface.

I think I missed that part when I wrote the bad commit.

This was found via the test suite's "zero-mask" test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-11 20:18:27 +02:00
Dagobert Michelsen
753a4cdf30 Use detected EGREP instead of generic grep
https://bugs.freedesktop.org/show_bug.cgi?id=38069
2011-06-08 16:01:03 +02:00
Benjamin Otte
00de16b7ac image: Don't crash on weird pixman formats
_pixel_to_solid() used to assert that it got a known cairo_format_t.
However, this might not be the case when backends decide to use a pixman
format that is not representable by a cairo format (X and DirectFB are
examples for backends that do that).

This patch makes _pixel_to_solid() return NULL in that case and fixes
the callers to deal with it.

https://bugs.freedesktop.org/show_bug.cgi?id=37916
2011-06-08 16:01:03 +02:00
Murray Cumming
d0615633dc cairo: Remove trailing comma from cairo_format_t
Fixes warnings when building with C++.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36989
2011-06-08 12:02:28 +02:00
Taekyun Kim
6edc5ca55f tessellator: Fix boxes tessellator to handle num_boxes <= 1 correctly
We cannot assume that parameter 'out' is empty. So we should make it
empty before returning CAIRO_STATUS_SUCCESS when 'in' contains no boxes.

When 'in' contains a single box, we should copy 'in' to 'out' rather
than just returning CAIRO_STATUS_SUCCESS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 09:59:42 +01:00
Chris Wilson
72b6299c12 gl: Mark the use-once vertex buffers as DYNAMIC
As we write, use and then immediately discard the vertex buffers, our
usage pattern more closely matches DYNAMIC (as opposed to STREAM). This
improve performance by about 10% on intel.

firefox-talos-gfx(snb) 20.226 -> 18.402

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-02 08:57:19 +01:00
Chris Wilson
bf1b08d066 perf 2011-06-02 08:57:13 +01:00
Chris Wilson
63bdae27a8 xlib,xcb: Force strict adherence to the Render specification when testing
Introduce cairo_xlib_device_debug_set_precision() to override the
automatic selection of rendering precision and force the Xorg/DDX to
strictly adhere to the precise rendering mode of the Render
specification. This allows us to test drivers without worrying, too
much, about minor discrepancies in antialiasing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-01 16:50:25 +01:00
Adrian Johnson
6936a2b417 PS: Use tight bounding box
Now that the page size is specified by %%DocumentMedia
we can make %%BoundingBox compliant.
2011-05-22 20:41:18 +09:30
Jeff Muizelaar
bdfd860ae7 Avoid implicit conversion to double when rounding 2011-05-19 14:43:34 -04:00
Alexandros Frantzis
4d96859ba5 gl: Add fallback path for GLES2 implementations not supporting GL_OES_mapbuffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:37:51 +01:00
Alexandros Frantzis
c2b4bc6dea gl: Fall back to dlsym() if *GetProcAddress() fails
In strictly conforming EGL implementations, eglGetProcAddress() can be used
only to get extension functions, but some of the functions we want belong to
core GL(ES). If the *GetProcAddress function provided by the context fails,
try to get the address of the wanted GL function using standard system
facilities (eg dlsym() in *nix systems).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:36:03 +01:00
Alexandros Frantzis
2001d20747 gl: Define the float precision in the fragment shader for GLES2
According to the GLSL ES standard, the precision of variables in the fragment
shader should be explicitly defined (although mesa's compiler is not that
strict).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:35:53 +01:00
Alexandros Frantzis
2472ed899c gl: Fix build issues for GLES2
The glReadBuffer/glDrawBuffer functions are not present in GLES2, only
a single buffer is supported.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:35:26 +01:00
Alexandros Frantzis
f84653422a gl: Add GLESv2 backend to build system
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:34:17 +01:00
Alexandros Frantzis
b990dfb067 gl: Require the GL_OES_texture_npot extension for GLES2
The default support for GLES2 NPOT textures is very limited. We need the
additional features provided by the GL_OES_texture_npot extension.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:34:07 +01:00
Alexandros Frantzis
faa031f6d5 gl: Use GL_MAX_TEXTURE_IMAGE_UNITS to query the maximum texture units
The previous used value, GL_MAX_TEXTURE_UNITS, is only appropriate for the
fixed pipeline. It is replaced with GL_MAX_TEXTURE_IMAGE_UNITS that refers to
the number of texture units available in the fragment shader.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:34:00 +01:00
Alexandros Frantzis
1f1255689b gl: Remove unnecessary call to glDisableClientState()
This function has no effect when using shaders and is not supported at all in
GLES2.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:33:52 +01:00
Alexandros Frantzis
bbb244c7f2 gl: Add GLES2 support for drawing image surfaces on gl surfaces
Work around GLES2 limitations in texture pixel formats and options for
pixel packing/unpacking.

Depending on the endianness and the image pixel format, we may need to
manually swap the elements in a pixel group. This is not currently
implemented, but for little-endian architectures the common pixman BGRA
formats don't need a swap.

Due to GL_UNPACK_ROW_LENGTH missing in GLES2 we have to extract the image
data ourselves in some cases, so we can provide it to glTexSubImage2D
using a layout it can understand. We must extract the pixels if:
a. we don't want full-length lines or
b. the row stride cannot be handled by GL itself using a 4 byte
   alignment constraint

We use GL_PACK_ALIGNMENT 4 by default because that is the default pixman
alignment value and in some cases it allows us to avoid the manual pixel
extraction. However, when we extract image data manually we use an alignment
of 1.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:33:40 +01:00
Alexandros Frantzis
14db3d23c7 gl: Add support for creating image surfaces for GLES2
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:31:42 +01:00
Alexandros Frantzis
0e41145a75 gl: Use conventional texture upload for GLES2
GLES2 doesn't support Pixel Buffer Objects. Use conventional texture upload
for GLES2 (using client-side memory).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:30:29 +01:00
Alexandros Frantzis
d20f66608c gl: Require the GL_EXT_texture_format_BGRA8888 extension for GLES2
This extension adds limited BGRA support to GLES2. It is better than
nothing...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:30:02 +01:00
Alexandros Frantzis
777ed8b4c4 Extract function to query endianness from xlib/xcb and make it common
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:27:27 +01:00
Alexandros Frantzis
7bfcf1deaf gl: Store gradients in 2D textures of height 1 instead of 1D textures
1D textures are not available in GLES2. We use 2D textures with height 1
instead, which are equivalent to 1D textures and exist across all GL flavors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:20:54 +01:00
Alexandros Frantzis
d308eee918 gl: Provide a shader implementation of GL_CLAMP_TO_BORDER for GLES2
The GL_CLAMP_TO_BORDER wrapping method (used with CAIRO_EXTEND_NONE) is not
available in GLES2. We use shaders to implement similar functionality for
GLES2.

If bilinear filtering is used, the shader performs a linear fade to
transparency effect in the texel coordinate intervals [-1/2n, 1/2n]
and [1 - 1/2n, 1 + 1/2n] (n: texture size).

If nearest filtering is used, the shader ensures that a clear color is
used for all texel coordinate values outside [0, 1).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:19:52 +01:00
Alexandros Frantzis
63aa65cfbb gl: Add functions to get the filter and extend of gl operands.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:19:40 +01:00
Alexandros Frantzis
7185ce4ddb gl: Pass more information to the shader emitter functions
This makes the shader emitter functions more versatile. It allows them to use
all information provided by the operands and the context to decide what shader
to produce.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:19:16 +01:00
Alexandros Frantzis
1f9200ffbf gl: Add GLES2 support to dispatch table initialization
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:18:52 +01:00
Alexandros Frantzis
4804160fd1 gl: Store the GL flavor (Desktop or ES) in the device struct
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:18:15 +01:00
Alexandros Frantzis
f1eef40c2a gl: Correctly extract GL version from OpenGL ES version strings
The GL version string returned by glGetString() for GLES doesn't have the
version number at the beginning of the string.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:11:15 +01:00
Chris Wilson
b1c96f1852 Silence the compiler for another couple of RGB30 switches
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-04 08:04:43 +01:00
Chris Wilson
5559dd0bbc image: Fix pixman format to RGB30 conversion
Søren Sandmann Pedersen spotted that we had reversed the channel order
in the conversion back from the pixman format codes to
CAIRO_FORMAT_RGB30.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-04 08:02:56 +01:00
Jesse Barnes
356c4ed9cc Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30
This is a common format used by framebuffers to drive 10bpc displays
and is often hardware accelerated by XRender with underlying support
from pixman's x2r10g10b10 format (which provides coercion paths for
fallbacks).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-01 09:00:14 +01:00
Jeff Muizelaar
bf75c9542d win32: Explain the purpose of the surface extents
It wasn't immediately obvious to me what the purpose of having
extents instead of just a size was.
2011-04-21 17:53:21 -04:00
Jeff Muizelaar
9f92901b09 Remove quartz-image extents.
We never used the x,y portion of the extents so we might as well take it out.
2011-04-21 15:23:14 -04:00