diff --git a/dm/DM.cpp b/dm/DM.cpp index e162e7762c..6dc7e668e2 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -130,7 +130,7 @@ static void gather_srcs() { push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str()))); } } else { - push_src("skp", new SKPSrc(SkString(path))); + push_src("skp", new SKPSrc(path)); } } static const char* const exts[] = { @@ -150,8 +150,8 @@ static void gather_srcs() { } } else if (sk_exists(flag)) { // assume that FLAGS_images[i] is a valid image if it is a file. - push_src("image", new ImageSrc(SkString(flag))); // Decode entire image. - push_src("image", new ImageSrc(SkString(flag), 5)); // Decode 5 random subsets. + push_src("image", new ImageSrc(flag)); // Decode entire image. + push_src("image", new ImageSrc(flag, 5)); // Decode 5 random subsets. } } } diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index a57192e881..39b92cd800 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -31,7 +31,7 @@ Name GMSrc::name() const { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -ImageSrc::ImageSrc(SkString path, int subsets) : fPath(path), fSubsets(subsets) {} +ImageSrc::ImageSrc(Path path, int subsets) : fPath(path), fSubsets(subsets) {} Error ImageSrc::draw(SkCanvas* canvas) const { SkAutoTUnref encoded(SkData::NewFromFileName(fPath.c_str())); @@ -103,7 +103,7 @@ Name ImageSrc::name() const { static const SkRect kSKPViewport = {0,0, 1000,1000}; -SKPSrc::SKPSrc(SkString path) : fPath(path) {} +SKPSrc::SKPSrc(Path path) : fPath(path) {} Error SKPSrc::draw(SkCanvas* canvas) const { SkAutoTDelete stream(SkStream::NewFromFile(fPath.c_str())); diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index 67c8e5cf4f..16f7c144eb 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -21,6 +21,7 @@ struct ImplicitString : public SkString { }; typedef ImplicitString Error; typedef ImplicitString Name; +typedef ImplicitString Path; struct Src { // All Srcs must be thread safe. @@ -60,25 +61,25 @@ private: class ImageSrc : public Src { public: - explicit ImageSrc(SkString path, int subsets = 0); + explicit ImageSrc(Path path, int subsets = 0); Error draw(SkCanvas*) const SK_OVERRIDE; SkISize size() const SK_OVERRIDE; Name name() const SK_OVERRIDE; private: - SkString fPath; - int fSubsets; + Path fPath; + int fSubsets; }; class SKPSrc : public Src { public: - explicit SKPSrc(SkString path); + explicit SKPSrc(Path path); Error draw(SkCanvas*) const SK_OVERRIDE; SkISize size() const SK_OVERRIDE; Name name() const SK_OVERRIDE; private: - SkString fPath; + Path fPath; }; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/