mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0fab880126
commit
351994a6cc
2823 changed files with 619073 additions and 0 deletions
52
uppdev/CDraw/smmx.cpp
Normal file
52
uppdev/CDraw/smmx.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include "MDraw.h"
|
||||
|
||||
void memsetds(dword *a, dword c, int cx)
|
||||
{
|
||||
if(cx == 0)
|
||||
return;
|
||||
if((dword)a & 4) {
|
||||
*a++ = c;
|
||||
cx--;
|
||||
}
|
||||
int r = cx & 7;
|
||||
__m64 mc = _mm_cvtsi32_si64(c);
|
||||
mc = _mm_unpacklo_pi32(mc, mc);
|
||||
cx >>= 3;
|
||||
__m64 *ma = (__m64 *)a;
|
||||
while(cx-- > 0) {
|
||||
_mm_stream_pi(ma + 0, mc);
|
||||
_mm_stream_pi(ma + 1, mc);
|
||||
_mm_stream_pi(ma + 2, mc);
|
||||
_mm_stream_pi(ma + 3, mc);
|
||||
ma += 4;
|
||||
}
|
||||
a = (dword *)ma;
|
||||
switch(r) {
|
||||
case 7: a[6] = c;
|
||||
case 6: a[5] = c;
|
||||
case 5: a[4] = c;
|
||||
case 4: a[3] = c;
|
||||
case 3: a[2] = c;
|
||||
case 2: a[1] = c;
|
||||
case 1: a[0] = c;
|
||||
}
|
||||
_mm_sfence();
|
||||
_mm_empty();
|
||||
}
|
||||
|
||||
void DrawRectS(PixelBlock& w, int x, int y, int cx, int cy, Color c)
|
||||
{
|
||||
Rect r = RectC(x, y, cx, cy);
|
||||
r.Intersect(w.GetSize());
|
||||
if(r.IsEmpty())
|
||||
return;
|
||||
dword color = c.GetRaw();
|
||||
dword *a = w.PointAdr(r.left, r.top);
|
||||
int d = w.LineDelta();
|
||||
cy = r.Height();
|
||||
cx = r.Width();
|
||||
while(cy--) {
|
||||
memsetds(a, color, cx);
|
||||
a += d;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue