本文整理汇总了C++中LayoutRect::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutRect::isEmpty方法的具体用法?C++ LayoutRect::isEmpty怎么用?C++ LayoutRect::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutRect
的用法示例。
在下文中一共展示了LayoutRect::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintReplaced
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = videoElement().player();
bool displayingPoster = videoElement().shouldDisplayPosterImage();
Page* page = frame().page();
if (!displayingPoster && !mediaPlayer) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
LayoutRect rect = videoBox();
if (rect.isEmpty()) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
rect.moveBy(paintOffset);
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantRepaintedObject(this, rect);
LayoutRect contentRect = contentBoxRect();
contentRect.moveBy(paintOffset);
GraphicsContext& context = paintInfo.context();
bool clip = !contentRect.contains(rect);
GraphicsContextStateSaver stateSaver(context, clip);
if (clip)
context.clip(contentRect);
if (displayingPoster)
paintIntoRect(context, rect);
else if (!videoElement().isFullscreen() || !mediaPlayer->supportsAcceleratedRendering()) {
if (view().frameView().paintBehavior() & PaintBehaviorFlattenCompositingLayers)
mediaPlayer->paintCurrentFrameInContext(context, rect);
else
mediaPlayer->paint(context, rect);
}
}
示例2: paint
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Vector<RenderBox*>& layers)
{
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorationBackground())
paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, adjustedPaintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (selectionState() != SelectionNone) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
}
}
示例3: boundingBoxForQuads
LayoutRect AccessibilityObject::boundingBoxForQuads(RenderObject* obj, const Vector<FloatQuad>& quads)
{
ASSERT(obj);
if (!obj)
return LayoutRect();
size_t count = quads.size();
if (!count)
return LayoutRect();
LayoutRect result;
for (size_t i = 0; i < count; ++i) {
LayoutRect r = quads[i].enclosingBoundingBox();
if (!r.isEmpty()) {
if (obj->style()->hasAppearance())
obj->theme()->adjustRepaintRect(obj, r);
result.unite(r);
}
}
return result;
}
示例4: paintSelection
void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ASSERT(paintInfo.phase == PaintPhaseForeground);
if (!m_layoutBlockFlow.shouldPaintSelectionGaps())
return;
LayoutUnit lastTop = 0;
LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layoutBlockFlow, lastTop);
LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layoutBlockFlow, lastTop);
LayoutRect bounds = m_layoutBlockFlow.visualOverflowRect();
bounds.moveBy(paintOffset);
// Only create a DrawingRecorder and ClipScope if skipRecording is false. This logic is needed
// because selectionGaps(...) needs to be called even when we do not record.
bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, paintOffset);
Optional<LayoutObjectDrawingRecorder> drawingRecorder;
Optional<ClipScope> clipScope;
if (!skipRecording) {
drawingRecorder.emplace(paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, FloatRect(bounds), paintOffset);
clipScope.emplace(paintInfo.context);
}
LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight,
skipRecording ? nullptr : &paintInfo,
skipRecording ? nullptr : &(*clipScope));
// TODO(wkorman): Rework below to process paint invalidation rects during layout rather than paint.
if (!gapRectsBounds.isEmpty()) {
PaintLayer* layer = m_layoutBlockFlow.enclosingLayer();
gapRectsBounds.moveBy(-paintOffset);
if (!m_layoutBlockFlow.hasLayer()) {
LayoutRect localBounds(gapRectsBounds);
m_layoutBlockFlow.flipForWritingMode(localBounds);
gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox());
if (layer->layoutObject()->hasOverflowClip())
gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset());
}
layer->addBlockSelectionGapsBounds(gapRectsBounds);
}
}
示例5: prepareFilterEffect
bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer* renderLayer, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
{
ASSERT(m_haveFilterEffect && renderLayer->filterRenderer());
m_renderLayer = renderLayer;
m_repaintRect = dirtyRect;
FilterEffectRenderer* filter = renderLayer->filterRenderer();
LayoutRect filterSourceRect = filter->computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
if (filterSourceRect.isEmpty()) {
// The dirty rect is not in view, just bail out.
m_haveFilterEffect = false;
return false;
}
// Get the zoom factor to scale the filterSourceRect input
const RenderLayerModelObject* renderer = renderLayer->renderer();
const RenderStyle* style = renderer ? renderer->style() : 0;
float zoom = style ? style->effectiveZoom() : 1.0f;
AffineTransform absoluteTransform;
absoluteTransform.translate(filterBoxRect.x(), filterBoxRect.y());
filter->setAbsoluteTransform(absoluteTransform);
filter->setAbsoluteFilterRegion(AffineTransform().scale(zoom).mapRect(filterSourceRect));
filter->setFilterRegion(absoluteTransform.inverse().mapRect(filterSourceRect));
filter->lastEffect()->determineFilterPrimitiveSubregion();
bool hasUpdatedBackingStore = filter->updateBackingStoreRect(filterSourceRect);
if (filter->hasFilterThatMovesPixels()) {
if (hasUpdatedBackingStore)
m_repaintRect = filterSourceRect;
else {
m_repaintRect.unite(layerRepaintRect);
m_repaintRect.intersect(filterSourceRect);
}
}
return true;
}
示例6: paintReplaced
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = mediaElement()->player();
bool displayingPoster = videoElement()->shouldDisplayPosterImage();
if (!displayingPoster) {
if (!mediaPlayer)
return;
updatePlayer();
}
LayoutRect rect = videoBox();
if (rect.isEmpty())
return;
rect.moveBy(paintOffset);
if (displayingPoster)
paintIntoRect(paintInfo.context, rect);
else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
mediaPlayer->paintCurrentFrameInContext(paintInfo.context, rect);
else
mediaPlayer->paint(paintInfo.context, rect);
}
示例7: paintCaret
void CaretBase::paintCaret(Node* node, GraphicsContext* context, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const
{
if (m_caretVisibility == Hidden)
return;
LayoutRect drawingRect = localCaretRectWithoutUpdate();
drawingRect.moveBy(roundedIntPoint(paintOffset));
LayoutRect caret = intersection(drawingRect, clipRect);
if (caret.isEmpty())
return;
Color caretColor = Color::black;
Element* element;
if (node->isElementNode())
element = toElement(node);
else
element = node->parentElement();
if (element && element->renderer())
caretColor = element->renderer()->resolveColor(CSSPropertyColor);
context->fillRect(caret, caretColor);
}
示例8: paintReplaced
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = mediaElement()->player();
bool displayingPoster = videoElement()->shouldDisplayPosterImage();
Page* page = 0;
if (Frame* frame = this->frame())
page = frame->page();
if (!displayingPoster) {
if (!mediaPlayer) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
updatePlayer();
}
LayoutRect rect = videoBox();
if (rect.isEmpty()) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
rect.moveBy(paintOffset);
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantRepaintedObject(this, rect);
if (displayingPoster)
paintIntoRect(paintInfo.context, rect);
else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
mediaPlayer->paintCurrentFrameInContext(paintInfo.context, pixelSnappedIntRect(rect));
else
mediaPlayer->paint(paintInfo.context, pixelSnappedIntRect(rect));
}
示例9: isReplacementObscured
bool RenderEmbeddedObject::isReplacementObscured() const
{
// Return whether or not the replacement content for blocked plugins is accessible to the user.
// Check the opacity of each layer containing the element or its ancestors.
float opacity = 1.0;
for (RenderLayer* layer = enclosingLayer(); layer; layer = layer->parent()) {
opacity *= layer->renderer().style().opacity();
if (opacity < 0.1)
return true;
}
// Calculate the absolute rect for the blocked plugin replacement text.
IntRect absoluteBoundingBox = absoluteBoundingBoxRect();
LayoutPoint absoluteLocation(absoluteBoundingBox.location());
LayoutRect rect = unavailablePluginIndicatorBounds(absoluteLocation);
if (rect.isEmpty())
return true;
RenderView* rootRenderView = document().topDocument().renderView();
ASSERT(rootRenderView);
if (!rootRenderView)
return true;
IntRect rootViewRect = view().frameView().convertToRootView(snappedIntRect(rect));
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::AllowChildFrameContent);
HitTestResult result;
HitTestLocation location;
LayoutUnit x = rootViewRect.x();
LayoutUnit y = rootViewRect.y();
LayoutUnit width = rootViewRect.width();
LayoutUnit height = rootViewRect.height();
// Hit test the center and near the corners of the replacement text to ensure
// it is visible and is not masked by other elements.
bool hit = false;
location = LayoutPoint(x + width / 2, y + height / 2);
hit = rootRenderView->hitTest(request, location, result);
if (!hit || result.innerNode() != &frameOwnerElement())
return true;
location = LayoutPoint(x, y);
hit = rootRenderView->hitTest(request, location, result);
if (!hit || result.innerNode() != &frameOwnerElement())
return true;
location = LayoutPoint(x + width, y);
hit = rootRenderView->hitTest(request, location, result);
if (!hit || result.innerNode() != &frameOwnerElement())
return true;
location = LayoutPoint(x + width, y + height);
hit = rootRenderView->hitTest(request, location, result);
if (!hit || result.innerNode() != &frameOwnerElement())
return true;
location = LayoutPoint(x, y + height);
hit = rootRenderView->hitTest(request, location, result);
if (!hit || result.innerNode() != &frameOwnerElement())
return true;
return false;
}
示例10: intersects
bool LayoutRect::intersects(const LayoutRect& other) const {
// Checking emptiness handles negative widths as well as zero.
return !isEmpty() && !other.isEmpty() && x() < other.maxX() &&
other.x() < maxX() && y() < other.maxY() && other.y() < maxY();
}
示例11: addFocusRingRects
// addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call
void RenderSVGContainer::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*) const
{
LayoutRect paintRectInParent = LayoutRect(localToParentTransform().mapRect(paintInvalidationRectInLocalCoordinates()));
if (!paintRectInParent.isEmpty())
rects.append(paintRectInParent);
}
示例12: paint
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, adjustedPaintOffset);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo, paintRect);
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && !canHaveChildren())
return;
if (!paintInfo.shouldPaintWithinRoot(this))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, adjustedPaintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (drawSelectionTint) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
}
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:64,代码来源:RenderReplaced.cpp
示例13: addFocusRingRects
// This method is called from inside paintOutline() since we call paintOutline()
// while transformed to our coord system, return local coords
void RenderSVGShape::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
{
LayoutRect rect = LayoutRect(repaintRectInLocalCoordinates());
if (!rect.isEmpty())
rects.append(rect);
}
示例14: paintOutlineForLine
void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset,
const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& nextline, const Color outlineColor)
{
RenderStyle* styleToUse = m_renderInline.style();
int outlineWidth = styleToUse->outlineWidth();
EBorderStyle outlineStyle = styleToUse->outlineStyle();
bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext);
int offset = m_renderInline.style()->outlineOffset();
LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset),
LayoutSize(thisline.width() + offset, thisline.height() + offset));
IntRect pixelSnappedBox = pixelSnappedIntRect(box);
if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0)
return;
IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastline.x(), 0, lastline.width(), 0);
IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextline.x(), 0, nextline.width(), 0);
// left edge
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
pixelSnappedBox.x(),
pixelSnappedBox.maxY() + (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
BSLeft,
outlineColor, outlineStyle,
(lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
(nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
antialias);
// right edge
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.maxX(),
pixelSnappedBox.y() - (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0),
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.maxY() + (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0),
BSRight,
outlineColor, outlineStyle,
(lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth),
(nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth),
antialias);
// upper edge
if (thisline.x() < lastline.x()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - outlineWidth,
std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? 1000000 : pixelSnappedLastLine.x())),
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
outlineWidth,
(!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
antialias);
}
if (lastline.maxX() < thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
std::max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX(), pixelSnappedBox.x() - outlineWidth),
pixelSnappedBox.y() - outlineWidth,
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
(!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOffset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth,
outlineWidth, antialias);
}
if (thisline.x() == thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - outlineWidth,
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
outlineWidth,
outlineWidth,
antialias);
}
// lower edge
if (thisline.x() < nextline.x()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.maxY(),
std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pixelSnappedNextLine.x() + 1 : 1000000),
pixelSnappedBox.maxY() + outlineWidth,
BSBottom, outlineColor, outlineStyle,
outlineWidth,
(!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
antialias);
}
if (nextline.maxX() < thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -1000000, pixelSnappedBox.x() - outlineWidth),
pixelSnappedBox.maxY(),
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.maxY() + outlineWidth,
BSBottom, outlineColor, outlineStyle,
(!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOffset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth,
//.........这里部分代码省略.........
示例15: paintOutlineForLine
void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset,
const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& nextline, const Color outlineColor)
{
const ComputedStyle& styleToUse = m_layoutInline.styleRef();
int outlineWidth = styleToUse.outlineWidth();
EBorderStyle outlineStyle = styleToUse.outlineStyle();
bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext);
int offset = m_layoutInline.style()->outlineOffset();
LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset),
LayoutSize(thisline.width() + offset, thisline.height() + offset));
IntRect pixelSnappedBox = pixelSnappedIntRect(box);
if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0)
return;
// Note that we use IntRect below for working with solely x/width values, simplifying logic at cost of a bit of memory.
IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastline.x() - offset, 0, lastline.width() + offset, 0);
IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextline.x() - offset, 0, nextline.width() + offset, 0);
const int fallbackMaxOutlineX = std::numeric_limits<int>::max();
const int fallbackMinOutlineX = std::numeric_limits<int>::min();
// left edge
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
pixelSnappedBox.x(),
pixelSnappedBox.maxY() + (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
BSLeft,
outlineColor, outlineStyle,
(lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
(nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
antialias);
// right edge
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.maxX(),
pixelSnappedBox.y() - (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0),
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.maxY() + (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0),
BSRight,
outlineColor, outlineStyle,
(lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth),
(nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth),
antialias);
// upper edge
if (thisline.x() < lastline.x()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - outlineWidth,
std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? fallbackMaxOutlineX : pixelSnappedLastLine.x())),
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
outlineWidth,
(!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
antialias);
}
if (lastline.maxX() < thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
std::max(lastline.isEmpty() ? fallbackMinOutlineX : pixelSnappedLastLine.maxX(), pixelSnappedBox.x() - outlineWidth),
pixelSnappedBox.y() - outlineWidth,
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
(!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOffset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth,
outlineWidth, antialias);
}
if (thisline.x() == thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.y() - outlineWidth,
pixelSnappedBox.maxX() + outlineWidth,
pixelSnappedBox.y(),
BSTop, outlineColor, outlineStyle,
outlineWidth,
outlineWidth,
antialias);
}
// lower edge
if (thisline.x() < nextline.x()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
pixelSnappedBox.x() - outlineWidth,
pixelSnappedBox.maxY(),
std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pixelSnappedNextLine.x() + 1 : fallbackMaxOutlineX),
pixelSnappedBox.maxY() + outlineWidth,
BSBottom, outlineColor, outlineStyle,
outlineWidth,
(!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
antialias);
}
if (nextline.maxX() < thisline.maxX()) {
ObjectPainter::drawLineForBoxSide(graphicsContext,
std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : fallbackMinOutlineX, pixelSnappedBox.x() - outlineWidth),
pixelSnappedBox.maxY(),
//.........这里部分代码省略.........