Code: Select all
<FrameComponent>
<Area>
<Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<Image type="LeftEdge" imageset="Slider" image="Left" />
<Image type="RightEdge" imageset="Slider" image="Right" />
<Image type="Background" imageset="Slider" image="Horz" />
<VertFormat type="Stretched" />
<HorzFormat type="Tiled" />
</FrameComponent>
<HorzFormat type="Tiled" />
You could see, the horzFormatting is "Tiled".
In code "cegui-0.6.2\src\falagard\ceguifalframecomponent.cpp"
Code: Select all
void FrameComponent::render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const
...
// right image
if (d_frameImages[FIC_RIGHT_EDGE])
{
// calculate final destination area
imageSize = d_frameImages[FIC_RIGHT_EDGE]->getSize();
finalRect.d_top = destRect.d_top + rightOffset;
finalRect.d_bottom = finalRect.d_top + rightHeight;
finalRect.d_right = destRect.d_right;
finalRect.d_left = finalRect.d_right - imageSize.d_width;
finalRect = destRect.getIntersection (finalRect);
// adjust background area to miss this edge
backgroundRect.d_right -= imageSize.d_width - d_frameImages[FIC_RIGHT_EDGE]->getOffsetX();
...
backgroundRect.d_right -= imageSize.d_width - d_frameImages[FIC_RIGHT_EDGE]->getOffsetX();
backgroundRect.d_right should be negative when imageSize.d_width is bigger then itself.
It's go into more code.
Code: Select all
void FrameComponent::doBackgroundRender(Window& srcWindow, Rect& destRect, float base_z, const ColourRect& colours, const Rect* clipper, bool clipToDisplay) const
...
// calculate initial x co-ordinate and horizontal tile count according to formatting options
switch (horzFormatting)
{
...
case HF_TILED:
xpos = destRect.d_left;
horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width);
break;
horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width);
Attention!!! destRect.getWidth() return negative here. For this expression, horzTiles will be a huge number which should make bad allocation blow code.
I think it is a bug and here is my solution:
Code: Select all
case HF_TILED:
xpos = destRect.d_left;
if (destRect.getWidth() > 0)
horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width);
else
horzTiles = 1;
break;
Code: Select all
case VF_TILED:
ypos = destRect.d_top;
if (destRect.getHeight() > 0)
vertTiles = (uint)((destRect.getHeight() + (imgSz.d_height - 1)) / imgSz.d_height);
else
vertTiles = 1;
break;
What's your suggestion?