Blender V4.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
9#pragma once
10
11#include "BLI_rect.h"
12#include "BLI_set.hh"
13#include "BLI_vector.hh"
14
15#include <mutex>
16
17struct RenderResult;
18
19namespace blender::render {
20
22 public:
23 TilesHighlight() = default;
24 ~TilesHighlight() = default;
25
26 void highlight_tile_for_result(const RenderResult *result);
27 void unhighlight_tile_for_result(const RenderResult *result);
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 inline bool operator==(const Tile &other) const
45 {
46 return rect == other.rect;
47 }
48 inline 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 std::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
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)
ccl_global const KernelWorkTile * tile
unsigned __int64 uint64_t
Definition stdint.h:90