| 117 | // Copy from the src image to our scanline, in our preferred pixel layout. |
| 118 | template<typename InType, typename OutType> |
| 119 | void GenericScanlineHelper<InType, OutType>::prepRGBAScanline(float** buffer, long & numPixels) |
| 120 | { |
| 121 | // Note that only a line-by-line processing is done on the image buffer. |
| 122 | |
| 123 | if(m_yIndex >= m_dstImg.m_height) |
| 124 | { |
| 125 | numPixels = 0; |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | *buffer = m_useDstBuffer ? (float*)(m_dstImg.m_rData + m_dstImg.m_yStrideBytes * m_yIndex) |
| 130 | : &m_rgbaFloatBuffer[0]; |
| 131 | |
| 132 | if((m_inOptimizedMode&PACKED_OPTIMIZATION)==PACKED_OPTIMIZATION) |
| 133 | { |
| 134 | const void * inBuffer = (void*)(m_srcImg.m_rData + m_srcImg.m_yStrideBytes * m_yIndex); |
| 135 | |
| 136 | m_srcImg.m_bitDepthOp->apply(inBuffer, *buffer, m_dstImg.m_width); |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | // Pack from any channel ordering & bit-depth to a packed RGBA F32 buffer. |
| 141 | |
| 142 | Generic<InType>::PackRGBAFromImageDesc(m_srcImg, |
| 143 | &m_inBitDepthBuffer[0], |
| 144 | *buffer, |
| 145 | m_dstImg.m_width, |
| 146 | m_yIndex * m_dstImg.m_width); |
| 147 | } |
| 148 | |
| 149 | numPixels = m_dstImg.m_width; |
| 150 | } |
| 151 | |
| 152 | // Write back the result of our work, from the scanline to our destination image. |
| 153 | template<typename InType, typename OutType> |