[Bf-blender-cvs] [a27bc7c372c] temp-gpu-image-engine: Fix crash in sequencer tests.

Jeroen Bakker noreply at git.blender.org
Mon Dec 13 12:47:44 CET 2021


Commit: a27bc7c372c9f1b59f3940f820b82822e7bc2f60
Author: Jeroen Bakker
Date:   Mon Dec 13 08:21:41 2021 +0100
Branches: temp-gpu-image-engine
https://developer.blender.org/rBa27bc7c372c9f1b59f3940f820b82822e7bc2f60

Fix crash in sequencer tests.

===================================================================

M	source/blender/imbuf/intern/transform.cc

===================================================================

diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc
index a0b39cd5b7c..814e21e730c 100644
--- a/source/blender/imbuf/intern/transform.cc
+++ b/source/blender/imbuf/intern/transform.cc
@@ -162,7 +162,9 @@ class TexelPointer {
       pointer = image_buffer->rect_float + offset;
     }
     else if constexpr (std::is_same_v<ImBufStorageType, unsigned char>) {
-      pointer = image_buffer->rect + offset;
+      pointer = const_cast<unsigned char *>(
+          static_cast<const unsigned char *>(static_cast<const void *>(image_buffer->rect)) +
+          offset);
     }
     else {
       pointer = nullptr;
@@ -316,7 +318,7 @@ template<typename Processor> void transform_scanline_function(void *custom_data,
   processor.process(user_data, scanline);
 }
 
-template<InterpolationColorFunction InterpolationFunction>
+template<InterpolationColorFunction InterpolationFunction, typename StorageType>
 ScanlineThreadFunc get_scanline_function(const eIMBTransformMode mode)
 
 {
@@ -324,17 +326,17 @@ ScanlineThreadFunc get_scanline_function(const eIMBTransformMode mode)
     case IMB_TRANSFORM_MODE_REGULAR:
       return transform_scanline_function<ScanlineProcessor<NoDiscard,
                                                            InterpolationFunction,
-                                                           TexelPointer<float, 4>,
+                                                           TexelPointer<StorageType, 4>,
                                                            PassThroughUV>>;
     case IMB_TRANSFORM_MODE_CROP_SRC:
       return transform_scanline_function<ScanlineProcessor<CropSource,
                                                            InterpolationFunction,
-                                                           TexelPointer<float, 4>,
+                                                           TexelPointer<StorageType, 4>,
                                                            PassThroughUV>>;
     case IMB_TRANSFORM_MODE_WRAP_REPEAT:
       return transform_scanline_function<ScanlineProcessor<NoDiscard,
                                                            InterpolationFunction,
-                                                           TexelPointer<float, 4>,
+                                                           TexelPointer<StorageType, 4>,
                                                            WrapRepeatUV>>;
   }
 
@@ -351,13 +353,13 @@ static void transform(TransformUserData *user_data, const eIMBTransformMode mode
     constexpr InterpolationColorFunction interpolation_function =
         Filter == IMB_FILTER_NEAREST ? nearest_interpolation_color_fl :
                                        bilinear_interpolation_color_fl;
-    scanline_func = get_scanline_function<interpolation_function>(mode);
+    scanline_func = get_scanline_function<interpolation_function, float>(mode);
   }
   else if (user_data->dst->rect) {
     constexpr InterpolationColorFunction interpolation_function =
         Filter == IMB_FILTER_NEAREST ? nearest_interpolation_color_char :
                                        bilinear_interpolation_color_char;
-    scanline_func = get_scanline_function<interpolation_function>(mode);
+    scanline_func = get_scanline_function<interpolation_function, unsigned char>(mode);
   }
 
   if (scanline_func != nullptr) {



More information about the Bf-blender-cvs mailing list