| 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 |  | 
|  | 8 | #include "Resources.h" | 
| halcanary | 2f0a728 | 2015-08-21 07:47:23 -0700 | [diff] [blame] | 9 | #include "SkImage.h" | 
| halcanary | d476a17 | 2014-12-02 06:37:21 -0800 | [diff] [blame] | 10 | #include "gm.h" | 
|  | 11 |  | 
|  | 12 | /* | 
|  | 13 | *  Test decoding grayscale JPEG | 
|  | 14 | *  http://crbug.com/436079 | 
|  | 15 | */ | 
|  | 16 | DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) { | 
|  | 17 | const char kResource[] = "grayscale.jpg"; | 
| reed | 9ce9d67 | 2016-03-17 10:51:11 -0700 | [diff] [blame] | 18 | sk_sp<SkImage> image(GetResourceAsImage(kResource)); | 
| halcanary | 2f0a728 | 2015-08-21 07:47:23 -0700 | [diff] [blame] | 19 | if (image) { | 
|  | 20 | canvas->drawImage(image, 0.0f, 0.0f); | 
| halcanary | d476a17 | 2014-12-02 06:37:21 -0800 | [diff] [blame] | 21 | } else { | 
|  | 22 | SkDebugf("\nCould not decode file '%s'. Did you forget" | 
|  | 23 | " to set the resourcePath?\n", kResource); | 
|  | 24 | } | 
|  | 25 | } |