halcanary | d476a17 | 2014-12-02 06:37:21 -0800 | [diff] [blame] | 1 | /* |
| 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 9 | #include "include/core/SkCanvas.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkImage.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 11 | #include "include/core/SkRefCnt.h" |
| 12 | #include "include/core/SkTypes.h" |
Kevin Lubick | 8b74188 | 2023-10-06 11:41:38 -0400 | [diff] [blame] | 13 | #include "tools/DecodeUtils.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "tools/Resources.h" |
halcanary | d476a17 | 2014-12-02 06:37:21 -0800 | [diff] [blame] | 15 | |
| 16 | /* |
| 17 | * Test decoding grayscale JPEG |
| 18 | * http://crbug.com/436079 |
| 19 | */ |
| 20 | DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) { |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 21 | const char kResource[] = "images/grayscale.jpg"; |
Kevin Lubick | 8b74188 | 2023-10-06 11:41:38 -0400 | [diff] [blame] | 22 | sk_sp<SkImage> image(ToolUtils::GetResourceAsImage(kResource)); |
halcanary | 2f0a728 | 2015-08-21 07:47:23 -0700 | [diff] [blame] | 23 | if (image) { |
| 24 | canvas->drawImage(image, 0.0f, 0.0f); |
halcanary | d476a17 | 2014-12-02 06:37:21 -0800 | [diff] [blame] | 25 | } else { |
| 26 | SkDebugf("\nCould not decode file '%s'. Did you forget" |
| 27 | " to set the resourcePath?\n", kResource); |
| 28 | } |
| 29 | } |