本文整理汇总了C++中png_get_progressive_ptr函数的典型用法代码示例。如果您正苦于以下问题:C++ png_get_progressive_ptr函数的具体用法?C++ png_get_progressive_ptr怎么用?C++ png_get_progressive_ptr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了png_get_progressive_ptr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void
nsPNGDecoder::end_callback(png_structp png_ptr, png_infop info_ptr)
{
/* libpng comments:
*
* this function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
nsPNGDecoder* decoder =
static_cast<nsPNGDecoder*>(png_get_progressive_ptr(png_ptr));
// We shouldn't get here if we've hit an error
MOZ_ASSERT(!decoder->HasError(), "Finishing up PNG but hit error!");
int32_t loop_count = 0;
#ifdef PNG_APNG_SUPPORTED
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_acTL)) {
int32_t num_plays = png_get_num_plays(png_ptr, info_ptr);
loop_count = num_plays - 1;
}
#endif
// Send final notifications
decoder->EndImageFrame();
decoder->PostDecodeDone(loop_count);
}
开发者ID:hobinjk,项目名称:gecko-dev,代码行数:33,代码来源:nsPNGDecoder.cpp
示例2: read_data_fn
static void read_data_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
struct png_t* png = (struct png_t*)png_get_progressive_ptr(png_ptr);
if(png->pos + length > png->size) png_error(png_ptr, "Read Error");
memcpy(data, &png->data[png->pos], length);
png->pos += length;
}
开发者ID:Strongc,项目名称:playasa,代码行数:7,代码来源:libpng.c
示例3: end_callback
void PngReader::end_callback(
png_structp png, png_infop info )
{
PngReader* reader =
( PngReader* )png_get_progressive_ptr( png );
reader->m_finished = true;
}
开发者ID:delfigamer,项目名称:mist,代码行数:7,代码来源:pngreader.cpp
示例4: png_end_callback
/* Called after reading the entire image */
static void
png_end_callback (png_structp png_read_ptr,
png_infop png_info_ptr)
{
LoadContext* lc;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
}
开发者ID:YueLinHo,项目名称:MB3Gdk-pixbuf,代码行数:12,代码来源:io-png.c
示例5: pngDecEndCallback
void pngDecEndCallback(png_structp png_ptr, png_infop info)
{
PngStream* stream = (PngStream*)png_get_progressive_ptr(png_ptr);
if (!stream)
{
cellPngDec.error("Failed to obtain streamPtr in endCallback.");
return;
}
stream->endOfFile = true;
}
开发者ID:AniLeo,项目名称:rpcs3,代码行数:11,代码来源:cellPngDec.cpp
示例6: pngDecInfoCallback
void pngDecInfoCallback(png_structp png_ptr, png_infop info)
{
PngStream* stream = (PngStream*)png_get_progressive_ptr(png_ptr);
if (!stream)
{
cellPngDec.error("Failed to obtain streamPtr in rowCallback.");
return;
}
const size_t remaining = png_process_data_pause(png_ptr, false);
stream->buffer->cursor += (stream->buffer->length - remaining);
}
开发者ID:AniLeo,项目名称:rpcs3,代码行数:12,代码来源:cellPngDec.cpp
示例7: row_callback
static void row_callback(png_structp png_s, png_bytep new_row,
png_uint_32 row_num, int pass)
{
nspng_content *png_c = png_get_progressive_ptr(png_s);
unsigned long rowbytes = png_c->rowbytes;
unsigned char *buffer, *row;
/* Give up if there's no bitmap */
if (png_c->bitmap == NULL)
return;
/* Abort if we've not got any data */
if (new_row == NULL)
return;
/* Get bitmap buffer */
buffer = bitmap_get_buffer(png_c->bitmap);
if (buffer == NULL) {
/* No buffer, bail out */
longjmp(png_jmpbuf(png_s), 1);
}
/* Calculate address of row start */
row = buffer + (png_c->rowstride * row_num);
/* Handle interlaced sprites using the Adam7 algorithm */
if (png_c->interlace) {
unsigned long dst_off;
unsigned long src_off = 0;
unsigned int start, step;
start = interlace_start[pass];
step = interlace_step[pass];
row_num = interlace_row_start[pass] +
interlace_row_step[pass] * row_num;
/* Copy the data to our current row taking interlacing
* into consideration */
row = buffer + (png_c->rowstride * row_num);
for (dst_off = start; dst_off < rowbytes; dst_off += step) {
row[dst_off++] = new_row[src_off++];
row[dst_off++] = new_row[src_off++];
row[dst_off++] = new_row[src_off++];
row[dst_off++] = new_row[src_off++];
}
} else {
/* Do a fast memcpy of the row data */
memcpy(row, new_row, rowbytes);
}
}
开发者ID:bkeepers,项目名称:cheribsd,代码行数:51,代码来源:png.c
示例8: row_callback
void PngReader::row_callback(
png_structp png, png_bytep row,
png_uint_32 rowpos, int pass )
{
if( !row )
{
return;
}
PngReader* reader =
( PngReader* )png_get_progressive_ptr( png );
png_progressive_combine_row(
png,
reader->m_data->m_data +
reader->m_stride * ( reader->m_height - rowpos - 1 ),
row );
}
开发者ID:delfigamer,项目名称:mist,代码行数:16,代码来源:pngreader.cpp
示例9: _png_get_row_func
static void _png_get_row_func(png_structp png_ptr,
png_bytep new_row,
png_uint_32 row_num,
int pass) {
FXPNG_Context* p = (FXPNG_Context*)png_get_progressive_ptr(png_ptr);
if (!p)
return;
CCodec_PngModule* pModule = (CCodec_PngModule*)p->parent_ptr;
uint8_t* src_buf = nullptr;
if (!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) {
png_error(png_ptr, "Ask Scanline buffer Callback Error");
}
if (src_buf) {
png_progressive_combine_row(png_ptr, src_buf, new_row);
}
pModule->FillScanlineBufCompletedCallback(p->child_ptr, pass, row_num);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:18,代码来源:fx_codec_png.cpp
示例10: decode
bool decode(const SharedBuffer& data, bool sizeOnly)
{
m_decodingSizeOnly = sizeOnly;
PNGImageDecoder* decoder = static_cast<PNGImageDecoder*>(png_get_progressive_ptr(m_png));
// We need to do the setjmp here. Otherwise bad things will happen.
if (setjmp(JMPBUF(m_png)))
return decoder->setFailed();
const char* segment;
while (unsigned segmentLength = data.getSomeData(segment, m_readOffset)) {
m_readOffset += segmentLength;
m_currentBufferSize = m_readOffset;
png_process_data(m_png, m_info, reinterpret_cast<png_bytep>(const_cast<char*>(segment)), segmentLength);
// We explicitly specify the superclass isSizeAvailable() because we
// merely want to check if we've managed to set the size, not
// (recursively) trigger additional decoding if we haven't.
if (sizeOnly ? decoder->ImageDecoder::isSizeAvailable() : decoder->isComplete())
return true;
}
return false;
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:22,代码来源:PNGImageDecoder.cpp
示例11: png_row_callback
/* Called for each row; note that you will get duplicate row numbers
for interlaced PNGs */
static void
png_row_callback (png_structp png_read_ptr,
png_bytep new_row,
png_uint_32 row_num,
int pass_num)
{
LoadContext* lc;
guchar* old_row = NULL;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
if (row_num >= lc->pixbuf->height) {
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Fatal error reading PNG image file"));
}
return;
}
if (lc->first_row_seen_in_chunk < 0) {
lc->first_row_seen_in_chunk = row_num;
lc->first_pass_seen_in_chunk = pass_num;
}
lc->max_row_seen_in_chunk = MAX(lc->max_row_seen_in_chunk, ((gint)row_num));
lc->last_row_seen_in_chunk = row_num;
lc->last_pass_seen_in_chunk = pass_num;
old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
}
开发者ID:YueLinHo,项目名称:MB3Gdk-pixbuf,代码行数:40,代码来源:io-png.c
示例12: info_callback
void PngReader::info_callback(
png_structp png, png_infop info )
{
PngReader* reader =
( PngReader* )png_get_progressive_ptr( png );
int bitdepth;
int colortype;
png_get_IHDR( png, info,
( png_uint_32* )&reader->m_width,
( png_uint_32* )&reader->m_height,
&bitdepth, &colortype, 0, 0, 0 );
formattable[ reader->m_format ].setformat(
png, info, bitdepth, colortype );
png_set_interlace_handling( png );
png_read_update_info( png, info );
reader->m_stride =
reader->m_width *
formattable[ reader->m_format ].pixelstride;
size_t size = reader->m_stride * reader->m_height;
reader->m_data = DataBuffer::create(
size, size, 0 );
memset( reader->m_data->m_data, 0, size );
}
开发者ID:delfigamer,项目名称:mist,代码行数:23,代码来源:pngreader.cpp
示例13: pngDecRowCallback
void pngDecRowCallback(png_structp png_ptr, png_bytep new_row, png_uint_32 row_num, int pass)
{
PngStream* stream = (PngStream*)png_get_progressive_ptr(png_ptr);
if (!stream)
{
cellPngDec.error("Failed to obtain streamPtr in rowCallback.");
return;
}
// we have to check this everytime as this func can be called multiple times per row, and/or only once per row
if (stream->nextRow + stream->outputCounts == row_num)
stream->nextRow = row_num;
if (stream->ppuContext && (stream->nextRow == row_num || pass > 0))
{
if (pass > 0 )
{
stream->cbDispInfo->scanPassCount = pass;
stream->cbDispInfo->nextOutputStartY = row_num;
}
else {
stream->cbDispInfo->scanPassCount = 0;
stream->cbDispInfo->nextOutputStartY = 0;
}
stream->cbDispInfo->outputImage = stream->cbDispParam->nextOutputImage;
stream->cbCtrlDisp.cbCtrlDispFunc(*stream->ppuContext, stream->cbDispInfo, stream->cbDispParam, stream->cbCtrlDisp.cbCtrlDispArg);
stream->cbDispInfo->outputStartY = row_num;
}
u8* data;
if (pass > 0)
data = static_cast<u8*>(stream->cbDispParam->nextOutputImage.get_ptr());
else
data = static_cast<u8*>(stream->cbDispParam->nextOutputImage.get_ptr()) + ((row_num - stream->cbDispInfo->outputStartY) * stream->cbDispInfo->outputFrameWidthByte);
png_progressive_combine_row(png_ptr, data, new_row);
}
开发者ID:AniLeo,项目名称:rpcs3,代码行数:37,代码来源:cellPngDec.cpp
示例14: info_callback
/**
* info_callback -- PNG header has been completely received, prepare to process
* image data
*/
static void info_callback(png_structp png_s, png_infop info)
{
int interlace;
png_uint_32 width, height;
nspng_content *png_c = png_get_progressive_ptr(png_s);
width = png_get_image_width(png_s, info);
height = png_get_image_height(png_s, info);
interlace = png_get_interlace_type(png_s, info);
png_c->base.width = width;
png_c->base.height = height;
png_c->base.size += width * height * 4;
/* see if progressive-conversion should continue */
if (image_cache_speculate((struct content *)png_c) == false) {
longjmp(png_jmpbuf(png_s), CBERR_NOPRE);
}
/* Claim the required memory for the converted PNG */
png_c->bitmap = bitmap_create(width, height, BITMAP_NEW);
if (png_c->bitmap == NULL) {
/* Failed to create bitmap skip pre-conversion */
longjmp(png_jmpbuf(png_s), CBERR_NOPRE);
}
png_c->rowstride = bitmap_get_rowstride(png_c->bitmap);
png_c->bpp = bitmap_get_bpp(png_c->bitmap);
nspng_setup_transforms(png_s, info);
png_c->rowbytes = png_get_rowbytes(png_s, info);
png_c->interlace = (interlace == PNG_INTERLACE_ADAM7);
LOG(("size %li * %li, rowbytes %zu", (unsigned long)width,
(unsigned long)height, png_c->rowbytes));
}
开发者ID:bkeepers,项目名称:cheribsd,代码行数:41,代码来源:png.c
示例15: readpng2_info_callback
static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
{
mainprog_info *mainprog_ptr;
int color_type, bit_depth;
png_uint_32 width, height;
#ifdef PNG_FLOATING_POINT_SUPPORTED
double gamma;
#else
png_fixed_point gamma;
#endif
/* setjmp() doesn't make sense here, because we'd either have to exit(),
* longjmp() ourselves, or return control to libpng, which doesn't want
* to see us again. By not doing anything here, libpng will instead jump
* to readpng2_decode_data(), which can return an error value to the main
* program. */
/* retrieve the pointer to our special-purpose struct, using the png_ptr
* that libpng passed back to us (i.e., not a global this time--there's
* no real difference for a single image, but for a multithreaded browser
* decoding several PNG images at the same time, one needs to avoid mixing
* up different images' structs) */
mainprog_ptr = png_get_progressive_ptr(png_ptr);
if (mainprog_ptr == NULL) { /* we be hosed */
fprintf(stderr,
"readpng2 error: main struct not recoverable in info_callback.\n");
fflush(stderr);
return;
/*
* Alternatively, we could call our error-handler just like libpng
* does, which would effectively terminate the program. Since this
* can only happen if png_ptr gets redirected somewhere odd or the
* main PNG struct gets wiped, we're probably toast anyway. (If
* png_ptr itself is NULL, we would not have been called.)
*/
}
/* this is just like in the non-progressive case */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
NULL, NULL, NULL);
mainprog_ptr->width = (ulg)width;
mainprog_ptr->height = (ulg)height;
/* since we know we've read all of the PNG file's "header" (i.e., up
* to IDAT), we can check for a background color here */
if (mainprog_ptr->need_bgcolor &&
png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD))
{
png_color_16p pBackground;
/* it is not obvious from the libpng documentation, but this function
* takes a pointer to a pointer, and it always returns valid red,
* green and blue values, regardless of color_type: */
png_get_bKGD(png_ptr, info_ptr, &pBackground);
/* however, it always returns the raw bKGD data, regardless of any
* bit-depth transformations, so check depth and adjust if necessary */
if (bit_depth == 16) {
mainprog_ptr->bg_red = pBackground->red >> 8;
mainprog_ptr->bg_green = pBackground->green >> 8;
mainprog_ptr->bg_blue = pBackground->blue >> 8;
} else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
开发者ID:9heart,项目名称:DT3,代码行数:70,代码来源:readpng2.c
示例16: _png_get_header_func
static void _png_get_header_func(png_structp png_ptr, png_infop info_ptr) {
FXPNG_Context* p = (FXPNG_Context*)png_get_progressive_ptr(png_ptr);
if (!p)
return;
CCodec_PngModule* pModule = (CCodec_PngModule*)p->parent_ptr;
if (!pModule)
return;
png_uint_32 width = 0, height = 0;
int bpc = 0, color_type = 0, color_type1 = 0, pass = 0;
double gamma = 1.0;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bpc, &color_type, nullptr,
nullptr, nullptr);
color_type1 = color_type;
if (bpc > 8) {
png_set_strip_16(png_ptr);
} else if (bpc < 8) {
png_set_expand_gray_1_2_4_to_8(png_ptr);
}
bpc = 8;
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_palette_to_rgb(png_ptr);
}
pass = png_set_interlace_handling(png_ptr);
if (!pModule->ReadHeaderCallback(p->child_ptr, width, height, bpc, pass,
&color_type, &gamma)) {
png_error(p->png_ptr, "Read Header Callback Error");
}
int intent;
if (png_get_sRGB(png_ptr, info_ptr, &intent)) {
png_set_gamma(png_ptr, gamma, 0.45455);
} else {
double image_gamma;
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma)) {
png_set_gamma(png_ptr, gamma, image_gamma);
} else {
png_set_gamma(png_ptr, gamma, 0.45455);
}
}
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
case PNG_COLOR_TYPE_GRAY_ALPHA: {
if (color_type1 & PNG_COLOR_MASK_COLOR) {
png_set_rgb_to_gray(png_ptr, 1, 0.299, 0.587);
}
} break;
case PNG_COLOR_TYPE_PALETTE:
if (color_type1 != PNG_COLOR_TYPE_PALETTE) {
png_error(p->png_ptr, "Not Support Output Palette Now");
}
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
if (!(color_type1 & PNG_COLOR_MASK_COLOR)) {
png_set_gray_to_rgb(png_ptr);
}
png_set_bgr(png_ptr);
break;
}
if (!(color_type & PNG_COLOR_MASK_ALPHA)) {
png_set_strip_alpha(png_ptr);
}
if (color_type & PNG_COLOR_MASK_ALPHA &&
!(color_type1 & PNG_COLOR_MASK_ALPHA)) {
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
}
png_read_update_info(png_ptr, info_ptr);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:68,代码来源:fx_codec_png.cpp
示例17: decodingFailed
void decodingFailed(png_structp png, png_const_charp errorMsg)
{
static_cast<PNGImageDecoder*>(png_get_progressive_ptr(png))->decodingFailed();
longjmp(png->jmpbuf, 1);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:5,代码来源:BCPNGImageDecoderWK.cpp
示例18: InfoCallback
/**
* Supplied to libpng to call when it has read enough data to determine
* bounds.
*/
static void InfoCallback(png_structp png_ptr, png_infop info_ptr) {
// png_get_progressive_ptr returns the pointer we set on the png_ptr with
// png_set_progressive_read_fn
static_cast<AutoCleanPng*>(png_get_progressive_ptr(png_ptr))->infoCallback();
}
开发者ID:ydzydz,项目名称:skia,代码行数:9,代码来源:SkPngCodec.cpp
示例19: png_info_callback
/* Called at the start of the progressive load, once we have image info */
static void
png_info_callback (png_structp png_read_ptr,
png_infop png_info_ptr)
{
LoadContext* lc;
png_uint_32 width, height;
png_textp png_text_ptr;
int i, num_texts;
int color_type;
gboolean have_alpha = FALSE;
gchar *icc_profile_base64;
const gchar *icc_profile_title;
const gchar *icc_profile;
png_uint_32 icc_profile_size;
guint32 retval;
gint compression_type;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
if (!setup_png_transformations(lc->png_read_ptr,
lc->png_info_ptr,
lc->error,
&width, &height, &color_type)) {
lc->fatal_error_occurred = TRUE;
return;
}
/* If we have alpha, set a flag */
if (color_type & PNG_COLOR_MASK_ALPHA)
have_alpha = TRUE;
if (lc->size_func) {
gint w = width;
gint h = height;
(* lc->size_func) (&w, &h, lc->notify_user_data);
if (w == 0 || h == 0) {
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Transformed PNG has zero width or height."));
}
return;
}
}
lc->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
if (lc->pixbuf == NULL) {
/* Failed to allocate memory */
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to store a %lu by %lu image; try exiting some applications to reduce memory usage"),
(gulong) width, (gulong) height);
}
return;
}
/* Extract text chunks and attach them as pixbuf options */
if (png_get_text (png_read_ptr, png_info_ptr, &png_text_ptr, &num_texts)) {
for (i = 0; i < num_texts; i++) {
gchar *key, *value;
if (png_text_to_pixbuf_option (png_text_ptr[i],
&key, &value)) {
gdk_pixbuf_set_option (lc->pixbuf, key, value);
g_free (key);
g_free (value);
}
}
}
#if defined(PNG_cHRM_SUPPORTED)
/* Extract embedded ICC profile */
retval = png_get_iCCP (png_read_ptr, png_info_ptr,
(png_charpp) &icc_profile_title, &compression_type,
(png_bytepp) &icc_profile, &icc_profile_size);
if (retval != 0) {
icc_profile_base64 = g_base64_encode ((const guchar *) icc_profile, (gsize)icc_profile_size);
gdk_pixbuf_set_option (lc->pixbuf, "icc-profile", icc_profile_base64);
g_free (icc_profile_base64);
}
#endif
/* Notify the client that we are ready to go */
if (lc->prepare_func)
(* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data);
return;
//.........这里部分代码省略.........
开发者ID:YueLinHo,项目名称:MB3Gdk-pixbuf,代码行数:101,代码来源:io-png.c
示例20: GetDecoder
static SkPngNormalDecoder* GetDecoder(png_structp png_ptr) {
return static_cast<SkPngNormalDecoder*>(png_get_progressive_ptr(png_ptr));
}
开发者ID:ydzydz,项目名称:skia,代码行数:3,代码来源:SkPngCodec.cpp
注:本文中的png_get_progressive_ptr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论