mirror of
https://github.com/brl/mutter.git
synced 2025-08-04 15:45:54 +00:00
On bad blend strings, print the error if not returning it
It's very common that there's no reasonable fallback to do if the blend or combine string you set isn't supported. So, rather than requiring everybody to pass in a GError purely to catch syntax erorrs, automatically g_warning() if a parse error is encountered and @error is NULL. http://bugzilla.openedhand.com/show_bug.cgi?id=1642 Signed-off-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:

committed by
Robert Bragg

parent
8a31263274
commit
a5b5691082
@@ -533,6 +533,7 @@ cogl_material_set_blend (CoglHandle handle,
|
||||
CoglBlendStringStatement split[2];
|
||||
CoglBlendStringStatement *rgb;
|
||||
CoglBlendStringStatement *a;
|
||||
GError *internal_error = NULL;
|
||||
int count;
|
||||
|
||||
g_return_val_if_fail (cogl_is_material (handle), FALSE);
|
||||
@@ -543,9 +544,19 @@ cogl_material_set_blend (CoglHandle handle,
|
||||
_cogl_blend_string_compile (blend_description,
|
||||
COGL_BLEND_STRING_CONTEXT_BLENDING,
|
||||
statements,
|
||||
error);
|
||||
&internal_error);
|
||||
if (!count)
|
||||
return FALSE;
|
||||
{
|
||||
if (error)
|
||||
g_propagate_error (error, internal_error);
|
||||
else
|
||||
{
|
||||
g_warning ("Cannot compile blend description: %s\n",
|
||||
internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA)
|
||||
{
|
||||
@@ -806,6 +817,7 @@ cogl_material_set_layer_combine (CoglHandle handle,
|
||||
CoglBlendStringStatement split[2];
|
||||
CoglBlendStringStatement *rgb;
|
||||
CoglBlendStringStatement *a;
|
||||
GError *internal_error = NULL;
|
||||
int count;
|
||||
|
||||
g_return_val_if_fail (cogl_is_material (handle), FALSE);
|
||||
@@ -817,9 +829,19 @@ cogl_material_set_layer_combine (CoglHandle handle,
|
||||
_cogl_blend_string_compile (combine_description,
|
||||
COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE,
|
||||
statements,
|
||||
error);
|
||||
&internal_error);
|
||||
if (!count)
|
||||
return FALSE;
|
||||
{
|
||||
if (error)
|
||||
g_propagate_error (error, internal_error);
|
||||
else
|
||||
{
|
||||
g_warning ("Cannot compile combine description: %s\n",
|
||||
internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA)
|
||||
{
|
||||
|
Reference in New Issue
Block a user