graphics: Fix nxstyle errors
error: Bad alignment error: Right brace must be followed by a blank line error: Long line found
This commit is contained in:
parent
b5fb80c0cd
commit
1707be3977
@ -148,18 +148,21 @@ static void tiff_cleanup(FAR struct tiff_info_s *info)
|
|||||||
{
|
{
|
||||||
close(info->outfd);
|
close(info->outfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->outfd = -1;
|
info->outfd = -1;
|
||||||
|
|
||||||
if (info->tmp1fd >= 0)
|
if (info->tmp1fd >= 0)
|
||||||
{
|
{
|
||||||
close(info->tmp1fd);
|
close(info->tmp1fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->tmp1fd = -1;
|
info->tmp1fd = -1;
|
||||||
|
|
||||||
if (info->tmp2fd >= 0)
|
if (info->tmp2fd >= 0)
|
||||||
{
|
{
|
||||||
close(info->tmp2fd);
|
close(info->tmp2fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->tmp2fd = -1;
|
info->tmp2fd = -1;
|
||||||
|
|
||||||
/* And remove the temporary files */
|
/* And remove the temporary files */
|
||||||
@ -200,20 +203,21 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
/* Put all of the pieces together to create the final output file. There
|
/* Put all of the pieces together to create the final output file.
|
||||||
* are three pieces:
|
* There are three pieces:
|
||||||
*
|
*
|
||||||
* 1) outfile: The partial output file containing the header, IFD and strip
|
* 1) outfile: The partial output file containing the header, IFD and strip
|
||||||
* counts. This includes the StripOffsets and StripByteCounts that need
|
* counts. This includes the StripOffsets and StripByteCounts that need
|
||||||
* to be updated. Size=outsize;
|
* to be updated. Size=outsize;
|
||||||
* 2) tmpfile1: This contains the offsets into tmpfile3 for each strip. The
|
* 2) tmpfile1: This contains the offsets into tmpfile3 for each strip.
|
||||||
* size of this file is tmp1size. These offsets are relative to the
|
* The size of this file is tmp1size. These offsets are relative to the
|
||||||
* beginning of tmpfile3 and need to be offset by outsize+tmp1size.
|
* beginning of tmpfile3 and need to be offset by outsize+tmp1size.
|
||||||
* 3) tmpfile3: The strip data. Size is tmp2size. This is raw image data;
|
* 3) tmpfile3: The strip data. Size is tmp2size. This is raw image data;
|
||||||
* no fixups are required.
|
* no fixups are required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(info && info->outfd >= 0 && info->tmp1fd >= 0 && info->tmp2fd >= 0);
|
DEBUGASSERT(info && info->outfd >= 0 &&
|
||||||
|
info->tmp1fd >= 0 && info->tmp2fd >= 0);
|
||||||
DEBUGASSERT((info->outsize & 3) == 0 && (info->tmp1size & 3) == 0);
|
DEBUGASSERT((info->outsize & 3) == 0 && (info->tmp1size & 3) == 0);
|
||||||
|
|
||||||
/* Fix-up the count value in the StripByteCounts IFD entry in the outfile.
|
/* Fix-up the count value in the StripByteCounts IFD entry in the outfile.
|
||||||
@ -221,7 +225,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
* was written.
|
* was written.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = tiff_readifdentry(info->outfd, info->filefmt->sbcifdoffset, &ifdentry);
|
ret = tiff_readifdentry(info->outfd, info->filefmt->sbcifdoffset,
|
||||||
|
&ifdentry);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -229,7 +234,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
|
|
||||||
tiff_put32(ifdentry.count, info->nstrips);
|
tiff_put32(ifdentry.count, info->nstrips);
|
||||||
|
|
||||||
ret = tiff_writeifdentry(info->outfd, info->filefmt->sbcifdoffset, &ifdentry);
|
ret = tiff_writeifdentry(info->outfd, info->filefmt->sbcifdoffset,
|
||||||
|
&ifdentry);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -240,7 +246,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
* outfile, hence, the correct offset is outsize.
|
* outfile, hence, the correct offset is outsize.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = tiff_readifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry);
|
ret = tiff_readifdentry(info->outfd, info->filefmt->soifdoffset,
|
||||||
|
&ifdentry);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -249,7 +256,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
tiff_put32(ifdentry.count, info->nstrips);
|
tiff_put32(ifdentry.count, info->nstrips);
|
||||||
tiff_put32(ifdentry.offset, info->outsize);
|
tiff_put32(ifdentry.offset, info->outsize);
|
||||||
|
|
||||||
ret = tiff_writeifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry);
|
ret = tiff_writeifdentry(info->outfd, info->filefmt->soifdoffset,
|
||||||
|
&ifdentry);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -333,6 +341,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
total += nbytes;
|
total += nbytes;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||||
DEBUGASSERT(total == info->tmp1size);
|
DEBUGASSERT(total == info->tmp1size);
|
||||||
#endif
|
#endif
|
||||||
@ -383,6 +392,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
|
|||||||
total += nbytes;
|
total += nbytes;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||||
DEBUGASSERT(total == info->tmp2size);
|
DEBUGASSERT(total == info->tmp2size);
|
||||||
#endif
|
#endif
|
||||||
@ -397,19 +407,20 @@ errout:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_abort
|
* Name: tiff_abort
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Abort the TIFF file creation and create-up resources.
|
* Abort the TIFF file creation and create-up resources.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* info - A pointer to the caller allocated parameter passing/TIFF state instance.
|
* info - A pointer to the caller allocated parameter passing/TIFF state
|
||||||
|
* instance.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void tiff_abort(FAR struct tiff_info_s *info)
|
void tiff_abort(FAR struct tiff_info_s *info)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* apps/include/graphics/tiff.h
|
* apps/include/graphics/tiff.h
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Reference:
|
/* Reference:
|
||||||
* "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association.
|
* "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association.
|
||||||
@ -25,21 +25,21 @@
|
|||||||
#ifndef __APPS_INCLUDE_GRAPHICS_TIFF_H
|
#ifndef __APPS_INCLUDE_GRAPHICS_TIFF_H
|
||||||
#define __APPS_INCLUDE_GRAPHICS_TIFF_H
|
#define __APPS_INCLUDE_GRAPHICS_TIFF_H
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ********************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
/* TIFF File Format Definitions *****************************************************/
|
/* TIFF File Format Definitions *********************************************/
|
||||||
|
|
||||||
/* Values for the IFD field type */
|
/* Values for the IFD field type */
|
||||||
|
|
||||||
@ -207,11 +207,11 @@
|
|||||||
#define IFD_TAG_REFERENCEBW 532 /* ReferenceBlackWhite, RATIONAL */
|
#define IFD_TAG_REFERENCEBW 532 /* ReferenceBlackWhite, RATIONAL */
|
||||||
#define IFD_TAG_COPYRIGHT 33432 /* Copyright, ASCII */
|
#define IFD_TAG_COPYRIGHT 33432 /* Copyright, ASCII */
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* TIFF File Format Structure *******************************************************/
|
/* TIFF File Format Structure ***********************************************/
|
||||||
|
|
||||||
/* "A TIFF file begins with an 8-byte image file header that points to an
|
/* "A TIFF file begins with an 8-byte image file header that points to an
|
||||||
* image file directory (IFD). An image file directory contains information
|
* image file directory (IFD). An image file directory contains information
|
||||||
@ -243,10 +243,10 @@ struct tiff_ifdentry_s
|
|||||||
};
|
};
|
||||||
#define SIZEOF_IFD_ENTRY 12
|
#define SIZEOF_IFD_ENTRY 12
|
||||||
|
|
||||||
/************************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Structures needed to interface with the TIFF file creation library) and also
|
/* Structures needed to interface with the TIFF file creation library) and
|
||||||
* structures used only internally by the TIFF file creation library).
|
* also structures used only internally by the TIFF file creation library).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This structure describes on strip in tmpfile2 */
|
/* This structure describes on strip in tmpfile2 */
|
||||||
@ -257,8 +257,8 @@ struct tiff_strip_s
|
|||||||
uint32_t count; /* Count of pixels in the strip */
|
uint32_t count; /* Count of pixels in the strip */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure is used only internally by the TIFF file creation library to
|
/* This structure is used only internally by the TIFF file creation library
|
||||||
* manage file offsets.
|
* to manage file offsets.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct tiff_filefmt_s
|
struct tiff_filefmt_s
|
||||||
@ -290,8 +290,8 @@ struct tiff_info_s
|
|||||||
*
|
*
|
||||||
* colorfmt - Specifies the form of the color data that will be provided
|
* colorfmt - Specifies the form of the color data that will be provided
|
||||||
* in the strip data. These are the FB_FMT_* definitions
|
* in the strip data. These are the FB_FMT_* definitions
|
||||||
* provided in include/nuttx/video/fb.h. Only the following values
|
* provided in include/nuttx/video/fb.h. Only the following
|
||||||
* are supported:
|
* values are supported:
|
||||||
*
|
*
|
||||||
* FB_FMT_Y1 BPP=1, monochrome, 0=black
|
* FB_FMT_Y1 BPP=1, monochrome, 0=black
|
||||||
* FB_FMT_Y4 BPP=4, 4-bit greyscale, 0=black
|
* FB_FMT_Y4 BPP=4, 4-bit greyscale, 0=black
|
||||||
@ -345,9 +345,9 @@ struct tiff_info_s
|
|||||||
FAR const struct tiff_filefmt_s *filefmt;
|
FAR const struct tiff_filefmt_s *filefmt;
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
@ -357,12 +357,12 @@ extern "C"
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_initialize
|
* Name: tiff_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to create a new TIFF file. The overall steps to creating a TIFF file are
|
* Setup to create a new TIFF file. The overall steps to creating a
|
||||||
* as follows:
|
* TIFF file are as follows:
|
||||||
*
|
*
|
||||||
* 1) Create an initialize a struct tiff_info_s instance
|
* 1) Create an initialize a struct tiff_info_s instance
|
||||||
* 2) Call tiff_initialize() to setup the file creation
|
* 2) Call tiff_initialize() to setup the file creation
|
||||||
@ -370,21 +370,23 @@ extern "C"
|
|||||||
* 4) Call tiff_finalize() to complete the file creation.
|
* 4) Call tiff_finalize() to complete the file creation.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* info - A pointer to the caller allocated parameter passing/TIFF state instance.
|
* info - A pointer to the caller allocated parameter passing/TIFF state
|
||||||
|
* instance.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success. A negated errno value on failure.
|
* Zero (OK) on success. A negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int tiff_initialize(FAR struct tiff_info_s *info);
|
int tiff_initialize(FAR struct tiff_info_s *info);
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_addstrip
|
* Name: tiff_addstrip
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Add an image data strip. The size of the strip in pixels must be equal to
|
* Add an image data strip. The size of the strip in pixels
|
||||||
* the RowsPerStrip x ImageWidth values that were provided to tiff_initialize().
|
* must be equal to the RowsPerStrip x ImageWidth values
|
||||||
|
* that were provided to tiff_initialize().
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* info - A pointer to the caller allocated parameter passing/TIFF state
|
* info - A pointer to the caller allocated parameter passing/TIFF state
|
||||||
@ -394,43 +396,45 @@ int tiff_initialize(FAR struct tiff_info_s *info);
|
|||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success. A negated errno value on failure.
|
* Zero (OK) on success. A negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip);
|
int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip);
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_finalize
|
* Name: tiff_finalize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Finalize the TIFF output file, completing the TIFF file creation steps.
|
* Finalize the TIFF output file, completing the TIFF file creation steps.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* info - A pointer to the caller allocated parameter passing/TIFF state instance.
|
* info - A pointer to the caller allocated parameter passing/TIFF state
|
||||||
|
* instance.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success. A negated errno value on failure.
|
* Zero (OK) on success. A negated errno value on failure.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int tiff_finalize(FAR struct tiff_info_s *info);
|
int tiff_finalize(FAR struct tiff_info_s *info);
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_abort
|
* Name: tiff_abort
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Abort the TIFF file creation and create-up resources.
|
* Abort the TIFF file creation and create-up resources.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* info - A pointer to the caller allocated parameter passing/TIFF state instance.
|
* info - A pointer to the caller allocated parameter passing/TIFF state
|
||||||
|
* instance.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void tiff_abort(FAR struct tiff_info_s *info);
|
void tiff_abort(FAR struct tiff_info_s *info);
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: tiff_put/get16/32
|
* Name: tiff_put/get16/32
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -445,7 +449,7 @@ void tiff_abort(FAR struct tiff_info_s *info);
|
|||||||
* None (put)
|
* None (put)
|
||||||
* The extracted value (get)
|
* The extracted value (get)
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void tiff_put16(FAR uint8_t *dest, uint16_t value);
|
void tiff_put16(FAR uint8_t *dest, uint16_t value);
|
||||||
void tiff_put32(FAR uint8_t *dest, uint32_t value);
|
void tiff_put32(FAR uint8_t *dest, uint32_t value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user