Skip to content

Commit

Permalink
yield
Browse files Browse the repository at this point in the history
  • Loading branch information
miyako committed Apr 28, 2022
1 parent dd85fa6 commit eeed043
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 474 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.DS_Store
xpdf/build/*
xpdf/test/userPreferences.*
110 changes: 69 additions & 41 deletions xpdf/4DPlugin-xpdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,49 +113,77 @@ void output_flush_fn(png_structp png_ptr)

static void writePNGData(png_structp png, SplashBitmap *bitmap, GBool pngAlpha) {

Guchar *p, *alpha, *rowBuf, *rowBufPtr;
int y, x;

if (setjmp(png_jmpbuf(png))) {
exit(2);
}
p = bitmap->getDataPtr();

if (pngAlpha) {
alpha = bitmap->getAlphaPtr();
if (bitmap->getMode() == splashModeMono8) {
rowBuf = (Guchar *)gmallocn(bitmap->getWidth(), 2);
for (y = 0; y < bitmap->getHeight(); ++y) {
rowBufPtr = rowBuf;
for (x = 0; x < bitmap->getWidth(); ++x) {
*rowBufPtr++ = *p++;
*rowBufPtr++ = *alpha++;
Guchar *p, *alpha, *rowBuf, *rowBufPtr;
int y, x;

if (setjmp(png_jmpbuf(png))) {
exit(2);
}
png_write_row(png, (png_bytep)rowBuf);
}
gfree(rowBuf);
} else { // splashModeRGB8
rowBuf = (Guchar *)gmallocn(bitmap->getWidth(), 4);
for (y = 0; y < bitmap->getHeight(); ++y) {
rowBufPtr = rowBuf;
for (x = 0; x < bitmap->getWidth(); ++x) {
PA_Yield();
*rowBufPtr++ = *p++;
*rowBufPtr++ = *p++;
*rowBufPtr++ = *p++;
*rowBufPtr++ = *alpha++;
}
png_write_row(png, (png_bytep)rowBuf);
}
gfree(rowBuf);

time_t startTime = time(0);

p = bitmap->getDataPtr();

if (pngAlpha) {
alpha = bitmap->getAlphaPtr();
if (bitmap->getMode() == splashModeMono8) {
rowBuf = (Guchar *)gmallocn(bitmap->getWidth(), 2);
for (y = 0; y < bitmap->getHeight(); ++y) {

time_t now = time(0);
time_t elapsedTime = abs(startTime - now);
if (elapsedTime > 0)
{
startTime = now;
PA_YieldAbsolute();
}

rowBufPtr = rowBuf;
for (x = 0; x < bitmap->getWidth(); ++x) {
*rowBufPtr++ = *p++;
*rowBufPtr++ = *alpha++;
}
png_write_row(png, (png_bytep)rowBuf);
}
gfree(rowBuf);
} else { // splashModeRGB8
rowBuf = (Guchar *)gmallocn(bitmap->getWidth(), 4);
for (y = 0; y < bitmap->getHeight(); ++y) {

time_t now = time(0);
time_t elapsedTime = abs(startTime - now);
if (elapsedTime > 0)
{
startTime = now;
PA_YieldAbsolute();
}

rowBufPtr = rowBuf;
for (x = 0; x < bitmap->getWidth(); ++x) {
*rowBufPtr++ = *p++;
*rowBufPtr++ = *p++;
*rowBufPtr++ = *p++;
*rowBufPtr++ = *alpha++;
}
png_write_row(png, (png_bytep)rowBuf);
}
gfree(rowBuf);
}
} else {
for (y = 0; y < bitmap->getHeight(); ++y) {

time_t now = time(0);
time_t elapsedTime = abs(startTime - now);
if (elapsedTime > 0)
{
startTime = now;
PA_YieldAbsolute();
}

png_write_row(png, (png_bytep)p);
p += bitmap->getRowSize();
}
}
} else {
for (y = 0; y < bitmap->getHeight(); ++y) {
PA_Yield();
png_write_row(png, (png_bytep)p);
p += bitmap->getRowSize();
}
}
}

static BOOL setupPNG(png_structp *png,
Expand Down
7 changes: 7 additions & 0 deletions xpdf/test/Data/Logs/test_errors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by 4D Developer on:Thu, 14 Apr 2022 06:35:19 GMT-->
<ErrorList>
<Method name="update_manifest_json">
<Error line="2">シンタックスエラー</Error>
</Method>
</ErrorList>
1 change: 1 addition & 0 deletions xpdf/test/Data/Logs/test_symbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04/14/22 15:35インタープロセス変数サイズ:12プロセス変数サイズ:216 (M) generate_file_from_template$fileName テキスト $template テキスト $templatesFolder テキスト $data BLOB $params Object $path Object $filePath テキスト $withBom ブール $1 Object $2 テキスト $3 テキスト $4 ブール (M) generate_project_infoplist$in テキスト $params Object $path Object $out テキスト $lprojPath テキスト $1 Object (M) generate_constants_xlf$projectFolder テキスト $constantsXlf テキスト $templatesFolder テキスト $constantsJsonPath テキスト $json Object $constantsXlfPath テキスト $params Object $path Object $1 Object (M) update_manifest_json$day 日付 $1 日付 (M) generate_project_xcode$in テキスト $params Object $path Object $out テキスト $projectPath テキスト $1 Object (M) TEST_IMAGE$status Object $params Object $_4D_auto_iter_0 Object $_4D_auto_iter_1 Object $_4D_auto_iter_2 Object $path テキスト $image ピクチャー (M) TEST_TEXT$status Object $params Object $path テキスト (M) TEST_INFO$status Object $params Object $path テキスト (M) generate_project$params Object (M) generate_project_vs$in テキスト $params Object $out テキスト $1 Object (M) generate_project_plugin_stub$projectFolder テキスト $in テキスト $targetPath テキスト $infoPlistStringsPath テキスト $templatesFolder テキスト $constantsXlfPath テキスト $constantsPath テキスト $params Object $iconPath テキスト $path Object $manifestPath テキスト $manifestJsonPath テキスト $infoPlistPath テキスト $out テキスト $stubPath テキスト $1 Object (M) generate_project_source$in テキスト $params Object $out テキスト $1 Object メソッド generate_file_from_template(Object;テキスト;テキスト;ブール), called 10 times, Thread Safeメソッド generate_project_infoplist(Object), called 1 times, Thread Safeメソッド generate_constants_xlf(Object), called 1 times, Thread Safeメソッド update_manifest_json(日付), not called, Thread Safeメソッド generate_project_xcode(Object), called 1 times, Thread Safeメソッド TEST_IMAGE, not called, Thread Unsafeメソッド TEST_TEXT, not called, Thread Safeメソッド TEST_INFO, not called, Thread Safeメソッド generate_project, not called, Thread Safeメソッド generate_project_vs(Object), called 1 times, Thread Safeメソッド generate_project_plugin_stub(Object), called 1 times, Thread Safeメソッド generate_project_source(Object), called 1 times, Thread Safe
Expand Down
Binary file modified xpdf/test/Data/data.4DD
Binary file not shown.
Binary file modified xpdf/test/Data/data.journal
Binary file not shown.
59 changes: 0 additions & 59 deletions xpdf/test/Project/DerivedData/methodAttributes.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
{
"methods": {
"generate_file_from_template": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"generate_project_infoplist": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"generate_constants_xlf": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"update_manifest_json": {
"timeStamp": "2022-04-12T15:49:34.445Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"generate_project_xcode": {
"timeStamp": "2022-04-12T15:49:34.445Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"TEST_IMAGE": {
"timeStamp": "2022-04-12T23:14:01.013Z"
},
Expand All @@ -43,30 +8,6 @@
},
"TEST_INFO": {
"timeStamp": "2022-04-12T15:49:34.444Z"
},
"generate_project": {
"timeStamp": "2022-04-12T15:49:34.444Z"
},
"generate_project_vs": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"generate_project_plugin_stub": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
},
"generate_project_source": {
"timeStamp": "2022-04-12T15:49:34.444Z",
"attributes": {
"invisible": true,
"preemptive": "capable"
}
}
}
}
15 changes: 0 additions & 15 deletions xpdf/test/Project/Sources/Methods/generate_constants_xlf.4dm

This file was deleted.

40 changes: 0 additions & 40 deletions xpdf/test/Project/Sources/Methods/generate_file_from_template.4dm

This file was deleted.

12 changes: 0 additions & 12 deletions xpdf/test/Project/Sources/Methods/generate_project.4dm

This file was deleted.

13 changes: 0 additions & 13 deletions xpdf/test/Project/Sources/Methods/generate_project_infoplist.4dm

This file was deleted.

75 changes: 0 additions & 75 deletions xpdf/test/Project/Sources/Methods/generate_project_plugin_stub.4dm

This file was deleted.

14 changes: 0 additions & 14 deletions xpdf/test/Project/Sources/Methods/generate_project_source.4dm

This file was deleted.

Loading

0 comments on commit eeed043

Please sign in to comment.