| 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 "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
| 9 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 case kIndex_8_SkColorType: { | 275 case kIndex_8_SkColorType: { |
| 276 SkColorTable* colorTable = bitmap.getColorTable(); | 276 SkColorTable* colorTable = bitmap.getColorTable(); |
| 277 SkPMColor* colorPtr = const_cast<SkPMColor*>(colorTable->readColors(
)); | 277 SkPMColor* colorPtr = const_cast<SkPMColor*>(colorTable->readColors(
)); |
| 278 SkOpts::RGBA_to_rgbA(colorPtr, colorPtr, colorTable->count()); | 278 SkOpts::RGBA_to_rgbA(colorPtr, colorPtr, colorTable->count()); |
| 279 break; | 279 break; |
| 280 } | 280 } |
| 281 default: | 281 default: |
| 282 // No need to premultiply kGray or k565 outputs. | 282 // No need to premultiply kGray or k565 outputs. |
| 283 break; | 283 break; |
| 284 } | 284 } |
| 285 |
| 286 // In the kIndex_8 case, the canvas won't even try to draw unless we mark th
e |
| 287 // bitmap as kPremul. |
| 288 bitmap.setAlphaType(kPremul_SkAlphaType); |
| 285 } | 289 } |
| 286 | 290 |
| 287 bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType, | 291 bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType, |
| 288 CodecSrc::DstColorType dstColorType) { | 292 CodecSrc::DstColorType dstColorType) { |
| 289 switch (dstColorType) { | 293 switch (dstColorType) { |
| 290 case CodecSrc::kIndex8_Always_DstColorType: | 294 case CodecSrc::kIndex8_Always_DstColorType: |
| 291 if (kRGB_565_SkColorType == canvasColorType) { | 295 if (kRGB_565_SkColorType == canvasColorType) { |
| 292 return false; | 296 return false; |
| 293 } | 297 } |
| 294 *decodeInfo = decodeInfo->makeColorType(kIndex_8_SkColorType); | 298 *decodeInfo = decodeInfo->makeColorType(kIndex_8_SkColorType); |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 skr.visit<void>(i, drawsAsSingletonPictures); | 1382 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1379 } | 1383 } |
| 1380 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1384 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1381 | 1385 |
| 1382 canvas->drawPicture(macroPic); | 1386 canvas->drawPicture(macroPic); |
| 1383 return check_against_reference(bitmap, src, fSink); | 1387 return check_against_reference(bitmap, src, fSink); |
| 1384 }); | 1388 }); |
| 1385 } | 1389 } |
| 1386 | 1390 |
| 1387 } // namespace DM | 1391 } // namespace DM |
| OLD | NEW |