Fix xbrz to compile on non-win32, fix GTK+ port to use new xBRZ.

This commit is contained in:
Brandon Wright 2016-10-08 21:06:15 -05:00
parent d506501d54
commit 720827a479
2 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,10 @@
#include <algorithm>
#include <vector>
#ifndef WIN32
#include <cmath>
#endif
namespace
{
template <uint32_t N> inline
@ -387,13 +391,13 @@ template <> inline unsigned char rotateBlendInfo<ROT_90 >(unsigned char b) { ret
template <> inline unsigned char rotateBlendInfo<ROT_180>(unsigned char b) { return ((b << 4) | (b >> 4)) & 0xff; }
template <> inline unsigned char rotateBlendInfo<ROT_270>(unsigned char b) { return ((b << 6) | (b >> 2)) & 0xff; }
#ifdef WIN32
#ifndef NDEBUG
int debugPixelX = -1;
int debugPixelY = 12;
__declspec(thread) bool breakIntoDebugger = false;
#endif
#endif
/*
input kernel area naming convention:
@ -422,9 +426,11 @@ void blendPixel(const Kernel_3x3& ker,
#define h get_h<rotDeg>(ker)
#define i get_i<rotDeg>(ker)
#ifdef WIN32
#ifndef NDEBUG
if (breakIntoDebugger)
__debugbreak(); //__asm int 3;
#endif
#endif
const unsigned char blend = rotateBlendInfo<rotDeg>(blendInfo);
@ -580,8 +586,10 @@ void scaleImage(const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
for (int x = 0; x < srcWidth; ++x, out += Scaler::scale)
{
#ifdef WIN32
#ifndef NDEBUG
breakIntoDebugger = debugPixelX == x && debugPixelY == y;
#endif
#endif
//all those bounds checks have only insignificant impact on performance!
const int x_m1 = std::max(x - 1, 0); //perf: prefer array indexing to additional pointers!

View File

@ -255,7 +255,7 @@ void xBRZ(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int wi
copyImage16To32(reinterpret_cast<const uint16_t*>(srcPtr), width, height, srcPitch,
&renderBuffer[0], 0, height);
xbrz::scale(scalingFactor, &renderBuffer[0], &xbrzBuffer[0], width, height, xbrz::RGB, xbrz::ScalerCfg(), 0, height);
xbrz::scale(scalingFactor, &renderBuffer[0], &xbrzBuffer[0], width, height, xbrz::ColorFormat::RGB, xbrz::ScalerCfg(), 0, height);
stretchImage32To16(&xbrzBuffer[0], width * scalingFactor, height * scalingFactor,
reinterpret_cast<uint16_t*>(dstPtr), trgWidth, trgHeight, dstPitch, 0, height * scalingFactor);