913 {
914 if (fBenches) {
916 fBenches = fBenches->
next();
917 fSourceType = "bench";
918 fBenchType = "micro";
920 }
921
922 while (fGMs) {
923 std::unique_ptr<skiagm::GM> gm = fGMs->
get()();
924 if (gm->isBazelOnly()) {
925
926
927
928
929 continue;
930 }
932 if (gm->runAsBench()) {
933 fSourceType = "gm";
934 fBenchType = "micro";
935 return new GMBench(std::move(gm));
936 }
937 }
938
939 while (fCurrentTextBlobTrace < fTextBlobTraces.
size()) {
940 SkString path = fTextBlobTraces[fCurrentTextBlobTrace++];
942 static constexpr char kEnding[] = ".trace";
945 }
946 fSourceType = "texttrace";
947 fBenchType = "micro";
950 [
path](){ return SkStream::MakeFromFile(path.c_str()); });
951 }
952
953
954 while (fCurrentRecording < fSKPs.
size()) {
957 if (!pic) {
958 continue;
959 }
961 fSourceType = "skp";
962 fBenchType = "recording";
966 }
967
968
969 while (fCurrentDeserialPicture < fSKPs.
size()) {
970 const SkString&
path = fSKPs[fCurrentDeserialPicture++];
973 continue;
974 }
976 fSourceType = "skp";
977 fBenchType = "deserial";
978 fSKPBytes =
static_cast<double>(
data->size());
979 fSKPOps = 0;
981 }
982
983
984 while (fCurrentScale < fScales.
size()) {
985 while (fCurrentSKP < fSKPs.
size()) {
988 if (!pic) {
989 continue;
990 }
991
992 if (FLAGS_bbh) {
993
998 &factory));
1000 }
1002 fSourceType = "skp";
1003 fBenchType = "playback";
1004 return new SKPBench(
name.c_str(), pic.
get(), fClip, fScales[fCurrentScale],
1005 FLAGS_loopSKP);
1006 }
1007
1008 while (fCurrentSVG < fSVGs.
size()) {
1009 const char*
path = fSVGs[fCurrentSVG++].c_str();
1011 fSourceType = "svg";
1012 fBenchType = "playback";
1014 fScales[fCurrentScale], FLAGS_loopSKP);
1015 }
1016 }
1017
1018 fCurrentSKP = 0;
1019 fCurrentSVG = 0;
1020 fCurrentScale++;
1021 }
1022
1023
1024 if (fZoomMax != 1.0f && fZoomPeriodMs > 0) {
1025 while (fCurrentAnimSKP < fSKPs.
size()) {
1028 if (!pic) {
1029 fCurrentAnimSKP++;
1030 continue;
1031 }
1032
1033 fCurrentAnimSKP++;
1038 FLAGS_loopSKP);
1039 }
1040 }
1041
1042
1043 while (fCurrentMSKP < fMSKPs.
size()) {
1045 std::unique_ptr<MSKPPlayer> player =
ReadMSKP(
path.c_str());
1046 if (!player) {
1047 continue;
1048 }
1050 fSourceType = "mskp";
1051 fBenchType = "mskp";
1053 }
1054
1055 for (; fCurrentCodec < fImages.
size(); fCurrentCodec++) {
1056 fSourceType = "image";
1057 fBenchType = "skcodec";
1060 continue;
1061 }
1064 if (!codec) {
1065
1067 continue;
1068 }
1069
1070 while (fCurrentColorType < fColorTypes.
size()) {
1072
1073 SkAlphaType alphaType = codec->getInfo().alphaType();
1074 if (FLAGS_simpleCodec) {
1077 }
1078
1079 fCurrentColorType++;
1080 } else {
1081 switch (alphaType) {
1083
1084 fCurrentColorType++;
1085 break;
1088 if (0 == fCurrentAlphaType) {
1089
1091 fCurrentAlphaType++;
1092 } else {
1093
1095 fCurrentAlphaType = 0;
1096 fCurrentColorType++;
1097 }
1098 break;
1099 default:
1101 fCurrentColorType++;
1102 break;
1103 }
1104 }
1105
1106
1108 codec->getInfo().makeColorType(
colorType).makeAlphaType(alphaType);
1109 const size_t rowBytes =
info.minRowBytes();
1111
1113 info, storage.get(), rowBytes);
1120
1121 break;
1122 default:
1123
1125 break;
1126 }
1127 }
1128 fCurrentColorType = 0;
1129 }
1130
1131
1132 const int sampleSizes[] = { 2, 4, 8 };
1133 for (; fCurrentAndroidCodec < fImages.
size(); fCurrentAndroidCodec++) {
1134 fSourceType = "image";
1135 fBenchType = "skandroidcodec";
1136
1139 continue;
1140 }
1143 if (!codec) {
1144
1146 continue;
1147 }
1148
1149 while (fCurrentSampleSize < (
int)
std::size(sampleSizes)) {
1150 int sampleSize = sampleSizes[fCurrentSampleSize];
1151 fCurrentSampleSize++;
1152 if (10 * sampleSize >
std::min(codec->getInfo().width(), codec->getInfo().height())) {
1153
1154 break;
1155 }
1156
1158 encoded.get(), sampleSize);
1159 }
1160 fCurrentSampleSize = 0;
1161 }
1162
1163#ifdef SK_ENABLE_ANDROID_UTILS
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177 const uint32_t brdSampleSizes[] = { 1, 2, 4, 8, 16 };
1178 const uint32_t minOutputSize = 512;
1179 for (; fCurrentBRDImage < fImages.
size(); fCurrentBRDImage++) {
1180 fSourceType = "image";
1181 fBenchType = "BRD";
1182
1185 continue;
1186 }
1187
1188 while (fCurrentColorType < fColorTypes.
size()) {
1189 while (fCurrentSampleSize < (
int)
std::size(brdSampleSizes)) {
1190 while (fCurrentSubsetType <= kLastSingle_SubsetType) {
1191
1194 uint32_t sampleSize = brdSampleSizes[fCurrentSampleSize];
1195 int currentSubsetType = fCurrentSubsetType++;
1196
1199 if (!valid_brd_bench(encoded,
colorType, sampleSize, minOutputSize,
1201 break;
1202 }
1203
1206 const uint32_t subsetSize = sampleSize * minOutputSize;
1207 switch (currentSubsetType) {
1208 case kTopLeft_SubsetType:
1211 break;
1212 case kTopRight_SubsetType:
1215 subsetSize);
1216 break;
1217 case kMiddle_SubsetType:
1220 (
height - subsetSize) / 2, subsetSize, subsetSize);
1221 break;
1222 case kBottomLeft_SubsetType:
1225 subsetSize);
1226 break;
1227 case kBottomRight_SubsetType:
1230 height - subsetSize, subsetSize, subsetSize);
1231 break;
1232 default:
1234 }
1235
1236 return new BitmapRegionDecoderBench(
basename.c_str(), encoded.get(),
1238 }
1239 fCurrentSubsetType = 0;
1240 fCurrentSampleSize++;
1241 }
1242 fCurrentSampleSize = 0;
1243 fCurrentColorType++;
1244 }
1245 fCurrentColorType = 0;
1246 }
1247#endif
1248
1249 return nullptr;
1250 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Benchmark * CreateDiffCanvasBench(SkString name, std::function< std::unique_ptr< SkStreamAsset >()> dataSrc)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static std::unique_ptr< MSKPPlayer > ReadMSKP(const char *path)
static sk_sp< SkPicture > ReadSVGPicture(const char *path)
static sk_sp< SkPicture > ReadPicture(const char *path)
static sk_sp< Animation > MakeZoomAnimation(SkScalar zoomMax, double zoomPeriodMs)
static std::unique_ptr< SkAndroidCodec > MakeFromData(sk_sp< SkData >, SkPngChunkReader *=nullptr)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
static sk_sp< SkData > MakeFromFileName(const char path[])
static SkString Basename(const char *fullPath)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
virtual SkRect cullRect() const =0
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
virtual size_t approximateBytesUsed() const =0
virtual int approximateOpCount(bool nested=false) const =0
static float min(float r, float g, float b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
constexpr float height() const
constexpr float width() const
std::shared_ptr< const fml::Mapping > data