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

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

Issue 2771813003: Prepare ImageData for color managed BaseRenderingContext2D::create/put/get-ImageData (Closed)
Patch Set: Fixing issues Created 3 years, 8 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 1, 1, colorType, SkAlphaType::kUnpremul_SkAlphaType, colorSpace); 538 1, 1, colorType, SkAlphaType::kUnpremul_SkAlphaType, colorSpace);
539 std::unique_ptr<uint8_t[]> convertedPixel( 539 std::unique_ptr<uint8_t[]> convertedPixel(
540 new uint8_t[imageInfo.bytesPerPixel()]()); 540 new uint8_t[imageInfo.bytesPerPixel()]());
541 convertedImage->readPixels( 541 convertedImage->readPixels(
542 imageInfo, convertedPixel.get(), 542 imageInfo, convertedPixel.get(),
543 convertedImage->width() * imageInfo.bytesPerPixel(), 0, 0); 543 convertedImage->width() * imageInfo.bytesPerPixel(), 0, 0);
544 544
545 // Transform the source pixel and check if the pixel from image bitmap has 545 // Transform the source pixel and check if the pixel from image bitmap has
546 // the same color information. 546 // the same color information.
547 std::unique_ptr<SkColorSpaceXform> colorSpaceXform = SkColorSpaceXform::New( 547 std::unique_ptr<SkColorSpaceXform> colorSpaceXform = SkColorSpaceXform::New(
548 imageData->getSkColorSpace().get(), colorSpace.get()); 548 imageData->skColorSpace().get(), colorSpace.get());
549 std::unique_ptr<uint8_t[]> transformedPixel( 549 std::unique_ptr<uint8_t[]> transformedPixel(
550 new uint8_t[imageInfo.bytesPerPixel()]()); 550 new uint8_t[imageInfo.bytesPerPixel()]());
551 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32, 551 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32,
552 srcPixel.get(), 1, 552 srcPixel.get(), 1,
553 SkAlphaType::kUnpremul_SkAlphaType); 553 SkAlphaType::kUnpremul_SkAlphaType);
554 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(), 554 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(),
555 imageInfo.bytesPerPixel()); 555 imageInfo.bytesPerPixel());
556 ASSERT_EQ(compare, 0); 556 ASSERT_EQ(compare, 0);
557 } 557 }
558 } 558 }
559 559
560 } // namespace blink 560 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.cpp ('k') | third_party/WebKit/Source/core/html/ImageData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698