Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: tools/Resources.cpp

Issue 680533002: add gm: colorwheel (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« gm/gm.h ('K') | « tools/Resources.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/Resources.cpp
diff --git a/tools/Resources.cpp b/tools/Resources.cpp
index 606c5c4968c52fcb7544ba47fc5fd0ba1285269d..54010e5af0da8ffc2ba662a2525b63eeb28e00df 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -9,6 +9,9 @@
#include "SkCommandLineFlags.h"
#include "SkOSFile.h"
+#include "SkBitmap.h"
+#include "SkData.h"
mtklein 2014/10/24 16:47:48 sort?
hal.canary 2014/10/24 17:22:01 Done.
+#include "SkDecodingImageGenerator.h"
DEFINE_string2(resourcePath, i, "resources", "Directory with test resources: images, fonts, etc.");
@@ -19,3 +22,13 @@ 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);
+}
+
« gm/gm.h ('K') | « tools/Resources.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698