Files
test/source/blender/imbuf/IMB_imbuf_enums.h
Aras Pranckevicius facb17b0e3 Cleanup: BLI ENUM_OPERATORS cleanup/robustness
BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:

- Move it out into a separate BLI_enum_flags.hh header, instead of
  "random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
  bit value. This originally was added in a31a87f89 (2020 Oct), in
  order to silence some UBSan warnings that were coming
  from GPU related structures (looking at current GPU code, I don't
  think this is happening anymore). However, that caused actual
  user-visible bugs due to incorrectly specified max. enum bit value,
  and today 14% of all usages have incorrect highest individual
  bit value spelled out.
    - I have reviewed all usages of operator ~ and none of them are
      used for directly producing a DNA-serialized value; all the
      usages are for masking out other bits for which the new ~
      behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
  that are set in C++ enum class cases; update existing cases to use
  that instead of three other ways that were used.

Pull Request: https://projects.blender.org/blender/blender/pulls/148230
2025-10-17 12:57:50 +02:00

51 lines
944 B
C

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BLI_enum_flags.hh"
/** \file
* \ingroup imbuf
*/
#define IM_MAX_SPACE 64
/** #ImBuf.ftype: main image types. */
enum eImbFileType {
IMB_FTYPE_NONE = 0,
IMB_FTYPE_PNG = 1,
IMB_FTYPE_TGA = 2,
IMB_FTYPE_JPG = 3,
IMB_FTYPE_BMP = 4,
IMB_FTYPE_OPENEXR = 5,
IMB_FTYPE_IRIS = 6,
IMB_FTYPE_PSD = 7,
#ifdef WITH_IMAGE_OPENJPEG
IMB_FTYPE_JP2 = 8,
#endif
IMB_FTYPE_RADHDR = 9,
IMB_FTYPE_TIF = 10,
#ifdef WITH_IMAGE_CINEON
IMB_FTYPE_CINEON = 11,
IMB_FTYPE_DPX = 12,
#endif
IMB_FTYPE_DDS = 13,
#ifdef WITH_IMAGE_WEBP
IMB_FTYPE_WEBP = 14,
#endif
};
/** NOTE: Keep in sync with #MovieClipProxy.build_size_flag */
enum IMB_Proxy_Size {
IMB_PROXY_NONE = 0,
IMB_PROXY_25 = 1,
IMB_PROXY_50 = 2,
IMB_PROXY_75 = 4,
IMB_PROXY_100 = 8,
IMB_PROXY_MAX_SLOT = 4,
};
ENUM_OPERATORS(IMB_Proxy_Size);