mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 17:27:35 +00:00
LibDraw: Remove old PNG_STOPWATCH_DEBUG debug code
This commit is contained in:
parent
1060d59ddd
commit
5b992b130a
1 changed files with 81 additions and 106 deletions
|
@ -37,8 +37,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//#define PNG_STOPWATCH_DEBUG
|
||||
|
||||
static const u8 png_header[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
|
||||
|
||||
struct PNG_IHDR {
|
||||
|
@ -301,10 +299,6 @@ template<bool has_alpha, u8 filter_type>
|
|||
|
||||
[[gnu::noinline]] static void unfilter(PNGLoadingContext& context)
|
||||
{
|
||||
{
|
||||
#ifdef PNG_STOPWATCH_DEBUG
|
||||
Stopwatch sw("load_png_impl: unfilter: unpack");
|
||||
#endif
|
||||
// First unpack the scanlines to RGBA:
|
||||
switch (context.color_type) {
|
||||
case 2:
|
||||
|
@ -374,13 +368,9 @@ template<bool has_alpha, u8 filter_type>
|
|||
ASSERT_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto dummy_scanline = ByteBuffer::create_zeroed(context.width * sizeof(RGBA32));
|
||||
|
||||
#ifdef PNG_STOPWATCH_DEBUG
|
||||
Stopwatch sw("load_png_impl: unfilter: process");
|
||||
#endif
|
||||
for (int y = 0; y < context.height; ++y) {
|
||||
auto filter = context.scanlines[y].filter;
|
||||
if (filter == 0) {
|
||||
|
@ -501,10 +491,6 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
|
|||
if (context.state >= PNGLoadingContext::State::BitmapDecoded)
|
||||
return true;
|
||||
|
||||
{
|
||||
#ifdef PNG_STOPWATCH_DEBUG
|
||||
Stopwatch sw("load_png_impl: uncompress");
|
||||
#endif
|
||||
unsigned long srclen = context.compressed_data.size() - 6;
|
||||
unsigned long destlen = context.decompression_buffer_size;
|
||||
int ret = puff(context.decompression_buffer, &destlen, context.compressed_data.data() + 2, &srclen);
|
||||
|
@ -513,12 +499,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
|
|||
return false;
|
||||
}
|
||||
context.compressed_data.clear();
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef PNG_STOPWATCH_DEBUG
|
||||
Stopwatch sw("load_png_impl: extract scanlines");
|
||||
#endif
|
||||
context.scanlines.ensure_capacity(context.height);
|
||||
Streamer streamer(context.decompression_buffer, context.decompression_buffer_size);
|
||||
for (int y = 0; y < context.height; ++y) {
|
||||
|
@ -535,14 +516,8 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef PNG_STOPWATCH_DEBUG
|
||||
Stopwatch sw("load_png_impl: create bitmap");
|
||||
#endif
|
||||
context.bitmap = GraphicsBitmap::create_purgeable(context.has_alpha() ? GraphicsBitmap::Format::RGBA32 : GraphicsBitmap::Format::RGB32, { context.width, context.height });
|
||||
}
|
||||
|
||||
unfilter(context);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue