本文整理汇总了C++中PaintInfo::forceTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintInfo::forceTextColor方法的具体用法?C++ PaintInfo::forceTextColor怎么用?C++ PaintInfo::forceTextColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintInfo
的用法示例。
在下文中一共展示了PaintInfo::forceTextColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext& context = paintInfo.context();
const RenderStyle& lineStyle = this->lineStyle();
Color textColor = lineStyle.visitedDependentColor(CSSPropertyWebkitTextFillColor);
if (textColor != context.fillColor())
context.setFillColor(textColor);
bool setShadow = false;
if (lineStyle.textShadow()) {
context.setShadow(LayoutSize(lineStyle.textShadow()->x(), lineStyle.textShadow()->y()),
lineStyle.textShadow()->radius(), lineStyle.textShadow()->color());
setShadow = true;
}
const FontCascade& font = lineStyle.fontCascade();
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, paintOffset, lineStyle, font);
// Select the correct color for painting the text.
Color foreground = paintInfo.forceTextColor() ? paintInfo.forcedTextColor() : blockFlow().selectionForegroundColor();
if (foreground.isValid() && foreground != textColor)
context.setFillColor(foreground);
}
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
context.drawText(font, RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
// Restore the regular fill color.
if (textColor != context.fillColor())
context.setFillColor(textColor);
if (setShadow)
context.clearShadow();
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, lineStyle);
}