diff --git a/src/image/image.cpp b/src/image/image.cpp index 21ed86b3..2fdfa5f1 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -208,7 +208,7 @@ _T(PixelFormat::RGBA_F32); #undef _T /* Special case for the "any" format: return the last active buffer */ -template<> void *Image::Lock<PixelFormat::Unknown>() +void *Image::Lock() { ASSERT(m_data->m_format != PixelFormat::Unknown); diff --git a/src/image/render/screen.cpp b/src/image/render/screen.cpp index cceaf075..1947f7f3 100644 --- a/src/image/render/screen.cpp +++ b/src/image/render/screen.cpp @@ -59,7 +59,7 @@ bool Image::RenderBayer(ivec2 size) typedef struct { int x, y; - double dist; + float dist; } dot_t; @@ -78,10 +78,10 @@ bool Image::RenderHalftone(ivec2 size) for (int y = 0; y < size.y; y++) for (int x = 0; x < size.x; x++) { - double dy = ((double)y + .07) / size.y - .5; - double dx = (double)x / size.x - .5; + float dy = ((float)y + 0.07f) / size.y - 0.5f; + float dx = (float)x / size.x - 0.5f; /* Using dx²+dy² here creates another interesting halftone. */ - double r = - cos(M_PI * (dx - dy)) - cos(M_PI * (dx + dy)); + float r = - lol::cos(F_PI * (dx - dy)) - lol::cos(F_PI * (dx + dy)); circle[y * size.x + x].x = x; circle[y * size.x + x].y = y; circle[y * size.x + x].dist = r; @@ -98,8 +98,8 @@ bool Image::RenderHalftone(ivec2 size) pixels[y * (2 * size.x) + x] = (float)(2 * n + 1) * mul; pixels[(y + size.y) * (2 * size.x) + x + size.x] = (float)(2 * n + 2) * mul; - pixels[(y + size.y) * (2 * size.x) + x] = 1. - (float)(2 * n + 1) * mul; - pixels[y * (2 * size.x) + x + size.x] = 1. - (float)(2 * n + 2) * mul; + pixels[(y + size.y) * (2 * size.x) + x] = 1.0f - (float)(2 * n + 1) * mul; + pixels[y * (2 * size.x) + x + size.x] = 1.0f - (float)(2 * n + 2) * mul; } Unlock(pixels); diff --git a/src/lol/image/image.h b/src/lol/image/image.h index 3b7acfbd..04343dac 100644 --- a/src/lol/image/image.h +++ b/src/lol/image/image.h @@ -69,8 +69,8 @@ public: WrapMode GetWrapY() const; void SetWrap(WrapMode wrap_x, WrapMode wrap_y); - template<PixelFormat T = PixelFormat::Unknown> - typename PixelType<T>::type *Lock(); + template<PixelFormat T> typename PixelType<T>::type *Lock(); + void *Lock(); void Unlock(void const *pixels); bool RetrieveTiles(Array<ivec2, ivec2>& tiles) const; diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj index 30870efd..aa77f0b2 100644 --- a/src/lolcore.vcxproj +++ b/src/lolcore.vcxproj @@ -149,7 +149,13 @@ <ClCompile Include="image\codec\zed-palette-image.cpp" /> <ClCompile Include="image\color\cie1931.cpp" /> <ClCompile Include="image\color\color.cpp" /> + <ClCompile Include="image\dither\ediff.cpp" /> + <ClCompile Include="image\dither\ostromoukhov.cpp" /> + <ClCompile Include="image\dither\random.cpp" /> <ClCompile Include="image\image.cpp" /> + <ClCompile Include="image\pixels.cpp" /> + <ClCompile Include="image\render\noise.cpp" /> + <ClCompile Include="image\render\screen.cpp" /> <ClCompile Include="input\controller.cpp" /> <ClCompile Include="input\input.cpp" /> <ClCompile Include="layer.cpp" /> @@ -431,4 +437,4 @@ <ImportGroup Label="ExtensionTargets"> <Import Project="$(SolutionDir)\Lol.Fx.targets" /> </ImportGroup> -</Project> +</Project> \ No newline at end of file diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters index 775991a0..e7f756a3 100644 --- a/src/lolcore.vcxproj.filters +++ b/src/lolcore.vcxproj.filters @@ -85,6 +85,12 @@ <Filter Include="platform\nacl"> <UniqueIdentifier>{f6cc3470-c841-4581-969b-e60cea841c27}</UniqueIdentifier> </Filter> + <Filter Include="image\dither"> + <UniqueIdentifier>{63e63eea-c96e-4d37-81f6-f3f17e18b751}</UniqueIdentifier> + </Filter> + <Filter Include="image\render"> + <UniqueIdentifier>{23655fca-56e5-48ec-8cf0-a71322f4cc89}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="image\image.cpp"> @@ -355,6 +361,24 @@ <ClCompile Include="sys\thread.cpp"> <Filter>sys</Filter> </ClCompile> + <ClCompile Include="image\dither\ediff.cpp"> + <Filter>image\dither</Filter> + </ClCompile> + <ClCompile Include="image\dither\ostromoukhov.cpp"> + <Filter>image\dither</Filter> + </ClCompile> + <ClCompile Include="image\dither\random.cpp"> + <Filter>image\dither</Filter> + </ClCompile> + <ClCompile Include="image\render\noise.cpp"> + <Filter>image\render</Filter> + </ClCompile> + <ClCompile Include="image\render\screen.cpp"> + <Filter>image\render</Filter> + </ClCompile> + <ClCompile Include="image\pixels.cpp"> + <Filter>image</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="debug\fps.h"> @@ -760,4 +784,4 @@ </None> <None Include="Makefile.am" /> </ItemGroup> -</Project> +</Project> \ No newline at end of file