diff options
author | halcanary <halcanary@google.com> | 2014-10-26 05:23:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-26 05:23:53 -0700 |
commit | 30b83d45a3af444e6868c638d86442c2ea3e20c6 (patch) | |
tree | 1500063e2224a5820798eec578bf941c50e977e6 /tools/Resources.cpp | |
parent | 86217d831d70949f9dde6a60f821d3f357558bdf (diff) |
add gm: colorwheel
BUG=skia:3061
Review URL: https://codereview.chromium.org/680533002
Diffstat (limited to 'tools/Resources.cpp')
-rw-r--r-- | tools/Resources.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/Resources.cpp b/tools/Resources.cpp index 606c5c4968..50c08922fa 100644 --- a/tools/Resources.cpp +++ b/tools/Resources.cpp @@ -6,8 +6,10 @@ */ #include "Resources.h" - +#include "SkBitmap.h" #include "SkCommandLineFlags.h" +#include "SkData.h" +#include "SkDecodingImageGenerator.h" #include "SkOSFile.h" DEFINE_string2(resourcePath, i, "resources", "Directory with test resources: images, fonts, etc."); @@ -19,3 +21,12 @@ SkString GetResourcePath(const char* resource) { void SetResourcePath(const char* resource) { FLAGS_resourcePath.set(0, resource); } + +bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) { + SkString resourcePath = GetResourcePath(resource); + SkAutoTUnref<SkData> resourceData( + SkData::NewFromFileName(resourcePath.c_str())); + return resourceData && SkInstallDiscardablePixelRef( + SkDecodingImageGenerator::Create( + resourceData, SkDecodingImageGenerator::Options()), dst); +} |