diff --git a/include/nme/Pixel.h b/include/nme/Pixel.h index 51fcfa587..e81219426 100644 --- a/include/nme/Pixel.h +++ b/include/nme/Pixel.h @@ -654,6 +654,24 @@ inline void BlendPixel(AlphaPixel &outA, const RGB &) outA.a = 255; } +template +inline void BlendPixel( LumaPixel &outLuma, const T &inPixel) +{ + if (!inPixel.getAlpha()) + { + } + else if (inPixel.getAlpha()==255) + { + outLuma.luma = inPixel.getLuma(); + } + else + { + int a = inPixel.getAlpha(); + int notA= 255-a; + outLuma.luma = (outLuma.luma*notA + inPixel.getLuma()*inPixel.getAlpha() + 128)>>8; + } +} + template inline void BlendPixel(RGB &outRgb, const T &inPixel) @@ -748,6 +766,16 @@ inline AlphaPixel BilinearInterp( AlphaPixel s00, AlphaPixel s01, AlphaPixel s10 return s; } +inline LumaPixel BilinearInterp( LumaPixel s00, LumaPixel s01, LumaPixel s10, LumaPixel s11, int x_frac, int y_frac) +{ + LumaPixel s; + + int ca_0 = s00.luma + (((s01.luma-s00.luma)*x_frac) >> 16); + int ca_1 = s10.luma + (((s11.luma-s10.luma)*x_frac) >> 16); + s.luma = ca_0 + (((ca_1-ca_0)*y_frac) >> 16); + return s; +} + diff --git a/project/src/common/Surface.cpp b/project/src/common/Surface.cpp index 09af06c97..edee48b2c 100644 --- a/project/src/common/Surface.cpp +++ b/project/src/common/Surface.cpp @@ -477,6 +477,9 @@ void TStretchSuraceTo(const SimpleSurface *inSurface, const RenderTarget &outTar case pfAlpha: TStretchTo(inSurface, outTarget, inSrcRect, inDestRect, inFlags); break; + case pfLuma: + TStretchTo >(inSurface, outTarget, inSrcRect, inDestRect, inFlags); + break; default: ; } } @@ -498,6 +501,9 @@ void SimpleSurface::StretchTo(const RenderTarget &outTarget, case pfAlpha: TStretchSuraceTo(this, outTarget, inSrcRect, inDestRect,inFlags); break; + case pfLuma: + TStretchSuraceTo< LumaPixel >(this, outTarget, inSrcRect, inDestRect,inFlags); + break; default: ; } } diff --git a/project/src/software-renderer/PolygonRender.cpp b/project/src/software-renderer/PolygonRender.cpp index 4b9146c9c..2da417e8a 100644 --- a/project/src/software-renderer/PolygonRender.cpp +++ b/project/src/software-renderer/PolygonRender.cpp @@ -583,8 +583,6 @@ void PolygonRender::HitTestFatCubic(const UserPoint &inP0, const UserPoint &inP1 bool PolygonRender::Render(const RenderTarget &inTarget, const RenderState &inState) { - - Extent2DF extent; CachedExtentRenderer::GetExtent(inState.mTransform, extent,true); diff --git a/project/src/software-renderer/Render.h b/project/src/software-renderer/Render.h index b51eff93e..d2b21a71b 100644 --- a/project/src/software-renderer/Render.h +++ b/project/src/software-renderer/Render.h @@ -339,7 +339,16 @@ void RenderBlend(const AlphaMask &inAlpha, SOURCE_ &inSource, const RenderTarget DestRender(inAlpha, inSource, dest, inBlend, inState, inTX, inTY); } break; - default: ; + case pfLuma: + { + DestSurface > dest(inDest); + DestRender(inAlpha, inSource, dest, inBlend, inState, inTX, inTY); + } + break; + + default: + //printf("Unknown poxel type\n"); + ; } } diff --git a/src/nme/StaticNme.hx b/src/nme/StaticNme.hx index e93275059..4999482e2 100644 --- a/src/nme/StaticNme.hx +++ b/src/nme/StaticNme.hx @@ -1,7 +1,7 @@ package nme; @:cppFileCode('extern "C" int nme_register_prims();') -#if toolkit +#if !nmelink @:build(nme.macros.BuildXml.importRelative("../../../project/ToolkitBuild.xml")) #else @:buildXml("