//-------------------------------------------------------------- float ofxMuiTextBlock::getTextHeight() const { if(isTextHorizontal()) { return getBlockHeight(); } else { return getBlockWidth(); } }
//////////////////////////////////////////////////////////////////////////////// // Need a serious debugging method, that will touch all pointers that are // supposed to be not NULL. I'd like to try to force a segfault here, if it // is going to happen, instead of letting it kill my program where I don't // know what happened. void Tx::pprintAlot(ostream & os) { cout << "Tx hash: " << thisHash_.toHexStr(true) << endl; if(!txRefObj_.isNull()) { cout << "HeaderNum: " << getBlockHeight() << endl; //cout << "HeadHash: " << getBlockHash().toHexStr(true) << endl; } cout << endl << "NumTxIn: " << getNumTxIn() << endl; for(uint32_t i=0; i<getNumTxIn(); i++) { TxIn txin = getTxInCopy(i); cout << " TxIn: " << i << endl; cout << " Siz: " << txin.getSize() << endl; cout << " Scr: " << txin.getScriptSize() << " Type: " << (int)txin.getScriptType() << endl; cout << " OPR: " << txin.getOutPoint().getTxHash().toHexStr(true) << txin.getOutPoint().getTxOutIndex() << endl; cout << " Seq: " << txin.getSequence() << endl; } cout << endl << "NumTxOut: " << getNumTxOut() << endl; for(uint32_t i=0; i<getNumTxOut(); i++) { TxOut txout = getTxOutCopy(i); cout << " TxOut: " << i << endl; cout << " Siz: " << txout.getSize() << endl; cout << " Scr: " << txout.getScriptSize() << " Type: " << (int)txout.getScriptType() << endl; cout << " Val: " << txout.getValue() << endl; } }
bool BlockIndex::findSupplement(const std::vector<Crypto::Hash>& ids, uint32_t& offset) const { for (const auto& id : ids) { if (getBlockHeight(id, offset)) { return true; } } return false; }
bool BlockIndex::findSupplement(const std::list<crypto::hash>& ids, uint64_t& offset) const { for (const auto& id : ids) { if (getBlockHeight(id, offset)) return true; } return false; }
bool DBTxRef::isMainBranch(void) const { if(dbKey6B_.getSize() != 6) return false; else { uint8_t dup8 = db_->getValidDupIDForHeight(getBlockHeight()); return (getDuplicateID() == dup8); } }
void BlockHeader::pprintAlot(ostream & os) { cout << "Header: " << getBlockHeight() << endl; cout << "Hash: " << getThisHash().toHexStr(true) << endl; cout << "Hash: " << getThisHash().toHexStr(false) << endl; cout << "PrvHash: " << getPrevHash().toHexStr(true) << endl; cout << "PrvHash: " << getPrevHash().toHexStr(false) << endl; cout << "this*: " << this << endl; cout << "TotSize: " << getBlockSize() << endl; cout << "Tx Count: " << numTx_ << endl; }
BinaryData DBTxRef::getBlockHash(void) const { StoredHeader sbh; if(dbKey6B_.getSize() == 6) { db_->getStoredHeader(sbh, getBlockHeight(), getDuplicateID(), false); return sbh.thisHash_; } else return BtcUtils::EmptyHash(); }
uint32_t DBTxRef::getBlockTimestamp() const { StoredHeader sbh; if(dbKey6B_.getSize() == 6) { db_->getStoredHeader(sbh, getBlockHeight(), getDuplicateID(), false); return READ_UINT32_LE(sbh.dataCopy_.getPtr()+68); } else return UINT32_MAX; }
void TxRef::pprint(ostream & os, int nIndent) const { os << "TxRef Information:" << endl; //os << " Hash: " << getThisHash().toHexStr() << endl; os << " Height: " << getBlockHeight() << endl; os << " BlkIndex: " << getBlockTxIndex() << endl; //os << " FileIdx: " << blkFilePtr_.getFileIndex() << endl; //os << " FileStart: " << blkFilePtr_.getStartByte() << endl; //os << " NumBytes: " << blkFilePtr_.getNumBytes() << endl; os << " ----- " << endl; os << " Read from disk, full tx-info: " << endl; //getTxCopy().pprint(os, nIndent+1); }
void BlockHeaderRef::pprintAlot(ostream & os) { cout << "Header: " << getBlockHeight() << endl; cout << "Hash: " << getThisHash().toHexStr(true) << endl; cout << "Hash: " << getThisHash().toHexStr(false) << endl; cout << "PrvHash: " << getPrevHash().toHexStr(true) << endl; cout << "PrvHash: " << getPrevHash().toHexStr(false) << endl; cout << "this*: " << this << endl; cout << "TotSize: " << getBlockSize() << endl; vector<TxRef*> txlist = getTxRefPtrList(); vector<BinaryData> hashlist = getTxHashList(); cout << "Number of Tx: " << txlist.size() << ", " << hashlist.size() << endl; for(uint32_t i=0; i<txlist.size(); i++) txlist[i]->pprintAlot(); }
std::vector<Crypto::Hash> BlockIndex::buildSparseChain(const Crypto::Hash& startBlockId) const { assert(m_index.count(startBlockId) > 0); uint32_t startBlockHeight; getBlockHeight(startBlockId, startBlockHeight); std::vector<Crypto::Hash> result; size_t sparseChainEnd = static_cast<size_t>(startBlockHeight + 1); for (size_t i = 1; i <= sparseChainEnd; i *= 2) { result.emplace_back(m_container[sparseChainEnd - i]); } if (result.back() != m_container[0]) { result.emplace_back(m_container[0]); } return result; }
void Tx::pprint(ostream & os, int nIndent, bool pBigendian) { string indent = ""; for(int i=0; i<nIndent; i++) indent = indent + " "; os << indent << "Tx: " << thisHash_.toHexStr(pBigendian) << (pBigendian ? " (BE)" : " (LE)") << endl; if( txRefObj_.isNull()) os << indent << " Blk: <NOT PART OF A BLOCK YET>" << endl; else os << indent << " Blk: " << getBlockHeight() << endl; os << indent << " TxSize: " << getSize() << " bytes" << endl; os << indent << " NumInputs: " << getNumTxIn() << endl; os << indent << " NumOutputs: " << getNumTxOut() << endl; os << endl; for(uint32_t i=0; i<getNumTxIn(); i++) getTxInCopy(i).pprint(os, nIndent+1, pBigendian); os << endl; for(uint32_t i=0; i<getNumTxOut(); i++) getTxOutCopy(i).pprint(os, nIndent+1, pBigendian); }
//-------------------------------------------------------------- void ofxMuiTextBlock::draw(float x, float y) { ofPushStyle(); ofPushMatrix(); ofTranslate(x,y); { if(debug) { ofSetColor(255,255,0); ofLine(0,0,0,ofGetHeight()); ofLine(0,0,ofGetWidth(),0); ofPushStyle(); if(isTextWidthLimited()) { ofSetColor(255,0,0); ofLine(getBlockWidth(),0,getBlockWidth(),ofGetHeight()); } if(isTextHeightLimited()) { ofSetColor(255,0,0); ofLine(0,getBlockHeight(),ofGetWidth(),getBlockHeight()); } ofPopStyle(); } ofTranslate(0,font->getSize()); ofSetColor(cTextColor); font->drawString(displayText,0,0); /* if(!displayText.empty()) { ofSetColor(cTextColor); ofPushMatrix(); // TODO: add support for various text alignments ofRectangle drawOffsets = displayStringBoundingBox; switch(orientation) { case OF_ORIENTATION_UNKNOWN: // if unknown, use default case OF_ORIENTATION_DEFAULT: ofTranslate(0, labelFont->getSize()); break; case OF_ORIENTATION_180: ofTranslate(displayStringBoundingBox.width, getContentBoxHeight() - labelFont->getSize()); ofRotateZ(180); break; case OF_ORIENTATION_90_RIGHT: ofTranslate(0,0); ofRotateZ(90); break; case OF_ORIENTATION_90_LEFT: // TODO: this is off in the Y direction ... not sure why. ofTranslate(font->getSize(), getTextBoxHeight()); ofRotateZ(-90); break; } //font->drawString(displayText,drawOffsets.x,drawOffsets.y); ofPopMatrix(); } */ } ofPopMatrix(); ofPopStyle(); }
QPoint GameController::Center(const QPoint& _coordinate)//游戏坐标到屏幕格子中心坐标 {return QPoint((int)((_coordinate.x()+0.5)*getBlockWidth()),(int)((_coordinate.y()+0.5)*getBlockHeight()));}