| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
| 9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
| 10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 205 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
| 206 if (NULL == codec.get()) { | 206 if (NULL == codec.get()) { |
| 207 SkDebugf("Couldn't create codec for %s.", path.c_str()); | 207 SkDebugf("Couldn't create codec for %s.", path.c_str()); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Choose scales for scaling tests. | 211 // Choose scales for scaling tests. |
| 212 // TODO (msarett): Add more scaling tests as we implement more flexible scal
ing. | 212 // TODO (msarett): Add more scaling tests as we implement more flexible scal
ing. |
| 213 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these | 213 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these |
| 214 // tests. SkImageDecoder supports downscales by integer fac
tors. | 214 // tests. SkImageDecoder supports downscales by integer fac
tors. |
| 215 const float scales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f
, 1.0f }; | 215 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 |
| 216 // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6,
5, etc |
| 217 // 0.4, 0.7 etc allow to test what happens when the client requests a scale
that |
| 218 // does not exactly match a sampleSize or native scaling capability |
| 219 const float scales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f,
0.4f, 0.5f, 0.6f, |
| 220 0.625f, 0.750f, 0.8f, 0.875f, 1.0f }; |
| 216 | 221 |
| 217 for (float scale : scales) { | 222 for (float scale : scales) { |
| 218 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP")))
{ | 223 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP")))
{ |
| 219 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni
nitialized/ | 224 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni
nitialized/ |
| 220 // compute their colors based on uninitialized values. | 225 // compute their colors based on uninitialized values. |
| 221 continue; | 226 continue; |
| 222 } | 227 } |
| 223 // Build additional test cases for images that decode natively to non-ca
nvas types | 228 // Build additional test cases for images that decode natively to non-ca
nvas types |
| 224 switch(codec->getInfo().colorType()) { | 229 switch(codec->getInfo().colorType()) { |
| 225 case kGray_8_SkColorType: | 230 case kGray_8_SkColorType: |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 } | 848 } |
| 844 return 0; | 849 return 0; |
| 845 } | 850 } |
| 846 | 851 |
| 847 #if !defined(SK_BUILD_FOR_IOS) | 852 #if !defined(SK_BUILD_FOR_IOS) |
| 848 int main(int argc, char** argv) { | 853 int main(int argc, char** argv) { |
| 849 SkCommandLineFlags::Parse(argc, argv); | 854 SkCommandLineFlags::Parse(argc, argv); |
| 850 return dm_main(); | 855 return dm_main(); |
| 851 } | 856 } |
| 852 #endif | 857 #endif |
| OLD | NEW |