Blender V5.3
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
17namespace blender {
18
19struct RenderResult;
20
21namespace render {
22
24 public:
25 TilesHighlight() = default;
26 ~TilesHighlight() = default;
27
30
31 void highlight_tile(int x, int y, int width, int height);
32 void unhighlight_tile(int x, int y, int width, int height);
33
34 void clear();
35
37
38 private:
39 struct Tile {
40 Tile() = default;
41 explicit Tile(const RenderResult *result);
42 explicit Tile(int x, int y, int width, int height);
43
44 uint64_t hash() const;
45
46 bool operator==(const Tile &other) const
47 {
48 return rect == other.rect;
49 }
50 bool operator!=(const Tile &other) const
51 {
52 return !(*this == other);
53 }
54
55 rcti rect = {0, 0, 0, 0};
56 };
57
58 void highlight_tile(const Tile &tile);
59 void unhighlight_tile(const Tile &tile);
60
61 mutable Mutex mutex_;
62 Set<Tile> highlighted_tiles_set_;
63
64 /* Cached flat list of currently highlighted tiles for a fast access via API. */
65 mutable bool did_tiles_change_ = false;
66 mutable Vector<rcti> cached_highlighted_tiles_;
67};
68
69} // namespace render
70} // namespace blender
Tile()=default
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 Error &left, const Error &right)
BMesh Iterators.
unsigned __int64 uint64_t
Definition BKE_text.h:91
bool operator!=(const CPPType &a, const CPPType &b)
std::mutex Mutex
Definition BLI_mutex.hh:51
#define hash
Definition noise_c.cc:156