本文整理汇总了C++中FloatRect::setLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::setLocation方法的具体用法?C++ FloatRect::setLocation怎么用?C++ FloatRect::setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::setLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp)
{
CGImageRef image = frameAtIndex(m_currentFrame);
if (!image) // If it's too early we won't have an image yet.
return;
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, destRect, solidColor(), compositeOp);
return;
}
CGContextRef context = ctxt->platformContext();
ctxt->save();
// If the source rect is a subportion of the image, then we compute an inflated destination rect that will hold the entire image
// and then set a clip to the portion that we want to display.
CGSize selfSize = size();
FloatRect adjustedDestRect = destRect;
if (srcRect.width() != selfSize.width || srcRect.height() != selfSize.height) {
// A subportion of the image is drawing. Adjust the destination rect to
// account for this.
float xScale = srcRect.width() / destRect.width();
float yScale = srcRect.height() / destRect.height();
adjustedDestRect.setLocation(FloatPoint(destRect.x() - srcRect.x() / xScale, destRect.y() - srcRect.y() / yScale));
adjustedDestRect.setSize(FloatSize(size().width() / xScale, size().height() / yScale));
CGContextClipToRect(context, destRect);
}
// If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly.
float currHeight = CGImageGetHeight(image);
if (currHeight < selfSize.height)
adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height);
// Flip the coords.
ctxt->setCompositeOperation(compositeOp);
CGContextTranslateCTM(context, adjustedDestRect.x(), adjustedDestRect.bottom());
CGContextScaleCTM(context, 1, -1);
adjustedDestRect.setLocation(FloatPoint());
// Draw the image.
CGContextDrawImage(context, adjustedDestRect, image);
ctxt->restore();
startAnimation();
if (imageObserver())
imageObserver()->didDraw(this);
}
示例2: glyphSize
static inline void calculateGlyphBoundaries(const QueryData* queryData, const SVGTextFragment& fragment, int startPosition, FloatRect& extent)
{
float scalingFactor = queryData->textLayoutObject->scalingFactor();
ASSERT(scalingFactor);
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, startPosition);
glyphPosition.move(0, -queryData->textLayoutObject->scaledFont().fontMetrics().floatAscent() / scalingFactor);
extent.setLocation(glyphPosition);
// Use the SVGTextMetrics computed by SVGTextMetricsBuilder (which spends
// time attempting to compute more correct glyph bounds already, handling
// cursive scripts to some degree.)
const Vector<SVGTextMetrics>& textMetricsValues = queryData->textLayoutObject->layoutAttributes()->textMetricsValues();
const SVGTextMetrics& metrics = findMetricsForCharacter(textMetricsValues, fragment, startPosition);
// TODO(fs): Negative glyph extents seems kind of weird to have, but
// presently it can occur in some cases (like Arabic.)
FloatSize glyphSize(std::max<float>(metrics.width(), 0), std::max<float>(metrics.height(), 0));
extent.setSize(glyphSize);
// If RTL, adjust the starting point to align with the LHS of the glyph bounding box.
if (!queryData->textBox->isLeftToRightDirection()) {
if (queryData->isVerticalText)
extent.move(0, -glyphSize.height());
else
extent.move(-glyphSize.width(), 0);
}
AffineTransform fragmentTransform;
fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
extent = fragmentTransform.mapRect(extent);
}
示例3: getReplacementTextGeometry
bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, FontCascade& font, TextRun& run, float& textWidth) const
{
bool includesArrow = shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason);
contentRect = contentBoxRect();
contentRect.moveBy(roundedIntPoint(accumulatedOffset));
FontCascadeDescription fontDescription;
RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
fontDescription.setWeight(FontWeightBold);
fontDescription.setRenderingMode(frame().settings().fontRenderingMode());
fontDescription.setComputedSize(12);
font = FontCascade(fontDescription, 0, 0);
font.update(0);
run = TextRun(m_unavailablePluginReplacementText);
textWidth = font.width(run);
replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftTextMargin + (includesArrow ? replacementTextRoundedRectRightTextMarginWithArrow : replacementTextRoundedRectRightTextMargin), replacementTextRoundedRectHeight));
float x = (contentRect.size().width() / 2 - replacementTextRect.size().width() / 2) + contentRect.location().x();
float y = (contentRect.size().height() / 2 - replacementTextRect.size().height() / 2) + contentRect.location().y();
replacementTextRect.setLocation(FloatPoint(x, y));
indicatorRect = replacementTextRect;
// Expand the background rect to include the arrow, if it will be used.
if (includesArrow) {
arrowRect = indicatorRect;
arrowRect.setX(ceilf(arrowRect.maxX() + replacementArrowLeftMargin));
arrowRect.setWidth(arrowRect.height());
indicatorRect.unite(arrowRect);
}
return true;
}
示例4: getReplacementTextGeometry
bool RenderEmbeddedObject::getReplacementTextGeometry(int tx, int ty, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth)
{
contentRect = contentBoxRect();
contentRect.move(tx, ty);
FontDescription fontDescription;
RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
fontDescription.setWeight(FontWeightBold);
Settings* settings = document()->settings();
ASSERT(settings);
if (!settings)
return false;
fontDescription.setRenderingMode(settings->fontRenderingMode());
fontDescription.setComputedSize(fontDescription.specifiedSize());
font = Font(fontDescription, 0, 0);
font.update(0);
run = TextRun(m_replacementText.characters(), m_replacementText.length());
run.disableRoundingHacks();
textWidth = font.floatWidth(run);
replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
float x = (contentRect.size().width() / 2 - replacementTextRect.size().width() / 2) + contentRect.location().x();
float y = (contentRect.size().height() / 2 - replacementTextRect.size().height() / 2) + contentRect.location().y();
replacementTextRect.setLocation(FloatPoint(x, y));
path.addRoundedRect(replacementTextRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
return true;
}
示例5: calculateGlyphBoundaries
static inline void calculateGlyphBoundaries(SVGTextQuery::Data* queryData, const SVGTextFragment& fragment, int startPosition, FloatRect& extent)
{
float scalingFactor = queryData->textRenderer->scalingFactor();
ASSERT(scalingFactor);
extent.setLocation(FloatPoint(fragment.x, fragment.y - queryData->textRenderer->scaledFont().fontMetrics().floatAscent() / scalingFactor));
if (startPosition) {
SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(queryData->textRenderer, fragment.characterOffset, startPosition);
if (queryData->isVerticalText)
extent.move(0, metrics.height());
else
extent.move(metrics.width(), 0);
}
SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(queryData->textRenderer, fragment.characterOffset + startPosition, 1);
extent.setSize(FloatSize(metrics.width(), metrics.height()));
AffineTransform fragmentTransform;
fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
if (fragmentTransform.isIdentity())
return;
extent = fragmentTransform.mapRect(extent);
}
示例6: drawNativeImage
void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize&, CompositeOperator op, BlendMode mode, const ImageOrientation& orientation)
{
context.save();
// Set the compositing operation.
if (op == CompositeSourceOver && mode == BlendModeNormal && !nativeImageHasAlpha(image))
context.setCompositeOperation(CompositeCopy);
else
context.setCompositeOperation(op, mode);
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
IntSize scaledSize = nativeImageSize(image);
FloatRect adjustedSrcRect = adjustSourceRectForDownSampling(srcRect, scaledSize);
#else
FloatRect adjustedSrcRect(srcRect);
#endif
FloatRect adjustedDestRect = destRect;
if (orientation != DefaultImageOrientation) {
// ImageOrientation expects the origin to be at (0, 0).
context.translate(destRect.x(), destRect.y());
adjustedDestRect.setLocation(FloatPoint());
context.concatCTM(orientation.transformFromDefault(adjustedDestRect.size()));
if (orientation.usesWidthAsHeight()) {
// The destination rectangle will have it's width and height already reversed for the orientation of
// the image, as it was needed for page layout, so we need to reverse it back here.
adjustedDestRect.setSize(adjustedDestRect.size().transposedSize());
}
}
context.platformContext()->drawSurfaceToContext(image.get(), adjustedDestRect, adjustedSrcRect, context);
context.restore();
}
示例7: getReplacementTextGeometry
bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const
{
contentRect = contentBoxRect();
contentRect.moveBy(roundedIntPoint(accumulatedOffset));
FontDescription fontDescription;
RenderTheme::theme().systemFont(CSSValueWebkitSmallControl, fontDescription);
fontDescription.setWeight(FontWeightBold);
Settings* settings = document().settings();
ASSERT(settings);
if (!settings)
return false;
fontDescription.setComputedSize(fontDescription.specifiedSize());
font = Font(fontDescription, 0, 0);
font.update(0);
run = TextRun(m_unavailablePluginReplacementText);
textWidth = font.width(run);
replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
float x = (contentRect.size().width() / 2 - replacementTextRect.size().width() / 2) + contentRect.location().x();
float y = (contentRect.size().height() / 2 - replacementTextRect.size().height() / 2) + contentRect.location().y();
replacementTextRect.setLocation(FloatPoint(x, y));
path.addRoundedRect(replacementTextRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
return true;
}
示例8: beginFilterEffect
GraphicsContext* FilterEffectRendererHelper::beginFilterEffect(RenderLayer* renderLayer, GraphicsContext* oldContext, const LayoutRect& filterRect)
{
ASSERT(m_haveFilterEffect && renderLayer->filter());
m_savedGraphicsContext = oldContext;
m_renderLayer = renderLayer;
m_paintOffset = filterRect.location();
FloatRect filterSourceRect = filterRect;
filterSourceRect.setLocation(LayoutPoint());
FilterEffectRenderer* filter = renderLayer->filter();
filter->updateBackingStore(filterSourceRect);
filter->prepare();
// Paint into the context that represents the SourceGraphic of the filter.
GraphicsContext* sourceGraphicsContext = filter->inputContext();
if (!sourceGraphicsContext) {
// Could not allocate a new graphics context. Disable the filters and continue.
m_haveFilterEffect = false;
return m_savedGraphicsContext;
}
sourceGraphicsContext->save();
sourceGraphicsContext->translate(-filterRect.x(), -filterRect.y());
sourceGraphicsContext->clearRect(filterRect);
return sourceGraphicsContext;
}
示例9: paintMeter
bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
// Some platforms do not have a native gauge widget, so we draw here a default implementation.
RenderMeter* renderMeter = toRenderMeter(renderObject);
RenderStyle* style = renderObject->style();
int left = style->borderLeft().width() + style->paddingLeft().value();
int top = style->borderTop().width() + style->paddingTop().value();
int right = style->borderRight().width() + style->paddingRight().value();
int bottom = style->borderBottom().width() + style->paddingBottom().value();
FloatRect innerRect(rect.x() + left, rect.y() + top, rect.width() - left - right, rect.height() - top - bottom);
HTMLMeterElement* element = static_cast<HTMLMeterElement*>(renderMeter->node());
double min = element->min();
double max = element->max();
double value = element->value();
if (min >= max) {
paintInfo.context->fillRect(innerRect, Color::black, style->colorSpace());
return false;
}
// Paint the background first
paintInfo.context->fillRect(innerRect, Color::lightGray, style->colorSpace());
FloatRect valueRect;
if (rect.width() < rect.height()) {
// Vertical gauge
double scale = innerRect.height() / (max - min);
valueRect.setLocation(FloatPoint(innerRect.x(), innerRect.y() + narrowPrecisionToFloat((max - value) * scale)));
valueRect.setSize(FloatSize(innerRect.width(), narrowPrecisionToFloat((value - min) * scale)));
} else if (renderMeter->style()->direction() == RTL) {
// right to left horizontal gauge
double scale = innerRect.width() / (max - min);
valueRect.setLocation(FloatPoint(innerRect.x() + narrowPrecisionToFloat((max - value) * scale), innerRect.y()));
valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min) * scale), innerRect.height()));
} else {
// left to right horizontal gauge
double scale = innerRect.width() / (max - min);
valueRect.setLocation(innerRect.location());
valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min)) * scale, innerRect.height()));
}
if (!valueRect.isEmpty())
paintInfo.context->fillRect(valueRect, Color::black, style->colorSpace());
return false;
}
示例10: draw
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrientationEnum shouldRespectImageOrientation)
{
TRACE_EVENT0("skia", "BitmapImage::draw");
SkBitmap bitmap;
if (!bitmapForCurrentFrame(&bitmap))
return; // It's too early and we don't have an image yet.
FloatRect normDstRect = adjustForNegativeSize(dstRect);
FloatRect normSrcRect = adjustForNegativeSize(srcRect);
normSrcRect.intersect(FloatRect(0, 0, bitmap.width(), bitmap.height()));
if (normSrcRect.isEmpty() || normDstRect.isEmpty())
return; // Nothing to draw.
ImageOrientation orientation = DefaultImageOrientation;
if (shouldRespectImageOrientation == RespectImageOrientation)
orientation = frameOrientationAtIndex(m_currentFrame);
GraphicsContextStateSaver saveContext(*ctxt, false);
if (orientation != DefaultImageOrientation) {
saveContext.save();
// ImageOrientation expects the origin to be at (0, 0)
ctxt->translate(normDstRect.x(), normDstRect.y());
normDstRect.setLocation(FloatPoint());
ctxt->concatCTM(orientation.transformFromDefault(normDstRect.size()));
if (orientation.usesWidthAsHeight()) {
// The destination rect will have it's width and height already reversed for the orientation of
// the image, as it was needed for page layout, so we need to reverse it back here.
normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRect.height(), normDstRect.width());
}
}
bool isLazyDecoded = DeferredImageDecoder::isLazyDecoded(bitmap);
bool isOpaque = bitmap.isOpaque();
{
SkPaint paint;
SkRect skSrcRect = normSrcRect;
int initialSaveCount = ctxt->preparePaintForDrawRectToRect(&paint, skSrcRect, normDstRect, compositeOp, !isOpaque, isLazyDecoded, bitmap.isImmutable());
// We want to filter it if we decided to do interpolation above, or if
// there is something interesting going on with the matrix (like a rotation).
// Note: for serialization, we will want to subset the bitmap first so we
// don't send extra pixels.
ctxt->drawBitmapRect(bitmap, &skSrcRect, normDstRect, &paint);
ctxt->canvas()->restoreToCount(initialSaveCount);
}
if (isLazyDecoded)
PlatformInstrumentation::didDrawLazyPixelRef(bitmap.getGenerationID());
if (ImageObserver* observer = imageObserver())
observer->didDraw(this);
startAnimation();
}
示例11: draw
void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op,
BlendMode, RespectImageOrientationEnum shouldRespectImageOrientation)
{
if (!dst.width() || !dst.height() || !src.width() || !src.height())
return;
startAnimation();
NativeImageCairo* nativeImage = frameAtIndex(m_currentFrame);
if (!nativeImage) // If it's too early we won't have an image yet.
return;
if (mayFillWithSolidColor()) {
fillWithSolidColor(context, dst, solidColor(), styleColorSpace, op);
return;
}
context->save();
// Set the compositing operation.
if (op == CompositeSourceOver && !frameHasAlphaAtIndex(m_currentFrame))
context->setCompositeOperation(CompositeCopy);
else
context->setCompositeOperation(op);
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
cairo_surface_t* surface = nativeImage->surface();
IntSize scaledSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface));
FloatRect adjustedSrcRect = adjustSourceRectForDownSampling(src, scaledSize);
#else
FloatRect adjustedSrcRect(src);
#endif
ImageOrientation orientation = DefaultImageOrientation;
if (shouldRespectImageOrientation == RespectImageOrientation)
orientation = frameOrientationAtIndex(m_currentFrame);
FloatRect dstRect = dst;
if (orientation != DefaultImageOrientation) {
// ImageOrientation expects the origin to be at (0, 0).
context->translate(dstRect.x(), dstRect.y());
dstRect.setLocation(FloatPoint());
context->concatCTM(orientation.transformFromDefault(dstRect.size()));
if (orientation.usesWidthAsHeight()) {
// The destination rectangle will have it's width and height already reversed for the orientation of
// the image, as it was needed for page layout, so we need to reverse it back here.
dstRect = FloatRect(dstRect.x(), dstRect.y(), dstRect.height(), dstRect.width());
}
}
context->platformContext()->drawSurfaceToContext(nativeImage->surface(), dstRect, adjustedSrcRect, context);
context->restore();
if (imageObserver())
imageObserver()->didDraw(this);
}
示例12: draw
void BitmapImage::draw(GraphicsContext& context, const FloatRect& dst, const FloatRect& src, CompositeOperator op,
BlendMode blendMode, ImageOrientationDescription description)
{
if (!dst.width() || !dst.height() || !src.width() || !src.height())
return;
startAnimation();
auto surface = frameImageAtIndex(m_currentFrame);
if (!surface) // If it's too early we won't have an image yet.
return;
Color color = singlePixelSolidColor();
if (color.isValid()) {
fillWithSolidColor(context, dst, color, op);
return;
}
context.save();
// Set the compositing operation.
if (op == CompositeSourceOver && blendMode == BlendModeNormal && !frameHasAlphaAtIndex(m_currentFrame))
context.setCompositeOperation(CompositeCopy);
else
context.setCompositeOperation(op, blendMode);
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
IntSize scaledSize = cairoSurfaceSize(surface.get());
FloatRect adjustedSrcRect = adjustSourceRectForDownSampling(src, scaledSize);
#else
FloatRect adjustedSrcRect(src);
#endif
ImageOrientation frameOrientation(description.imageOrientation());
if (description.respectImageOrientation() == RespectImageOrientation)
frameOrientation = frameOrientationAtIndex(m_currentFrame);
FloatRect dstRect = dst;
if (frameOrientation != DefaultImageOrientation) {
// ImageOrientation expects the origin to be at (0, 0).
context.translate(dstRect.x(), dstRect.y());
dstRect.setLocation(FloatPoint());
context.concatCTM(frameOrientation.transformFromDefault(dstRect.size()));
if (frameOrientation.usesWidthAsHeight()) {
// The destination rectangle will have it's width and height already reversed for the orientation of
// the image, as it was needed for page layout, so we need to reverse it back here.
dstRect = FloatRect(dstRect.x(), dstRect.y(), dstRect.height(), dstRect.width());
}
}
context.platformContext()->drawSurfaceToContext(surface.get(), dstRect, adjustedSrcRect, context);
context.restore();
if (imageObserver())
imageObserver()->didDraw(this);
}
示例13: viewport
FloatRect SVGSVGElement::viewport() const
{
FloatRect viewRectangle;
if (!isOutermostSVG())
viewRectangle.setLocation(FloatPoint(x().value(this), y().value(this)));
viewRectangle.setSize(FloatSize(width().value(this), height().value(this)));
return viewBoxToViewTransform(viewRectangle.width(), viewRectangle.height()).mapRect(viewRectangle);
}
示例14: viewport
FloatRect SVGSVGElement::viewport() const
{
// FIXME: This method doesn't follow the spec and is basically untested. Parent documents are not considered here.
SVGLengthContext lengthContext(this);
FloatRect viewRectangle;
if (!isOutermostSVG())
viewRectangle.setLocation(FloatPoint(x().value(lengthContext), y().value(lengthContext)));
viewRectangle.setSize(FloatSize(width().value(lengthContext), height().value(lengthContext)));
return viewBoxToViewTransform(viewRectangle.width(), viewRectangle.height()).mapRect(viewRectangle);
}
示例15: paintReplaced
void RenderEmbeddedObject::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
{
if (!m_replacementText)
return;
if (paintInfo.phase == PaintPhaseSelection)
return;
GraphicsContext* context = paintInfo.context;
if (context->paintingDisabled())
return;
FloatRect pluginRect = contentBoxRect();
pluginRect.move(tx, ty);
FontDescription fontDescription;
RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
fontDescription.setWeight(FontWeightBold);
Settings* settings = document()->settings();
ASSERT(settings);
if (!settings)
return;
fontDescription.setRenderingMode(settings->fontRenderingMode());
fontDescription.setComputedSize(fontDescription.specifiedSize());
Font font(fontDescription, 0, 0);
font.update(0);
TextRun run(m_replacementText.characters(), m_replacementText.length());
run.disableRoundingHacks();
float textWidth = font.floatWidth(run);
FloatRect replacementTextRect;
replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
replacementTextRect.setLocation(FloatPoint((pluginRect.size().width() / 2 - replacementTextRect.size().width() / 2) + pluginRect.location().x(),
(pluginRect.size().height() / 2 - replacementTextRect.size().height() / 2) + pluginRect.location().y()));
Path path = Path::createRoundedRectangle(replacementTextRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
context->save();
context->clip(pluginRect);
context->beginPath();
context->addPath(path);
context->setAlpha(replacementTextRoundedRectOpacity);
context->setFillColor(Color::white, style()->colorSpace());
context->fillPath();
FloatPoint labelPoint(roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2),
roundf(replacementTextRect.location().y()+ (replacementTextRect.size().height() - font.height()) / 2 + font.ascent()));
context->setAlpha(replacementTextTextOpacity);
context->setFillColor(Color::black, style()->colorSpace());
context->drawBidiText(font, run, labelPoint);
context->restore();
}