OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Resources.h" | 8 #include "Resources.h" |
9 #include "SkCanvas.h" | 9 #include "SkImage.h" |
10 #include "gm.h" | 10 #include "gm.h" |
11 | 11 |
12 /* | 12 /* |
13 * Test decoding grayscale JPEG | 13 * Test decoding grayscale JPEG |
14 * http://crbug.com/436079 | 14 * http://crbug.com/436079 |
15 */ | 15 */ |
16 DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) { | 16 DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) { |
17 const char kResource[] = "grayscale.jpg"; | 17 const char kResource[] = "grayscale.jpg"; |
18 SkBitmap bitmap; | 18 SkAutoTUnref<SkImage> image(GetResourceAsImage(kResource)); |
19 if (GetResourceAsBitmap(kResource, &bitmap)) { | 19 if (image) { |
20 canvas->drawBitmap(bitmap, 0.0f, 0.0f); | 20 canvas->drawImage(image, 0.0f, 0.0f); |
21 } else { | 21 } else { |
22 SkDebugf("\nCould not decode file '%s'. Did you forget" | 22 SkDebugf("\nCould not decode file '%s'. Did you forget" |
23 " to set the resourcePath?\n", kResource); | 23 " to set the resourcePath?\n", kResource); |
24 } | 24 } |
25 } | 25 } |
OLD | NEW |