OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 m_frameCount = 2; | 353 m_frameCount = 2; |
354 m_lazyDecoder->setData(*m_data, false); | 354 m_lazyDecoder->setData(*m_data, false); |
355 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 355 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
356 m_frameCount = 0; | 356 m_frameCount = 0; |
357 m_lazyDecoder->setData(*m_data, true); | 357 m_lazyDecoder->setData(*m_data, true); |
358 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 358 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
359 } | 359 } |
360 | 360 |
361 TEST_F(DeferredImageDecoderTest, frameOpacity) | 361 TEST_F(DeferredImageDecoderTest, frameOpacity) |
362 { | 362 { |
363 std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(*m_data, | 363 std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(ImageDeco
der::determineImageType(*m_data), |
364 ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileAppl
ied); | 364 ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileAppl
ied); |
365 std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create
ForTesting(std::move(actualDecoder)); | 365 std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create
ForTesting(std::move(actualDecoder)); |
366 decoder->setData(*m_data, true); | 366 decoder->setData(*m_data, true); |
367 | 367 |
368 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1); | 368 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1); |
369 | 369 |
370 size_t rowBytes = pixInfo.minRowBytes(); | 370 size_t rowBytes = pixInfo.minRowBytes(); |
371 size_t size = pixInfo.getSafeSize(rowBytes); | 371 size_t size = pixInfo.getSafeSize(rowBytes); |
372 | 372 |
373 SkAutoMalloc storage(size); | 373 SkAutoMalloc storage(size); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 { | 413 { |
414 RefPtr<SharedBuffer> originalData = SharedBuffer::create(m_data->data(), m_d
ata->size()); | 414 RefPtr<SharedBuffer> originalData = SharedBuffer::create(m_data->data(), m_d
ata->size()); |
415 EXPECT_EQ(originalData->size(), m_data->size()); | 415 EXPECT_EQ(originalData->size(), m_data->size()); |
416 m_lazyDecoder->setData(*originalData, false); | 416 m_lazyDecoder->setData(*originalData, false); |
417 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); | 417 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); |
418 EXPECT_EQ(originalData->size(), newData->size()); | 418 EXPECT_EQ(originalData->size(), newData->size()); |
419 EXPECT_EQ(0, std::memcmp(originalData->data(), newData->data(), newData->siz
e())); | 419 EXPECT_EQ(0, std::memcmp(originalData->data(), newData->data(), newData->siz
e())); |
420 } | 420 } |
421 | 421 |
422 } // namespace blink | 422 } // namespace blink |
OLD | NEW |