本文整理汇总了C++中LayoutSize::clampToMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutSize::clampToMinimumSize方法的具体用法?C++ LayoutSize::clampToMinimumSize怎么用?C++ LayoutSize::clampToMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutSize
的用法示例。
在下文中一共展示了LayoutSize::clampToMinimumSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imageSizeForRenderer
LayoutSize CachedImage::imageSizeForRenderer(const RenderElement* renderer, float multiplier, SizeType sizeType)
{
if (!m_image)
return LayoutSize();
LayoutSize imageSize;
if (is<BitmapImage>(*m_image) && renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation)
imageSize = LayoutSize(downcast<BitmapImage>(*m_image).sizeRespectingOrientation());
else if (is<SVGImage>(*m_image) && sizeType == UsedSize)
imageSize = LayoutSize(m_svgImageCache->imageSizeForRenderer(renderer));
else
imageSize = LayoutSize(m_image->size());
if (multiplier == 1.0f)
return imageSize;
// Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier;
float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier;
LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
imageSize.scale(widthScale, heightScale);
imageSize.clampToMinimumSize(minimumSize);
ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageSize.height().fraction() == 0.0f));
return imageSize;
}