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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Fix legacy ImageFrame Created 4 years, 1 month 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) 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 m_lazyDecoder->setData(m_data, false); 323 m_lazyDecoder->setData(m_data, false);
324 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); 324 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount());
325 m_frameCount = 0; 325 m_frameCount = 0;
326 m_lazyDecoder->setData(m_data, true); 326 m_lazyDecoder->setData(m_data, true);
327 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); 327 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount());
328 } 328 }
329 329
330 TEST_F(DeferredImageDecoderTest, frameOpacity) { 330 TEST_F(DeferredImageDecoderTest, frameOpacity) {
331 std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create( 331 std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create(
332 m_data, true, ImageDecoder::AlphaPremultiplied, 332 m_data, true, ImageDecoder::AlphaPremultiplied,
333 ImageDecoder::GammaAndColorProfileApplied); 333 ImageDecoder::ColorSpaceApplied);
334 334
335 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1); 335 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1);
336 336
337 size_t rowBytes = pixInfo.minRowBytes(); 337 size_t rowBytes = pixInfo.minRowBytes();
338 size_t size = pixInfo.getSafeSize(rowBytes); 338 size_t size = pixInfo.getSafeSize(rowBytes);
339 339
340 SkAutoMalloc storage(size); 340 SkAutoMalloc storage(size);
341 SkPixmap pixmap(pixInfo, storage.get(), rowBytes); 341 SkPixmap pixmap(pixInfo, storage.get(), rowBytes);
342 342
343 // Before decoding, the frame is not known to be opaque. 343 // Before decoding, the frame is not known to be opaque.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 SharedBuffer::create(m_data->data(), m_data->size()); 380 SharedBuffer::create(m_data->data(), m_data->size());
381 EXPECT_EQ(originalData->size(), m_data->size()); 381 EXPECT_EQ(originalData->size(), m_data->size());
382 m_lazyDecoder->setData(originalData, false); 382 m_lazyDecoder->setData(originalData, false);
383 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); 383 RefPtr<SharedBuffer> newData = m_lazyDecoder->data();
384 EXPECT_EQ(originalData->size(), newData->size()); 384 EXPECT_EQ(originalData->size(), newData->size());
385 EXPECT_EQ( 385 EXPECT_EQ(
386 0, std::memcmp(originalData->data(), newData->data(), newData->size())); 386 0, std::memcmp(originalData->data(), newData->data(), newData->size()));
387 } 387 }
388 388
389 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698