blob: f51db14c58799d86623f8687ed50648283c05f76 [file] [log] [blame]
halcanaryd476a172014-12-02 06:37:21 -08001/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04009#include "include/core/SkCanvas.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkImage.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040011#include "include/core/SkRefCnt.h"
12#include "include/core/SkTypes.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "tools/Resources.h"
halcanaryd476a172014-12-02 06:37:21 -080014
15/*
16 * Test decoding grayscale JPEG
17 * http://crbug.com/436079
18 */
19DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) {
Hal Canaryc465d132017-12-08 10:21:31 -050020 const char kResource[] = "images/grayscale.jpg";
reed9ce9d672016-03-17 10:51:11 -070021 sk_sp<SkImage> image(GetResourceAsImage(kResource));
halcanary2f0a7282015-08-21 07:47:23 -070022 if (image) {
23 canvas->drawImage(image, 0.0f, 0.0f);
halcanaryd476a172014-12-02 06:37:21 -080024 } else {
25 SkDebugf("\nCould not decode file '%s'. Did you forget"
26 " to set the resourcePath?\n", kResource);
27 }
28}