2014-12-02 14:37:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkImage.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/core/SkTypes.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/Resources.h"
|
2014-12-02 14:37:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Test decoding grayscale JPEG
|
|
|
|
* http://crbug.com/436079
|
|
|
|
*/
|
|
|
|
DEF_SIMPLE_GM(grayscalejpg, canvas, 128, 128) {
|
2017-12-08 15:21:31 +00:00
|
|
|
const char kResource[] = "images/grayscale.jpg";
|
2016-03-17 17:51:11 +00:00
|
|
|
sk_sp<SkImage> image(GetResourceAsImage(kResource));
|
2015-08-21 14:47:23 +00:00
|
|
|
if (image) {
|
|
|
|
canvas->drawImage(image, 0.0f, 0.0f);
|
2014-12-02 14:37:21 +00:00
|
|
|
} else {
|
|
|
|
SkDebugf("\nCould not decode file '%s'. Did you forget"
|
|
|
|
" to set the resourcePath?\n", kResource);
|
|
|
|
}
|
|
|
|
}
|