diff --git a/trunk/ConsoleDataMigration/sources/common/QrImage.cpp b/trunk/ConsoleDataMigration/sources/common/QrImage.cpp index 9436f49..c77f99a 100644 --- a/trunk/ConsoleDataMigration/sources/common/QrImage.cpp +++ b/trunk/ConsoleDataMigration/sources/common/QrImage.cpp @@ -16,10 +16,18 @@ #include "QrImage.h" #include "HeapManager.h" #include "Util.h" +#include #include +#include "ResFont.h" #include +namespace +{ +char s_DeviceIdStr[32]; +char s_SerialNumberStr[32]; +} + namespace common { @@ -34,21 +42,39 @@ QrImage::~QrImage() // TODO Auto-generated destructor stub } +void DrawDeviceId() +{ + GetTextWriter()->Printf("DeviceId = %s", s_DeviceIdStr); +} + +void DrawSerialNumber() +{ + GetTextWriter()->Printf("SerialNo. = %s", s_SerialNumberStr); +} + void QrImage::Draw(demo::RenderSystemDrawing& renderSystem, bit64 deviceId, u8* serialNo, bool flip) { char deviceIdStr[32]; nn::nstd::TSNPrintf(deviceIdStr, sizeof(deviceIdStr), "%llu", deviceId); - renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); - renderSystem.Clear(); std::string deviceIdString(deviceIdStr); Util::SplitDeviceidWithSpace(deviceIdString); - renderSystem.DrawText(0, 0, "DeviceId = %s", deviceIdString.c_str()); + std::strlcpy(s_DeviceIdStr, deviceIdString.c_str(), sizeof(s_DeviceIdStr)); + std::strlcpy(s_SerialNumberStr, reinterpret_cast(serialNo), sizeof(s_SerialNumberStr)); + + renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); + renderSystem.Clear(); + GetTextWriter()->SetTextColor(nn::util::Color8(255, 255, 255, 255)); + SetDrawTextHandler(DrawDeviceId); + DrawResFont(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); DrawStringinQr(renderSystem, reinterpret_cast(deviceIdStr), Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); renderSystem.SwapBuffers(); + renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); renderSystem.Clear(); - renderSystem.DrawText(0, 0, "SerialNo. = %s", serialNo); + GetTextWriter()->SetTextColor(nn::util::Color8(255, 255, 255, 255)); + SetDrawTextHandler(DrawSerialNumber); + DrawResFont(Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); DrawStringinQr(renderSystem, serialNo, Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); renderSystem.SwapBuffers(); } @@ -71,7 +97,7 @@ void QrImage::DrawStringinQr(demo::RenderSystemDrawing& renderSystem, u8* str, u /* 作成するQRコードの情報を設定 */ EncodeData info; // バージョン2で数字34文字OK - info.version = 12; + info.version = 10; /* 誤り訂正レベルH */ info.ecc_level = ECC_LEVEL_H; /* コンテンツ文字列の情報 */