diff options
author | halcanary <halcanary@google.com> | 2015-08-21 07:47:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-21 07:47:23 -0700 |
commit | 2f0a728e5aed1553811a44c4203b68853255f1bd (patch) | |
tree | 7002fb23b222addcdc57d119436e964a3a91e6b7 /gm/grayscalejpg.cpp | |
parent | b30e9d3960567571946ed89cbe7f5a2bd8255f85 (diff) |
GMs: change some GMs to use SkImage over SkBitmap
Also, add GetResourceAsImage() to Resources.h
Motivation: test drawImage() as much as we test drawBitmap()
Review URL: https://codereview.chromium.org/1306133003
Diffstat (limited to 'gm/grayscalejpg.cpp')
-rw-r--r-- | gm/grayscalejpg.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gm/grayscalejpg.cpp b/gm/grayscalejpg.cpp index 0c617bf2eb..70ea72e9bd 100644 --- a/gm/grayscalejpg.cpp +++ b/gm/grayscalejpg.cpp @@ -6,7 +6,7 @@ */ #include "Resources.h" -#include "SkCanvas.h" +#include "SkImage.h" #include "gm.h" /* @@ -15,9 +15,9 @@ */ DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) { const char kResource[] = "grayscale.jpg"; - SkBitmap bitmap; - if (GetResourceAsBitmap(kResource, &bitmap)) { - canvas->drawBitmap(bitmap, 0.0f, 0.0f); + SkAutoTUnref<SkImage> image(GetResourceAsImage(kResource)); + if (image) { + canvas->drawImage(image, 0.0f, 0.0f); } else { SkDebugf("\nCould not decode file '%s'. Did you forget" " to set the resourcePath?\n", kResource); |