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