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

Side by Side Diff: tests/ImageIsOpaqueTest.cpp

Issue 2085653003: Enable flattening and unflattening of SkColorSpace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit tests 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 unified diff | Download patch
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 13 matching lines...) Expand all
24 SkASSERT(wb.bytesWritten() < sizeof(storage)); 24 SkASSERT(wb.bytesWritten() < sizeof(storage));
25 25
26 SkReadBuffer rb(storage, wb.bytesWritten()); 26 SkReadBuffer rb(storage, wb.bytesWritten());
27 27
28 // pick a noisy byte pattern, so we ensure that unflatten sets all of our fi elds 28 // pick a noisy byte pattern, so we ensure that unflatten sets all of our fi elds
29 SkImageInfo info2 = SkImageInfo::Make(0xB8, 0xB8, (SkColorType) 0xB8, (SkAlp haType) 0xB8); 29 SkImageInfo info2 = SkImageInfo::Make(0xB8, 0xB8, (SkColorType) 0xB8, (SkAlp haType) 0xB8);
30 30
31 info2.unflatten(rb); 31 info2.unflatten(rb);
32 REPORTER_ASSERT(reporter, rb.offset() == wb.bytesWritten()); 32 REPORTER_ASSERT(reporter, rb.offset() == wb.bytesWritten());
33 33
34 // FIXME (msarett): 34 REPORTER_ASSERT(reporter, info == info2);
35 // Support flatten/unflatten of SkColorSpace objects.
36 REPORTER_ASSERT(reporter, info.makeColorSpace(nullptr) == info2.makeColorSpa ce(nullptr));
37 } 35 }
38 36
39 DEF_TEST(ImageInfo_flattening, reporter) { 37 DEF_TEST(ImageInfo_flattening, reporter) {
40 sk_sp<SkColorSpace> spaces[] = { 38 sk_sp<SkColorSpace> spaces[] = {
41 nullptr, 39 nullptr,
42 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named), 40 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named),
43 SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named), 41 SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named),
44 }; 42 };
45 43
46 for (int ct = 0; ct <= kLastEnum_SkColorType; ++ct) { 44 for (int ct = 0; ct <= kLastEnum_SkColorType; ++ct) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo , infoTransparent)); 78 auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo , infoTransparent));
81 check_isopaque(reporter, surfaceTransparent, false); 79 check_isopaque(reporter, surfaceTransparent, false);
82 80
83 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); 81 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
84 auto surfaceOpaque(SkSurface::MakeRenderTarget(context,SkBudgeted::kNo, info Opaque)); 82 auto surfaceOpaque(SkSurface::MakeRenderTarget(context,SkBudgeted::kNo, info Opaque));
85 83
86 check_isopaque(reporter, surfaceOpaque, true); 84 check_isopaque(reporter, surfaceOpaque, true);
87 } 85 }
88 86
89 #endif 87 #endif
OLDNEW
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698