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

Unified Diff: tools/Resources.cpp

Issue 1306133003: GMs: change some GMs to use SkImage over SkBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « 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 608b03cff650a07acc2410b1eaeb7ddaa052d7b1..75625b40a61d10bbfa9a64ea5bd9308c4031fd58 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkCommandLineFlags.h"
#include "SkData.h"
+#include "SkImage.h"
#include "SkImageGenerator.h"
#include "SkOSFile.h"
#include "SkStream.h"
@@ -30,6 +31,12 @@ bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) {
return resourceData && SkInstallDiscardablePixelRef(resourceData, dst);
}
+SkImage* GetResourceAsImage(const char* resource) {
+ SkString path = GetResourcePath(resource);
+ SkAutoTUnref<SkData> resourceData(SkData::NewFromFileName(path.c_str()));
+ return SkImage::NewFromEncoded(resourceData);
+}
+
SkStreamAsset* GetResourceAsStream(const char* resource) {
SkString resourcePath = GetResourcePath(resource);
SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str()));
« no previous file with comments | « tools/Resources.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698