コード例 #1
0
ファイル: RenderThemeGtk.cpp プロジェクト: Wrichik1999/webkit
bool RenderThemeGtk::paintMediaSliderTrack(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& r)
{
    HTMLMediaElement* mediaElement = parentMediaElement(o);
    if (!mediaElement)
        return false;

    GraphicsContext* context = paintInfo.context;
    context->save();
    context->setStrokeStyle(NoStroke);

    float mediaDuration = mediaElement->duration();
    float totalTrackWidth = r.width();
    RenderStyle* style = &o.style();
    RefPtr<TimeRanges> timeRanges = mediaElement->buffered();
    for (unsigned index = 0; index < timeRanges->length(); ++index) {
        float start = timeRanges->start(index, IGNORE_EXCEPTION);
        float end = timeRanges->end(index, IGNORE_EXCEPTION);
        float startRatio = start / mediaDuration;
        float lengthRatio = (end - start) / mediaDuration;
        if (!lengthRatio)
            continue;

        IntRect rangeRect(r);
        rangeRect.setWidth(lengthRatio * totalTrackWidth);
        if (index)
            rangeRect.move(startRatio * totalTrackWidth, 0);
        context->fillRoundedRect(FloatRoundedRect(rangeRect, borderRadiiFromStyle(style)), style->visitedDependentColor(CSSPropertyColor), style->colorSpace());
    }

    context->restore();
    return false;
}
コード例 #2
0
ファイル: OERRW.hpp プロジェクト: vbeffara/mtools
 /* print some info about the walk */
 std::string toString() const
     {
     std::string s = "Once Edge Reinforced Random Walk ERRW\n";
     s += "  -> reinf. param. delta    = " + mtools::toString(reinfParam()) + "\n";
     s += "  -> nb of visited sites    = " + mtools::toString(nbVisited()) + "\n";
     s += "  -> current position       = (" + mtools::toString(pos.X()) + "," + mtools::toString(pos.Y()) + ")\n";
     s += "  -> range of the trace     = " + mtools::toString(rangeRect()) + "\n\n";
     return s;
     }