1
0
Fork 0
Commit graph

45 commits

Author SHA1 Message Date
Florian Müllner
8842bdfb11 Do not skip CoglError parameters
While CoglError is a define to GError, it doesn't follow the convention
of ignoring errors when NULL is passed, but rather treats the error as
fatal :-(
That's clearly unwanted for a compositor, so make sure to always pass
an error parameter where a runtime error is possible (i.e. any CoglError
that is not a malformed blend string).

https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:22:24 +02:00
Ting-Wei Lan
0aa4c4d43e build: Fix return value in meta-background.c
https://bugzilla.gnome.org/show_bug.cgi?id=754545
2015-09-04 11:47:34 +08:00
Ray Strode
1d56d50fcd background: paint color matte for scaled and centered backgrounds
Some backgrounds don't fully fill the screen.  For those backgrounds
it's important to paint a color behind them to fill in the gaps.

This commit checks whether or not the background image textures take
up the entire monitor, and in the event they don't, draws a color
behind them (such as it would do if the background were
translucent).

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -04:00
Ray Strode
0ffd4254d9 background: simplify conditional in meta_background_get_texture
meta_background_get_texture only draws the bottom image texture
if
   1) the blend factor leaves the top image translucent
   or
   2) the top image is translucent from alpha

The latter case doesn't actually matter since we're using REPLACE
on the top image texture.

This commit drops the unnecessary check for the second case and
applies demorgans law to the conditional for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -04:00
Rui Matos
7c5fe42835 meta-background: Add a function to refresh all background instances
We need to reload the FBOs under some circumstances, this adds a way
to easily do so.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2015-03-25 11:48:32 +01:00
Cosimo Cecchi
a37f632b1b background: use GFiles instead of filenames
We want to use GResources for system backgrounds, so move this to a
GFile.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:54:36 -07:00
Owen W. Taylor
458953268b MetaBackground: fix getting stuck in a bad state after monitor changes
After the ::monitors-changed signal, set the dirty flag on each new
monitor information struct so the per-monitor resources will be
recreated.
2014-09-12 14:59:20 -04:00
Owen W. Taylor
e27bbdc769 Fix colors for horizontal background gradients
COGL_PIXEL_FORMAT_RGB_888 is packed 3-bytes per pixel.
2014-09-12 11:00:55 -04:00
Owen W. Taylor
09b46029fa Fix multi-monitor backgrounds
The texture area was meant to be in monitor-relative coordinates, but that
was not consistently followed throughout the code - fix.

https://bugzilla.gnome.org/show_bug.cgi?id=736568
2014-09-12 11:00:55 -04:00
Florian Müllner
9be3e56b70 background: Fix monitor validation in get_texture()
Monitor indexes should be in the range [0, n], not [-1, 0] :-)
2014-09-06 18:22:56 +02:00
Jasper St. Pierre
3ea6424b8f background: Fix meta_background_new
This is used by the default plugin.
2014-09-03 19:55:15 -07:00
Jasper St. Pierre
d4317ba1e4 background: Fix build
These warnings weren't properly working on Owen's machine, so they went
unchecked.
2014-09-03 11:03:17 -07:00
Owen W. Taylor
a4a688ed83 Rewrite background code
The old requirement that multiple MetaBackgroundActor objects be
layered on top of each to produce blended backgrounds resulted in
extremely inefficient drawing since the entire framebuffer had
to be read and written multiple times.

 * Replace the MetaBackground ClutterContent with a plain GObject
   that serves to hold the background parameters and prerender
   textures to be used to draw the background. It handles
   colors, gradients, and blended images, but does not handle
   vignetting

 * Add vignetting to MetaBackgroundActor directly.

 * Add MetaBackgroundImage and MetaBackgroundImageCache to allow
   multiple MetaBackground objects to share the same images

By removing the usage of ClutterContent, the following optimizations
were easy to add:

 Blending is turned off when the actor is fully opaque
 Nearest-neighbour filtering is used when drawing 1:1

The GLSL vignette code is slightly improved to use a vertex shader
snippet for computing the texture coordinate => position in actor
mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=735637
2014-09-03 13:43:40 -04:00
Jasper St. Pierre
b284126d3b background: Don't bother attaching a paint node if the region is empty 2014-08-07 14:59:59 -04:00
Jasper St. Pierre
6858cb261f background-actor: Don't bother clipping to the content box
We already clip to the content box when we go to paint the content.
2014-08-07 14:58:18 -04:00
Jasper St. Pierre
2d6954186e background: Don't render with blending when we don't need to
If we have an opaque background image, then we shouldn't need to blend
against anything for it to work. Turn off blending in this case.
2014-08-07 14:01:14 -04:00
Jasper St. Pierre
d72bf0cd5d compositor: Don't use cogl_texture_new_with_data in the obvious cases
It's a deprecated API that can surprise us. Namely, when the internal
format passed is COGL_PIXEL_FORMAT_ANY, it will *always* allocate an
RGBA8888 pixel format texture, even if we only passed it a RGB format
or even an A8 format.

cogl_texture_2d_new_with_data is the newer, better API and doesn't have
these warts.
2014-08-07 14:01:14 -04:00
Jasper St. Pierre
584460deec background: Merge the code for creating the color texture into here
It's unused anywhere else.
2014-08-07 13:49:16 -04:00
Jasper St. Pierre
e3d5969282 background: Don't bother supporting alpha channels for gradients 2014-08-07 13:39:21 -04:00
Adel Gadllah
37652ca2cf background: Do not assume GLSL is available
Some hardware does not support it causing crashes in cogl during paint.

https://bugzilla.gnome.org/show_bug.cgi?id=733623
2014-07-24 16:51:53 +02:00
Jasper St. Pierre
8373c90cd8 background: Remove load_still_frame
Nothing uses it, and it's incompatible with XWayland anyway.
2014-04-02 12:35:24 -04:00
Andika Triwidada
9b21346427 Changed obsolete FSF postal address into generic URL.
Fix https://bugzilla.gnome.org/show_bug.cgi?id=721517 #2
2014-01-13 11:35:47 -05:00
Giovanni Campagna
7b537d6b8f Fix regression in mutter-wayland translations
Switching meta/util.h to gi18n.h was wrong, mutter is a library
and needs gi18n-lib.h, but that cannot be included from a public
header (since it depends on config.h or command line options),
so split util.h into a public and a private part.

https://bugzilla.gnome.org/show_bug.cgi?id=707897
2013-09-11 16:01:07 +02:00
Adel Gadllah
daba05f6a7 background: Rename visible_region to clip_region
This does better reflect what this region is used for.

https://bugzilla.gnome.org/show_bug.cgi?id=703332
2013-08-29 17:08:57 -04:00
Tim Lunn
ab72352c47 background: don't save pixbuf in user data
https://bugzilla.gnome.org/show_bug.cgi?id=706777
2013-08-27 09:57:06 +02:00
Ray Strode
b76c3312e9 Revert "background: Allow using sliced textures"
This reverts commit f743539886.

( accidentally pushed this when trying to push commit
  b7840bec7d )
2013-07-01 07:33:19 -04:00
Ray Strode
fd7db8e6b3 Revert "background: downscale background to fit in texture limits"
This reverts commit 15e01152da.

( accidentally pushed this when trying to push commit
  b7840bec7d )
2013-07-01 07:31:25 -04:00
Ray Strode
b7840bec7d background: Allow using sliced textures for file based backgrounds
Some cards have 2k texture limits, which can be smaller than
commonly sized backgrounds.

One way to get around this problem is to use Cogl's "sliced texture"
feature, that transparently uses several hardware textures under the hood.

This commit changes background textures loaded from file to potentially
use slicing.  Based on a patch by Jasper St. Pierre
<jstpierre@mecheye.net>.

https://bugzilla.gnome.org/show_bug.cgi?id=702283
2013-07-01 07:28:59 -04:00
Jasper St. Pierre
f743539886 background: Allow using sliced textures
https://bugzilla.gnome.org/show_bug.cgi?id=702283
2013-07-01 07:28:32 -04:00
Ray Strode
15e01152da background: downscale background to fit in texture limits
Some cards have 2k texture limits, which can be smaller than
commonly sized backgrounds.

This commit downscales the background in this situation, so that
it won't fail to load.

https://bugzilla.gnome.org/show_bug.cgi?id=702283
2013-07-01 07:28:32 -04:00
Pavel Vasin
8880dffbdb background: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=698710
2013-04-29 14:58:30 +02:00
Jasper Lievisse Adriaanse
992a15e640 Don't redefine MetaBackgroundPrivate, fixing a build issue:
compositor/meta-background.c:64: error: redefinition of typedef 'MetaBackgroundPrivate'
./meta/meta-background.h:51: error: previous declaration of 'MetaBackgroundPrivate' was here
2013-03-29 16:59:26 +01:00
Ray Strode
577e5e2e1a background: don't tank if background is destroyed before it gets a pipeline
Right now we call unset_texture from MetaBackground's dispose method.

unset_texture assumes there's a pipeline available, but there may not
be if the object was just created.

This commit fixes that incorrect assumption.

https://bugzilla.gnome.org/show_bug.cgi?id=696157
2013-03-26 16:58:22 -04:00
Ray Strode
47cf63bebe background: share snippets between pipelines
Cogl automatically caches pipelines with no eviction policy,
so we need to make sure to reuse snippets to prevent
identical pipelines from getting cached separately.

https://bugzilla.gnome.org/show_bug.cgi?id=696157
2013-03-26 16:58:22 -04:00
Ray Strode
0e58906194 background: drop saturation and blur effects
We don't use them anymore, so drop them.

https://bugzilla.gnome.org/show_bug.cgi?id=696157
2013-03-26 16:58:22 -04:00
Ray Strode
13c7020b80 background: fix pixbuf leak in load_file_finish
g_task_propagate_pointer relinishes the GTask
of its reference to the propagated pointer, so we need to
unref it ourselves when we're done with it.

https://bugzilla.gnome.org/show_bug.cgi?id=696157
2013-03-26 16:58:22 -04:00
Ray Strode
5ed6e37e3c background: fix task leak in load_file_async
g_task_run_in_thread takes its own reference to the
task passed in, so we can unref the initial reference.

https://bugzilla.gnome.org/show_bug.cgi?id=696157
2013-03-26 16:58:21 -04:00
Jasper St. Pierre
e216b6ca0f background: Fix the desaturate effect when on its own
We need to make sure cogl_texel is set to something,
otherwise we'll have junk.

https://bugzilla.gnome.org/show_bug.cgi?id=696087
2013-03-18 15:23:19 -04:00
Tomeu Vizoso
2efed44257 Add a meaningful name and description to all sections/files in the API docs
https://bugzilla.gnome.org/show_bug.cgi?id=695641
2013-03-14 18:11:04 -04:00
Ray Strode
6e831c88a6 compositor: fix background vignette for non-stretched styles
The background vignette currently fits itself to the painted
texture, instead of the monitor.  This causes some very
wrong looking drawing for backgrounds that don't fill the screen.

This commit reworks the vignette shader code to be clearer, more
correct, and parameterized so that it knows how to scale and
position the vignette.

https://bugzilla.gnome.org/show_bug.cgi?id=694393
2013-03-02 17:31:43 -05:00
Ray Strode
0e3d164117 compositor: when tiling background, center on screen
The WALLPAPER style of background painting currently
draws starting in the upper left corner of each monitor.

This isn't really correct, it means the seam between
monitors doesn't match up and edges look unbalanced if
the tile isn't a multipe of monitor size.

Really, the tiles should be centered in the middle of
the screen.  (Just like when tiling a bathroom floor,
tiles should start in the center of the room.)

This commit reworks the math to make that happen.

https://bugzilla.gnome.org/show_bug.cgi?id=694393
2013-03-02 17:30:32 -05:00
Ray Strode
e623406c99 background: Fix gradient color rendering
There is currently code to try to fill gradients in a
hardware native format, using #ifdefs. That optimization is
unimportant since gradients only use 2 byte buffers. It's
also incorrect because it's getting the channel order wrong
at buffer initialization time.

This commit drops the ifdefs for clarity and fixes the
channel order.

https://bugzilla.gnome.org/show_bug.cgi?id=694641
2013-02-28 13:17:24 -05:00
Rico Tzschichholz
1dbefc4e36 compositor/background: Avoid uninitialized variable warning
'code' may be used uninitialized in this function, so make sure
to return early in this case.
2013-02-20 14:02:02 +01:00
Jasper St. Pierre
7f6a77232f compositor: Don't use deprecated Cogl-1.0 API
https://bugzilla.gnome.org/show_bug.cgi?id=694224
2013-02-19 20:05:33 -05:00
Ray Strode
580feb0c85 compositor: rework how backgrounds are managed
Background handling in GNOME is very roundabout at the moment.

gnome-settings-daemon uses gnome-desktop to read the background from
disk into a screen-sized pixmap. It then sets the XID of that pixmap
on the _XROOTPMAP_ID root window property.

mutter puts that pixmap into a texture/actor which gnome-shell then
uses.

Having the gnome-settings-daemon detour from disk to screen means we
can't easily let the compositor handle transition effects when
switching backgrounds. Also, having the background actor be
per-screen instead of per-monitor means we may have oversized
textures in certain multihead setups.

This commit changes mutter to read backgrounds from disk itself, and
it changes backgrounds to be per-monitor.

This way background handling/compositing is left to the compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=682427
2013-02-19 18:21:00 -05:00