mutter/cogl
Thomas Hindoe Paaboel Andersen d992722c24 cogl: correct check for COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL
In _cogl_offscreen_gl_allocate we only want to perform certain actions if
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL is not set in create_flags.

We perfrom this check with:

if (!offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL)

which is not correct as we negate the create_flags before the bitwise &.

It happens to work as intended though, as CoglOffscreenFlags only has one
element, and that element has the value 1. If the flag is not set then the
nagation of create_flags is true and the bitwise and with the element value
is true as well.
If any flag is set then the negation will give 0 and the bitwise & will be
false.

So while it works correctly it is fragile as either additional flags or a
change in the enum element value will break this check. This patch makes
things a bit more safe by adding parentheses to let the bitwise & happen
before the negation.

Definition of the enum:

typedef enum
{
  COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
} CoglOffscreenFlags;

https://gitlab.gnome.org/GNOME/mutter/merge_requests/938
2019-11-16 00:13:59 +01:00
..
cogl cogl: correct check for COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL 2019-11-16 00:13:59 +01:00
cogl-pango cogl: Remove COGL_PRIVATE_FEATURE_QUADS 2019-10-21 21:43:07 +00:00
cogl-path
test-fixtures cogl: Remove always-set COGL_FEATURE_ID_OFFSCREEN 2019-10-21 21:43:08 +00:00
tests test: Remove unreferenced test-texture-rectangle 2019-11-07 12:47:23 +00:00
.gitignore
cogl-config.h.meson
cogl-mutter-config.h.in
config-custom.h
meson.build Add Graphene dependency 2019-10-16 11:38:13 +00:00