本文整理汇总了C++中recorder函数的典型用法代码示例。如果您正苦于以下问题:C++ recorder函数的具体用法?C++ recorder怎么用?C++ recorder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recorder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintInfoBeforeFiltering
void SVGImagePainter::paint(const PaintInfo& paintInfo)
{
if (paintInfo.phase != PaintPhaseForeground
|| m_layoutSVGImage.style()->visibility() == HIDDEN
|| !m_layoutSVGImage.imageResource()->hasImage())
return;
FloatRect boundingBox = m_layoutSVGImage.paintInvalidationRectInLocalCoordinates();
if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGImage.localToParentTransform(), boundingBox))
return;
PaintInfo paintInfoBeforeFiltering(paintInfo);
// Images cannot have children so do not call updateCullRect.
TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layoutSVGImage, m_layoutSVGImage.localToParentTransform());
{
SVGPaintContext paintContext(m_layoutSVGImage, paintInfoBeforeFiltering);
if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_layoutSVGImage, paintContext.paintInfo().phase, LayoutPoint())) {
LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().context, m_layoutSVGImage, paintContext.paintInfo().phase, boundingBox, LayoutPoint());
paintForeground(paintContext.paintInfo());
}
}
if (m_layoutSVGImage.style()->outlineWidth()) {
PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly;
ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, LayoutPoint(boundingBox.location()));
}
}
示例2: ASSERT
void RenderSVGImage::layout()
{
ASSERT(needsLayout());
LayoutRectRecorder recorder(*this);
LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
updateImageViewport();
bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundariesUpdate;
if (m_needsTransformUpdate) {
m_localTransform = toSVGImageElement(element())->animatedLocalTransform();
m_needsTransformUpdate = false;
}
if (m_needsBoundariesUpdate) {
m_repaintBoundingBox = m_objectBoundingBox;
SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox);
m_needsBoundariesUpdate = false;
}
// Invalidate all resources of this client if our layout changed.
if (everHadLayout() && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
// If our bounds changed, notify the parents.
if (transformOrBoundariesUpdate)
RenderSVGModelObject::setNeedsBoundariesUpdate();
repainter.repaintAfterLayout();
clearNeedsLayout();
}
示例3: paintBounds
void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
return;
LayoutTable* table = m_layoutTableCell.table();
if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
return;
bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorder() && !table->collapseBorders();
if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxShadow() && !needsToPaintBorder)
return;
LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent);
LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTableCell, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(paintRect));
if (recorder.canUseCachedDrawing())
return;
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(), Normal);
// Paint our cell background.
paintBackgroundsBehindCell(paintInfo, paintOffset, &m_layoutTableCell);
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(), Inset);
if (!needsToPaintBorder)
return;
BoxPainter::paintBorder(m_layoutTableCell, paintInfo, paintRect, m_layoutTableCell.styleRef());
}
示例4: main
//
// Load images from network stream, run motion detection, write to MP4 files and trap and print notifications
// WARNING - This example can write lots of files, some large, to /tmp (or wherever configured)
//
int main( int argc, const char *argv[] )
{
debugInitialise( "example9", "", 0 );
Info( "Starting" );
avInit();
Application app;
NetworkAVInput input( "input", "rtsp://170.93.143.139:1935/rtplive/0b01b57900060075004d823633235daa" );
app.addThread( &input );
MotionDetector motionDetector( "detector" );
motionDetector.registerProvider( input );
app.addThread( &motionDetector );
VideoParms videoParms( 640, 480 );
AudioParms audioParms;
VideoRecorder recorder( "recorder" , "/transfer", "mp4", videoParms, audioParms );
//MovieFileOutput recorder( "recorder" , "/tmp", "mp4", 300, videoParms, audioParms );
recorder.registerProvider( motionDetector );
app.addThread( &recorder );
NotifyOutput notifier( "notifier" );
notifier.registerProvider( recorder );
app.addThread( ¬ifier );
app.run();
}
示例5: recorder
void ScrollbarThemeNonMacCommon::paintTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect)
{
if (scrollbar->orientation() != VerticalScrollbar)
return;
if (rect.height() <= 0 || rect.width() <= 0)
return;
// Get the tickmarks for the frameview.
Vector<IntRect> tickmarks;
scrollbar->getTickmarks(tickmarks);
if (!tickmarks.size())
return;
if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, DisplayItem::ScrollbarTickmarks))
return;
DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarTickmarks, rect);
GraphicsContextStateSaver stateSaver(*context);
context->setShouldAntialias(false);
for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.end(); ++i) {
// Calculate how far down (in %) the tick-mark should appear.
const float percent = static_cast<float>(i->y()) / scrollbar->totalSize();
// Calculate how far down (in pixels) the tick-mark should appear.
const int yPos = rect.y() + (rect.height() * percent);
FloatRect tickRect(rect.x(), yPos, rect.width(), 3);
context->fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF));
FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1);
context->fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF));
}
}
示例6: DEF_TEST
DEF_TEST(RecordOpts_SaveSaveLayerRestoreRestore, r) {
SkRecord record;
SkRecorder recorder(&record, W, H);
// A previous bug NoOp'd away the first 3 commands.
recorder.save();
recorder.saveLayer(NULL, NULL);
recorder.restore();
recorder.restore();
SkRecordNoopSaveRestores(&record);
switch (record.count()) {
case 4:
assert_type<SkRecords::Save> (r, record, 0);
assert_type<SkRecords::SaveLayer>(r, record, 1);
assert_type<SkRecords::Restore> (r, record, 2);
assert_type<SkRecords::Restore> (r, record, 3);
break;
case 2:
assert_type<SkRecords::SaveLayer>(r, record, 0);
assert_type<SkRecords::Restore> (r, record, 1);
break;
case 0:
break;
default:
REPORTER_ASSERT(r, false);
}
}
示例7: main
int main() {
try {
// An actual myo::Hub; NOT a MyoSim::Hub.
myo::Hub hub("com.voidingwarranties.myo-simulator-example");
myo::Myo* myo = hub.waitForMyo(10000);
if (!myo) {
throw std::runtime_error("Unable to find a Myo!");
}
// Record only pose events.
MyoSim::EventRecorder recorder(MyoSim::EventRecorder::POSE);
hub.addListener(&recorder);
// Record for 5 seconds.
myo->unlock(myo::Myo::unlockHold);
hub.run(5000);
myo->lock();
std::cout << "Events recorded. Press ENTER to replay events.";
getchar();
MyoSim::Hub simulated_hub;
PrintListener print_listener;
simulated_hub.addListener(&print_listener);
MyoSim::EventPlayer player(simulated_hub);
player.play(recorder.getEventSession());
} catch (const std::exception& ex) {
std::cerr << "Error: " << ex.what() << std::endl;
return 1;
}
return 0;
}
示例8: recorder
/*!
Calculate the painter path for a styled or rounded border
When the canvas has no styled background or rounded borders
the painter path is empty.
\param rect Bounding rectangle of the canvas
\return Painter path, that can be used for clipping
*/
QPainterPath QwtPlotCanvas::borderPath( const QRect &rect ) const
{
if ( testAttribute(Qt::WA_StyledBackground ) )
{
QwtStyleSheetRecorder recorder( rect.size() );
QPainter painter( &recorder );
QStyleOption opt;
opt.initFrom(this);
opt.rect = rect;
style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, this);
painter.end();
if ( !recorder.background.path.isEmpty() )
return recorder.background.path;
if ( !recorder.border.rectList.isEmpty() )
return qwtCombinePathList( rect, recorder.border.pathList );
}
else if ( d_data->borderRadius > 0.0 )
{
double fw2 = frameWidth() * 0.5;
QRectF r = QRectF(rect).adjusted( fw2, fw2, -fw2, -fw2 );
QPainterPath path;
path.addRoundedRect( r, d_data->borderRadius, d_data->borderRadius );
return path;
}
return QPainterPath();
}
示例9: ASSERT
void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& cullRect)
{
ASSERT(paintInfo.phase == PaintPhaseForeground);
if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_inlineFlowBox.layoutObject().style()->visibility() != VISIBLE)
return;
// You can use p::first-line to specify a background. If so, the root line boxes for
// a line may actually have to paint a background.
const ComputedStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_inlineFlowBox.isFirstLineStyle());
bool shouldPaintBoxDecorationBackground;
if (m_inlineFlowBox.parent())
shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasBoxDecorationBackground();
else
shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.layoutObject().style();
if (!shouldPaintBoxDecorationBackground)
return;
if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground))
return;
DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(cullRect));
LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded();
// Move x/y to our coordinates.
LayoutRect localRect(frameRect);
m_inlineFlowBox.flipForWritingMode(localRect);
LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.size());
LayoutRect adjustedClipRect;
BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect, adjustedClipRect);
// Shadow comes first and is behind the background and border.
if (!m_inlineFlowBox.deprecatedBoxModelObject()->boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, &m_inlineFlowBox))
paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect);
Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleToUse, CSSPropertyBackgroundColor);
paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(), adjustedFrameRect);
paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect);
switch (borderPaintingType) {
case DontPaintBorders:
break;
case PaintBordersWithoutClip:
BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), paintInfo, adjustedFrameRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowBox.isFirstLineStyle()),
BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge());
break;
case PaintBordersWithClip:
// FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
// but it isn't even clear how this should work at all.
LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOffset, frameRect.size(), LTR);
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->clip(adjustedClipRect);
BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), paintInfo, imageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowBox.isFirstLineStyle()));
break;
}
}
示例10: paintBounds
void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(&m_renderTableCell))
return;
RenderTable* tableElt = m_renderTableCell.table();
if (!tableElt->collapseBorders() && m_renderTableCell.style()->emptyCells() == HIDE && !m_renderTableCell.firstChild())
return;
LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent);
RenderDrawingRecorder recorder(paintInfo.context, m_renderTableCell, paintInfo.phase, pixelSnappedIntRect(paintRect));
if (recorder.canUseCachedDrawing())
return;
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Normal);
// Paint our cell background.
paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableCell);
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Inset);
if (!m_renderTableCell.style()->hasBorder() || tableElt->collapseBorders())
return;
BoxPainter::paintBorder(m_renderTableCell, paintInfo, paintRect, m_renderTableCell.style());
}
示例11: LayoutRect
void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (m_layoutFieldset.style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
return;
LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size());
LayoutBox* legend = m_layoutFieldset.findInFlowLegend();
if (!legend)
return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset);
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutFieldset, paintInfo.phase, paintOffset))
return;
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_layoutFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit() : (legend->size().height() - m_layoutFieldset.borderTop()) / 2;
paintRect.expand(LayoutUnit(), -yOff);
paintRect.move(LayoutUnit(), yOff);
} else {
LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit() : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2;
paintRect.expand(-xOff, LayoutUnit());
paintRect.move(xOff, LayoutUnit());
}
LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, paintInfo.phase, paintRect, paintOffset);
BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect);
}
示例12: recorder
void RenderSVGShape::layout()
{
LayoutRectRecorder recorder(*this);
LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
bool updateCachedBoundariesInParents = false;
if (m_needsShapeUpdate || m_needsBoundariesUpdate) {
updateShapeFromElement();
m_needsShapeUpdate = false;
updateRepaintBoundingBox();
m_needsBoundariesUpdate = false;
updateCachedBoundariesInParents = true;
}
if (m_needsTransformUpdate) {
m_localTransform = toSVGGraphicsElement(element())->animatedLocalTransform();
m_needsTransformUpdate = false;
updateCachedBoundariesInParents = true;
}
// Invalidate all resources of this client if our layout changed.
if (everHadLayout() && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
// If our bounds changed, notify the parents.
if (updateCachedBoundariesInParents)
RenderSVGModelObject::setNeedsBoundariesUpdate();
repainter.repaintAfterLayout();
clearNeedsLayout();
}
示例13: LOGD
int MultiPlayer::Record(const std::string &fileName, int channel, int time)
{
LOGD("Record with name %s channel %d time %d", fileName.c_str(), channel, time);
if (fileName.length() == 0 || channel < 0 ||
channel >= (int)mplayerList.size() || time < 0) {
LOGE("Record: Illegal argument");
return -1;
}
// find player
shared_ptr<OnePlayer> onePlayer;
for (auto iter = this->mplayerList.begin(); iter != mplayerList.end(); iter++)
if ((*iter)->mid == channel)
onePlayer = *iter;
if (NULL == onePlayer.get()) {
LOGE("Cannot find player by id: %d", channel);
return -1;
}
// start record TODO fix hard code
shared_ptr<Recorder> recorder(new Recorder(onePlayer->mplayer));
int res = recorder->Start(fileName + ".mp4", time);
if (0 != res) {
LOGE("Start record failed: %d", res);
return res;
}
mrecorderList.push_back(recorder);
return 0;
}
示例14: ASSERT
void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ASSERT(paintInfo.shouldPaintWithinRoot(&m_svgInlineTextBox.layoutObject()));
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation);
if (m_svgInlineTextBox.layoutObject().style()->visibility() != VISIBLE)
return;
// We're explicitly not supporting composition & custom underlines and custom highlighters -- unlike InlineTextBox.
// If we ever need that for SVG, it's very easy to refactor and reuse the code.
if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection())
return;
LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
if (!textShouldBePainted(textLayoutObject))
return;
DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(paintInfo.phase);
if (!DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_svgInlineTextBox, displayItemType)) {
LayoutObject& parentLayoutObject = m_svgInlineTextBox.parent()->layoutObject();
const ComputedStyle& style = parentLayoutObject.styleRef();
DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, displayItemType, paintInfo.rect);
InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers(
paintInfo.context, paintOffset, style,
textLayoutObject.scaledFont(), true);
if (!m_svgInlineTextBox.textFragments().isEmpty())
paintTextFragments(paintInfo, parentLayoutObject);
}
}
示例15: paintFilteredContent
static void paintFilteredContent(GraphicsContext& context,
const LayoutObject& object,
FilterData* filterData) {
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, object, DisplayItem::kSVGFilter))
return;
FloatRect filterBounds =
filterData ? filterData->lastEffect->getFilter()->filterRegion()
: FloatRect();
LayoutObjectDrawingRecorder recorder(context, object, DisplayItem::kSVGFilter,
filterBounds);
if (!filterData || filterData->m_state != FilterData::ReadyToPaint)
return;
DCHECK(filterData->lastEffect->getFilter()->getSourceGraphic());
filterData->m_state = FilterData::PaintingFilter;
FilterEffect* lastEffect = filterData->lastEffect;
sk_sp<SkImageFilter> imageFilter =
SkiaImageFilterBuilder::build(lastEffect, ColorSpaceDeviceRGB);
context.save();
// Clip drawing of filtered image to the minimum required paint rect.
context.clipRect(lastEffect->mapRect(object.strokeBoundingBox()));
context.beginLayer(1, SkXfermode::kSrcOver_Mode, &filterBounds,
ColorFilterNone, std::move(imageFilter));
context.endLayer();
context.restore();
filterData->m_state = FilterData::ReadyToPaint;
}