From 9d5629025c91f2668eea162e06cb1c869308e113 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Tue, 24 Jun 2014 20:20:29 +0000 Subject: [PATCH] make alpha-detection loop in IsKeyFrame() in good x/y order Change-Id: Ifeeb855e66c7b6b849e8584787dc24e7371b1e67 --- examples/gif2webp_util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gif2webp_util.c b/examples/gif2webp_util.c index eedad982..e2555f5f 100644 --- a/examples/gif2webp_util.c +++ b/examples/gif2webp_util.c @@ -166,10 +166,10 @@ static int IsKeyFrame(const WebPPicture* const curr, // If previous canvas (with previous frame disposed) is all transparent, // current frame is a key frame. - for (i = 0; i < prev->width; ++i) { - for (j = 0; j < prev->height; ++j) { - const uint32_t prev_alpha = (prev->argb[j * prev->argb_stride + i]) >> 24; - if (prev_alpha != 0) { + for (j = 0; j < prev->height; ++j) { + const uint32_t* const row = &prev->argb[j * prev->argb_stride]; + for (i = 0; i < prev->width; ++i) { + if (row[i] & 0xff000000u) { // has alpha? is_key_frame = 0; break; }