Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: Checking if JPEGImageDecoder::OutputScanlines()'s SetHasAlpha(true) is under test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 ASSERT_TRUE(unpremul_decoder->FrameCount()); 385 ASSERT_TRUE(unpremul_decoder->FrameCount());
386 ImageFrame* premul_frame = premul_decoder->FrameBufferAtIndex(0); 386 ImageFrame* premul_frame = premul_decoder->FrameBufferAtIndex(0);
387 EXPECT_TRUE(premul_frame && 387 EXPECT_TRUE(premul_frame &&
388 premul_frame->GetStatus() != ImageFrame::kFrameComplete); 388 premul_frame->GetStatus() != ImageFrame::kFrameComplete);
389 EXPECT_EQ(premul_frame->Bitmap().alphaType(), kPremul_SkAlphaType); 389 EXPECT_EQ(premul_frame->Bitmap().alphaType(), kPremul_SkAlphaType);
390 ImageFrame* unpremul_frame = unpremul_decoder->FrameBufferAtIndex(0); 390 ImageFrame* unpremul_frame = unpremul_decoder->FrameBufferAtIndex(0);
391 EXPECT_TRUE(unpremul_frame && 391 EXPECT_TRUE(unpremul_frame &&
392 unpremul_frame->GetStatus() != ImageFrame::kFrameComplete); 392 unpremul_frame->GetStatus() != ImageFrame::kFrameComplete);
393 EXPECT_EQ(unpremul_frame->Bitmap().alphaType(), kUnpremul_SkAlphaType); 393 EXPECT_EQ(unpremul_frame->Bitmap().alphaType(), kUnpremul_SkAlphaType);
394 394
395 // Fully decoded frame => the frame alpha type is known (opaque). 395 // Fully decoded frame
396 premul_decoder->SetData(full_data.Get(), true); 396 premul_decoder->SetData(full_data.Get(), true);
397 ASSERT_TRUE(premul_decoder->FrameCount()); 397 ASSERT_TRUE(premul_decoder->FrameCount());
398 unpremul_decoder->SetData(full_data.Get(), true); 398 unpremul_decoder->SetData(full_data.Get(), true);
399 ASSERT_TRUE(unpremul_decoder->FrameCount()); 399 ASSERT_TRUE(unpremul_decoder->FrameCount());
400 premul_frame = premul_decoder->FrameBufferAtIndex(0); 400 premul_frame = premul_decoder->FrameBufferAtIndex(0);
401 EXPECT_TRUE(premul_frame && 401 EXPECT_TRUE(premul_frame &&
402 premul_frame->GetStatus() == ImageFrame::kFrameComplete); 402 premul_frame->GetStatus() == ImageFrame::kFrameComplete);
403 EXPECT_EQ(premul_frame->Bitmap().alphaType(), kOpaque_SkAlphaType); 403 EXPECT_EQ(premul_frame->Bitmap().alphaType(), kOpaque_SkAlphaType);
404 unpremul_frame = unpremul_decoder->FrameBufferAtIndex(0); 404 unpremul_frame = unpremul_decoder->FrameBufferAtIndex(0);
405 EXPECT_TRUE(unpremul_frame && 405 EXPECT_TRUE(unpremul_frame &&
(...skipping 25 matching lines...) Expand all
431 EXPECT_EQ(1u, decoder->FrameCount()); 431 EXPECT_EQ(1u, decoder->FrameCount());
432 ImageFrame* frame = decoder->FrameBufferAtIndex(0); 432 ImageFrame* frame = decoder->FrameBufferAtIndex(0);
433 decoder->SetMemoryAllocator(nullptr); 433 decoder->SetMemoryAllocator(nullptr);
434 434
435 ASSERT_TRUE(frame); 435 ASSERT_TRUE(frame);
436 EXPECT_EQ(IntRect(IntPoint(), decoder->Size()), frame->OriginalFrameRect()); 436 EXPECT_EQ(IntRect(IntPoint(), decoder->Size()), frame->OriginalFrameRect());
437 EXPECT_FALSE(frame->HasAlpha()); 437 EXPECT_FALSE(frame->HasAlpha());
438 } 438 }
439 439
440 } // namespace blink 440 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698