Commit graph

440 commits

Author SHA1 Message Date
Benjamin Otte
e79acf47a5 subsurface: Make CAIRO_SURFACE_TYPE_SUBSURFACE public 2010-08-26 12:55:39 +02:00
Oleg Romashin
6b92d5a0f9 qt: Use native glyph rendering.
Remove the hack of using the xlib surface to do glyph rendering and use
the new interface introduced with Qt4.7, or else fallback to image
rendering with freetype.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[2 files changed, 35 insertions(+), 140 deletions(-) \o/]
2010-07-16 09:49:42 +01:00
Benjamin Otte
b870cc030d doc: Move tmpl/ docs to inline docs
I did this manually so I could review the docs at the same time.
If anyone finds typos or other mistakes I did, please complain to me (or
better: fix them).
2010-07-08 14:27:16 +02:00
Benjamin Otte
398870e64a xlib: Setters should set finished surfaces into an error status
Caught by api-special-cases test
2010-07-06 00:22:38 +02:00
Chris Wilson
1f84f5682c xlib: Apply translation to image surface upload.
Fixes:

  Bug 28888 - cairo_paint with rgb images does not work correctly
  https://bugs.freedesktop.org/show_bug.cgi?id=28888
2010-07-02 13:19:17 +01:00
Chris Wilson
9fffc0e120 xlib: Precise and Imprecise were reversed.
The intention was to switch to imprecise mode by default, using the
exact rendering mode only upon request.
2010-06-19 11:15:13 +01:00
Chris Wilson
b322b2e619 xlib: Perform image uploads inplace.
Under the restrictive conditions where we are doing an untransformed
contained upload of an image into a matching surface, perform it in
place. The drivers will attempt to stream such uploads efficiently, far
more so than our code.
2010-06-19 10:52:52 +01:00
Chris Wilson
edb73b6dcf xlib: Adjust trapezoid precision based on antialias.
Render supports two modes of precision when rendering trapezoids.
Precise specifies points sampling on a 15x17 grid, ala pixman. Imprecise
allows the driver more freedom in the methods used, which may be more
amenable to acceleration. Choose to use the imprecise mode by default,
but still allow users to force the more rigidly specified precision by
changing the antialias mode.
2010-06-11 11:16:42 +01:00
Karl Tomlinson
55037bfb24 xlib: Find matching Visual for XRenderFormat
Not only is this useful for users to know which Visual matches any
particular Cairo surface, it should also close a few obscure bugs of not
converting images correctly on upload.

Fixes:

  Bug 28492 - cairo_xlib_surface_create_with_xrender_format does not
              create visual for resulting surface
  https://bugs.freedesktop.org/show_bug.cgi?id=28492

  Mozilla Bug 567065 - Try to create offscreen Xlib surface from existing
                       visual if possible
  https://bugzilla.mozilla.org/show_bug.cgi?id=567065

  Mozilla Bug 445250 - cairo_draw_with_xlib should provide a non-NULL visual
                       to callback
  https://bugzilla.mozilla.org/show_bug.cgi?id=445250

Reported-by: Oleg Romashin <romaxa@gmail.com>
2010-06-11 10:42:15 +01:00
Andrea Canciani
baaf312e04 pattern: remove content field from solid patterns
The content field in solid patterns had ill-defined semantic (or no
semantic at all), thus it can be removed.
2010-06-10 16:07:41 +02:00
Andrea Canciani
7461947eb1 surface: remove content argument from is_similar
The content argument was basically unuses.

Xlib change extracted from ickle's wip/compositor branch.
2010-06-10 16:07:41 +02:00
Benjamin Otte
2b771da47a xlib: ensure variable isn't uninitialized 2010-05-17 01:16:16 +02:00
Chris Wilson
88986fdbef xlib: Remove reference counting for cairo_xlib_screen_t
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.
2010-05-06 10:46:49 +01:00
Chris Wilson
7002b82472 xlib: Don't delete gradients in unbounded fixup code
The fix is ugly, but for now it works.
2010-05-04 13:53:02 +02:00
Benjamin Otte
5d07307b69 xlib: Don't modify variables that are needed later
In the XCopyArea region code, don't modify src_x/y when they are later
used in the unbounded fixup code.

Exposed by composite-integer-translate-source test.
2010-04-29 18:20:59 +02:00
Benjamin Otte
90160deb2a xlib: Constify some function arguments 2010-04-29 18:20:44 +02:00
Benjamin Otte
4da71d1a01 xlib: remove unused code 2010-04-29 18:11:54 +02:00
Andrea Canciani
b8a7f8621a Update FSF address
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
2010-04-27 11:13:38 +02:00
Benjamin Otte
f74ad37e66 xlib: Make display a cairo_device_t
The code now uses the locking of the cairo_device_t instead of its own
mutexes.

The code was modified so that cairo_surface_t does no longer reference
the display directly. Instead, it calls _cairo_xlib_display_acquire().
If a function assumes an already acquired display, it now requires the
caller to provide a cairo_xlib_display_t parameter. Functions that do
not require an acquired display will not require the display parameter
or they will take the cairo_device_t instead.
2010-04-18 23:20:02 +02:00
Benjamin Otte
2bffa2467e Use pixman_image_composite32()
Replace all occurences of pixman_image_composite()
2010-04-15 18:31:01 +02:00
Benjamin Otte
1d753b2f4d xlib: Make code not complain about every new format 2010-04-15 17:47:01 +02:00
Chris Wilson
005596907f xlib: Don't operate on an error object inside setters.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=599574

The backend API manipulated the surface prior to checking whether it was
an inert error surface - and in the event of an error surface, tried to
overwrite it's error status.
2010-04-14 19:31:31 +01:00
Chris Wilson
ce3ad6f41e xlib: Avoid multiple evaluations inside bswap_*() macro.
Fixes:
  Fonts are not readable if remote display to a machine with different
  endian.
  https://bugzilla.mozilla.org/show_bug.cgi?id=526977

Reported-and-tested-by: Ginn Chen <Ginn.Chen@Sun.COM>
2010-03-31 08:21:17 +01:00
Chris Wilson
7ab350378e Silence enumeration warnings following addition of RGB16_565 2010-03-30 18:31:34 +01:00
Chris Wilson
f071958606 xlib: Handle a1 image uploads through converter
Fixes test/large-source [xlib]
2010-03-02 13:58:18 +00:00
M Joonas Pihlaja
5b7f4bb241 api: Introduce CAIRO_FORMAT_INVALID formally in the API.
We were exposing the actual value of CAIRO_FORMAT_INVALID
through API functions already, so it makes sense to just
go ahead and put it in the cairo_format_t enum.
2010-03-01 01:21:31 +02:00
Chris Wilson
29bedde904 pattern: Add convenience patterns for stock colours
By preallocating in our data segment a couple of solid patterns for the
stock colours, it becomes more convenient when using those in surface
operations, such as when clearing.
2010-01-22 23:01:51 +00:00
Chris Wilson
3a5d71c431 pattern: An EXTEND_NONE surface is not opaque if we sample outside
Fixes test/clear-source as proposed by Benjamin Otte.
2010-01-22 23:01:51 +00:00
Chris Wilson
f617d5fc98 Add cairo_device_t
The device is a generic method for accessing the underlying interface
with the native graphics subsystem, typically the X connection or
perhaps the GL context. By exposing a cairo_device_t on a surface and
its various methods we enable finer control over interoperability with
external interactions of the device by applications. The use case in
mind is, for example, a multi-threaded gstreamer which needs to serialise
its own direct access to the device along with Cairo's across many
threads.

Secondly, the cairo_device_t is a unifying API for the mismash of
backend specific methods for controlling creation of surfaces with
explicit devices and a convenient hook for debugging and introspection.

The principal components of the API are the memory management of:

  cairo_device_reference(),
  cairo_device_finish() and
  cairo_device_destroy();

along with a pair of routines for serialising interaction:

  cairo_device_acquire() and
  cairo_device_release()

and a method to flush any outstanding accesses:

  cairo_device_flush().

The device for a particular surface may be retrieved using:

  cairo_surface_get_device().

The device returned is owned by the surface.
2010-01-22 23:01:50 +00:00
Chris Wilson
c50c8b90c0 Move _cairo_error() to a standalone header
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.
2010-01-22 22:30:43 +00:00
M Joonas Pihlaja
e2d75203c5 [dirty] Add more missing surface dirtying notifications.
Now that the image surface actually cares about
cairo_surface_mark_dirty() we're hitting cases where
we've forgotten to mark surfaces dirty.
2009-11-29 15:56:26 +02:00
Benjamin Otte
a9f37953c7 [xlib] Use correct number when checking if points are out of range 2009-11-04 13:59:58 +01:00
Benjamin Otte
52afe9c77f [xlib] Fix new Composite test
When the reference point was tirggering _line_exceeds_16_16() and got
adjusted, the code failed to compute the srcX and srcY arguments for the
call to XRenderCompositeTrapezoids() correctly and caused the resulting
source image to be misaligned.
2009-11-04 11:20:45 +01:00
Chris Wilson
f571356d34 xlib: Set has_component_alpha = FALSE for gradient Pictures
Whilst creating the xlib surface wrapper for gradient Pictures, the
corresponding attributes require ComponentAlpha disabled.
2009-10-27 20:27:09 +00:00
Chris Wilson
df357f26ff Support component-alpha.
Within our code base we carried a few hacks to utilize the component
alpha capabilities of pixman, whilst not supporting the concept for our
own masks. Thus we were setting it upon the pixman_image_t that we
passed around through code that was blissfully unaware and indeed the
component-alpha property was forgotten (e.g. upgrading glyph masks).

The real issue is that without explicit support that a pattern carries
subpixel masking information, that information is lost when using that
pattern with composite. Again we can look at the example of compositing
a sub-pixel glyph mask onto a remote xlib surface for further failure.
2009-10-21 11:37:16 +01:00
Chris Wilson
54df07a3da [surface] Don't AND in the desired content.
Gah, that was a horrible mistake. It was a flawed hack to create Pixmaps
of the correct depth when cloning patterns for blitting to the xlib
backend. However, it had the nasty side-effect of discarding alpha when
targeting Window surfaces. The correct solution is to simply correct the
Pixmap of the desired depth and render a matching pattern onto the
surface - i.e. a reversal the current acquire -> clone. See the
forthcoming revised xcb backend on how I should have done it originally.
2009-10-16 17:04:16 +01:00
Chris Wilson
395555b116 [xlib] Suppress warning that should never have been. 2009-09-30 17:50:35 +01:00
Chris Wilson
f8c49b4187 [xlib] XRequest bread crumbing
Add bread crumbs in the form of NoOperations that can be parsed by
xtrace and very useful when debugging protocol/server errors.
2009-09-29 03:03:51 +01:00
Benjamin Otte
50163a9faf [xlib] Set proper bpp when computing format from masks
Fixing omission in caa9eed464
2009-09-29 00:24:37 +02:00
Benjamin Otte
a160c8c400 [xlib] Handle 24bpp formats during dithering 2009-09-29 00:11:52 +02:00
Benjamin Otte
caa9eed464 [xlib] Handle case in draw_image() where pixman format is not RGB
When an image cannot be expressed as masks, its data cannot be used in
an XImage. In that case, we use pixman to copy the image to the desired
format.
2009-09-25 00:16:39 +02:00
Chris Wilson
e00d062749 [xlib] Fix recent bug in unbounded trapezoids
Gah! I had believed that the dst extents and the clip were correct to
enable unbounded fixup for the unbounded trapezoids. I was wrong, so I
need to requery the trapezoid extents. As this information is already
known, I should update the interface to pass along all relevant
information.
2009-09-21 13:50:00 +01:00
Chris Wilson
35daf95db8 [xlib] Trim a few redundant steps when uploading glyphs
Cleanup the glyph coercion routines to avoid the temporary cairo_t (as
we can just cairo_surface_paint() directly).
2009-09-21 04:26:01 +01:00
Chris Wilson
9b7c5d9505 [xlib] Cleanse creation of similar surfaces.
Reduce two nearly identical routines to one.
2009-09-20 20:10:34 +01:00
Chris Wilson
33be73dfb7 [xlib] Fix big-line.
Project lines that exceed the 16.16 limits onto the XFixedLine, as we know
that top/bottom must fit within the confines of the surface and so will be
less than 16 bits.

Sadly this is a run-on patch that also does:
1. Make FillTiled the default for new GCs.
2. Stores extend mode as opposed to repeat, and thereby cleaning up some
inconsistent code.
3. Remove the special casing for unbounded trapezoids, as it is redundant
with the polygon clipping.
4. Tidy the logic for deciding when to use the core protocol
(_categorize_composite_operation)
2009-09-11 14:59:58 +01:00
Chris Wilson
6960162c5e [xlib] Discard clip if larger than glyph extents
Implement cheap calculation of glyph extents to see whether we can discard
the clip region. This is effective around 50% of the time for firefox (and
makes the xtrace so much neater).
2009-09-11 14:56:17 +01:00
Chris Wilson
67d40e5c73 [xlib] Protect ourselves from liars that claim to have a 64k window
Found using webkit, who attempt to paint an width X page height window.
Please, please clip large windows to the visible area. Thanks.
2009-09-06 10:21:00 +01:00
Chris Wilson
a76c36f2ed [xlib] solid pictures should only be 1x1
Creating an widthxheight solid picture for using with
RenderCompositeTrapezoids defeats the optimization with the xserver that
checks for a solid alpha pattern. The checks it performs are for
CONTENT_ALPHA, Repeat, 1x1 and value == 0xff.
2009-09-03 14:29:20 +01:00
Chris Wilson
17cdffafda [xlib] Remove stray code
Grr. Should have spotted this before pushing - remove the addition of the
superfluous code.
2009-09-02 00:41:18 +01:00
Chris Wilson
59c4fe93ee [xlib] Eliminate GC clipping
Eradicate the use of clipping with GC. By never using clipping, we never
have to worry about retrieving a dirty clip from the GC cache.
2009-09-02 00:34:37 +01:00