DisplayPNGUtil.cpp revision c7814cf6e1240a519cbec0441e033d0e2470ed00
/* $Id$ */
/** @file
* PNG utilities
*/
/*
* Copyright (C) 2010-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "Logging.h"
#include "DisplayImpl.h"
#include <png.h>
#define kMaxSizePNG 1024
typedef struct PNGWriteCtx
{
int rc;
} PNGWriteCtx;
{
{
{
if (!pNew)
{
return;
}
}
}
}
{
/* Do nothing. */
}
{
int rc = VINF_SUCCESS;
{
/* Save unscaled screenshot. */
}
else
{
/* Large screenshot, scale. */
{
}
else
{
}
if (pu8Bitmap)
{
src,
}
else
{
rc = VERR_NO_MEMORY;
}
}
if (RT_SUCCESS(rc))
{
if (row_pointers)
{
if (png_ptr)
{
if (info_ptr)
{
{
ctx.cbAllocated = 0;
unsigned i = 0;
{
row_pointers[i] = row_pointer;
}
if (RT_SUCCESS(rc))
{
}
}
else
{
}
}
else
{
rc = VERR_NO_MEMORY;
}
: (png_infopp)NULL);
}
else
{
rc = VERR_NO_MEMORY;
}
}
else
{
rc = VERR_NO_MEMORY;
}
}
{
}
return rc;
}