sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [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 "SkImageGenerator.h" |
| 9 | #include "Test.h" |
| 10 | |
reed | 3ef71e3 | 2015-03-19 08:31:14 -0700 | [diff] [blame] | 11 | class MyImageGenerator : public SkImageGenerator { |
| 12 | public: |
| 13 | MyImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {} |
| 14 | }; |
| 15 | |
sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [diff] [blame] | 16 | DEF_TEST(ImageGenerator, reporter) { |
reed | 3ef71e3 | 2015-03-19 08:31:14 -0700 | [diff] [blame] | 17 | MyImageGenerator ig; |
sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [diff] [blame] | 18 | SkISize sizes[3]; |
| 19 | sizes[0] = SkISize::Make(200, 200); |
| 20 | sizes[1] = SkISize::Make(100, 100); |
| 21 | sizes[2] = SkISize::Make( 50, 50); |
| 22 | void* planes[3] = { NULL }; |
| 23 | size_t rowBytes[3] = { 0 }; |
rileya | abaef86 | 2014-09-12 17:45:58 -0700 | [diff] [blame] | 24 | SkYUVColorSpace colorSpace; |
sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [diff] [blame] | 25 | |
| 26 | // Check that the YUV decoding API does not cause any crashes |
rileya | abaef86 | 2014-09-12 17:45:58 -0700 | [diff] [blame] | 27 | ig.getYUV8Planes(sizes, NULL, NULL, &colorSpace); |
| 28 | ig.getYUV8Planes(sizes, NULL, NULL, NULL); |
| 29 | ig.getYUV8Planes(sizes, planes, NULL, NULL); |
| 30 | ig.getYUV8Planes(sizes, NULL, rowBytes, NULL); |
| 31 | ig.getYUV8Planes(sizes, planes, rowBytes, NULL); |
| 32 | ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace); |
sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [diff] [blame] | 33 | |
| 34 | int dummy; |
| 35 | planes[0] = planes[1] = planes[2] = &dummy; |
| 36 | rowBytes[0] = rowBytes[1] = rowBytes[2] = 250; |
| 37 | |
rileya | abaef86 | 2014-09-12 17:45:58 -0700 | [diff] [blame] | 38 | ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace); |
sugoi | 518d83d | 2014-07-21 11:37:39 -0700 | [diff] [blame] | 39 | } |