DM: paths as implict strings too.
authormtklein <mtklein@chromium.org>
Fri, 30 Jan 2015 19:42:31 +0000 (11:42 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 30 Jan 2015 19:42:31 +0000 (11:42 -0800)
BUG=skia:

Review URL: https://codereview.chromium.org/891823002

dm/DM.cpp
dm/DMSrcSink.cpp
dm/DMSrcSink.h

index e162e77..6dc7e66 100644 (file)
--- 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.
         }
     }
 }
index a57192e..39b92cd 100644 (file)
@@ -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()));
index 67c8e5c..16f7c14 100644 (file)
@@ -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;
 };
 
 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/