28 #ifndef YSL_INC_Service_yblit_h_
29 #define YSL_INC_Service_yblit_h_ 1
31 #include "../Core/ygdibase.h"
32 #include "../Core/ycutil.h"
50 typedef ystdex::pair_iterator<ystdex::pseudo_iterator<const
PixelType>,
60 template<typename _tPixel>
69 PixelFiller(_tPixel c)
77 operator()(_tPixel* dst)
92 template<
typename _tPixel,
class _fTransformPixel>
94 operator()(_tPixel* dst,
size_t n, _fTransformPixel tp)
115 template<
typename _tPixel,
class _fTransformPixel>
117 operator()(_tPixel* dst,
size_t n,
SDst dw, _fTransformPixel tp)
135 const Size& ds,
const Size& ss,
const Size& cs,
136 int& min_x,
int& min_y,
int& delta_x,
int& delta_y);
143 template<
bool _bSwapLR,
bool _bSwapUD>
145 BlitScale(
const Point& dp,
const Size& ds,
int delta_x,
int delta_y);
180 template<
bool _bDec,
typename _fCallable,
typename _tScalar,
typename _tDiff,
181 typename _tOut,
typename _tIn>
183 BlitScan(_fCallable&& f, _tScalar d_width, _tScalar s_width,
184 _tDiff delta_x, _tDiff delta_y, _tOut dst, _tIn src)
186 yforward(f)(delta_x, delta_y, dst, src,
187 (_bDec ? -1 : 1) * d_width - delta_x, s_width - delta_x);
208 template<
template<
bool>
class _gBlitLoop,
bool _bSwapLR,
bool _bSwapUD,
209 typename _tOut,
typename _tIn>
214 int min_x, min_y, delta_x, delta_y;
218 BlitScan<_bSwapLR != _bSwapUD>(_gBlitLoop<!_bSwapLR>(), ds.
Width,
219 ss.
Width, delta_x, delta_y, dst + BlitScale<_bSwapLR, _bSwapUD>(dp,
220 ds, delta_x, delta_y), src + (sp.
Y + min_y) * ss.
Width
235 template<
typename _tPixel,
class _fTransformPixel,
class _fTransformLine>
238 _fTransformPixel tp, _fTransformLine tl)
240 int min_x, min_y, delta_x, delta_y;
243 dst += max<SPos>(0, dp.
Y) * ds.
Width + max<SPos>(0, dp.
X);
244 for(; delta_y > 0; --delta_y)
246 tl(dst, delta_x, tp);
254 template<
typename _tPixel,
class _fTransformPixel,
class _fTransformLine>
256 operator()(_tPixel* dst,
const Size& ds,
const Rect& rSrc,
257 _fTransformPixel tp, _fTransformLine tl)
259 operator()<_tPixel, _fTransformPixel,
266 template<
typename _tPixel,
class _fTransformPixel,
class _fTransformLine>
269 SDst sw,
SDst sh, _fTransformPixel tp, _fTransformLine tl)
271 operator()<_tPixel, _fTransformPixel, _fTransformLine>(
283 template<
typename _tPixel>
295 template<
typename _tPixel>
306 template<
typename _tPixel>
317 template<
typename _tPixel>
329 template<
typename _tPixel>
340 template<
typename _tPixel>
358 template<
bool _bPositiveScan>
364 std::copy_n(src_iter, delta_x, dst_iter);
373 for(; delta_x > 0; --delta_x)
374 *dst_iter-- = *src_iter++;
383 template<
bool _bPositiveScan>
387 operator()(
int delta_x,
int delta_y,
389 int dst_inc,
int src_inc)
391 for(; delta_y > 0; --delta_y)
393 BlitLine<_bPositiveScan>(dst_iter, src_iter, delta_x);
395 ystdex::delta_assign<_bPositiveScan>(dst_iter, dst_inc);
406 template<
bool _bPositiveScan>
411 operator()(
int delta_x,
int delta_y,
413 int dst_inc,
int src_inc)
415 for(; delta_y > 0; --delta_y)
417 for(
int x(0); x < delta_x; ++x)
420 *dst_iter = *src_iter;
422 ystdex::xcrease<_bPositiveScan>(dst_iter);
425 ystdex::delta_assign<_bPositiveScan>(dst_iter, dst_inc);
431 operator()(
int delta_x,
int delta_y,
433 int dst_inc,
int src_inc)
435 for(; delta_y > 0; --delta_y)
437 for(
int x(0); x < delta_x; ++x)
439 *dst_iter = *src_iter.
base().second & 0x80
442 ystdex::xcrease<_bPositiveScan>(dst_iter);
445 ystdex::delta_assign<_bPositiveScan>(dst_iter, dst_inc);
457 template<
typename _tOut,
typename _tIn>
484 # ifdef YCL_PIXEL_FORMAT_AXYZ1555
511 u32 dbr((d & 0x1F) | (d << 6 & 0x1F0000)), dg(d & 0x3E0);
513 dbr += ((((s & 0x1F) | (s << 6 & 0x1F0000)) - dbr) * a +
BLT_ROUND_BR)
516 return FetchOpaque((dbr & 0x1F) | (dg & 0x3E0) | (dbr >> 6 & 0x7C00));
549 const Color dc(d), sc(s);
561 template<
typename _tOut,
typename _tIn>
568 const u8 a(*src_iter.
base().second);
577 const u8 a(*src_iter.base().second);
591 template<
bool _bPositiveScan>
595 template<
typename _tIn>
597 operator()(
int delta_x,
int delta_y,
599 int dst_inc,
int src_inc)
601 for(; delta_y > 0; --delta_y)
603 for(
int x(0); x < delta_x; ++x)
607 ystdex::xcrease<_bPositiveScan>(dst_iter);
610 ystdex::delta_assign<_bPositiveScan>(dst_iter, dst_inc);
620 template<
class _fTransformPixel>
637 template<
class _fTransformPixel>
641 return TransformRect<_fTransformPixel>(g, r.
GetPoint(), r.
GetSize(), tp);