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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 DiffMetricProc dmp, | 137 DiffMetricProc dmp, |
138 const int colorThreshold, | 138 const int colorThreshold, |
139 const SkString& outputDir, | 139 const SkString& outputDir, |
140 const SkString& filename) { | 140 const SkString& filename) { |
141 const int w = drp->fBase.fBitmap.width(); | 141 const int w = drp->fBase.fBitmap.width(); |
142 const int h = drp->fBase.fBitmap.height(); | 142 const int h = drp->fBase.fBitmap.height(); |
143 | 143 |
144 if (w != drp->fComparison.fBitmap.width() || h != drp->fComparison.fBitmap.h
eight()) { | 144 if (w != drp->fComparison.fBitmap.width() || h != drp->fComparison.fBitmap.h
eight()) { |
145 drp->fResult = DiffRecord::kDifferentSizes_Result; | 145 drp->fResult = DiffRecord::kDifferentSizes_Result; |
146 } else { | 146 } else { |
147 drp->fDifference.fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); | 147 drp->fDifference.fBitmap.allocN32Pixels(w, h); |
148 drp->fDifference.fBitmap.allocPixels(); | |
149 | 148 |
150 drp->fWhite.fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); | 149 drp->fWhite.fBitmap.allocN32Pixels(w, h); |
151 drp->fWhite.fBitmap.allocPixels(); | |
152 | 150 |
153 SkASSERT(DiffRecord::kUnknown_Result == drp->fResult); | 151 SkASSERT(DiffRecord::kUnknown_Result == drp->fResult); |
154 compute_diff(drp, dmp, colorThreshold); | 152 compute_diff(drp, dmp, colorThreshold); |
155 SkASSERT(DiffRecord::kUnknown_Result != drp->fResult); | 153 SkASSERT(DiffRecord::kUnknown_Result != drp->fResult); |
156 } | 154 } |
157 | 155 |
158 if (outputDir.isEmpty()) { | 156 if (outputDir.isEmpty()) { |
159 drp->fDifference.fStatus = DiffResource::kUnspecified_Status; | 157 drp->fDifference.fStatus = DiffResource::kUnspecified_Status; |
160 drp->fWhite.fStatus = DiffResource::kUnspecified_Status; | 158 drp->fWhite.fStatus = DiffResource::kUnspecified_Status; |
161 | 159 |
(...skipping 15 matching lines...) Expand all Loading... |
177 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; | 175 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; |
178 } | 176 } |
179 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { | 177 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { |
180 drp->fWhite.fStatus = DiffResource::kExists_Status; | 178 drp->fWhite.fStatus = DiffResource::kExists_Status; |
181 } else { | 179 } else { |
182 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; | 180 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; |
183 } | 181 } |
184 } | 182 } |
185 } | 183 } |
186 } | 184 } |
OLD | NEW |