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

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

Issue 2556723003: Merge color options into ColorBehavior (Closed)
Patch Set: Feedback Created 4 years 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::ColorSpaceTransformed, 333 ColorBehavior::transformToTargetForTesting());
334 ImageDecoder::targetColorSpaceForTesting());
335 334
336 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1); 335 SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1);
337 336
338 size_t rowBytes = pixInfo.minRowBytes(); 337 size_t rowBytes = pixInfo.minRowBytes();
339 size_t size = pixInfo.getSafeSize(rowBytes); 338 size_t size = pixInfo.getSafeSize(rowBytes);
340 339
341 Vector<char> storage(size); 340 Vector<char> storage(size);
342 SkPixmap pixmap(pixInfo, storage.data(), rowBytes); 341 SkPixmap pixmap(pixInfo, storage.data(), rowBytes);
343 342
344 // 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
381 SharedBuffer::create(m_data->data(), m_data->size()); 380 SharedBuffer::create(m_data->data(), m_data->size());
382 EXPECT_EQ(originalData->size(), m_data->size()); 381 EXPECT_EQ(originalData->size(), m_data->size());
383 m_lazyDecoder->setData(originalData, false); 382 m_lazyDecoder->setData(originalData, false);
384 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); 383 RefPtr<SharedBuffer> newData = m_lazyDecoder->data();
385 EXPECT_EQ(originalData->size(), newData->size()); 384 EXPECT_EQ(originalData->size(), newData->size());
386 EXPECT_EQ( 385 EXPECT_EQ(
387 0, std::memcmp(originalData->data(), newData->data(), newData->size())); 386 0, std::memcmp(originalData->data(), newData->data(), newData->size()));
388 } 387 }
389 388
390 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698