void VirtualFont::addTransformedCluster(const Cluster &cluster, const Vec2f &position) { for (auto &shape : cluster.shapes) { Quad quad; auto glyph = cluster.font->fillQuad(quad, shape, position, sizeRatio); if (glyph) { if (!hasClip || clipQuad(quad, glyph->texture)) { auto batch = batchMap->getBatch(glyph->texture); matrix.addTransformedQuad(quad, batch->vertices); incrementSequence(batch); } } } }
void VirtualFont::addCluster(const Cluster &cluster, const Vec3f &position) { for (auto &shape : cluster.shapes) { Vec2f p = properties.useMipmap ? position.xy() : Vec2f(snap(position.x), snap(position.y)); Quad quad; auto glyph = cluster.font->fillQuad(quad, shape, p, sizeRatio); if (glyph) { if (!hasClip || clipQuad(quad, glyph->texture)) { auto batch = batchMap->getBatch(glyph->texture); batch->addQuad(quad, position.z); incrementSequence(batch); } } } }
void StaticAudioTrackClientProxy::setBufferPosition(size_t position) { // This can only happen on a 64-bit client if (position > UINT32_MAX) { // FIXME Should return an error status return; } mState.mPosition = (uint32_t) position; mState.mPositionSequence = incrementSequence(mState.mPositionSequence, mState.mLoopSequence); // set patch-up variables until the mState is acknowledged by the ServerProxy. // observed buffer position and loop count will freeze until then to give the // illusion of a synchronous change. if (mState.mLoopCount > 0) { // only check if loop count is changing getBufferPositionAndLoopCount(NULL, NULL); // get last position } mPosLoop.mBufferPosition = position; if (position >= mState.mLoopEnd) { // no ongoing loop is possible if position is greater than loopEnd. mPosLoop.mLoopCount = 0; } (void) mMutator.push(mState); }
void StaticAudioTrackClientProxy::setLoop(size_t loopStart, size_t loopEnd, int loopCount) { // This can only happen on a 64-bit client if (loopStart > UINT32_MAX || loopEnd > UINT32_MAX) { // FIXME Should return an error status return; } mState.mLoopStart = (uint32_t) loopStart; mState.mLoopEnd = (uint32_t) loopEnd; mState.mLoopCount = loopCount; mState.mLoopSequence = incrementSequence(mState.mLoopSequence, mState.mPositionSequence); // set patch-up variables until the mState is acknowledged by the ServerProxy. // observed buffer position and loop count will freeze until then to give the // illusion of a synchronous change. getBufferPositionAndLoopCount(NULL, NULL); // preserve behavior to restart at mState.mLoopStart if position exceeds mState.mLoopEnd. if (mState.mLoopCount != 0 && mPosLoop.mBufferPosition >= mState.mLoopEnd) { mPosLoop.mBufferPosition = mState.mLoopStart; } mPosLoop.mLoopCount = mState.mLoopCount; (void) mMutator.push(mState); }
bool Publication::enqueueMessage(const SerializedMessage& m) { boost::mutex::scoped_lock lock(subscriber_links_mutex_); if (dropped_) { return false; } ROS_ASSERT(m.buf); uint32_t seq = incrementSequence(); if (has_header_) { // If we have a header, we know it's immediately after the message length // Deserialize it, write the sequence, and then serialize it again. namespace ser = ros::serialization; std_msgs::Header header; ser::IStream istream(m.buf.get() + 4, m.num_bytes - 4); ser::deserialize(istream, header); header.seq = seq; ser::OStream ostream(m.buf.get() + 4, m.num_bytes - 4); ser::serialize(ostream, header); } for(V_SubscriberLink::iterator i = subscriber_links_.begin(); i != subscriber_links_.end(); ++i) { const SubscriberLinkPtr& sub_link = (*i); sub_link->enqueueMessage(m, true, false); } if (latch_) { last_message_ = m; } return true; }