• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision262 (tree)
Time2012-01-17 19:00:54
Authorshirayanagi

Log Message

RGBA クラス更新
nacl 更新

Change Summary

Incremental Difference

--- trunk/framework/sample/Windows/unittest/src/fnd_image_test/test_color.cpp (revision 261)
+++ trunk/framework/sample/Windows/unittest/src/fnd_image_test/test_color.cpp (revision 262)
@@ -65,7 +65,7 @@
6565 ASSERT_FLOAT_EQ( 1.0f, fclr3.a );
6666 }
6767
68-typedef testing::Types< CRGBA8888, CCOLORREF, CRGB565 > FormatTypeParams;
68+typedef testing::Types< CRGBA8888, CCOLORREF, CRGB565, CRGB888 > FormatTypeParams;
6969
7070 template<typename T>
7171 class FndColorTypesTest : public testing::TestWithParam<T>
@@ -96,6 +96,12 @@
9696 ASSERT_FLOAT_EQ(1.0f, frgb.g);
9797 ASSERT_FLOAT_EQ(1.0f, frgb.b);
9898 ASSERT_FLOAT_EQ(1.0f, frgb.a);
99+
100+ CRGBA8888 rgba8888 = color;
101+ ASSERT_EQ(0xFF, rgba8888.r());
102+ ASSERT_EQ(0xFF, rgba8888.g());
103+ ASSERT_EQ(0xFF, rgba8888.b());
104+ ASSERT_EQ(0xFF, rgba8888.a());
99105 }
100106
101107 TYPED_TEST(FndColorTypesTest, convert)
@@ -119,6 +125,38 @@
119125 ASSERT_NEAR(rgba.a(), rgba_dst.a(), aa);
120126 }
121127
128+TYPED_TEST(FndColorTypesTest, convert_component1)
129+{
130+ u8 r = static_cast<u8>((rand()>>4) & 0xFF);
131+ u8 g = static_cast<u8>((rand()>>4) & 0xFF);
132+ u8 b = static_cast<u8>((rand()>>4) & 0xFF);
133+ u8 a = static_cast<u8>((rand()>>4) & 0xFF);
134+ CRGBA8888 rgba( r, g, b, a );
135+ ParamType color(rgba);
136+ CRGBA8888 rgba_dst = color;
137+
138+ ASSERT_EQ(rgba_dst.r(), color.r<u8>());
139+ ASSERT_EQ(rgba_dst.g(), color.g<u8>());
140+ ASSERT_EQ(rgba_dst.b(), color.b<u8>());
141+ ASSERT_EQ(rgba_dst.a(), color.a<u8>());
142+}
143+
144+TYPED_TEST(FndColorTypesTest, convert_component2)
145+{
146+ u8 r = static_cast<u8>((rand()>>4) & 0xFF);
147+ u8 g = static_cast<u8>((rand()>>4) & 0xFF);
148+ u8 b = static_cast<u8>((rand()>>4) & 0xFF);
149+ u8 a = static_cast<u8>((rand()>>4) & 0xFF);
150+ CRGBA8888 rgba( r, g, b, a );
151+ ParamType color(rgba);
152+ CRGB565 rgba_dst = rgba;
153+
154+ ASSERT_EQ(rgba_dst.r(), (color.r<u8, 5>()));
155+ ASSERT_EQ(rgba_dst.g(), (color.g<u8, 6>()));
156+ ASSERT_EQ(rgba_dst.b(), (color.b<u8, 5>()));
157+ ASSERT_EQ(rgba_dst.a(), (color.a<u8, 0>()));
158+}
159+
122160 TYPED_TEST(FndColorTypesTest, convert_from_float)
123161 {
124162 IrisFColor rgba;
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
--- trunk/framework/sample/Windows/unittest/src/nacl_test/input/index.txt (revision 261)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/input/index.txt (nonexistent)
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
--- trunk/framework/sample/Windows/unittest/src/nacl_test/file/main.cpp (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/file/main.cpp (revision 262)
@@ -0,0 +1,82 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file main.cpp
5+ * @brief test ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2012 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+
18+//======================================================================
19+// include
20+#include "web/nacl/core/NaclModule.h"
21+#include "web/nacl/core/NaclError.h"
22+#include "web/nacl/debug/NaclDebug.h"
23+#include "web/nacl/object/NaclScriptableObj.h"
24+#include "web/nacl/object/NaclMethod.h"
25+#include "web/nacl/fs/NaclFile.h"
26+#include "iris_using.h"
27+#include <algorithm>
28+
29+namespace test
30+{
31+
32+class TestInstance : public CInstance<TestInstance>
33+{
34+ typedef CInstance<TestInstance> _Mybase;
35+ CFileSystem m_fs;
36+public:
37+ explicit TestInstance(PP_Instance instance)
38+ : _Mybase(instance)
39+ , m_fs(this, PP_FILESYSTEMTYPE_LOCALPERSISTENT)
40+ {
41+ printf("Initialize TestScriptableObject.\n");
42+ AddMethod("writeFile", CMethodFactory::CreateMethod(this, &TestInstance::writeFile));
43+
44+ int32_t hr = m_fs.Open(4096);
45+ if( hr != PP_OK_COMPLETIONPENDING )
46+ {
47+ PostMessage("ERROR: Could not open local persistent file system.");
48+ }
49+ }
50+
51+public:
52+ pp::Var writeFile(std::string buf)
53+ {
54+ nacl::CFile m_file(this, m_fs);
55+ if( m_file.Open("/test", fnd::FOPEN_RW | fnd::FOPEN_CREATE) )
56+ {
57+ int32_t ret = m_file.Write(buf.c_str(), buf.length());
58+ OutputDebugVar(buf);
59+ return ret;
60+ }
61+ return true;
62+ }
63+};
64+
65+}
66+
67+// エントリポイントの記述
68+typedef CModule<test::TestInstance> Module;
69+static CModuleEntry<Module> s_module_entry;
70+
71+#if 1
72+namespace pp
73+{
74+
75+Module* CreateModule()
76+{
77+ if( IModuleEntry::GetInstancePtr() == nullptr ) return nullptr;
78+ return IModuleEntry::GetInstance().CreateInstance();
79+}
80+
81+}
82+#endif
--- trunk/framework/sample/Windows/unittest/src/nacl_test/file/index.html (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/file/index.html (revision 262)
@@ -0,0 +1,136 @@
1+<!DOCTYPE html>
2+<html lang="ja">
3+
4+
5+
6+
7+
8+<head>
9+<title>test</title>
10+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11+<script type="text/javascript" src="http://www.google.com/jsapi"></script>
12+<script type="text/javascript">google.load("jquery", "1.5");</script>
13+
14+<script type="text/javascript">
15+ hModule = null; // Global application object.
16+ statusText = 'NO-STATUS';
17+ var kMaxArraySize = 20;
18+ var messageArray = new Array();
19+
20+ function $(id) {
21+ return document.getElementById(id);
22+ }
23+
24+ function moduleDidLoad() {
25+ hModule = document.getElementById('input');
26+ // Add a message handler that accepts messages coming from the NaCl
27+ // module.
28+ hModule.addEventListener('message', handleMessage, true);
29+ updateStatus('SUCCESS');
30+ }
31+
32+ // Handle a message coming from the NaCl module.
33+ function handleMessage(message) {
34+ // Show last |kMaxArraySize| events in html.
35+ messageArray.push(message.data);
36+ if (messageArray.length > kMaxArraySize) {
37+ messageArray.shift();
38+ }
39+ var newData = messageArray.join('<BR>');
40+ document.getElementById('eventString').innerHTML = newData;
41+ // Print event to console.
42+ console.log(message.data);
43+ }
44+
45+ // If the page loads before the Native Client module loads, then set the
46+ // status message indicating that the module is still loading. Otherwise,
47+ // do not change the status message.
48+ function pageDidLoad() {
49+ if (hModule == null) {
50+ updateStatus('LOADING...');
51+ } else {
52+ // It's possible that the Native Client module onload event fired
53+ // before the page's onload event. In this case, the status message
54+ // will reflect 'SUCCESS', but won't be displayed. This call will
55+ // display the current message.
56+ updateStatus();
57+ }
58+ }
59+
60+ function writeFile() {
61+ try {
62+ hModule.postMessage('writeFile:' + inputBox.value);
63+ } catch (e) {
64+ alert(e.message);
65+ }
66+ }
67+
68+ // Set the global status message. If the element with id 'statusField'
69+ // exists, then set its HTML to the status message as well.
70+ // opt_message The message test. If this is null or undefined, then
71+ // attempt to set the element with id 'statusField' to the value of
72+ // |statusText|.
73+ function updateStatus(opt_message) {
74+ if (opt_message)
75+ statusText = opt_message;
76+ var statusField = document.getElementById('status_field');
77+ if (statusField) {
78+ statusField.innerHTML = statusText;
79+ }
80+ }
81+</script>
82+</head>
83+
84+<body onload="pageDidLoad()">
85+<!--[if lte IE 8]>
86+<p style="font-size : 20pt; padding : 1em ;">
87+IE では動作しません。
88+<a href="http://www.google.co.jp/chrome/intl/ja/landing_ie.html" target="_blank">Google Chrome</a> を利用してください。
89+</p>
90+<![endif]-->
91+<p>
92+ <form name="form"
93+ action=""
94+ method="get"
95+ onsubmit="return reverseText()">
96+ <input type="text" id="inputBox" name="inputBox" value="Hello world" />
97+ <input type="button" value="Call fileWrite()" onclick="fileWrite()" />
98+ </form>
99+ <!-- Load the published .nexe. This includes the 'src' attribute which
100+ shows how to load multi-architecture modules. Each entry in the "nexes"
101+ object in the .nmf manifest file is a key-value pair: the key is the runtime
102+ ('x86-32', 'x86-64', etc.); the value is a URL for the desired NaCl module.
103+ To load the debug versions of your .nexes, set the 'src' attribute to the
104+ _dbg.nmf version of the manifest file.
105+
106+ Note that the <EMBED> element is wrapped inside a <DIV>, which has a 'load'
107+ event listener attached. This method is used instead of attaching the 'load'
108+ event listener directly to the <EMBED> element to ensure that the listener
109+ is active before the NaCl module 'load' event fires.
110+ -->
111+ <div id="listener">
112+ <script type="text/javascript">
113+ function handleError(e) {
114+ var embed_element = document.getElementById('file');
115+ window.alert('Error: lastError = ' + embed_element.lastError);
116+ }
117+ $('listener').addEventListener('error', handleError, true);
118+ $('listener').addEventListener('load', moduleDidLoad, true);
119+ </script>
120+
121+ <embed name="nacl_module"
122+ id="file"
123+ width="400" height="400"
124+ src="file.nmf"
125+ type="application/x-nacl"
126+ style="background-color:gray" />
127+ </div>
128+</p>
129+<h2>Events</h2>
130+<p><b id='eventString'>None</b></p>
131+
132+
133+<h2>Status</h2>
134+<div id="status_field">NO-STATUS</div>
135+</body>
136+</html>
--- trunk/framework/sample/Windows/unittest/src/nacl_test/file/scons.bat (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/file/scons.bat (revision 262)
@@ -0,0 +1,45 @@
1+
2+@echo off
3+
4+setlocal
5+
6+rem 環境変数の確認
7+if not defined NACL_SDK_ROOT (
8+ @echo NACL_SDK_ROOT を設定してください。
9+ goto error
10+)
11+
12+pushd "%~dp0"
13+SET PATH=c:\cygwin\bin;%PATH%
14+
15+SET CYG_NACL_SDK_ROOT=/cygdrive/%NACL_SDK_ROOT%
16+SET CYG_NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT::=%
17+SET CYG_NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT:\=/%
18+SET NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT%
19+if not defined NACL_TARGET_PLATFORM SET NACL_TARGET_PLATFORM=pepper_15
20+SET NACL_SDK_PLATFORM_DIR=%NACL_SDK_ROOT%/%NACL_TARGET_PLATFORM%
21+
22+SET PYTHONPATH=%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/engine
23+
24+SET PYTHON=python
25+%PYTHON% -O -OO "%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/script/scons" ^
26+--warn no-visual-c-missing ^
27+--file=build.scons ^
28+--site-dir="%NACL_SDK_PLATFORM_DIR%/build_tools/nacl_sdk_scons" %*
29+
30+rem bash -c "python -O -OO \"%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/script/scons\" ^
31+rem --warn no-visual-c-missing ^
32+rem --file=build.scons ^
33+rem --site-dir=\"%NACL_SDK_PLATFORM_DIR%/build_tools/nacl_sdk_scons\" %*"
34+
35+if errorlevel 1 goto error
36+
37+goto end
38+
39+:error
40+pause
41+exit /b 1
42+
43+:end
44+exit /b 0
45+
--- trunk/framework/sample/Windows/unittest/src/nacl_test/sound/main.cpp (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/sound/main.cpp (revision 262)
@@ -0,0 +1,79 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file test.cpp
5+ * @brief test ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2011 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+
18+//======================================================================
19+// include
20+#include "web/nacl/core/NaclModule.h"
21+#include "web/nacl/core/NaclError.h"
22+#include "web/nacl/debug/NaclDebug.h"
23+#include "web/nacl/object/NaclScriptableObj.h"
24+#include "web/nacl/object/NaclMethod.h"
25+#include "iris_using.h"
26+#include <algorithm>
27+
28+namespace test
29+{
30+
31+class TestInputHandler : public IInputHandler
32+{
33+public:
34+ virtual bool OnMouseEvent(const pp::MouseInputEvent& rEvent, PP_InputEvent_Type type)
35+ {
36+ OutputDebugVar(rEvent.GetPosition().x());
37+ OutputDebugVar(rEvent.GetPosition().y());
38+ return IInputHandler::OnMouseEvent(rEvent, type);
39+ }
40+ virtual bool OnKeyboardEvent(const pp::KeyboardInputEvent& rEvent, PP_InputEvent_Type type)
41+ {
42+ OutputDebugVar(rEvent.GetKeyCode());
43+ return IInputHandler::OnKeyboardEvent(rEvent, type);
44+ }
45+};
46+
47+class TestInstance : public CInstance<TestInstance>
48+{
49+ typedef CInstance<TestInstance> _Mybase;
50+ TestInputHandler m_Input;
51+public:
52+ explicit TestInstance(PP_Instance instance)
53+ : _Mybase(instance)
54+ {
55+ printf("Initialize TestScriptableObject.\n");
56+ RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL);
57+ RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
58+ SetInputHandler(&m_Input);
59+ }
60+};
61+
62+}
63+
64+// エントリポイントの記述
65+typedef CModule<test::TestInstance> Module;
66+static CModuleEntry<Module> s_module_entry;
67+
68+#if 1
69+namespace pp
70+{
71+
72+Module* CreateModule()
73+{
74+ if( IModuleEntry::GetInstancePtr() == nullptr ) return nullptr;
75+ return IModuleEntry::GetInstance().CreateInstance();
76+}
77+
78+}
79+#endif
--- trunk/framework/sample/Windows/unittest/src/nacl_test/sound/scons.bat (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/sound/scons.bat (revision 262)
@@ -0,0 +1,45 @@
1+
2+@echo off
3+
4+setlocal
5+
6+rem 環境変数の確認
7+if not defined NACL_SDK_ROOT (
8+ @echo NACL_SDK_ROOT を設定してください。
9+ goto error
10+)
11+
12+pushd "%~dp0"
13+SET PATH=c:\cygwin\bin;%PATH%
14+
15+SET CYG_NACL_SDK_ROOT=/cygdrive/%NACL_SDK_ROOT%
16+SET CYG_NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT::=%
17+SET CYG_NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT:\=/%
18+SET NACL_SDK_ROOT=%CYG_NACL_SDK_ROOT%
19+if not defined NACL_TARGET_PLATFORM SET NACL_TARGET_PLATFORM=pepper_15
20+SET NACL_SDK_PLATFORM_DIR=%NACL_SDK_ROOT%/%NACL_TARGET_PLATFORM%
21+
22+SET PYTHONPATH=%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/engine
23+
24+SET PYTHON=python
25+%PYTHON% -O -OO "%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/script/scons" ^
26+--warn no-visual-c-missing ^
27+--file=build.scons ^
28+--site-dir="%NACL_SDK_PLATFORM_DIR%/build_tools/nacl_sdk_scons" %*
29+
30+rem bash -c "python -O -OO \"%NACL_SDK_PLATFORM_DIR%/third_party/scons-2.0.1/script/scons\" ^
31+rem --warn no-visual-c-missing ^
32+rem --file=build.scons ^
33+rem --site-dir=\"%NACL_SDK_PLATFORM_DIR%/build_tools/nacl_sdk_scons\" %*"
34+
35+if errorlevel 1 goto error
36+
37+goto end
38+
39+:error
40+pause
41+exit /b 1
42+
43+:end
44+exit /b 0
45+
--- trunk/framework/sample/Windows/unittest/src/nacl_test/sound/index.html (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/sound/index.html (revision 262)
@@ -0,0 +1,121 @@
1+<!DOCTYPE html>
2+<html lang="ja">
3+
4+
5+
6+
7+
8+<head>
9+<title>test</title>
10+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11+<script type="text/javascript" src="http://www.google.com/jsapi"></script>
12+<script type="text/javascript">google.load("jquery", "1.5");</script>
13+
14+<script type="text/javascript">
15+ hModule = null; // Global application object.
16+ statusText = 'NO-STATUS';
17+ var kMaxArraySize = 20;
18+ var messageArray = new Array();
19+
20+ function $(id) {
21+ return document.getElementById(id);
22+ }
23+
24+ function moduleDidLoad() {
25+ hModule = document.getElementById('input');
26+ // Add a message handler that accepts messages coming from the NaCl
27+ // module.
28+ hModule.addEventListener('message', handleMessage, true);
29+ updateStatus('SUCCESS');
30+ }
31+
32+ // Handle a message coming from the NaCl module.
33+ function handleMessage(message) {
34+ // Show last |kMaxArraySize| events in html.
35+ messageArray.push(message.data);
36+ if (messageArray.length > kMaxArraySize) {
37+ messageArray.shift();
38+ }
39+ var newData = messageArray.join('<BR>');
40+ document.getElementById('eventString').innerHTML = newData;
41+ // Print event to console.
42+ console.log(message.data);
43+ }
44+
45+ // If the page loads before the Native Client module loads, then set the
46+ // status message indicating that the module is still loading. Otherwise,
47+ // do not change the status message.
48+ function pageDidLoad() {
49+ if (hModule == null) {
50+ updateStatus('LOADING...');
51+ } else {
52+ // It's possible that the Native Client module onload event fired
53+ // before the page's onload event. In this case, the status message
54+ // will reflect 'SUCCESS', but won't be displayed. This call will
55+ // display the current message.
56+ updateStatus();
57+ }
58+ }
59+
60+ // Set the global status message. If the element with id 'statusField'
61+ // exists, then set its HTML to the status message as well.
62+ // opt_message The message test. If this is null or undefined, then
63+ // attempt to set the element with id 'statusField' to the value of
64+ // |statusText|.
65+ function updateStatus(opt_message) {
66+ if (opt_message)
67+ statusText = opt_message;
68+ var statusField = document.getElementById('status_field');
69+ if (statusField) {
70+ statusField.innerHTML = statusText;
71+ }
72+ }
73+</script>
74+</head>
75+
76+<body onload="pageDidLoad()">
77+<!--[if lte IE 8]>
78+<p style="font-size : 20pt; padding : 1em ;">
79+IE では動作しません。
80+<a href="http://www.google.co.jp/chrome/intl/ja/landing_ie.html" target="_blank">Google Chrome</a> を利用してください。
81+</p>
82+<![endif]-->
83+<p>
84+ <!-- Load the published .nexe. This includes the 'src' attribute which
85+ shows how to load multi-architecture modules. Each entry in the "nexes"
86+ object in the .nmf manifest file is a key-value pair: the key is the runtime
87+ ('x86-32', 'x86-64', etc.); the value is a URL for the desired NaCl module.
88+ To load the debug versions of your .nexes, set the 'src' attribute to the
89+ _dbg.nmf version of the manifest file.
90+
91+ Note that the <EMBED> element is wrapped inside a <DIV>, which has a 'load'
92+ event listener attached. This method is used instead of attaching the 'load'
93+ event listener directly to the <EMBED> element to ensure that the listener
94+ is active before the NaCl module 'load' event fires.
95+ -->
96+ <div id="listener">
97+ <script type="text/javascript">
98+ function handleError(e) {
99+ var embed_element = document.getElementById('sound');
100+ window.alert('Error: lastError = ' + embed_element.lastError);
101+ }
102+ $('listener').addEventListener('error', handleError, true);
103+ $('listener').addEventListener('load', moduleDidLoad, true);
104+ </script>
105+
106+ <embed name="nacl_module"
107+ id="sound"
108+ width=400 height=400
109+ src="sound.nmf"
110+ type="application/x-nacl"
111+ style="background-color:gray" />
112+ </div>
113+</p>
114+<h2>Events</h2>
115+<p><b id='eventString'>None</b></p>
116+
117+
118+<h2>Status</h2>
119+<div id="status_field">NO-STATUS</div>
120+</body>
121+</html>
--- trunk/framework/src/web/nacl/core/NaclInstance.h (revision 261)
+++ trunk/framework/src/web/nacl/core/NaclInstance.h (revision 262)
@@ -24,11 +24,9 @@
2424 #if defined(IRIS_NACL)
2525
2626 #include <ppapi/cpp/instance.h>
27-#include <ppapi/cpp/dev/scriptable_object_deprecated.h>
28-#include <ppapi/cpp/var.h>
29-#include <ppapi/cpp/input_event.h>
3027
3128 #include "../object/NaclScriptableObj.h"
29+#include "../object/NaclVar.h"
3230 #include "../input/NaclInputEvent.h"
3331
3432 namespace iris {
@@ -58,6 +56,17 @@
5856 m_ScriptObj.AddMethod(name, method);
5957 }
6058
59+ /// PostMessage
60+ template<typename TN>
61+ void PostMessage(const TN& value)
62+ {
63+ pp::Instance::PostMessage(CVarHelper::Construct(value));
64+ }
65+ void PostMessage(const pp::Var& message)
66+ {
67+ pp::Instance::PostMessage(message);
68+ }
69+
6170 public:
6271 // 入力ハンドラの設定
6372 void SetInputHandler(IInputHandler* handle) { m_pInputHandler = handle; }
--- trunk/framework/src/web/nacl/fs/NaclFile.h (revision 261)
+++ trunk/framework/src/web/nacl/fs/NaclFile.h (revision 262)
@@ -47,6 +47,7 @@
4747 CFileRef m_Ref;
4848 CFileIO m_File;
4949 int64_t m_Offset;
50+ PP_FileInfo m_Info;
5051 public:
5152 /**
5253 * @brief コンストラクタ
@@ -85,6 +86,8 @@
8586 //if( mode & fnd::FOPEN_POWERLOCK ) flags |= 0;
8687
8788 int32_t hr = m_File.Open(m_Ref, (PP_FileOpenFlags)flags);
89+ if( NACL_FAILED(hr) ) return false;
90+ hr = m_File.Query(&m_Info);
8891 m_Offset = 0;
8992 return NACL_SUCCEEDED(hr);
9093 }
@@ -142,7 +145,7 @@
142145 */
143146 virtual u32 GetSize(void) const
144147 {
145- return 0;
148+ return m_Info.size;
146149 }
147150
148151 /**
--- trunk/framework/src/web/nacl/fs/NaclFileIO.h (revision 261)
+++ trunk/framework/src/web/nacl/fs/NaclFileIO.h (revision 262)
@@ -73,6 +73,8 @@
7373 public:
7474 /**
7575 * @brief 開く
76+ * @param [in] ref = FileRef
77+ * @param [in] option_flags = フラグ
7678 * @return 結果
7779 */
7880 int32_t Open(const pp::FileRef& ref, int32_t option_flags)
@@ -83,6 +85,9 @@
8385
8486 /**
8587 * @brief 読み込み
88+ * @param [in] offsert = オフセット
89+ * @param [out] buffer = 出力バッファ
90+ * @param [in] bytes_to_read = 読み込みサイズ
8691 * @return 結果
8792 */
8893 int32_t Read(int64_t offset, char* buffer, int32_t bytes_to_read)
@@ -93,15 +98,39 @@
9398
9499 /**
95100 * @brief 書き込み
101+ * @param [in] offsert = オフセット
102+ * @param [in] buffer = 入力バッファ
103+ * @param [in] bytes_to_write = 書き込みサイズ
96104 * @return 結果
97105 */
98- int32_t Write(int64_t offset, const char* buffer, int32_t bytes_to_read)
106+ int32_t Write(int64_t offset, const char* buffer, int32_t bytes_to_write)
99107 {
100108 pp::CompletionCallback cc = m_Factory.NewRequiredCallback(&CFileIO::OnWrite);
101- return m_FileIO.Write(offset, buffer, bytes_to_read, cc);
109+ return m_FileIO.Write(offset, buffer, bytes_to_write, cc);
102110 }
103111
104112 /**
113+ * @brief Flush
114+ * @return 結果
115+ */
116+ int32_t Flush(void)
117+ {
118+ pp::CompletionCallback cc = m_Factory.NewRequiredCallback(&CFileIO::OnFlush);
119+ return m_FileIO.Flush(cc);
120+ }
121+
122+ /**
123+ * @brief Query
124+ * @param [out] result_buf = 出力
125+ * @return 結果
126+ */
127+ int32_t Query(PP_FileInfo* result_buf)
128+ {
129+ pp::CompletionCallback cc = m_Factory.NewRequiredCallback(&CFileIO::OnQuery);
130+ return m_FileIO.Query(result_buf, cc);
131+ }
132+
133+ /**
105134 * @brief
106135 * @return 結果
107136 */
@@ -132,9 +161,29 @@
132161
133162 /**
134163 * @brief コールバック関数
164+ * @param [in] bytes_read = 読み込んだサイズ
165+ */
166+ virtual void OnRead(int32_t bytes_read)
167+ {
168+ IRIS_UNUSED_VAR(bytes_read);
169+ OutputDebugVar(bytes_read);
170+ }
171+
172+ /**
173+ * @brief コールバック関数
174+ * @param [in] bytes_written = 書き込んだサイズ
175+ */
176+ virtual void OnWrite(int32_t bytes_written)
177+ {
178+ IRIS_UNUSED_VAR(bytes_written);
179+ OutputDebugVar(bytes_written);
180+ }
181+
182+ /**
183+ * @brief コールバック関数
135184 * @param [in] result = 結果
136185 */
137- virtual void OnRead(int32_t result)
186+ virtual void OnFlush(int32_t result)
138187 {
139188 IRIS_UNUSED_VAR(result);
140189 OutputDebugVar( FormatMessage(result) );
@@ -144,9 +193,10 @@
144193 * @brief コールバック関数
145194 * @param [in] result = 結果
146195 */
147- virtual void OnWrite(int32_t result)
196+ virtual void OnQuery(int32_t result)
148197 {
149198 IRIS_UNUSED_VAR(result);
199+ OutputDebugVar( FormatMessage(result) );
150200 }
151201
152202 /**
--- trunk/framework/src/fnd/image/FndColor.h (revision 261)
+++ trunk/framework/src/fnd/image/FndColor.h (revision 262)
@@ -22,7 +22,6 @@
2222 #include "../../iris_object.h"
2323 #include "../../iris_debug.h"
2424 #include "../../c++0x/cpp0x_enable_if.hpp"
25-#include "../../ml/iml_math.hpp"
2625
2726 namespace iris {
2827 namespace fnd
@@ -57,6 +56,7 @@
5756 typedef CColor<u16, 5, 5, 5, 1, 1, 6, 11, 0> CBGRA5551;
5857 typedef CColor<u16, 5, 5, 5, 1, 10, 5, 0, 15> CBGRA5551_REV;
5958 typedef CColor<u16, 5, 6, 5, 0, 11, 5, 0, 0> CRGB565;
59+typedef CColor<u16, 5, 6, 5, 0, 0, 5, 11, 0> CRGB565_REV;
6060
6161 typedef CColor< u8, 3, 3, 2, 0, 5, 2, 0, 0> CRGB332;
6262 typedef CColor< u8, 3, 3, 2, 0, 0, 3, 6, 0> CRGB332_REV;
@@ -218,6 +218,30 @@
218218 */
219219
220220 /**
221+ * @name 各成分の変換
222+ */
223+ template<typename U, int BITS_>
224+ U r(void) const { return convert<BITS_, BSZ_R, U>::shift(r()); }
225+ template<typename U, int BITS_>
226+ U g(void) const { return convert<BITS_, BSZ_G, U>::shift(g()); }
227+ template<typename U, int BITS_>
228+ U b(void) const { return convert<BITS_, BSZ_B, U>::shift(b()); }
229+ template<typename U, int BITS_>
230+ U a(void) const { return convert<BITS_, BSZ_A, U>::shift(a()); }
231+
232+ template<typename U>
233+ U r(void) const { return convert<sizeof(U)*8, BSZ_R, U>::shift(r()); }
234+ template<typename U>
235+ U g(void) const { return convert<sizeof(U)*8, BSZ_G, U>::shift(g()); }
236+ template<typename U>
237+ U b(void) const { return convert<sizeof(U)*8, BSZ_B, U>::shift(b()); }
238+ template<typename U>
239+ U a(void) const { return convert<sizeof(U)*8, BSZ_A, U>::shift(a()); }
240+ /**
241+ * @}
242+ */
243+
244+ /**
221245 * @name 各成分の設定
222246 * @{
223247 */
@@ -230,7 +254,7 @@
230254 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
231255 void r(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
232256 {
233- r( iml::signed_lshift<BSZ_R-ORBITS_>::shift<value_type_r>(rObj.r()) );
257+ r( convert<BSZ_R, ORBITS_, value_type_r>::shift(rObj.r()) );
234258 }
235259 template<typename OTN_, int OGBITS_, int OBBITS_, int OABITS_
236260 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
@@ -243,7 +267,7 @@
243267 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
244268 void g(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
245269 {
246- g( iml::signed_lshift<BSZ_G-OGBITS_>::shift<value_type_g>(rObj.g()) );
270+ g( convert<BSZ_G, OGBITS_, value_type_g>::shift(rObj.g()) );
247271 }
248272 template<typename OTN_, int ORBITS_, int OBBITS_, int OABITS_
249273 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
@@ -256,7 +280,7 @@
256280 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
257281 void b(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj)
258282 {
259- b( iml::signed_lshift<BSZ_B-OBBITS_>::shift<value_type_b>(rObj.b()) );
283+ b( convert<BSZ_B, OBBITS_, value_type_b>::shift(rObj.b()) );
260284 }
261285 template<typename OTN_, int ORBITS_, int OGBITS_, int OABITS_
262286 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
@@ -269,12 +293,13 @@
269293 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
270294 void a(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj, typename enable_if<(OABITS_!=0)>::type*& = cpp0x::enabler::value)
271295 {
272- a( iml::signed_lshift<BSZ_A-OABITS_>::shift<value_type_a>(rObj.a()) );
296+ a( convert<BSZ_A, OABITS_, value_type_a>::shift(rObj.a()) );
273297 }
274298 template<typename OTN_, int ORBITS_, int OGBITS_, int OBBITS_, int OABITS_
275299 , int ORSHIFT_, int OGSHIFT_, int OBSHIFT_, int OASHIFT_>
276300 void a(const CColor<OTN_, ORBITS_, OGBITS_, OBBITS_, OABITS_, ORSHIFT_, OGSHIFT_, OBSHIFT_, OASHIFT_>& rObj, typename enable_if<(OABITS_==0)>::type*& = cpp0x::enabler::value)
277301 {
302+ // 右辺の a が 0 の場合。
278303 IRIS_UNUSED_VAR(rObj);
279304 a(max_a());
280305 }
@@ -315,6 +340,67 @@
315340 operator IrisFColor (void) const { return Normalize(); }
316341
317342 private:
343+ template<int BTO, int BFROM, typename TO>
344+ class convert
345+ {
346+ template<int BTO_, int BFROM_, typename FROM>
347+ struct impl
348+ {
349+ template<bool bSubtractive, typename DMY>
350+ struct impl2
351+ {
352+ static inline TO shift(FROM value)
353+ {
354+ // 減色
355+ return static_cast<TO>( value >> (BFROM - BTO) );
356+ }
357+ };
358+ template<typename DMY>
359+ struct impl2<false, DMY>
360+ {
361+ static inline TO shift(FROM value)
362+ {
363+ // 増色
364+ TO tmp = static_cast<TO>(value) << (BTO - BFROM);
365+ return static_cast<TO>(tmp | (tmp >> BFROM));
366+ }
367+ };
368+
369+ static inline TO shift(FROM value)
370+ {
371+ return impl2<(BTO_ < BFROM), void>::shift(value);
372+ }
373+ };
374+ // ビット数が一緒の場合は、何もしない
375+ template<int B, typename FROM>
376+ struct impl<B, B, FROM>
377+ {
378+ static inline TO shift(FROM value) { return static_cast<TO>(value); }
379+ };
380+ // どちらかのビット数が 0 の場合は、0 確定
381+ template<int B, typename FROM>
382+ struct impl<B, 0, FROM>
383+ {
384+ static inline TO shift(FROM /*value*/) { return 0; }
385+ };
386+ template<int B, typename FROM>
387+ struct impl<0, B, FROM>
388+ {
389+ static inline TO shift(FROM /*value*/) { return 0; }
390+ };
391+ template<typename FROM>
392+ struct impl<0, 0, FROM>
393+ {
394+ static inline TO shift(FROM /*value*/) { return 0; }
395+ };
396+ public:
397+ template<typename FROM>
398+ static inline TO shift(FROM value)
399+ {
400+ return impl<BTO, BFROM, FROM>::shift(value);
401+ }
402+ };
403+
318404 template<int SIZE>
319405 void a_(value_type_a v) { value_type max = (value_type)max_a(); m_col &= ~(max << SFT_A); m_col |= ((v > max ? max : (value_type)v)) << SFT_A; }
320406 template<>
--- trunk/framework/testsuite/iutest/include/iutest_listener.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/iutest_listener.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_exception.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_exception.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_regex.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_regex.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_list.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_list.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_typelist.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_typelist.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
@@ -1189,7 +1189,6 @@
11891189
11901190 } // end of namespace detail
11911191
1192-
11931192 } // end of namespace iutest
11941193
11951194 #endif
--- trunk/framework/testsuite/iutest/include/internal/iutest_file.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_file.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_pp.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_pp.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_random.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_random.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_message.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_message.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
--- trunk/framework/testsuite/iutest/include/internal/iutest_constant.h (revision 261)
+++ trunk/framework/testsuite/iutest/include/internal/iutest_constant.h (revision 262)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see LICENSE
1414 */
Show on old repository browser