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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp

Issue 2728373004: Remove Float32ImageData and update ImageData for color management (Closed)
Patch Set: Addressing comments Created 3 years, 9 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(), 484 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(),
485 imageInfo.bytesPerPixel()); 485 imageInfo.bytesPerPixel());
486 ASSERT_EQ(compare, 0); 486 ASSERT_EQ(compare, 0);
487 } 487 }
488 } 488 }
489 489
490 TEST_F(ImageBitmapTest, ImageBitmapColorSpaceConversionImageData) { 490 TEST_F(ImageBitmapTest, ImageBitmapColorSpaceConversionImageData) {
491 unsigned char dataBuffer[4] = {255, 0, 0, 255}; 491 unsigned char dataBuffer[4] = {255, 0, 0, 255};
492 DOMUint8ClampedArray* data = DOMUint8ClampedArray::create(dataBuffer, 4); 492 DOMUint8ClampedArray* data = DOMUint8ClampedArray::create(dataBuffer, 4);
493 ImageData* imageData = 493 ImageData* imageData = ImageData::create(IntSize(1, 1), data);
494 ImageData::create(IntSize(1, 1), data, kLegacyImageDataColorSpaceName);
495 std::unique_ptr<uint8_t[]> srcPixel(new uint8_t[4]()); 494 std::unique_ptr<uint8_t[]> srcPixel(new uint8_t[4]());
496 memcpy(srcPixel.get(), imageData->data()->data(), 4); 495 memcpy(srcPixel.get(), imageData->data()->data(), 4);
497 496
498 Optional<IntRect> cropRect = IntRect(0, 0, 1, 1); 497 Optional<IntRect> cropRect = IntRect(0, 0, 1, 1);
499 sk_sp<SkColorSpace> colorSpace = nullptr; 498 sk_sp<SkColorSpace> colorSpace = nullptr;
500 SkColorSpaceXform::ColorFormat colorFormat32 = 499 SkColorSpaceXform::ColorFormat colorFormat32 =
501 (SkColorType::kN32_SkColorType == kBGRA_8888_SkColorType) 500 (SkColorType::kN32_SkColorType == kBGRA_8888_SkColorType)
502 ? SkColorSpaceXform::ColorFormat::kBGRA_8888_ColorFormat 501 ? SkColorSpaceXform::ColorFormat::kBGRA_8888_ColorFormat
503 : SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat; 502 : SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat;
504 SkColorType colorType = SkColorType::kN32_SkColorType; 503 SkColorType colorType = SkColorType::kN32_SkColorType;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32, 551 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32,
553 srcPixel.get(), 1, 552 srcPixel.get(), 1,
554 SkAlphaType::kUnpremul_SkAlphaType); 553 SkAlphaType::kUnpremul_SkAlphaType);
555 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(), 554 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(),
556 imageInfo.bytesPerPixel()); 555 imageInfo.bytesPerPixel());
557 ASSERT_EQ(compare, 0); 556 ASSERT_EQ(compare, 0);
558 } 557 }
559 } 558 }
560 559
561 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698