Blender V4.5
image_usage.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <cstring>
12
13#include "DNA_color_types.h"
14#include "DNA_image_types.h"
15
16namespace blender::image_engine {
17
22struct ImageUsage {
24 short pass = 0;
26 short layer = 0;
28 short view = 0;
29
34
35 const void *last_image = nullptr;
36
37 ImageUsage() = default;
38 ImageUsage(const ::Image *image, const ::ImageUser *image_user, bool do_tile_drawing)
39 {
40 pass = image_user ? image_user->pass : 0;
41 layer = image_user ? image_user->layer : 0;
42 view = image_user ? image_user->multi_index : 0;
43 colorspace_settings = image->colorspace_settings;
44 alpha_mode = image->alpha_mode;
45 last_image = static_cast<const void *>(image);
46 last_tile_drawing = do_tile_drawing;
47 }
48
49 bool operator==(const ImageUsage &other) const
50 {
51 return memcmp(this, &other, sizeof(ImageUsage)) == 0;
52 }
53 bool operator!=(const ImageUsage &other) const
54 {
55 return !(*this == other);
56 }
57};
58
59} // namespace blender::image_engine
ImageUsage(const ::Image *image, const ::ImageUser *image_user, bool do_tile_drawing)
ColorManagedColorspaceSettings colorspace_settings
bool operator==(const ImageUsage &other) const
bool operator!=(const ImageUsage &other) const