From d526c8eaffc99e8f5618185f51a63fcb5b3ad645 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 26 Apr 2015 00:15:46 +0300 Subject: Use cilkplus in sdlgraphics. --- src/render/sdlgraphics.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/render') 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(mWindow->pixels) + static_cast(y * mWindow->pitch); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { *(p + static_cast(x)) = static_cast(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(mWindow->pixels) + static_cast(y * mWindow->pitch); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { uint8_t *const p = p0 + static_cast(x * 2); *reinterpret_cast(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(mWindow->pixels) + static_cast(y * mWindow->pitch); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { uint8_t *const p = p0 + static_cast(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(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(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( static_cast(mWindow->pixels) + static_cast(y * mWindow->pitch)); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { uint32_t *const p = p0 + static_cast(x); const uint32_t dst = *p; -- cgit v1.2.3-60-g2f50