Blender V5.0
tile_highlight.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_vec_types.h"
12
13#include "BLI_mutex.hh"
14#include "BLI_set.hh"
15#include "BLI_vector.hh"
16
17struct RenderResult;
18
19namespace blender::render {
20
22 public:
23 TilesHighlight() = default;
24 ~TilesHighlight() = default;
25
28
29 void highlight_tile(int x, int y, int width, int height);
30 void unhighlight_tile(int x, int y, int width, int height);
31
32 void clear();
33
35
36 private:
37 struct Tile {
38 Tile() = default;
39 explicit Tile(const RenderResult *result);
40 explicit Tile(int x, int y, int width, int height);
41
42 uint64_t hash() const;
43
44 bool operator==(const Tile &other) const
45 {
46 return rect == other.rect;
47 }
48 bool operator!=(const Tile &other) const
49 {
50 return !(*this == other);
51 }
52
53 rcti rect = {0, 0, 0, 0};
54 };
55
56 void highlight_tile(const Tile &tile);
57 void unhighlight_tile(const Tile &tile);
58
59 mutable Mutex mutex_;
60 Set<Tile> highlighted_tiles_set_;
61
62 /* Cached flat list of currently highlighted tiles for a fast access via API. */
63 mutable bool did_tiles_change_ = false;
64 mutable Vector<rcti> cached_highlighted_tiles_;
65};
66
67} // namespace blender::render
unsigned long long int uint64_t
void highlight_tile_for_result(const RenderResult *result)
void unhighlight_tile(int x, int y, int width, int height)
void unhighlight_tile_for_result(const RenderResult *result)
Span< rcti > get_all_highlighted_tiles() const
void highlight_tile(int x, int y, int width, int height)
const ccl_global KernelWorkTile * tile
bool operator!=(const CPPType &a, const CPPType &b)
std::mutex Mutex
Definition BLI_mutex.hh:47
bool operator==(const CPPType &a, const CPPType &b)
#define hash
Definition noise_c.cc:154