summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-26 00:15:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-26 16:44:04 +0300
commitd526c8eaffc99e8f5618185f51a63fcb5b3ad645 (patch)
treee558c4600a8df0c2ccdae1b9ae14c4b821583588
parent8d52054793fea7819dbe346b1d8d68fb3a4ef865 (diff)
downloadmanaverse-d526c8eaffc99e8f5618185f51a63fcb5b3ad645.tar.gz
manaverse-d526c8eaffc99e8f5618185f51a63fcb5b3ad645.tar.bz2
manaverse-d526c8eaffc99e8f5618185f51a63fcb5b3ad645.tar.xz
manaverse-d526c8eaffc99e8f5618185f51a63fcb5b3ad645.zip
Use cilkplus in sdlgraphics.
-rw-r--r--src/render/sdlgraphics.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 19e85b7bd..a82f85621 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -922,7 +922,6 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
area.x + area.width : top.x + top.width;
const int y2 = area.y + area.height < top.y + top.height ?
area.y + area.height : top.y + top.height;
- int x, y;
SDL_LockSurface(mWindow);
@@ -934,11 +933,11 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
switch (bpp)
{
case 1:
- for (y = y1; y < y2; y++)
+ cilk_for (int y = y1; y < y2; y++)
{
uint8_t *const p = static_cast<uint8_t *>(mWindow->pixels)
+ static_cast<size_t>(y * mWindow->pitch);
- for (x = x1; x < x2; x++)
+ for (int x = x1; x < x2; x++)
{
*(p + static_cast<size_t>(x))
= static_cast<uint8_t>(pixel);
@@ -946,11 +945,11 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
}
break;
case 2:
- for (y = y1; y < y2; y++)
+ cilk_for (int y = y1; y < y2; y++)
{
uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels)
+ static_cast<size_t>(y * mWindow->pitch);
- for (x = x1; x < x2; x++)
+ for (int x = x1; x < x2; x++)
{
uint8_t *const p = p0 + static_cast<size_t>(x * 2);
*reinterpret_cast<uint16_t *>(p) = SDLAlpha16(
@@ -967,11 +966,11 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
const int cg = mColor.g * mColor.a;
const int cb = mColor.b * mColor.a;
- for (y = y1; y < y2; y++)
+ cilk_for (int y = y1; y < y2; y++)
{
uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels)
+ static_cast<size_t>(y * mWindow->pitch);
- for (x = x1; x < x2; x++)
+ for (int x = x1; x < x2; x++)
{
uint8_t *const p = p0 + static_cast<size_t>(x * 3);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -995,11 +994,11 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
const unsigned pr = (pixel & 0xff0000) * mColor.a;
const unsigned a1 = (255 - mColor.a);
- for (y = y1; y < y2; y++)
+ cilk_for (int y = y1; y < y2; y++)
{
uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels)
+ y * mWindow->pitch;
- for (x = x1; x < x2; x++)
+ for (int x = x1; x < x2; x++)
{
uint8_t *p = p0 + x * 4;
uint32_t dst = *reinterpret_cast<uint32_t *>(p);
@@ -1058,12 +1057,12 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
mOldAlpha = mColor.a;
}
- for (y = y1; y < y2; y++)
+ cilk_for (int y = y1; y < y2; y++)
{
uint32_t *const p0 = reinterpret_cast<uint32_t*>(
static_cast<uint8_t*>(mWindow->pixels)
+ static_cast<size_t>(y * mWindow->pitch));
- for (x = x1; x < x2; x++)
+ for (int x = x1; x < x2; x++)
{
uint32_t *const p = p0 + static_cast<size_t>(x);
const uint32_t dst = *p;