static SkString path_to_expected_image(const char* root, const Task& task) { SkString filename = task.name(); // We know that all names passed in here belong to top-level Tasks, which have a single suffix // (8888, 565, gpu, etc.) indicating what subdirectory to look in. SkTArray<SkString> suffixes; const int suffixLength = split_suffixes(1, filename.c_str(), &suffixes); SkASSERT(1 == suffixes.count()); // We'll look in root/suffix for images. const SkString dir = SkOSPath::Join(root, suffixes[0].c_str()); // Remove the suffix and tack on a .png. filename.remove(filename.size() - suffixLength, suffixLength); filename.append(".png"); return SkOSPath::Join(dir.c_str(), filename.c_str()); }
inline static SkString find_base_name(const Task& parent, SkTArray<SkString>* suffixList) { const int suffixes = parent.depth() + 1; const SkString& name = parent.name(); const int totalSuffixLength = split_suffixes(suffixes, name.c_str(), suffixList); return SkString(name.c_str(), name.size() - totalSuffixLength); }
WriteTask::WriteTask(const Task& parent, SkBitmap bitmap) : CpuTask(parent), fBitmap(bitmap) { const int suffixes = parent.depth() + 1; const SkString& name = parent.name(); const int totalSuffixLength = split_suffixes(suffixes, name.c_str(), &fSuffixes); fGmName.set(name.c_str(), name.size()-totalSuffixLength); }