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

Side by Side Diff: tests/CodecTest.cpp

Issue 2288163003: Add Alpha8 support to SkPNGImageEncoder Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« src/codec/SkPngCodec.cpp ('K') | « src/images/SkPNGImageEncoder.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 2015 Google Inc. 2 * Copyright 2015 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 1112
1113 // Create an arbitrary gray bitmap. 1113 // Create an arbitrary gray bitmap.
1114 path = "grayscale.jpg"; 1114 path = "grayscale.jpg";
1115 stream.reset(resource(path)); 1115 stream.reset(resource(path));
1116 codec.reset(SkCodec::NewFromStream(stream.release())); 1116 codec.reset(SkCodec::NewFromStream(stream.release()));
1117 SkBitmap bm2; 1117 SkBitmap bm2;
1118 bm2.allocPixels(codec->getInfo()); 1118 bm2.allocPixels(codec->getInfo());
1119 result = codec->getPixels(codec->getInfo(), bm2.getPixels(), bm2.rowBytes()) ; 1119 result = codec->getPixels(codec->getInfo(), bm2.getPixels(), bm2.rowBytes()) ;
1120 REPORTER_ASSERT(r, SkCodec::kSuccess == result); 1120 REPORTER_ASSERT(r, SkCodec::kSuccess == result);
1121 check_round_trip(r, bm2); 1121 check_round_trip(r, bm2);
1122
1123 // Create an arbitrary alpha8 bitmap.
1124 path = "arrow.png";
1125 stream.reset(resource(path));
1126 codec.reset(SkCodec::NewFromStream(stream.release()));
1127 SkBitmap tmp;
1128 tmp.allocPixels(codec->getInfo());
1129 result = codec->getPixels(codec->getInfo(), tmp.getPixels(), tmp.rowBytes()) ;
1130 REPORTER_ASSERT(r, SkCodec::kSuccess == result);
1131 SkBitmap bm3;
1132 tmp.copyTo(&bm3, kAlpha_8_SkColorType);
1133 check_round_trip(r, bm3);
1122 } 1134 }
OLDNEW
« src/codec/SkPngCodec.cpp ('K') | « src/images/SkPNGImageEncoder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698