blob: d0dd80a335551ed6b8146701af2b8ef4dfd664a7 [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"
Kevin Lubick8b741882023-10-06 11:41:38 -040013#include "tools/DecodeUtils.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "tools/Resources.h"
halcanaryd476a172014-12-02 06:37:21 -080015
16/*
17 * Test decoding grayscale JPEG
18 * http://crbug.com/436079
19 */
20DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) {
Hal Canaryc465d132017-12-08 10:21:31 -050021 const char kResource[] = "images/grayscale.jpg";
Kevin Lubick8b741882023-10-06 11:41:38 -040022 sk_sp<SkImage> image(ToolUtils::GetResourceAsImage(kResource));
halcanary2f0a7282015-08-21 07:47:23 -070023 if (image) {
24 canvas->drawImage(image, 0.0f, 0.0f);
halcanaryd476a172014-12-02 06:37:21 -080025 } else {
26 SkDebugf("\nCould not decode file '%s'. Did you forget"
27 " to set the resourcePath?\n", kResource);
28 }
29}