void PathParser::reset_shape(const UnivocalPath& append_path) { fillShape(); _shape_origin = append_path.startPoint(); moveTo(_shape_origin); append(append_path); }
static bool initCursor( AppCtx *appCtx ) { bool result= false; unsigned char *data= 0; int width, height; int allocSize; unsigned int edgeColor= 0xFFE6DF11; unsigned int fillColor= 0x70000000; // Create a default cursor image width= 64; height= 64; allocSize= width*4*height; data= (unsigned char *)calloc( 1, allocSize ); if ( !data ) { printf("Unable to allocate memory for default pointer cursor - cursor disabled\n"); goto exit; } drawLine( data, width, height, 0, 0, 0, 43, edgeColor, 3 ); drawLine( data, width, height, 0, 0, 43, 0, edgeColor, 3 ); drawLine( data, width, height, 1, 43, 16, 28, edgeColor, 3 ); drawLine( data, width, height, 43, 0, 28, 15, edgeColor, 3 ); drawLine( data, width, height, 28, 16, 55, 43, edgeColor, 3 ); drawLine( data, width, height, 17, 28, 44, 55, edgeColor, 3 ); drawLine( data, width, height, 45, 54, 55, 44, edgeColor, 3 ); fillShape( data, width, height, fillColor, 3 ); drawLine( data, width, height, 0, 44, 2, 44, edgeColor, 1); drawLine( data, width, height, 0, 45, 1, 45, edgeColor, 1); if ( !WstCompositorSetDefaultCursor( appCtx->wctx, data, width, height, 0, 0 ) ) { const char *detail= WstCompositorGetLastErrorDetail( appCtx->wctx ); printf("Unable to set default cursor: error: (%s)\n", detail ); goto exit; } appCtx->cursorReady= true; result= true; exit: if ( data ) { free( data ); } return result; }
void RenderSVGShape::fillStrokeMarkers(PaintInfo& childPaintInfo) { auto paintOrder = style().svgStyle().paintTypesForPaintOrder(); for (unsigned i = 0; i < paintOrder.size(); ++i) { switch (paintOrder.at(i)) { case PaintTypeFill: fillShape(style(), childPaintInfo.context()); break; case PaintTypeStroke: strokeShape(childPaintInfo.context()); break; case PaintTypeMarkers: if (!m_markerPositions.isEmpty()) drawMarkers(childPaintInfo); break; } } }
void SVGShapePainter::paint(const PaintInfo& paintInfo) { if (paintInfo.phase != PaintPhaseForeground || m_layoutSVGShape.style()->visibility() == HIDDEN || m_layoutSVGShape.isShapeEmpty()) return; FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalCoordinates(); if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGShape.localTransform(), boundingBox)) return; PaintInfo paintInfoBeforeFiltering(paintInfo); // Shapes cannot have children so do not call updateCullRect. TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layoutSVGShape, m_layoutSVGShape.localTransform()); { SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering); if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_layoutSVGShape, paintContext.paintInfo().phase, LayoutPoint())) { LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().context, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox, LayoutPoint()); const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyle(); bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES; for (int i = 0; i < 3; i++) { switch (svgStyle.paintOrderType(i)) { case PT_FILL: { SkPaint fillPaint; if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToFillMode, fillPaint)) break; fillPaint.setAntiAlias(shouldAntiAlias); fillShape(paintContext.paintInfo().context, fillPaint, fillRuleFromStyle(paintContext.paintInfo(), svgStyle)); break; } case PT_STROKE: if (svgStyle.hasVisibleStroke()) { GraphicsContextStateSaver stateSaver(paintContext.paintInfo().context, false); AffineTransform nonScalingTransform; const AffineTransform* additionalPaintServerTransform = 0; if (m_layoutSVGShape.hasNonScalingStroke()) { nonScalingTransform = m_layoutSVGShape.nonScalingStrokeTransform(); if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver)) return; // Non-scaling stroke needs to reset the transform back to the host transform. additionalPaintServerTransform = &nonScalingTransform; } SkPaint strokePaint; if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToStrokeMode, strokePaint, additionalPaintServerTransform)) break; strokePaint.setAntiAlias(shouldAntiAlias); StrokeData strokeData; SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, m_layoutSVGShape.styleRef(), m_layoutSVGShape, m_layoutSVGShape.dashScaleFactor()); strokeData.setupPaint(&strokePaint); strokeShape(paintContext.paintInfo().context, strokePaint); } break; case PT_MARKERS: paintMarkers(paintContext.paintInfo(), boundingBox); break; default: ASSERT_NOT_REACHED(); break; } } } } if (m_layoutSVGShape.style()->outlineWidth()) { PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; ObjectPainter(m_layoutSVGShape).paintOutline(outlinePaintInfo, LayoutPoint(boundingBox.location())); } }