void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo, const FloatRect& boundingBox) { const Vector<MarkerPosition>* markerPositions = m_layoutSVGShape.markerPositions(); if (!markerPositions || markerPositions->isEmpty()) return; SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(&m_layoutSVGShape); if (!resources) return; LayoutSVGResourceMarker* markerStart = resources->markerStart(); LayoutSVGResourceMarker* markerMid = resources->markerMid(); LayoutSVGResourceMarker* markerEnd = resources->markerEnd(); if (!markerStart && !markerMid && !markerEnd) return; float strokeWidth = m_layoutSVGShape.strokeWidth(); unsigned size = markerPositions->size(); for (unsigned i = 0; i < size; ++i) { if (LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType((*markerPositions)[i].type, markerStart, markerMid, markerEnd)) { SkPictureBuilder pictureBuilder(boundingBox, nullptr, &paintInfo.context); PaintInfo markerPaintInfo(pictureBuilder.context(), paintInfo); // It's expensive to track the transformed paint cull rect for each // marker so just disable culling. The shape paint call will already // be culled if it is outside the paint info cull rect. markerPaintInfo.m_cullRect.m_rect = LayoutRect::infiniteIntRect(); paintMarker(markerPaintInfo, *marker, (*markerPositions)[i], strokeWidth); pictureBuilder.endRecording()->playback(paintInfo.context.canvas()); } } }
void RefactorOverlay::paint(QPainter *painter, const QRect &clip) { m_maxWidth = 0; for (int i = 0; i < m_markers.size(); ++i) { paintMarker(m_markers.at(i), painter, clip); } if (BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_editor->document()->documentLayout())) documentLayout->setRequiredWidth(m_maxWidth); }
void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget) const { if (control == QStyle::CC_CustomBase) { const QRangeSlider* rSlider = static_cast<const QRangeSlider*>(widget); QRect bbox = rSlider->getBBox(); QPair<int, int> range = rSlider->range(); QPair<int, int> cutoffRange = rSlider->cutoffRange(); paintGroove(*painter, bbox); paintFilling(*painter, bbox, range, cutoffRange); paintTicks(*painter, bbox, cutoffRange, rSlider->tickInterval(), rSlider->isLogarithmic()); paintMarker(*painter, bbox, range, cutoffRange, FIRST); paintMarker(*painter, bbox, range, cutoffRange, SECOND); return; } return realStyle_->drawComplexControl(control, option, painter, widget); }
void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo) { const Vector<MarkerPosition>* markerPositions = m_renderSVGShape.markerPositions(); if (!markerPositions || markerPositions->isEmpty()) return; SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(&m_renderSVGShape); if (!resources) return; RenderSVGResourceMarker* markerStart = resources->markerStart(); RenderSVGResourceMarker* markerMid = resources->markerMid(); RenderSVGResourceMarker* markerEnd = resources->markerEnd(); if (!markerStart && !markerMid && !markerEnd) return; float strokeWidth = m_renderSVGShape.strokeWidth(); unsigned size = markerPositions->size(); for (unsigned i = 0; i < size; ++i) { if (RenderSVGResourceMarker* marker = SVGMarkerData::markerForType((*markerPositions)[i].type, markerStart, markerMid, markerEnd)) paintMarker(paintInfo, *marker, (*markerPositions)[i], strokeWidth); } }