Blender V5.0
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 const void *last_scene = nullptr;
37
38 ImageUsage() = default;
39 ImageUsage(const ::Image *image, const ::ImageUser *image_user, bool do_tile_drawing)
40 {
41 pass = image_user ? image_user->pass : 0;
42 layer = image_user ? image_user->layer : 0;
43 view = image_user ? image_user->multi_index : 0;
44 colorspace_settings = image->colorspace_settings;
45 alpha_mode = image->alpha_mode;
46 last_image = static_cast<const void *>(image);
47 last_scene = image_user ? static_cast<const void *>(image_user->scene) : nullptr;
48 last_tile_drawing = do_tile_drawing;
49 }
50
51 bool operator==(const ImageUsage &other) const
52 {
53 return memcmp(this, &other, sizeof(ImageUsage)) == 0;
54 }
55 bool operator!=(const ImageUsage &other) const
56 {
57 return !(*this == other);
58 }
59};
60
61} // 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