mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Texture-based round corners: Fix building for stroke width 1,2,4 instead of 1,3,4.
This commit is contained in:
parent
a6fa56609b
commit
5820a7e248
10
imgui.h
10
imgui.h
@ -2704,11 +2704,11 @@ struct ImFontGlyphRangesBuilder
|
|||||||
// Data for texture-based rounded corners for a given radius
|
// Data for texture-based rounded corners for a given radius
|
||||||
struct ImFontRoundedCornerData
|
struct ImFontRoundedCornerData
|
||||||
{
|
{
|
||||||
ImVec4 TexUvFilled; // UV of filled round corner quad in the atlas (only valid when stroke width is 1)
|
ImVec4 TexUvFilled; // UV of filled round corner quad in the atlas (only valid when stroke width is 1)
|
||||||
ImVec4 TexUvStroked; // UV of stroked round corner quad in the atlas
|
ImVec4 TexUvStroked; // UV of stroked round corner quad in the atlas
|
||||||
float ParametricStrokeWidth; // Pre-calculated value for stroke width divided by the radius
|
float ParametricStrokeWidth; // Pre-calculated value for stroke width divided by the radius
|
||||||
int RectId; // Rect ID in the atlas, or -1 if there is no data
|
int RectId; // Rect ID in the atlas, or -1 if there is no data
|
||||||
bool StrokedUsesAlternateUVs; // True if stroked drawing should use the alternate (i.e. other corner) UVs
|
bool StrokedUsesAlternateUVs; // True if stroked drawing should use the alternate (i.e. other corner) UVs
|
||||||
};
|
};
|
||||||
|
|
||||||
// See ImFontAtlas::AddCustomRectXXX functions.
|
// See ImFontAtlas::AddCustomRectXXX functions.
|
||||||
|
@ -725,7 +725,6 @@ struct IMGUI_API ImDrawListSharedData
|
|||||||
ImU8 CircleSegmentCounts[64]; // Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
|
ImU8 CircleSegmentCounts[64]; // Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
|
||||||
const ImVec4* TexUvLines; // UV of anti-aliased lines in the atlas
|
const ImVec4* TexUvLines; // UV of anti-aliased lines in the atlas
|
||||||
|
|
||||||
// FIXME-ROUNDCORNERS: WIP + need to remove CircleVtx12 before PR
|
|
||||||
ImVector<ImFontRoundedCornerData>* TexRoundCornerData; // Data for texture-based rounded corners, indexed by radius
|
ImVector<ImFontRoundedCornerData>* TexRoundCornerData; // Data for texture-based rounded corners, indexed by radius
|
||||||
|
|
||||||
ImDrawListSharedData();
|
ImDrawListSharedData();
|
||||||
@ -2901,11 +2900,11 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table
|
|||||||
|
|
||||||
// Note that stroke width increases effective radius, so (e.g.) a max radius circle will have to use the fallback path if stroke width is > 1
|
// Note that stroke width increases effective radius, so (e.g.) a max radius circle will have to use the fallback path if stroke width is > 1
|
||||||
const int ImFontAtlasRoundCornersMaxSize = 32; // Maximum size of rounded corner texture to generate in fonts
|
const int ImFontAtlasRoundCornersMaxSize = 32; // Maximum size of rounded corner texture to generate in fonts
|
||||||
const int ImFontAtlasRoundCornersMaxStrokeWidth = 5; // Maximum stroke width of rounded corner texture to generate in fonts
|
const int ImFontAtlasRoundCornersMaxStrokeWidth = 4; // Maximum stroke width of rounded corner texture to generate in fonts
|
||||||
// Bit mask for which stroke widths should have textures generated for them (the default of 0xD means widths 1, 2 and 4)
|
// Bit mask for which stroke widths should have textures generated for them (the default of 0x0B means widths 1, 2 and 4)
|
||||||
// Only bits up to ImFontAtlasRoundCornersMaxStrokeWidth are considered, and bit 0 (stroke width 1) must always be set
|
// Only bits up to ImFontAtlasRoundCornersMaxStrokeWidth are considered, and bit 0 (stroke width 1) must always be set
|
||||||
// Optimally there should be an odd number of bits set, as the texture packing packs the data in pairs, with one half of one pair being occupied by the filled texture
|
// Optimally there should be an odd number of bits set, as the texture packing packs the data in pairs, with one half of one pair being occupied by the filled texture
|
||||||
const int ImFontAtlasRoundCornersStrokeWidthMask = 0xD;
|
const int ImFontAtlasRoundCornersStrokeWidthMask = 0x0B;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Test Engine specific hooks (imgui_test_engine)
|
// [SECTION] Test Engine specific hooks (imgui_test_engine)
|
||||||
|
Loading…
Reference in New Issue
Block a user