示例#1
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addArcTo(const FloatPoint& point1, const FloatPoint& point2, float radius) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddArcToPoint(point1.x(), point1.y(), point2.x(), point2.y(), radius);
#endif
}
示例#2
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::closeSubpath() 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->CloseSubpath();
#endif
}
示例#3
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addQuadCurveTo(const FloatPoint& control, const FloatPoint& end) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddQuadCurveToPoint(control.x(), control.y(), end.x(), end.y());
#endif
}
示例#4
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addBezierCurveTo(const FloatPoint& control1, const FloatPoint& control2, const FloatPoint& end) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddCurveToPoint(control1.x(), control1.y(), control2.x(), control2.y(), end.x(), end.y());
#endif
}
示例#5
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addEllipse(const FloatRect& rect) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddEllipse(rect.x(), rect.y(), rect.width(), rect.height());
#endif
}
示例#6
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addLineTo(const FloatPoint& point) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddLineToPoint(point.x(), point.y());
#endif
}
示例#7
0
void Path::transform(const AffineTransform& trans)
{
    cairo_t* cr = ensurePlatformPath()->context();
    cairo_matrix_t c_matrix = cairo_matrix_t(trans);
    cairo_matrix_invert(&c_matrix);
    cairo_transform(cr, &c_matrix);
}
示例#8
0
void Path::addArc(const FloatPoint& p, float r, float startAngle, float endAngle, bool anticlockwise)
{
    // http://bugs.webkit.org/show_bug.cgi?id=16449
    // cairo_arc() functions hang or crash when passed inf as radius or start/end angle
    if (!isfinite(r) || !isfinite(startAngle) || !isfinite(endAngle))
        return;

    cairo_t* cr = ensurePlatformPath()->context();
    float sweep = endAngle - startAngle;
    const float twoPI = 2 * piFloat;
    if ((sweep <= -twoPI || sweep >= twoPI)
        && ((anticlockwise && (endAngle < startAngle)) || (!anticlockwise && (startAngle < endAngle)))) {
        if (anticlockwise)
            cairo_arc_negative(cr, p.x(), p.y(), r, startAngle, startAngle - twoPI);
        else
            cairo_arc(cr, p.x(), p.y(), r, startAngle, startAngle + twoPI);
        cairo_new_sub_path(cr);
        cairo_arc(cr, p.x(), p.y(), r, endAngle, endAngle);
    } else {
        if (anticlockwise)
            cairo_arc_negative(cr, p.x(), p.y(), r, startAngle, endAngle);
        else
            cairo_arc(cr, p.x(), p.y(), r, startAngle, endAngle);
    }
}
示例#9
0
void Path::addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& controlPoint3)
{
    cairo_t* cr = ensurePlatformPath()->context();
    cairo_curve_to(cr, controlPoint1.x(), controlPoint1.y(),
                   controlPoint2.x(), controlPoint2.y(),
                   controlPoint3.x(), controlPoint3.y());
}
示例#10
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::addArc(const FloatPoint& point, float radius, float startAngle, float endAngle, bool clockwise) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->AddArc(point.x(), point.y(), radius, startAngle, endAngle, clockwise);
#endif
}
示例#11
0
文件: PathWx.cpp 项目: dog-god/iptv
void Path::transform(const AffineTransform& transform) 
{
#if USE(WXGC)
    if (ensurePlatformPath())
        m_path->Transform(transform);
#endif
}
示例#12
0
void Path::translate(const FloatSize& size)
{
    CGAffineTransform translation = CGAffineTransformMake(1, 0, 0, 1, size.width(), size.height());
    CGMutablePathRef newPath = CGPathCreateMutable();
    // FIXME: This is potentially wasteful to allocate an empty path only to create a transformed copy.
    CGPathAddPath(newPath, &translation, ensurePlatformPath());
    CGPathRelease(m_path);
    m_path = newPath;
}
示例#13
0
Path::Path(const Path& other)
    : m_path(0)
{
    if (other.isNull())
        return;

    cairo_t* cr = ensurePlatformPath()->context();
    OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
    cairo_append_path(cr, pathCopy.get());
}
示例#14
0
文件: PathSkia.cpp 项目: dog-god/iptv
Path& Path::operator=(const Path& other)
{
    if (other.isNull()) {
        if (m_path)
            delete m_path;
        m_path = 0;
    } else
        *ensurePlatformPath() = *other.m_path;
    return *this;
}
示例#15
0
void Path::addEllipse(const FloatRect& rect)
{
    cairo_t* cr = ensurePlatformPath()->context();
    cairo_save(cr);
    float yRadius = .5 * rect.height();
    float xRadius = .5 * rect.width();
    cairo_translate(cr, rect.x() + xRadius, rect.y() + yRadius);
    cairo_scale(cr, xRadius, yRadius);
    cairo_arc(cr, 0., 0., 1., 0., 2 * piDouble);
    cairo_restore(cr);
}
示例#16
0
void Path::platformAddPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
{
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width());
    bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height());

    if (equalWidths && equalHeights) {
        wkCGPathAddRoundedRect(ensurePlatformPath(), 0, rect, topLeftRadius.width(), topLeftRadius.height());
        return;
    }
#endif

    addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
}
示例#17
0
/*
 * inspired by libsvg-cairo
 */
void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point)
{
    cairo_t* cr = ensurePlatformPath()->context();
    double x, y;
    double x1 = controlPoint.x();
    double y1 = controlPoint.y();
    double x2 = point.x();
    double y2 = point.y();
    cairo_get_current_point(cr, &x, &y);
    cairo_curve_to(cr,
                   x  + 2.0 / 3.0 * (x1 - x),  y  + 2.0 / 3.0 * (y1 - y),
                   x2 + 2.0 / 3.0 * (x1 - x2), y2 + 2.0 / 3.0 * (y1 - y2),
                   x2, y2);
}
示例#18
0
void Path::addEllipse(FloatPoint point, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, bool anticlockwise)
{
    cairo_t* cr = ensurePlatformPath()->context();
    cairo_save(cr);
    cairo_translate(cr, point.x(), point.y());
    cairo_rotate(cr, rotation);
    cairo_scale(cr, radiusX, radiusY);

    if (anticlockwise)
        cairo_arc_negative(cr, 0, 0, 1, startAngle, endAngle);
    else
        cairo_arc(cr, 0, 0, 1, startAngle, endAngle);

    cairo_restore(cr);
}
示例#19
0
Path& Path::operator=(const Path& other)
{
    if (&other == this)
        return *this;

    if (other.isNull()) {
        if (m_path) {
            delete m_path;
            m_path = 0;
        }
    } else {
        clear();
        cairo_t* cr = ensurePlatformPath()->context();
        OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
        cairo_append_path(cr, pathCopy.get());
    }

    return *this;
}
示例#20
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlockwise)
{
    ensurePlatformPath(); // Make sure m_path is not null.

    SkScalar cx = WebCoreFloatToSkScalar(p.x());
    SkScalar cy = WebCoreFloatToSkScalar(p.y());
    SkScalar radius = WebCoreFloatToSkScalar(r);
    SkScalar s360 = SkIntToScalar(360);

    SkRect oval;
    oval.set(cx - radius, cy - radius, cx + radius, cy + radius);

    float sweep = ea - sa;
    SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat);
    SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat);
    // Check for a circle.
    if (sweepDegrees >= s360 || sweepDegrees <= -s360) {
        // Move to the start position (0 sweep means we add a single point).
        m_path->arcTo(oval, startDegrees, 0, false);
        // Draw the circle.
        m_path->addOval(oval, anticlockwise ?
            SkPath::kCCW_Direction : SkPath::kCW_Direction);
        // Force a moveTo the end position.
        m_path->arcTo(oval, startDegrees + sweepDegrees, 0, true);
    } else {
        // Counterclockwise arcs should be drawn with negative sweeps, while
        // clockwise arcs should be drawn with positive sweeps. Check to see
        // if the situation is reversed and correct it by adding or subtracting
        // a full circle
        if (anticlockwise && sweepDegrees > 0) {
            sweepDegrees -= s360;
        } else if (!anticlockwise && sweepDegrees < 0) {
            sweepDegrees += s360;
        }

        m_path->arcTo(oval, startDegrees, sweepDegrees, false);
    }
}
示例#21
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::transform(const AffineTransform& xform)
{
    ensurePlatformPath()->transform(xform);
}
示例#22
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addEllipse(const FloatRect& rect)
{
    ensurePlatformPath()->addOval(rect);
}
示例#23
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addRect(const FloatRect& rect)
{
    ensurePlatformPath()->addRect(rect);
}
示例#24
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::closeSubpath()
{
    ensurePlatformPath()->close();
}
示例#25
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
{
    ensurePlatformPath()->arcTo(p1, p2, WebCoreFloatToSkScalar(radius));
}
示例#26
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addBezierCurveTo(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& ep)
{
    ensurePlatformPath()->cubicTo(p1, p2, ep);
}
示例#27
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& ep)
{
    ensurePlatformPath()->quadTo(cp, ep);
}
示例#28
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::addLineTo(const FloatPoint& point)
{
    ensurePlatformPath()->lineTo(point);
}
示例#29
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::moveTo(const FloatPoint& point)
{
    ensurePlatformPath()->moveTo(point);
}
示例#30
0
文件: PathSkia.cpp 项目: dog-god/iptv
void Path::translate(const FloatSize& size)
{
    ensurePlatformPath()->offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(size.height()));
}