diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-20 17:40:58 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-20 17:40:58 +0000 |
commit | 8570b5c8695052378491b0c61e745d736fe85c8d (patch) | |
tree | 10d7e94b3b6640379e372fd758540b356aaaf48a /gm | |
parent | b3e40c04ef3021a3a3a0d64127388707217d7e74 (diff) |
Adding CMYK jpeg changes w/o .gyp alterations
http://codereview.appspot.com/5785054/
git-svn-id: http://skia.googlecode.com/svn/trunk@3442 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/gm.cpp | 2 | ||||
-rw-r--r-- | gm/gm.h | 30 | ||||
-rw-r--r-- | gm/gmmain.cpp | 35 |
3 files changed, 44 insertions, 23 deletions
@@ -8,6 +8,8 @@ #include "gm.h" using namespace skiagm; +SkString GM::gResourcePath; + GM::GM() { fBGColor = SK_ColorWHITE; } @@ -18,18 +18,18 @@ #include "SkTRegistry.h" namespace skiagm { - - static inline SkISize make_isize(int w, int h) { - SkISize sz; - sz.set(w, h); - return sz; - } + + static inline SkISize make_isize(int w, int h) { + SkISize sz; + sz.set(w, h); + return sz; + } class GM { public: GM(); virtual ~GM(); - + enum Flags { kSkipPDF_Flag = 1 << 0, kSkipPicture_Flag = 1 << 1 @@ -39,7 +39,7 @@ namespace skiagm { void drawBackground(SkCanvas*); void drawContent(SkCanvas*); - SkISize getISize() { return this->onISize(); } + SkISize getISize() { return this->onISize(); } const char* shortName(); uint32_t getFlags() const { @@ -53,10 +53,16 @@ namespace skiagm { // GM's getISize bounds. void drawSizeBounds(SkCanvas*, SkColor); - protected: - virtual void onDraw(SkCanvas*) = 0; - virtual void onDrawBackground(SkCanvas*); - virtual SkISize onISize() = 0; + static void SetResourcePath(const char* resourcePath) { + gResourcePath = resourcePath; + } + + protected: + static SkString gResourcePath; + + virtual void onDraw(SkCanvas*) = 0; + virtual void onDrawBackground(SkCanvas*); + virtual SkISize onISize() = 0; virtual SkString onShortName() = 0; virtual uint32_t onGetFlags() const { return 0; } diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 6f53ce8f7b..61095e173f 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -589,9 +589,9 @@ static ErrorBitfield test_picture_serialization(GM* gm, static void usage(const char * argv0) { SkDebugf( - "%s [-w writePath] [-r readPath] [-d diffPath] [--noreplay]\n" - " [--serialize] [--forceBWtext] [--nopdf] [--nodeferred]\n" - " [--match substring] [--notexturecache]" + "%s [-w writePath] [-r readPath] [-d diffPath] [-i resourcePath]\n" + " [--noreplay] [--serialize] [--forceBWtext] [--nopdf] \n" + " [--nodeferred] [--match substring] [--notexturecache]" #if SK_MESA " [--mesagl]" #endif @@ -601,6 +601,7 @@ static void usage(const char * argv0) { " readPath: directory to read reference images from;\n" " reports if any pixels mismatch between reference and new images\n"); SkDebugf(" diffPath: directory to write difference images in.\n"); + SkDebugf(" resourcePath: directory that stores image resources.\n"); SkDebugf(" --noreplay: do not exercise SkPicture replay.\n"); SkDebugf( " --serialize: exercise SkPicture serialization & deserialization.\n"); @@ -660,6 +661,7 @@ int main(int argc, char * const argv[]) { const char* writePath = NULL; // if non-null, where we write the originals const char* readPath = NULL; // if non-null, were we read from to compare const char* diffPath = NULL; // if non-null, where we write our diffs (from compare) + const char* resourcePath = NULL;// if non-null, where we read from for image resources SkTDArray<const char*> fMatches; @@ -688,6 +690,11 @@ int main(int argc, char * const argv[]) { if (argv < stop && **argv) { diffPath = *argv; } + } else if (strcmp(*argv, "-i") == 0) { + argv++; + if (argv < stop && **argv) { + resourcePath = *argv; + } } else if (strcmp(*argv, "--forceBWtext") == 0) { gForceBWtext = true; } else if (strcmp(*argv, "--noreplay") == 0) { @@ -709,17 +716,19 @@ int main(int argc, char * const argv[]) { useMesa = true; #endif } else if (strcmp(*argv, "--notexturecache") == 0) { - disableTextureCache = true; + disableTextureCache = true; } else { - usage(commandName); - return -1; + usage(commandName); + return -1; } } if (argv != stop) { - usage(commandName); - return -1; + usage(commandName); + return -1; } + GM::SetResourcePath(resourcePath); + int maxW = -1; int maxH = -1; Iter iter; @@ -763,6 +772,10 @@ int main(int argc, char * const argv[]) { fprintf(stderr, "writing to %s\n", writePath); } + if (resourcePath) { + fprintf(stderr, "reading resources from %s\n", resourcePath); + } + // Accumulate success of all tests. int testsRun = 0; int testsPassed = 0; @@ -828,10 +841,10 @@ int main(int argc, char * const argv[]) { if (doDeferred && !testErrors && (kGPU_Backend == gRec[i].fBackend || - kRaster_Backend == gRec[i].fBackend)) { + kRaster_Backend == gRec[i].fBackend)) { testErrors |= test_deferred_drawing(gm, gRec[i], - forwardRenderedBitmap, - diffPath, gGrContext, rt.get()); + forwardRenderedBitmap, + diffPath, gGrContext, rt.get()); } if ((ERROR_NONE == testErrors) && doReplay && |