Blender
V4.3
source
blender
draw
engines
image
image_partial_updater.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2021 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include "
BKE_image.hh
"
12
#include "
BKE_image_partial_update.hh
"
13
14
struct
PartialImageUpdater
{
15
PartialUpdateUser *
user
;
16
const
Image
*
image
;
17
21
void
ensure_image
(
const
Image
*new_image)
22
{
23
if
(!is_valid(new_image)) {
24
free();
25
create(new_image);
26
}
27
}
28
29
virtual
~PartialImageUpdater
()
30
{
31
free();
32
}
33
34
private
:
40
bool
is_valid(
const
Image
*new_image)
const
41
{
42
if
(
image
!= new_image) {
43
return
false
;
44
}
45
46
return
user
!=
nullptr
;
47
}
48
49
void
create(
const
Image
*new_image)
50
{
51
BLI_assert
(
user
==
nullptr
);
52
user
=
BKE_image_partial_update_create
(new_image);
53
image
= new_image;
54
}
55
56
void
free()
57
{
58
if
(
user
!=
nullptr
) {
59
BKE_image_partial_update_free
(
user
);
60
user
=
nullptr
;
61
image
=
nullptr
;
62
}
63
}
64
};
BKE_image.hh
BKE_image_partial_update_free
void BKE_image_partial_update_free(PartialUpdateUser *user)
free a partial update user.
Definition
image_partial_update.cc:558
BKE_image_partial_update_create
PartialUpdateUser * BKE_image_partial_update_create(const Image *image)
Create a new PartialUpdateUser. An Object that contains data to use partial updates.
Definition
image_partial_update.cc:543
BKE_image_partial_update.hh
BLI_assert
#define BLI_assert(a)
Definition
BLI_assert.h:50
Image
struct Image Image
image
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
Image
Definition
DNA_image_types.h:142
PartialImageUpdater
Definition
image_partial_updater.hh:14
PartialImageUpdater::image
const Image * image
Definition
image_partial_updater.hh:16
PartialImageUpdater::~PartialImageUpdater
virtual ~PartialImageUpdater()
Definition
image_partial_updater.hh:29
PartialImageUpdater::ensure_image
void ensure_image(const Image *new_image)
Ensure that there is a partial update user for the given image.
Definition
image_partial_updater.hh:21
PartialImageUpdater::user
PartialUpdateUser * user
Definition
image_partial_updater.hh:15
Generated on Sat Oct 4 2025 05:32:23 for Blender by
doxygen
1.14.0