Commit 296e312a by Nicolas Capens

Avoid writing any pixels outside of the frame buffer.

crbug.com/336438
parent a38f746f
#define MAJOR_VERSION 3 #define MAJOR_VERSION 3
#define MINOR_VERSION 2 #define MINOR_VERSION 2
#define BUILD_VERSION 6 #define BUILD_VERSION 6
#define BUILD_REVISION 47312 #define BUILD_REVISION 47506
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -274,11 +274,13 @@ namespace sw ...@@ -274,11 +274,13 @@ namespace sw
if(state.depth == 32) if(state.depth == 32)
{ {
if(width2 % 4 == 0 && !state.HDR) Int x = x0;
if(!state.HDR)
{ {
For(Int x = x0, x < width2, x += 4) For(, x < width - 3, x += 4)
{ {
*Pointer<Int4>(d, 1) = *Pointer<Int4>(s, 16); *Pointer<Int4>(d, 1) = *Pointer<Int4>(s, width % 4 ? 1 : 16);
s += 4 * sBytes; s += 4 * sBytes;
d += 4 * dBytes; d += 4 * dBytes;
...@@ -286,27 +288,33 @@ namespace sw ...@@ -286,27 +288,33 @@ namespace sw
} }
else else
{ {
For(Int x = x0, x < width2, x += 2) For(, x < width - 1, x += 2)
{ {
Int2 c01; UShort4 c0 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 0), 0xC6)) >> 8;
UShort4 c1 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 8), 0xC6)) >> 8;
*Pointer<Int2>(d) = As<Int2>(Pack(c0, c1));
s += 2 * sBytes;
d += 2 * dBytes;
}
}
For(, x < width, x++)
{
if(!state.HDR) if(!state.HDR)
{ {
c01 = *Pointer<Int2>(s); *Pointer<Int>(d) = *Pointer<Int>(s);
} }
else else
{ {
UShort4 c0 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 0), 0xC6)) >> 8; UShort4 c = As<UShort4>(Swizzle(*Pointer<Short4>(s), 0xC6)) >> 8;
UShort4 c1 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 8), 0xC6)) >> 8;
c01 = As<Int2>(Pack(c0, c1)); *Pointer<Int>(d) = Int(As<Int2>(Pack(c, c)));
} }
*Pointer<Int2>(d) = c01; s += sBytes;
d += dBytes;
s += 2 * sBytes;
d += 2 * dBytes;
}
} }
} }
else if(state.depth == 24) else if(state.depth == 24)
......
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