| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "skdiff.h" | 7 #include "skdiff.h" |
| 8 #include "skdiff_utils.h" | 8 #include "skdiff_utils.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 SkDebugf("ERROR: no codec found for <%s>\n", resource.fFullPath.c_str())
; | 56 SkDebugf("ERROR: no codec found for <%s>\n", resource.fFullPath.c_str())
; |
| 57 resource.fStatus = DiffResource::kCouldNotDecode_Status; | 57 resource.fStatus = DiffResource::kCouldNotDecode_Status; |
| 58 return false; | 58 return false; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // In debug, the DLL will automatically be unloaded when this is deleted, | 61 // In debug, the DLL will automatically be unloaded when this is deleted, |
| 62 // but that shouldn't be a problem in release mode. | 62 // but that shouldn't be a problem in release mode. |
| 63 SkAutoTDelete<SkImageDecoder> ad(codec); | 63 SkAutoTDelete<SkImageDecoder> ad(codec); |
| 64 | 64 |
| 65 stream.rewind(); | 65 stream.rewind(); |
| 66 if (!codec->decode(&stream, &resource.fBitmap, SkBitmap::kARGB_8888_Config,
mode)) { | 66 if (!codec->decode(&stream, &resource.fBitmap, kN32_SkColorType, mode)) { |
| 67 SkDebugf("ERROR: codec failed for basePath <%s>\n", resource.fFullPath.c
_str()); | 67 SkDebugf("ERROR: codec failed for basePath <%s>\n", resource.fFullPath.c
_str()); |
| 68 resource.fStatus = DiffResource::kCouldNotDecode_Status; | 68 resource.fStatus = DiffResource::kCouldNotDecode_Status; |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 resource.fStatus = DiffResource::kDecoded_Status; | 72 resource.fStatus = DiffResource::kDecoded_Status; |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 /** Thanks to PNG, we need to force all pixels 100% opaque. */ | 76 /** Thanks to PNG, we need to force all pixels 100% opaque. */ |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; | 175 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; |
| 176 } | 176 } |
| 177 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { | 177 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { |
| 178 drp->fWhite.fStatus = DiffResource::kExists_Status; | 178 drp->fWhite.fStatus = DiffResource::kExists_Status; |
| 179 } else { | 179 } else { |
| 180 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; | 180 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 } | 184 } |
| OLD | NEW |