Skip to content

Commit

Permalink
ChangeLog and last fix for v2.0.3, issues #11,45: not use nested func…
Browse files Browse the repository at this point in the history
…tion for callbacks.
  • Loading branch information
bootchk committed Jan 8, 2018
1 parent f492cfe commit 734e899
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 32 deletions.
11 changes: 9 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ ChangeLog for the resynthesizer

2012 Lloyd Konneker bootch nc.rr.com

version 2.0
version 2.0.3 Not used nested function (unsafe gcc extension) for progress callbacks, issues #11,45

version 2.0.2 Remove deprecated PyGimp functions so users of unstable GIMP do not see warnings, pull request #7
Change Map>Resynthesize GUI to include hidden options, pull request #42

version 2.0.1 Fixes build scripts to support distribution builders, issue 31. Changes structure to build a library.

version 2.0.1 forward: see also the Github notes for the release

This version is a major rewrite but with little functional change.
version 2.0 is a major rewrite but with little functional change.

* Functional changes:

Expand Down
65 changes: 35 additions & 30 deletions lib/progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
#include "imageSynthConstants.h"
#include "progress.h"



void
initializeProgressRecord(
ProgressRecordT* progressRecord,
TRepetionParameters repetitionParams,
void (*progressCallback)(int, void*),
void * contextInfo)
{
progressRecord->completedPixelCount = 0;
progressRecord->priorReportedPercentComplete = 0;
progressRecord->estimatedPixelCountToCompletion = estimatePixelsToSynth(repetitionParams);
progressRecord->progressCallback = progressCallback;
progressRecord->context = contextInfo;
}


/*
* Intermediate between deeper engine and calling app's progress callback.
* Called from inside synthesis() every 4k target pixels i.e. with raw progress increments.
Expand Down Expand Up @@ -47,6 +64,23 @@ deepProgressCallback(ProgressRecordT * progressRecord)


#ifdef SYNTH_THREADED

void
initializeThreadedProgressRecord(
ProgressRecordT* progressRecord,
TRepetionParameters repetitionParams,
void (*progressCallback)(int, void*),
void * contextInfo,
GMutex *mutexProgress)
{
// init fields common to unthreaded and threaded
initializeProgressRecord(progressRecord, repetitionParams, progressCallback, contextInfo);

// also init additional field for thread safety
progressRecord->mutexProgress = mutexProgress;
}


/*
Threaded version.
Expand Down Expand Up @@ -82,34 +116,5 @@ deepProgressCallback(ProgressRecordT * progressRecord)
g_mutex_unlock(progressRecord->mutexProgress);
}
}
#endif


void
initializeProgressRecord(
ProgressRecordT* progressRecord,
TRepetionParameters repetitionParams,
void (*progressCallback)(int, void*),
void * contextInfo)
{
progressRecord->completedPixelCount = 0;
progressRecord->priorReportedPercentComplete = 0;
progressRecord->estimatedPixelCountToCompletion = estimatePixelsToSynth(repetitionParams);
progressRecord->progressCallback = progressCallback;
progressRecord->context = contextInfo;
}

void
initializeThreadedProgressRecord(
ProgressRecordT* progressRecord,
TRepetionParameters repetitionParams,
void (*progressCallback)(int, void*),
void * contextInfo,
GMutex *mutexProgress)
{
// init common fields
initializeProgressRecord(progressRecord, repetitionParams, progressCallback, contextInfo);

// also init additional field for threading
progressRecord->mutexProgress = mutexProgress;
}
#endif

0 comments on commit 734e899

Please sign in to comment.