diff options
author | mtklein <mtklein@chromium.org> | 2015-01-30 11:42:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-30 11:42:31 -0800 |
commit | 8d17a13a71edb0d8412e4354c428582b74587b79 (patch) | |
tree | ce1ebde6e25d7704777db35f1354a253d2cdab18 | |
parent | b9329991426d0b77ea194a380d72d73fb855308a (diff) |
DM: paths as implict strings too.
BUG=skia:
Review URL: https://codereview.chromium.org/891823002
-rw-r--r-- | dm/DM.cpp | 6 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 4 | ||||
-rw-r--r-- | dm/DMSrcSink.h | 11 |
3 files changed, 11 insertions, 10 deletions
@@ -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<SkData> 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<SkStream> 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; }; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |