| OLD | NEW |
| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 int compare = std::memcmp(converted_pixel.get(), transformed_pixel.get(), | 492 int compare = std::memcmp(converted_pixel.get(), transformed_pixel.get(), |
| 493 image_info.bytesPerPixel()); | 493 image_info.bytesPerPixel()); |
| 494 ASSERT_EQ(compare, 0); | 494 ASSERT_EQ(compare, 0); |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 TEST_F(ImageBitmapTest, ImageBitmapColorSpaceConversionImageData) { | 498 TEST_F(ImageBitmapTest, ImageBitmapColorSpaceConversionImageData) { |
| 499 unsigned char data_buffer[4] = {255, 0, 0, 255}; | 499 unsigned char data_buffer[4] = {255, 0, 0, 255}; |
| 500 DOMUint8ClampedArray* data = DOMUint8ClampedArray::Create(data_buffer, 4); | 500 DOMUint8ClampedArray* data = DOMUint8ClampedArray::Create(data_buffer, 4); |
| 501 ImageData* image_data = | 501 ImageData* image_data = ImageData::Create(IntSize(1, 1), data); |
| 502 ImageData::Create(IntSize(1, 1), NotShared<DOMUint8ClampedArray>(data)); | |
| 503 std::unique_ptr<uint8_t[]> src_pixel(new uint8_t[4]()); | 502 std::unique_ptr<uint8_t[]> src_pixel(new uint8_t[4]()); |
| 504 memcpy(src_pixel.get(), image_data->data()->Data(), 4); | 503 memcpy(src_pixel.get(), image_data->data()->Data(), 4); |
| 505 | 504 |
| 506 Optional<IntRect> crop_rect = IntRect(0, 0, 1, 1); | 505 Optional<IntRect> crop_rect = IntRect(0, 0, 1, 1); |
| 507 sk_sp<SkColorSpace> color_space = nullptr; | 506 sk_sp<SkColorSpace> color_space = nullptr; |
| 508 SkColorSpaceXform::ColorFormat color_format32 = | 507 SkColorSpaceXform::ColorFormat color_format32 = |
| 509 (SkColorType::kN32_SkColorType == kBGRA_8888_SkColorType) | 508 (SkColorType::kN32_SkColorType == kBGRA_8888_SkColorType) |
| 510 ? SkColorSpaceXform::ColorFormat::kBGRA_8888_ColorFormat | 509 ? SkColorSpaceXform::ColorFormat::kBGRA_8888_ColorFormat |
| 511 : SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat; | 510 : SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat; |
| 512 SkColorType color_type = SkColorType::kN32_SkColorType; | 511 SkColorType color_type = SkColorType::kN32_SkColorType; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 color_space_xform->apply(color_format, transformed_pixel.get(), | 560 color_space_xform->apply(color_format, transformed_pixel.get(), |
| 562 color_format32, src_pixel.get(), 1, | 561 color_format32, src_pixel.get(), 1, |
| 563 SkAlphaType::kUnpremul_SkAlphaType); | 562 SkAlphaType::kUnpremul_SkAlphaType); |
| 564 int compare = std::memcmp(converted_pixel.get(), transformed_pixel.get(), | 563 int compare = std::memcmp(converted_pixel.get(), transformed_pixel.get(), |
| 565 image_info.bytesPerPixel()); | 564 image_info.bytesPerPixel()); |
| 566 ASSERT_EQ(compare, 0); | 565 ASSERT_EQ(compare, 0); |
| 567 } | 566 } |
| 568 } | 567 } |
| 569 | 568 |
| 570 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |