diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-04-04 15:00:33 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-04-04 15:12:33 +0300 |
commit | 9c2b5900c0add01a6fb0cbef234c78eb04ec9ff4 (patch) | |
tree | 225ded5ad2d4364cdf90f3b4c0cf68368cf3ddf6 | |
parent | a56f53ad5615afc4b9ed74907de21376c14b3775 (diff) |
Move ImageTileWrapper to BKE.
ImageTileWrapper is a wrapper around ImageTile to centralize tile calculations when
using CPP. Currentry used by the image engine and will be used for the 3d
texturing brush project.
-rw-r--r-- | source/blender/blenkernel/BKE_image_wrappers.hh (renamed from source/blender/draw/engines/image/image_wrappers.hh) | 12 | ||||
-rw-r--r-- | source/blender/draw/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/draw/engines/image/image_drawing_mode.hh | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/image/image_instance_data.hh | 5 |
4 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/draw/engines/image/image_wrappers.hh b/source/blender/blenkernel/BKE_image_wrappers.hh index 323d3ce66a1..344edd952f8 100644 --- a/source/blender/draw/engines/image/image_wrappers.hh +++ b/source/blender/blenkernel/BKE_image_wrappers.hh @@ -2,13 +2,17 @@ * Copyright 2022 Blender Foundation. */ /** \file - * \ingroup draw_engine + * \ingroup imbuf */ #pragma once #include "DNA_image_types.h" +#include "BLI_math_vec_types.hh" + +namespace blender::bke::image { + struct ImageTileWrapper { ImageTile *image_tile; ImageTileWrapper(ImageTile *image_tile) : image_tile(image_tile) @@ -20,6 +24,11 @@ struct ImageTileWrapper { return image_tile->tile_number; } + int2 get_tile_offset() const + { + return int2(get_tile_x_offset(), get_tile_y_offset()); + } + int get_tile_x_offset() const { int tile_number = get_tile_number(); @@ -32,3 +41,4 @@ struct ImageTileWrapper { return (tile_number - 1001) / 10; } }; +} // namespace blender::bke::image diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index be7d24fb007..4fe169abdf7 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -227,7 +227,6 @@ set(SRC engines/image/image_space_node.hh engines/image/image_texture_info.hh engines/image/image_usage.hh - engines/image/image_wrappers.hh engines/workbench/workbench_engine.h engines/workbench/workbench_private.h engines/workbench/workbench_shader_shared.h diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 14529797405..a1cd110e1d8 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -16,7 +16,6 @@ #include "image_batches.hh" #include "image_private.hh" -#include "image_wrappers.hh" namespace blender::draw::image_engine { @@ -74,6 +73,7 @@ struct OneTextureMethod { }; using namespace blender::bke::image::partial_update; +using namespace blender::bke::image; template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractDrawingMode { private: diff --git a/source/blender/draw/engines/image/image_instance_data.hh b/source/blender/draw/engines/image/image_instance_data.hh index 682b93a80b3..cb84c7f14ad 100644 --- a/source/blender/draw/engines/image/image_instance_data.hh +++ b/source/blender/draw/engines/image/image_instance_data.hh @@ -7,6 +7,8 @@ #pragma once +#include "BKE_image_wrappers.hh" + #include "image_batches.hh" #include "image_buffer_cache.hh" #include "image_partial_updater.hh" @@ -14,14 +16,11 @@ #include "image_shader_params.hh" #include "image_texture_info.hh" #include "image_usage.hh" -#include "image_wrappers.hh" #include "DRW_render.h" /** * \brief max allowed textures to use by the ScreenSpaceDrawingMode. - * - * 4 textures are used to reduce uploading screen space textures when translating the image. */ constexpr int SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN = 1; |