From bea92c3bba8d6fc2e5f26ce38f46e43b72fcdb59 Mon Sep 17 00:00:00 2001 From: rachytski Date: Sun, 24 Jul 2011 15:55:48 +0300 Subject: [PATCH] fixed solid pen pattern disappearing on iOS. --- yg/pen_info.cpp | 4 ++-- yg/yg_tests/skin_loader_test.cpp | 4 ++-- yg/yg_tests/skin_test.cpp | 14 ++++++-------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/yg/pen_info.cpp b/yg/pen_info.cpp index 91d2e0d9c6..f8f8948e34 100644 --- a/yg/pen_info.cpp +++ b/yg/pen_info.cpp @@ -108,8 +108,8 @@ namespace yg m2::PointU const PenInfo::patternSize() const { if (m_isSolid) - return m2::PointU(ceil(m_w) + 4, - ceil(m_w) + 4); + return m2::PointU(ceil(m_w / 2) * 2 + 4, + ceil(m_w / 2) * 2 + 4); else { uint32_t len = static_cast(accumulate(m_pat.begin(), m_pat.end(), 0.0)); diff --git a/yg/yg_tests/skin_loader_test.cpp b/yg/yg_tests/skin_loader_test.cpp index d9db87914f..4a688b1ab7 100644 --- a/yg/yg_tests/skin_loader_test.cpp +++ b/yg/yg_tests/skin_loader_test.cpp @@ -8,6 +8,6 @@ UNIT_TEST(SkinLoaderTest_Main) { GL_TEST_START; - shared_ptr rm(new yg::ResourceManager(1000, 1000, 2, 1000, 1000, 2, 1000, 1000, 2, 128, 128, 15, 256, 256, 5, 256, 256, 40, "", "", "", 2 * 1024 * 1024, yg::Rt8Bpp, false, false)); - /*yg::Skin * skin = */loadSkin(rm, "basic.skn", 2, 2); + shared_ptr rm(new yg::ResourceManager(1000, 1000, 2, 1000, 1000, 2, 1000, 1000, 2, 128, 128, 15, 256, 256, 5, 256, 256, 40, "unicode_blocks.txt", "fonts_whitelist.txt", "fonts_blacklist.txt", 2 * 1024 * 1024, yg::Rt8Bpp, false, false)); + loadSkin(rm, "basic.skn", 2, 2); }; diff --git a/yg/yg_tests/skin_test.cpp b/yg/yg_tests/skin_test.cpp index 7137fcb1fb..4d8b2332d1 100644 --- a/yg/yg_tests/skin_test.cpp +++ b/yg/yg_tests/skin_test.cpp @@ -10,12 +10,12 @@ UNIT_TEST(SkinTest_Main) { GL_TEST_START; - shared_ptr rm(new yg::ResourceManager(100, 100, 1, 100, 100, 1, 100, 100, 1, 128, 128, 15, 256, 256, 5, 256, 256, 40, "", "", "", 2 * 1024 * 1024, yg::Rt8Bpp, false, false)); - yg::Skin * skin = loadSkin(rm, "test.skn", 2, 2); + shared_ptr rm(new yg::ResourceManager(100, 100, 1, 100, 100, 1, 100, 100, 1, 128, 128, 15, 256, 256, 5, 256, 256, 40, "unicode_blocks.txt", "fonts_whitelist.txt", "fonts_blacklist.txt", 2 * 1024 * 1024, yg::Rt8Bpp, false, false)); + yg::Skin * skin = loadSkin(rm, "basic.skn", 2, 2); double p0 [] = {1, 1}; yg::PenInfo penInfo0(yg::Color(0xFF, 0, 0, 0xFF), 1, p0, 2, 0); - /*uint32_t ruleID0 = */skin->mapPenInfo(penInfo0); +// skin->mapPenInfo(penInfo0); double p1 [] = {10, 10, 20, 20}; yg::PenInfo penInfo1(yg::Color(0xFF, 0, 0, 0xFF), 40, p1, 4, 0); @@ -26,14 +26,12 @@ UNIT_TEST(SkinTest_Main) double p3[] = {5, 5, 45, 30}; yg::PenInfo penInfo3(yg::Color(0xFF, 0, 0xFF, 0xFF), 35, p3, 4, 0); - /*uint32_t styleID1 = */skin->mapPenInfo(penInfo1); - /*uint32_t styleID2 = */skin->mapPenInfo(penInfo2); - //skin->texture().dump("skin_test0.png"); +// skin->mapPenInfo(penInfo1); +// skin->mapPenInfo(penInfo2); // Overflowing - /*uint32_t styleID3 = */skin->mapPenInfo(penInfo3); - //skin->texture().dump("skin_test1.png"); +// skin->mapPenInfo(penInfo3); delete skin; }