Qt 4.8
Static Public Functions | List of all members
QRadialFetchSimd< Simd > Class Template Reference

#include <qdrawhelper_p.h>

Static Public Functions

static void fetch (uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det, qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
 

Detailed Description

template<class Simd>
class QRadialFetchSimd< Simd >

Definition at line 482 of file qdrawhelper_p.h.

Functions

◆ fetch()

template<class Simd >
static void QRadialFetchSimd< Simd >::fetch ( uint buffer,
uint end,
const Operator op,
const QSpanData data,
qreal  det,
qreal  delta_det,
qreal  delta_delta_det,
qreal  b,
qreal  delta_b 
)
inlinestatic

Definition at line 485 of file qdrawhelper_p.h.

487  {
488  typename Simd::Vect_buffer_f det_vec;
489  typename Simd::Vect_buffer_f delta_det4_vec;
490  typename Simd::Vect_buffer_f b_vec;
491 
492  for (int i = 0; i < 4; ++i) {
493  det_vec.f[i] = det;
494  delta_det4_vec.f[i] = 4 * delta_det;
495  b_vec.f[i] = b;
496 
497  det += delta_det;
498  delta_det += delta_delta_det;
499  b += delta_b;
500  }
501 
502  const typename Simd::Float32x4 v_delta_delta_det16 = Simd::v_dup(16 * delta_delta_det);
503  const typename Simd::Float32x4 v_delta_delta_det6 = Simd::v_dup(6 * delta_delta_det);
504  const typename Simd::Float32x4 v_delta_b4 = Simd::v_dup(4 * delta_b);
505 
506  const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius);
507  const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr);
508 
509  const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f);
510  const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1));
511  const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f);
512 
513  const typename Simd::Int32x4 v_repeat_mask = Simd::v_dup(~(uint(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT));
514  const typename Simd::Int32x4 v_reflect_mask = Simd::v_dup(~(uint(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT+1)));
515 
516  const typename Simd::Int32x4 v_reflect_limit = Simd::v_dup(2 * GRADIENT_STOPTABLE_SIZE - 1);
517 
518  const int extended_mask = op->radial.extended ? 0x0 : ~0x0;
519 
520 #define FETCH_RADIAL_LOOP_PROLOGUE \
521  while (buffer < end) { \
522  typename Simd::Vect_buffer_i v_buffer_mask; \
523  v_buffer_mask.v = Simd::v_greaterOrEqual(det_vec.v, v_min); \
524  const typename Simd::Float32x4 v_index_local = Simd::v_sub(Simd::v_sqrt(Simd::v_max(v_min, det_vec.v)), b_vec.v); \
525  const typename Simd::Float32x4 v_index = Simd::v_add(Simd::v_mul(v_index_local, v_max), v_half); \
526  v_buffer_mask.v = Simd::v_and(v_buffer_mask.v, Simd::v_greaterOrEqual(Simd::v_add(v_r0, Simd::v_mul(v_dr, v_index_local)), v_min)); \
527  typename Simd::Vect_buffer_i index_vec;
528 #define FETCH_RADIAL_LOOP_CLAMP_REPEAT \
529  index_vec.v = Simd::v_and(v_repeat_mask, Simd::v_toInt(v_index));
530 #define FETCH_RADIAL_LOOP_CLAMP_REFLECT \
531  const typename Simd::Int32x4 v_index_i = Simd::v_and(v_reflect_mask, Simd::v_toInt(v_index)); \
532  const typename Simd::Int32x4 v_index_i_inv = Simd::v_sub(v_reflect_limit, v_index_i); \
533  index_vec.v = Simd::v_min_16(v_index_i, v_index_i_inv);
534 #define FETCH_RADIAL_LOOP_CLAMP_PAD \
535  index_vec.v = Simd::v_toInt(Simd::v_min(v_max, Simd::v_max(v_min, v_index)));
536 #define FETCH_RADIAL_LOOP_EPILOGUE \
537  det_vec.v = Simd::v_add(Simd::v_add(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
538  delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
539  b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
540  for (int i = 0; i < 4; ++i) \
541  *buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable[index_vec.i[i]]; \
542  }
543 
544 #define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \
545  FETCH_RADIAL_LOOP_PROLOGUE \
546  FETCH_RADIAL_LOOP_CLAMP \
547  FETCH_RADIAL_LOOP_EPILOGUE
548 
549  switch (data->gradient.spread) {
552  break;
555  break;
558  break;
559  default:
560  Q_ASSERT(false);
561  }
562  }
#define GRADIENT_STOPTABLE_SIZE
#define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP)
QGradient::Spread spread
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define FETCH_RADIAL_LOOP_CLAMP_PAD
RadialGradientValues radial
unsigned int uint
Definition: qglobal.h:996
#define FETCH_RADIAL_LOOP_CLAMP_REPEAT
#define GRADIENT_STOPTABLE_SIZE_SHIFT
QGradientData gradient
struct QRadialGradientData::@232 focal
QRadialGradientData radial
#define FETCH_RADIAL_LOOP_CLAMP_REFLECT

The documentation for this class was generated from the following file: