OSDN Git Service

Modified the implementation for Visual Studio.
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Wed, 29 Aug 2012 10:52:08 +0000 (19:52 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Wed, 29 Aug 2012 10:52:08 +0000 (19:52 +0900)
soft/utils/common/tinybmpio/bmpimg.c
soft/utils/lcdtool/canvas.c
soft/utils/lcdtool/canvas.h
soft/utils/lcdtool/lcdimg.h
soft/utils/lcdtool/lcdtool.sln [new file with mode: 0644]
soft/utils/lcdtool/lcdtool.vcxproj [new file with mode: 0644]
soft/utils/lcdtool/lcdtool.vcxproj.filters [new file with mode: 0644]
soft/utils/lcdtool/lcdtool.vcxproj.user [new file with mode: 0644]

index 694f795..7d63881 100644 (file)
@@ -317,6 +317,10 @@ int bmpimg_draw_line(bmpimg_t *p, const int x1, const int y1, const int x2, cons
     int tmp_x2 = x2;
     int tmp_y2 = y2;
     int steep = val_abs(tmp_y2 - tmp_y1) > val_abs(tmp_x2 - tmp_x1);
+    int deltax, deltay;
+    int error;
+    int ystep, y;
+    int x;
     if (steep) {
         val_swap(&tmp_x1, &tmp_y1);
         val_swap(&tmp_x2, &tmp_y2);
@@ -325,17 +329,16 @@ int bmpimg_draw_line(bmpimg_t *p, const int x1, const int y1, const int x2, cons
         val_swap(&tmp_x1, &tmp_x2);
         val_swap(&tmp_y1, &tmp_y2);
     }
-    int deltax = tmp_x2 - tmp_x1;
-    int deltay = val_abs(tmp_y2 - tmp_y1);
-    int error = deltax / 2;
-    int ystep;
-    int y = tmp_y1;
+    deltax = tmp_x2 - tmp_x1;
+    deltay = val_abs(tmp_y2 - tmp_y1);
+    error = deltax / 2;
+    ystep;
+    y = tmp_y1;
     if (tmp_y1 < tmp_y2) {
         ystep = 1;
     } else {
         ystep = -1;
     }
-    int x;
     for (x = tmp_x1; x <= tmp_x2; x++) {
         if (steep) {
             bmpimg_fill_box(p, y, x, y, x, color);
@@ -425,13 +428,14 @@ void bmpimg_draw_progressbar(
         const int value,
         bmpcol_t *color)
 {
+    int tmp_max, tmp_val, pix;
     bmpimg_draw_box(p, x1, y1, x2, y2, color);
     if ((value < min) || (max < value)) {
         return;
     }
-    int tmp_max = max - min;
-    int tmp_val = value - min;
-    int pix = ((x2 - x1) * tmp_val) / tmp_max;
+    tmp_max = max - min;
+    tmp_val = value - min;
+    pix = ((x2 - x1) * tmp_val) / tmp_max;
     bmpimg_fill_box(p, x1 + 1, y1 + 1, x1 + pix - 1, y2 - 1, color);
 }
 
index 3783eaa..e6ce38a 100644 (file)
@@ -78,7 +78,7 @@ void canvas_pixel_reader(const int x, const int y, uint8_t *r, uint8_t *g, uint8
     *b = buffer->b;
 }
 
-void canvas_drawer(const int px, const int py, bool on, void *extobj)
+void canvas_drawer(const int px, const int py, int on, void *extobj)
 {
     canvas_t *canvas = (canvas_t *)extobj;
     bmpcol_t *buffer = canvas->buffer + (canvas->w * py) + px;
index d3edb7b..06ac0e5 100644 (file)
@@ -2,7 +2,6 @@
 #ifndef CANVAS_H
 #define CANVAS_H
 
-#include <stdbool.h>
 #include "bmpimg.h"
 
 /**
@@ -46,7 +45,7 @@ void canvas_pixel_writer(const int x, const int y, const uint8_t r, const uint8_
  */
 void canvas_pixel_reader(const int x, const int y, uint8_t *r, uint8_t *g, uint8_t *b, void *extobj);
 
-void canvas_drawer(const int px, const int py, bool on, void *extobj);
+void canvas_drawer(const int px, const int py, int on, void *extobj);
 
 #endif
 
index e670bea..c7a04e4 100644 (file)
 #ifndef LCDIMG_H
 #define LCDIMG_H
 
-#include <stdbool.h>
-
 typedef struct LCDIMG LCDIMG;
 
-typedef void (*LCDIMG_DRAWER)(const int px, const int py, bool on, void *extobj);
+typedef void (*LCDIMG_DRAWER)(const int px, const int py, int on, void *extobj);
 
 LCDIMG *lcdimg_open(const int x, const int y);
 int lcdimg_text(LCDIMG *p, const int x, const int y, const char c);
diff --git a/soft/utils/lcdtool/lcdtool.sln b/soft/utils/lcdtool/lcdtool.sln
new file mode 100644 (file)
index 0000000..8074b8d
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lcdtool", "lcdtool.vcxproj", "{821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}.Debug|Win32.ActiveCfg = Debug|Win32
+               {821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}.Debug|Win32.Build.0 = Debug|Win32
+               {821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}.Release|Win32.ActiveCfg = Release|Win32
+               {821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/soft/utils/lcdtool/lcdtool.vcxproj b/soft/utils/lcdtool/lcdtool.vcxproj
new file mode 100644 (file)
index 0000000..2866228
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{821B0564-1B4F-4CAE-99DD-E2F09A06C5AB}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>lcdtool</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>../common/tinybmpio;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>../common/tinybmpio;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\common\tinybmpio\bmpfile.c" />
+    <ClCompile Include="..\common\tinybmpio\bmpimg.c" />
+    <ClCompile Include="..\common\tinybmpio\bmplowio.c" />
+    <ClCompile Include="canvas.c" />
+    <ClCompile Include="lcdimg.c" />
+    <ClCompile Include="main.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\common\tinybmpio\bmpfile.h" />
+    <ClInclude Include="..\common\tinybmpio\bmpimg.h" />
+    <ClInclude Include="..\common\tinybmpio\bmpint.h" />
+    <ClInclude Include="..\common\tinybmpio\bmplowio.h" />
+    <ClInclude Include="canvas.h" />
+    <ClInclude Include="lcdimg.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/soft/utils/lcdtool/lcdtool.vcxproj.filters b/soft/utils/lcdtool/lcdtool.vcxproj.filters
new file mode 100644 (file)
index 0000000..903bd7f
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="ソース ファイル">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="ヘッダー ファイル">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="リソース ファイル">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="canvas.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="lcdimg.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="main.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="..\common\tinybmpio\bmpfile.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="..\common\tinybmpio\bmpimg.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="..\common\tinybmpio\bmplowio.c">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="canvas.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="lcdimg.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="..\common\tinybmpio\bmpfile.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="..\common\tinybmpio\bmpimg.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="..\common\tinybmpio\bmpint.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="..\common\tinybmpio\bmplowio.h">
+      <Filter>ヘッダー ファイル</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/soft/utils/lcdtool/lcdtool.vcxproj.user b/soft/utils/lcdtool/lcdtool.vcxproj.user
new file mode 100644 (file)
index 0000000..ace9a86
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file