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

Unified Diff: tests/ImageIsOpaqueTest.cpp

Issue 2085653003: Enable flattening and unflattening of SkColorSpace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« src/core/SkColorSpace_Base.h ('K') | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageIsOpaqueTest.cpp
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index 51229bfce3b31a6d40775db96324e586ae5b2f62..7b782eda95a2933b26d209a44949b85c143b1bb2 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -26,25 +26,33 @@ static void test_flatten(skiatest::Reporter* reporter, const SkImageInfo& info)
SkReadBuffer rb(storage, wb.bytesWritten());
// pick a noisy byte pattern, so we ensure that unflatten sets all of our fields
- SkImageInfo info2 = SkImageInfo::Make(0xB8, 0xB8, (SkColorType) 0xB8, (SkAlphaType) 0xB8,
- (SkColorProfileType) 0xB8);
+ SkImageInfo info2 = SkImageInfo::Make(0xB8, 0xB8, (SkColorType) 0xB8, (SkAlphaType) 0xB8);
info2.unflatten(rb);
REPORTER_ASSERT(reporter, rb.offset() == wb.bytesWritten());
- // FIXME (msarett):
- // Support flatten/unflatten of SkColorSpace objects.
- REPORTER_ASSERT(reporter, info.makeColorSpace(nullptr) == info2.makeColorSpace(nullptr));
+ REPORTER_ASSERT(reporter, info == info2);
}
DEF_TEST(ImageInfo_flattening, reporter) {
+ sk_sp<SkColorSpace> spaces[] = {
+ nullptr,
+ SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named),
+ SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named),
+
+ // FIXME (msarett):
+ // We should test more complicated color spaces here. Right now we use a pointer
+ // comparison to check if color spaces are equal, so == only works on the most
+ // basic profiles.
+ };
+
for (int ct = 0; ct <= kLastEnum_SkColorType; ++ct) {
for (int at = 0; at <= kLastEnum_SkAlphaType; ++at) {
- for (int pt = 0; pt <= kLastEnum_SkColorProfileType; ++pt) {
+ for (auto& cs : spaces) {
SkImageInfo info = SkImageInfo::Make(100, 200,
static_cast<SkColorType>(ct),
static_cast<SkAlphaType>(at),
- static_cast<SkColorProfileType>(pt));
+ cs);
test_flatten(reporter, info);
}
}
« src/core/SkColorSpace_Base.h ('K') | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698