bool findSubtree(TreeNode<T>* t1, TreeNode<T>* t2) { // for T2, collect the following metrics: depth, number of nodes and hash of their values, then // for each node in T1 which is the same with T2's root invoke the DFS algorithm to compute the aformentioned metrics, // and which aborts if the depth is higher than the T2's depth, or if the number of nodes in the subtree exceeds (T1 is very large!) // IF all the metrics are identical, the actual comparison of every nodes commenses // metrics can be extended/minimized (e.g. checking that left and right children are the same before proceeding auto metrics = collectMetrics(t2); auto metrics2 = collectMetrics(t1->left); auto metrics3 = collectMetrics(t1->right); return metrics2.root_value == metrics.root_value; }
QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer<QWindowsFontEngineData> &d) : QFontEngine(DirectWrite) , m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) , m_unitsPerEm(-1) , m_ascent(-1) , m_descent(-1) , m_xHeight(-1) , m_lineGap(-1) { qCDebug(lcQpaFonts) << __FUNCTION__ << pixelSize; Q_ASSERT(m_directWriteFontFace); m_fontEngineData->directWriteFactory->AddRef(); m_directWriteFontFace->AddRef(); fontDef.pixelSize = pixelSize; collectMetrics(); cache_cost = (m_ascent.toInt() + m_descent.toInt()) * m_xHeight.toInt() * 2000; }
QFontEngineDirectWrite::QFontEngineDirectWrite(IDWriteFactory *directWriteFactory, IDWriteFontFace *directWriteFontFace, qreal pixelSize) : m_directWriteFontFace(directWriteFontFace) , m_directWriteFactory(directWriteFactory) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) , m_unitsPerEm(-1) , m_ascent(-1) , m_descent(-1) , m_xHeight(-1) , m_lineGap(-1) { m_directWriteFactory->AddRef(); m_directWriteFontFace->AddRef(); fontDef.pixelSize = pixelSize; collectMetrics(); }
void ErrorCorrectPostProcess::process(const SequenceWorkItem& item, const ErrorCorrectResult& result) { // Determine if the read should be discarded bool readQCPass = true; if(result.kmerQC) { m_kmerQCPassed += 1; } else if(result.overlapQC) { m_overlapQCPassed += 1; } else { readQCPass = false; m_qcFail += 1; } // Collect metrics for the reads that were actually corrected if(m_bCollectMetrics && readQCPass) { collectMetrics(item.read.seq.toString(), result.correctSequence.toString(), item.read.qual); } SeqRecord record = item.read; record.seq = result.correctSequence; if(readQCPass || m_pDiscardWriter == NULL) { record.write(*m_pCorrectedWriter); ++m_readsKept; } else { record.write(*m_pDiscardWriter); ++m_readsDiscarded; } }
QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer<QWindowsFontEngineData> &d) : m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) , m_unitsPerEm(-1) , m_ascent(-1) , m_descent(-1) , m_xHeight(-1) , m_lineGap(-1) { if (QWindowsContext::verboseFonts) qDebug("%s %g", __FUNCTION__, pixelSize); d->directWriteFactory->AddRef(); m_directWriteFontFace->AddRef(); fontDef.pixelSize = pixelSize; collectMetrics(); }