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.
This commit is contained in:
Jeroen Bakker
2022-04-04 14:00:33 +02:00
parent a56f53ad56
commit 9c2b5900c0
4 changed files with 14 additions and 6 deletions
@@ -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
-1
View File
@@ -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
@@ -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:
@@ -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;