Commit 04f41257 by Nicolas Capens

Don't needlessly generate cursor drawing code.

Direct3D 9 provides support for a "hardware" cursor. There is no such thing in newer APIs, so we shouldn't waste time dynamically generating code for it. Change-Id: I8d54c3500966ce075afb83c98c5013024062eed8 Reviewed-on: https://swiftshader-review.googlesource.com/9629Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 0f206537
...@@ -33,7 +33,7 @@ namespace sw ...@@ -33,7 +33,7 @@ namespace sw
{ {
extern bool forceWindowed; extern bool forceWindowed;
FrameBuffer::Cursor FrameBuffer::cursor = {0}; FrameBuffer::Cursor FrameBuffer::cursor = {};
bool FrameBuffer::topLeftOrigin = false; bool FrameBuffer::topLeftOrigin = false;
void FrameBuffer::typeinfo() {} void FrameBuffer::typeinfo() {}
...@@ -531,31 +531,34 @@ namespace sw ...@@ -531,31 +531,34 @@ namespace sw
} }
} }
Int x0 = *Pointer<Int>(cursor + OFFSET(Cursor,x)); if(state.cursorWidth > 0 && state.cursorHeight > 0)
Int y0 = *Pointer<Int>(cursor + OFFSET(Cursor,y));
For(Int y1 = 0, y1 < state.cursorHeight, y1++)
{ {
Int y = y0 + y1; Int x0 = *Pointer<Int>(cursor + OFFSET(Cursor,x));
Int y0 = *Pointer<Int>(cursor + OFFSET(Cursor,y));
If(y >= 0 && y < height) For(Int y1 = 0, y1 < state.cursorHeight, y1++)
{ {
Pointer<Byte> d = dst + y * dStride + x0 * dBytes; Int y = y0 + y1;
Pointer<Byte> s = src + y * sStride + x0 * sBytes;
Pointer<Byte> c = *Pointer<Pointer<Byte>>(cursor + OFFSET(Cursor,image)) + y1 * state.cursorWidth * 4;
For(Int x1 = 0, x1 < state.cursorWidth, x1++) If(y >= 0 && y < height)
{ {
Int x = x0 + x1; Pointer<Byte> d = dst + y * dStride + x0 * dBytes;
Pointer<Byte> s = src + y * sStride + x0 * sBytes;
Pointer<Byte> c = *Pointer<Pointer<Byte>>(cursor + OFFSET(Cursor,image)) + y1 * state.cursorWidth * 4;
If(x >= 0 && x < width) For(Int x1 = 0, x1 < state.cursorWidth, x1++)
{ {
blend(state, d, s, c); Int x = x0 + x1;
}
If(x >= 0 && x < width)
{
blend(state, d, s, c);
}
c += 4; c += 4;
s += sBytes; s += sBytes;
d += dBytes; d += dBytes;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment