[gimp] plug-ins: in twain, unify 8- and 16-bit data transfer
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: in twain, unify 8- and 16-bit data transfer
- Date: Thu, 4 Jun 2020 19:02:01 +0000 (UTC)
commit 86569b9ae30b5407e43ed2e3b074906d9576c816
Author: Ell <ell_se yahoo com>
Date: Thu Jun 4 21:56:48 2020 +0300
plug-ins: in twain, unify 8- and 16-bit data transfer
plug-ins/twain/twain.c | 59 +++++---------------------------------------------
1 file changed, 6 insertions(+), 53 deletions(-)
---
diff --git a/plug-ins/twain/twain.c b/plug-ins/twain/twain.c
index 2d86104cf5..9e161a95e0 100644
--- a/plug-ins/twain/twain.c
+++ b/plug-ins/twain/twain.c
@@ -731,19 +731,16 @@ bitTransferCallback (pTW_IMAGEINFO imageInfo,
}
/*
- * oneBytePerSampleTransferCallback
+ * directTransferCallback
*
* The following function is called for each memory
* block that is transferred from the data source if
- * the image type is Grayscale or RGB. This transfer
- * mode is quicker than the modes that require translation
- * from a greater number of bits per sample down to the
- * 8 bits per sample understood by GIMP.
+ * the image type is Grayscale or RGB.
*/
static int
-oneBytePerSampleTransferCallback (pTW_IMAGEINFO imageInfo,
- pTW_IMAGEMEMXFER imageMemXfer,
- void *clientData)
+directTransferCallback (pTW_IMAGEINFO imageInfo,
+ pTW_IMAGEMEMXFER imageMemXfer,
+ void *clientData)
{
int rows = imageMemXfer->Rows;
int cols = imageMemXfer->Columns;
@@ -764,38 +761,6 @@ oneBytePerSampleTransferCallback (pTW_IMAGEINFO imageInfo,
return TRUE;
}
-/*
- * twoBytesPerSampleTransferCallback
- *
- * The following function is called for each memory
- * block that is transferred from the data source if
- * the image type is Grayscale or RGB.
- */
-static int
-twoBytesPerSampleTransferCallback (pTW_IMAGEINFO imageInfo,
- pTW_IMAGEMEMXFER imageMemXfer,
- void *clientData)
-{
- int rows = imageMemXfer->Rows;
- int cols = imageMemXfer->Columns;
-
- pClientDataStruct theClientData = (pClientDataStruct) clientData;
-
- /* Send the complete chunk */
- gegl_buffer_set (theClientData->buffer,
- GEGL_RECTANGLE (imageMemXfer->XOffset, imageMemXfer->YOffset,
- cols, rows), 0,
- theClientData->format, imageMemXfer->Memory.TheMem,
- GEGL_AUTO_ROWSTRIDE);
-
- /* Update the user on our progress */
- theClientData->completedPixels += (cols * rows);
- gimp_progress_update ((double) theClientData->completedPixels /
- (double) theClientData->totalPixels);
-
- return TRUE;
-}
-
/*
* palettedTransferCallback
*
@@ -908,19 +873,7 @@ dataTransferCallback (pTW_IMAGEINFO imageInfo,
case TWPT_GRAY:
case TWPT_RGB:
- switch (imageInfo->BitsPerPixel / imageInfo->SamplesPerPixel)
- {
- case 8:
- return oneBytePerSampleTransferCallback (imageInfo, imageMemXfer,
- clientData);
-
- case 16:
- return twoBytesPerSampleTransferCallback (imageInfo, imageMemXfer,
- clientData);
-
- default:
- return FALSE;
- }
+ return directTransferCallback (imageInfo, imageMemXfer, clientData);
default:
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]