| 78 | } |
| 79 | |
| 80 | m2::PointU ColorTextureSize(size_t colorsCount, uint32_t maxTextureSize) |
| 81 | { |
| 82 | uint32_t const sz = static_cast<uint32_t>(floor(sqrt(colorsCount + kReservedColors))); |
| 83 | /// @todo(pastk): do we need this assert at all? |
| 84 | // No problem if assert will fire here. Just color texture will be 2x bigger :) |
| 85 | // ASSERT_LESS_OR_EQUAL(sz, kMinColorTextureSize, (colorsCount)); |
| 86 | uint32_t colorTextureSize = std::max(math::NextPowOf2(sz), kMinColorTextureSize); |
| 87 | |
| 88 | colorTextureSize *= ColorTexture::GetColorSizeInPixels(); |
| 89 | colorTextureSize = std::min(maxTextureSize, colorTextureSize); |
| 90 | return m2::PointU(colorTextureSize, colorTextureSize); |
| 91 | } |
| 92 | |
| 93 | drape_ptr<Texture> CreateArrowTexture(ref_ptr<dp::GraphicsContext> context, |
| 94 | ref_ptr<HWTextureAllocator> textureAllocator, std::string const & texturePath, |