本文整理汇总了C++中rt函数的典型用法代码示例。如果您正苦于以下问题:C++ rt函数的具体用法?C++ rt怎么用?C++ rt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lt
Rect Transform::transform(const Rect& bounds) const
{
Rect r;
vec2 lt( bounds.left, bounds.top );
vec2 rt( bounds.right, bounds.top );
vec2 lb( bounds.left, bounds.bottom );
vec2 rb( bounds.right, bounds.bottom );
lt = transform(lt);
rt = transform(rt);
lb = transform(lb);
rb = transform(rb);
r.left = floorf(min(lt[0], rt[0], lb[0], rb[0]) + 0.5f);
r.top = floorf(min(lt[1], rt[1], lb[1], rb[1]) + 0.5f);
r.right = floorf(max(lt[0], rt[0], lb[0], rb[0]) + 0.5f);
r.bottom = floorf(max(lt[1], rt[1], lb[1], rb[1]) + 0.5f);
return r;
}
示例2: opName
const char* ARMv7DOpcodeLoadStoreRegisterImmediate::format()
{
const char* instructionName = opName();
if (!instructionName)
return defaultFormat();
appendInstructionName(opName());
appendRegisterName(rt());
appendSeparator();
appendCharacter('[');
appendRegisterName(rn());
if (immediate5()) {
appendSeparator();
appendUnsignedImmediate(immediate5() << scale());
}
appendCharacter(']');
return m_formatBuffer;
}
示例3: ASSERT
void CAlmanacDiagramCtrl::DrawStarPos(CDC *pDc, const CRect &rect)
{
ASSERT(pDc != NULL);
if (pDc==NULL || m_strDir.GetLength()!=4)
{
return;
}
CFont *OldFont = (CFont*)pDc->SelectObject(&m_TextFont);
for (int j=90; j<=360; j+=90)
{
POINT pt;
pt.x = m_centerCircle.x + m_iRadius * sin(j*PI/180);
pt.y = m_centerCircle.y - m_iRadius * cos(j*PI/180);
CRect rt;
rt.SetRect(pt.x-7, pt.y-7, pt.x+7, pt.y+7);
CString str;
str = m_strDir.Mid(j/90-1, 1);
pDc->DrawText(str, &rt, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
pDc->SetBkMode(TRANSPARENT);
pDc->SelectObject(&m_StarFont);
for (int i=0; i<m_iStarNum; i++)
{
POINT pt = CalStarPos(m_StarData[i]);
if (m_StarData[i].tracked == 1)
{
pDc->DrawIcon(pt.x-Icon_Size/2, pt.y-Icon_Size/2, m_hSigStrong);
}
else
{
pDc->DrawIcon(pt.x-Icon_Size/2, pt.y-Icon_Size/2, m_hSigWeak);
}
CRect rt(pt.x-Icon_Size/2, pt.y-Icon_Size/2,
pt.x+Icon_Size/2, pt.y+Icon_Size/2);
CString str;
str.Format(_T("%d"), m_StarData[i].id);
pDc->DrawText(str, &rt, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
pDc->SelectObject(OldFont);
}
示例4: main
int main(int, char**) {
bool not_done = true;
dds::Runtime rt("");
dds::Topic<TempSensorType> topic("TempSensorTopic");
dds::DataReader<TempSensorType> dr(topic);
//[NOTE #1]: Create an instance of the handler
TempSensorDataHandler handler;
auto func =
boost::bind(TempSensorDataHandler::handle_data, &handler, _1);
//[NOTE #2]: Register the handler for the relevant event
auto connection =
dr.connect<on_data_available>(func);
return 0;
}
示例5: info
void FcitxQtConnectionPrivate::initialize() {
m_serviceWatcher->setConnection(QDBusConnection::sessionBus());
m_serviceWatcher->addWatchedService(m_serviceName);
QFileInfo info(socketFile());
QDir dir(info.path());
if (!dir.exists()) {
QDir rt(QDir::root());
rt.mkpath(info.path());
}
m_watcher->addPath(info.path());
if (info.exists()) {
m_watcher->addPath(info.filePath());
}
connect(m_watcher, &QFileSystemWatcher::fileChanged,
this, &FcitxQtConnectionPrivate::socketFileChanged);
connect(m_watcher, &QFileSystemWatcher::directoryChanged,
this, &FcitxQtConnectionPrivate::socketFileChanged);
m_initialized = true;
}
示例6: TEST
TEST(Type, RuntimeType) {
HPHP::Transl::RuntimeType rt(new StringData());
Type t = Type::fromRuntimeType(rt);
EXPECT_TRUE(t.subtypeOf(Type::Str));
EXPECT_FALSE(t.subtypeOf(Type::Int));
rt = HPHP::Transl::RuntimeType(HphpArray::GetStaticEmptyArray());
t = Type::fromRuntimeType(rt);
EXPECT_TRUE(t.subtypeOf(Type::Arr));
EXPECT_FALSE(t.subtypeOf(Type::Str));
rt = HPHP::Transl::RuntimeType(true);
t = Type::fromRuntimeType(rt);
EXPECT_TRUE(t.subtypeOf(Type::Bool));
EXPECT_FALSE(t.subtypeOf(Type::Obj));
rt = HPHP::Transl::RuntimeType((int64_t) 1);
t = Type::fromRuntimeType(rt);
EXPECT_TRUE(t.subtypeOf(Type::Int));
EXPECT_FALSE(t.subtypeOf(Type::Dbl));
rt = HPHP::Transl::RuntimeType(DataType::KindOfObject,
DataType::KindOfInvalid);
rt = rt.setKnownClass(SystemLib::s_TraversableClass);
t = Type::fromRuntimeType(rt);
EXPECT_TRUE(t.subtypeOf(Type::Obj));
EXPECT_FALSE(Type::Obj.subtypeOf(t));
EXPECT_FALSE(Type::Int.subtypeOf(t));
HPHP::Transl::RuntimeType rt1 =
HPHP::Transl::RuntimeType(DataType::KindOfObject,
DataType::KindOfInvalid);
rt1 = rt1.setKnownClass(SystemLib::s_IteratorClass);
Type t1 = Type::fromRuntimeType(rt1);
EXPECT_TRUE(t1.subtypeOf(Type::Obj));
EXPECT_TRUE(t1.subtypeOf(t));
EXPECT_FALSE(Type::Obj.subtypeOf(t1));
EXPECT_FALSE(t.subtypeOf(t1));
EXPECT_FALSE(t.subtypeOf(Type::Str));
EXPECT_FALSE(Type::Int.subtypeOf(t));
}
示例7: SkDEBUGFAIL
sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
sk_sp<GrRenderTargetProxy> rtp,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
if (this->wasAbandoned()) {
return nullptr;
}
// SkSurface catches bad color space usage at creation. This check handles anything that slips
// by, including internal usage. We allow a null color space here, for read/write pixels and
// other special code paths. If a color space is provided, though, enforce all other rules.
if (colorSpace && !SkSurface_Gpu::Valid(fContext, rtp->config(), colorSpace.get())) {
SkDEBUGFAIL("Invalid config and colorspace combination");
return nullptr;
}
bool useDIF = false;
if (surfaceProps) {
useDIF = surfaceProps->isUseDeviceIndependentFonts();
}
if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() &&
rtp->isStencilBufferMultisampled()) {
// TODO: defer stencil buffer attachment for PathRenderingDrawContext
sk_sp<GrRenderTarget> rt(sk_ref_sp(rtp->instantiate(fContext->textureProvider())));
GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAttachment(rt.get());
if (sb) {
return sk_sp<GrRenderTargetContext>(new GrPathRenderingRenderTargetContext(
fContext, this, std::move(rtp),
std::move(colorSpace), surfaceProps,
fContext->getAuditTrail(), fSingleOwner));
}
}
return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext(fContext, this, std::move(rtp),
std::move(colorSpace),
surfaceProps,
fContext->getAuditTrail(),
fSingleOwner));
}
示例8: run_priority_abp
///////////////////////////////////////////////////////////////////////
// priority abp scheduler: local priority deques for each OS thread,
// with work stealing from the "bottom" of each.
int run_priority_abp(startup_function_type const& startup,
shutdown_function_type const& shutdown,
util::command_line_handling& cfg, bool blocking)
{
ensure_hierarchy_arity_compatibility(cfg.vm_);
ensure_hwloc_compatibility(cfg.vm_);
std::size_t num_high_priority_queues = cfg.num_threads_;
if (cfg.vm_.count("hpx:high-priority-threads")) {
num_high_priority_queues =
cfg.vm_["hpx:high-priority-threads"].as<std::size_t>();
}
bool numa_sensitive = false;
if (cfg.vm_.count("hpx:numa-sensitive"))
numa_sensitive = true;
// scheduling policy
typedef hpx::threads::policies::abp_priority_queue_scheduler
abp_priority_queue_policy;
abp_priority_queue_policy::init_parameter_type init(
cfg.num_threads_, num_high_priority_queues, 1000,
numa_sensitive);
// Build and configure this runtime instance.
typedef hpx::runtime_impl<abp_priority_queue_policy> runtime_type;
HPX_STD_UNIQUE_PTR<hpx::runtime> rt(
new runtime_type(cfg.rtcfg_, cfg.mode_, cfg.num_threads_, init));
if (blocking) {
return run(*rt, cfg.hpx_main_f_, cfg.vm_, cfg.mode_, startup,
shutdown);
}
// non-blocking version
start(*rt, cfg.hpx_main_f_, cfg.vm_, cfg.mode_, startup, shutdown);
rt.release(); // pointer to runtime is stored in TLS
return 0;
}
示例9: main
int main(int argc, char** argv) {
try {
std::string script = LoadScript(argc, argv);
rs::jsapi::Runtime rt(1024 * 1024 * 1024, true, true);
auto app = new Application(rt, "com.ripcordsoftware.examples.gtk", 1, argv);
rs::jsapi::Global::DefineProperty(rt, "app", *app);
auto builder = new Builder(rt);
rs::jsapi::Global::DefineProperty(rt, "builder", *builder);
rs::jsapi::Global::DefineFunction(rt, "trace",
[](const std::vector<rs::jsapi::Value>& args, rs::jsapi::Value& result){
for (auto arg : args) {
std::cout << arg.ToString();
}
if (args.size() > 0) {
std::cout << std::endl;
}
return true;
});
rt.Evaluate(script.c_str());
//rs::jsapi::Script scr(rt, script.c_str());
//scr.Compile();
//scr.Execute();
} catch (const rs::jsapi::ScriptException& ex) {
std::cerr <<
"ERROR: line " << ex.lineno << std::endl <<
ex.what() << std::endl <<
ex.linebuf << std::endl;
}
return 0;
}
示例10: minimumSize
QSize K3ActiveLabel::minimumSizeHint() const
{
QSize ms = minimumSize();
if ((ms.width() > 0) && (ms.height() > 0))
return ms;
int w = 400;
if (ms.width() > 0)
w = ms.width();
QString txt = toHtml();
Q3SimpleRichText rt(txt, font());
rt.setWidth(w - 2*frameWidth() - 10);
w = 10 + rt.widthUsed() + 2*frameWidth();
if (w < ms.width())
w = ms.width();
int h = rt.height() + 2*frameWidth();
if ( h < ms.height())
h = ms.height();
return QSize(w, h);
}
示例11: rts
void MainWindow::newCellTest()
{
QString rts("root"), rrts("right of root and quite long at that"),
lrts("left of root");
ZZCell rt((cellID)1, 0, rts),
rrt((cellID)2, 0, rrts),
lrt((cellID)3, 0, lrts);
// QHash should make a copy for us
// since these guys will be dead soon
world.insert(1, rt);
world.insert(2, rrt);
world.insert(3, lrt);
// Construct our top-level squares
QGraphicsRectItem *rt_rect = new QGraphicsRectItem(0,0,100,20),
*rrt_rect = new QGraphicsRectItem(0,0,100,20),
*lrt_rect = new QGraphicsRectItem(0,0,100,20);
QGraphicsTextItem *rt_text = new QGraphicsTextItem(rt.getContent(), rt_rect),
*rrt_text = new QGraphicsTextItem(rrt.getContent(), rrt_rect),
*lrt_text = new QGraphicsTextItem(lrt.getContent(), lrt_rect);
rt_rect->setPos(420, 420);
rrt_rect->setPos(530, 420);
lrt_rect->setPos(310, 420);
// Add our toplevel squares to our scene
scene->addItem(rt_rect);
scene->addItem(rrt_rect);
scene->addItem(lrt_rect);
scene->update();
ui->zzViewWidget->show();
}
示例12: rx
bool RegexSourceSink::StartAcquisition(QString dev)
{
QRegExp rx("(.+)/(.+)(\\..+)");
int pos=0;
pos=rx.indexIn(dev);
dir=rx.cap(1);
basename=rx.cap(2);
extension=rx.cap(3);
QRegExp rt("(\\d+$)");
pos=rt.indexIn(basename);
basename.truncate(pos);
// qDebug()<<dir<<basename<<rt.cap(1)<<extension;
QString regexString=basename+"\\d+"+extension;
// qDebug()<<"Will load files that match"<<regexString;
QRegExp movieRegex(regexString);
QDir basedir(dir);
if (!basedir.exists()) qDebug()<<"Extracted dir does not exist"<<dir;
QStringList filt;
filt<<"*"+extension;
basedir.setNameFilters(filt);
QStringList files=basedir.entryList();
goodFiles=new QStringList;
for (int i=0;i<files.count();i++) {
if (movieRegex.indexIn(files.at(i))!=-1) {
goodFiles->append(files.at(i));
}
}
if (goodFiles->count()==0) qDebug()<<"No matching files found";
index=0;
nFrames=goodFiles->count();
return true;
}
示例13: clientMouseMove
virtual void clientMouseMove(const twPoint& pt){
if(m_drag!=-1){
twRect rt(twPoint(0,0),getClientRect().size());
bool newHover=rt&&pt;
int newDrag=pt.y/m_rowHeight;
if(newDrag<0)
newDrag=0;
if(newDrag>=(int)items().size())
newDrag=items().size()-1;
if(newHover!=m_hover || newDrag!=m_drag){
invalidateClientRect(rectForItem(m_drag));
invalidateClientRect(rectForItem(newDrag));
m_hover=newHover;
m_drag=newDrag;
}
}
}
示例14: discardOutside
std::list<pBlock> ClearInterval::
discardOutside(Signal::Interval& I)
{
std::list<pBlock> discarded;
BlockCache::cache_t C = cache_->clone();
for (BlockCache::cache_t::value_type itr : C)
{
pBlock block(itr.second);
Signal::Interval blockInterval = block->getInterval();
Signal::Interval toKeep = I & blockInterval;
bool remove_entire_block = toKeep == Signal::Interval();
bool keep_entire_block = toKeep == blockInterval;
if ( remove_entire_block )
{
discarded.push_back (block);
}
else if ( keep_entire_block )
{
}
else
{
// clear partial block
if( I.first <= blockInterval.first && I.last < blockInterval.last )
{
Region ir = block->getRegion ();
ResampleTexture rt(block->glblock->glTexture ()->getOpenGlTextureId ());
ResampleTexture::Area A(ir.a.time, ir.a.scale, ir.b.time, ir.b.scale);
GlFrameBuffer::ScopeBinding sb = rt.enable(A);
float t = I.last / block->block_layout ().targetSampleRate();
A.x1 = t;
rt.drawColoredArea (A, 0.f);
(void)sb; // RAII
}
}
}
return discarded;
}
示例15: rt
void Ski_area_gui::draw_lines() const
{
int r = sa->get_r();
int c = sa->get_c();
for (int i = 0; i < r; ++i){
for (int j = 0; j < c; ++j){
Graph_lib::Rectangle rt(Point(pos.x + j*width, pos.y + i*height), width, height);
ostringstream oss;
oss << sa->get_height(i + 1, j + 1);
if (comment[i][j] != ""){
oss << '(' << comment[i][j] << ')';
}
Graph_lib::Text t(Point(pos.x + j*width + width / 2, pos.y + i*height + height), oss.str());
if (hl[i][j]){
t.set_color(Graph_lib::Color::white);
rt.set_fill_color(Graph_lib::Color::black);
}
rt.draw();
t.draw();
}
}
}