| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |