| 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 "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 default: | 113 default: |
| 114 decodeInfo = decodeInfo.makeColorType(canvasColorType); | 114 decodeInfo = decodeInfo.makeColorType(canvasColorType); |
| 115 break; | 115 break; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Try to scale the image if it is desired | 118 // Try to scale the image if it is desired |
| 119 SkISize size = codec->getScaledDimensions(fScale); | 119 SkISize size = codec->getScaledDimensions(fScale); |
| 120 if (size == decodeInfo.dimensions() && 1.0f != fScale) { | 120 if (size == decodeInfo.dimensions() && 1.0f != fScale) { |
| 121 return Error::Nonfatal("Test without scaling is uninteresting."); | 121 return Error::Nonfatal("Test without scaling is uninteresting."); |
| 122 } | 122 } |
| 123 |
| 124 // Visually inspecting very small output images is not necessary. We will |
| 125 // cover these cases in unit testing. |
| 126 if ((size.width() <= 10 || size.height() <= 10) && 1.0f != fScale) { |
| 127 return Error::Nonfatal("Scaling very small images is uninteresting."); |
| 128 } |
| 123 decodeInfo = decodeInfo.makeWH(size.width(), size.height()); | 129 decodeInfo = decodeInfo.makeWH(size.width(), size.height()); |
| 124 | 130 |
| 125 // Construct a color table for the decode if necessary | 131 // Construct a color table for the decode if necessary |
| 126 SkAutoTUnref<SkColorTable> colorTable(NULL); | 132 SkAutoTUnref<SkColorTable> colorTable(NULL); |
| 127 SkPMColor* colorPtr = NULL; | 133 SkPMColor* colorPtr = NULL; |
| 128 int* colorCountPtr = NULL; | 134 int* colorCountPtr = NULL; |
| 129 int maxColors = 256; | 135 int maxColors = 256; |
| 130 if (kIndex_8_SkColorType == decodeInfo.colorType()) { | 136 if (kIndex_8_SkColorType == decodeInfo.colorType()) { |
| 131 SkPMColor colors[256]; | 137 SkPMColor colors[256]; |
| 132 colorTable.reset(SkNEW_ARGS(SkColorTable, (colors, maxColors))); | 138 colorTable.reset(SkNEW_ARGS(SkColorTable, (colors, maxColors))); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 skr.visit<void>(i, drawsAsSingletonPictures); | 1089 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1084 } | 1090 } |
| 1085 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1091 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1086 | 1092 |
| 1087 canvas->drawPicture(macroPic); | 1093 canvas->drawPicture(macroPic); |
| 1088 return ""; | 1094 return ""; |
| 1089 }); | 1095 }); |
| 1090 } | 1096 } |
| 1091 | 1097 |
| 1092 } // namespace DM | 1098 } // namespace DM |
| OLD | NEW |