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

Side by Side Diff: tests/EXRTest.cpp

Issue 2344523002: Experimental: EXR
Patch Set: Now we have a decoder Created 4 years, 3 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 | « src/images/SkForceLinking.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
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "Resources.h"
9 #include "Test.h"
10
11 #include "SkCodec.h"
12 #include "SkImageEncoder.h"
13
14 static SkStreamAsset* resource(const char path[]) {
15 SkString fullPath = GetResourcePath(path);
16 return SkStream::NewFromFile(fullPath.c_str());
17 }
18
19 static void test(skiatest::Reporter* r, const char* path) {
20 SkAutoTDelete<SkStream> stream(resource(path));
21 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
22 const SkImageInfo& info = codec->getInfo();
23 SkImageInfo infoF16 = info.makeColorType(kRGBA_F16_SkColorType)
24 .makeColorSpace(info.colorSpace()->makeLinearGamma ());
25 if (kUnpremul_SkAlphaType == infoF16.alphaType()) {
26 infoF16 = infoF16.makeAlphaType(kPremul_SkAlphaType);
27 }
28
29 SkBitmap bm;
30 bm.allocPixels(infoF16);
31 SkCodec::Result result = codec->getPixels(infoF16, bm.getPixels(), bm.rowByt es());
32 REPORTER_ASSERT(r, SkCodec::kSuccess == result);
33
34 sk_sp<SkData> data(SkImageEncoder::EncodeData(bm, SkImageEncoder::kEXR_Type, 100));
35 SkFILEWStream writeStream("/usr/local/google/home/msarett/skia/mandrill_zfp. exr");
36 writeStream.write(data->data(), data->size());
37 }
38
39
40 DEF_TEST(EncodeEXR, r) {
41 test(r, "mandrill_512_q075.jpg");
42 //test(r, "color_alpha.png");
43 }
OLDNEW
« no previous file with comments | « src/images/SkForceLinking.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698