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

Unified Diff: gm/pixelxorxfermode.cpp

Issue 1806383002: Revert of Remove uses of SkImageDecoder from gms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/filterindiabox.cpp ('k') | gm/showmiplevels.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/pixelxorxfermode.cpp
diff --git a/gm/pixelxorxfermode.cpp b/gm/pixelxorxfermode.cpp
index daccca8c413d23a7224300767229eb9d9df3f480..35926a81c6cd85a82153bc081c4b4ef01e9f5d1b 100644
--- a/gm/pixelxorxfermode.cpp
+++ b/gm/pixelxorxfermode.cpp
@@ -8,6 +8,7 @@
#include "gm.h"
#include "Resources.h"
+#include "SkImageDecoder.h"
#include "SkPixelXorXfermode.h"
#include "SkStream.h"
@@ -23,7 +24,17 @@
SkISize onISize() override { return SkISize::Make(512, 512); }
void onOnceBeforeDraw() override {
- if (!GetResourceAsBitmap("mandrill_512.png", &fBM)) {
+ SkImageDecoder* codec = nullptr;
+ SkString resourcePath = GetResourcePath("mandrill_512.png");
+ SkFILEStream stream(resourcePath.c_str());
+ if (stream.isValid()) {
+ codec = SkImageDecoder::Factory(&stream);
+ }
+ if (codec) {
+ stream.rewind();
+ codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode);
+ delete codec;
+ } else {
fBM.allocN32Pixels(1, 1);
fBM.eraseARGB(255, 255, 0 , 0); // red == bad
}
« no previous file with comments | « gm/filterindiabox.cpp ('k') | gm/showmiplevels.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698