@@ -64,12 +64,12 @@ void evaluate_ast_stack(
6464
6565inline const big_float HALF = big_float(" 0.5" );
6666
67- void convert_coordinates (big_vec2& z, const ViewState* view_state ) {
68- big_float w (view_state-> hp_width );
69- big_float h (view_state-> hp_height );
67+ void convert_coordinates (big_vec2& z, const int width, const int height, const big_float range, const big_vec2 shift ) {
68+ big_float w (width );
69+ big_float h (height );
7070
71- z = view_state-> hp_range * (z - HALF * big_vec2 (w, h)) / h;
72- z = z + big_vec2 (view_state-> hp_shift . x , view_state-> hp_shift . y ) ;
71+ z = range * (z - HALF * big_vec2 (w, h)) / h;
72+ z = z + shift ;
7373}
7474
7575std::array<uint8_t , 3 > domain_color (const big_vec2& z) {
@@ -100,13 +100,13 @@ std::array<uint8_t, 3> domain_color(const big_vec2& z) {
100100 return std::array<uint8_t , 3 >{static_cast <uint8_t >(r * 255.0 ), static_cast <uint8_t >(g * 255.0 ), static_cast <uint8_t >(b * 255.0 )};
101101}
102102
103- void render_band (int start_y, int end_y, int width, int height, unsigned char * pixel_buffer, const CPU_Interpreter& interpreter, const std::vector<TokenOperator>& stack, const ViewState* view_state , std::atomic<int >& rows_completed) {
103+ void render_band (int start_y, int end_y, int width, int height, unsigned char * pixel_buffer, const CPU_Interpreter& interpreter, const std::vector<TokenOperator>& stack, const int hp_width, const int hp_height, const big_float range, const big_vec2 shift , std::atomic<int >& rows_completed) {
104104 for (int y = start_y; y < end_y; ++y) {
105105 for (int x = 0 ; x < width; ++x) {
106106
107107 big_vec2 z (big_float (x), big_float (height - y));
108108
109- convert_coordinates (z, view_state );
109+ convert_coordinates (z, hp_width, hp_height, range, shift );
110110
111111 big_vec2 result;
112112 evaluate_ast_stack (stack, z, interpreter, result);
@@ -145,7 +145,7 @@ void dispatch_render(int width, int height, unsigned char* pixel_buffer, CPU_Int
145145 threads.emplace_back (
146146 render_band,
147147 start_y, end_y, width, height,
148- pixel_buffer, std::ref (interpreter), std::ref (stack), view_state, std::ref (rows_completed)
148+ pixel_buffer, std::ref (interpreter), std::ref (stack), view_state-> hp_width , view_state-> hp_height , view_state-> hp_range , view_state-> hp_shift , std::ref (rows_completed)
149149 );
150150 }
151151
0 commit comments