renderbackend: moved bulk of hashing code to static function so more code has access to it
This commit is contained in:
@@ -119,17 +119,9 @@ QFuture<QList<QByteArray> > RenderBackend::Hash(const QList<rational> ×)
|
||||
QList<QByteArray> hashes;
|
||||
|
||||
foreach (const rational& t, times) {
|
||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
||||
|
||||
// Embed video parameters into this hash
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_width()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_height()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.format()), sizeof(PixelFormat::Format));
|
||||
hasher.addData(reinterpret_cast<const char*>(&render_mode_), sizeof(RenderMode::Mode));
|
||||
|
||||
copied_viewer_node_->texture_input()->get_connected_node()->Hash(hasher, t);
|
||||
|
||||
hashes.append(hasher.result());
|
||||
hashes.append(HashNode(copied_viewer_node_->texture_input()->get_connected_node(),
|
||||
video_params_,
|
||||
t));
|
||||
}
|
||||
|
||||
return hashes;
|
||||
@@ -347,6 +339,20 @@ void RenderBackend::ProcessUpdateQueue()
|
||||
CopyNodeInputValue(viewer_node_->samples_input());
|
||||
}
|
||||
|
||||
QByteArray RenderBackend::HashNode(const Node *n, const VideoParams ¶ms, const rational &time)
|
||||
{
|
||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
||||
|
||||
// Embed video parameters into this hash
|
||||
hasher.addData(reinterpret_cast<const char*>(¶ms.effective_width()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(¶ms.effective_height()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(¶ms.format()), sizeof(PixelFormat::Format));
|
||||
|
||||
n->Hash(hasher, time);
|
||||
|
||||
return hasher.result();
|
||||
}
|
||||
|
||||
void RenderBackend::WorkerFinished()
|
||||
{
|
||||
RenderWorker* worker = static_cast<RenderWorker*>(sender());
|
||||
|
||||
Reference in New Issue
Block a user