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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
10 #include "SkImageGenerator.h" | 10 #include "SkImageGenerator.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 SkGraphics::SetImageGeneratorFromEncodedFactory(prev); | 39 SkGraphics::SetImageGeneratorFromEncodedFactory(prev); |
40 } | 40 } |
41 | 41 |
42 class MyImageGenerator : public SkImageGenerator { | 42 class MyImageGenerator : public SkImageGenerator { |
43 public: | 43 public: |
44 MyImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {} | 44 MyImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {} |
45 }; | 45 }; |
46 | 46 |
47 DEF_TEST(ImageGenerator, reporter) { | 47 DEF_TEST(ImageGenerator, reporter) { |
48 MyImageGenerator ig; | 48 MyImageGenerator ig; |
49 SkYUVSizeInfo sizeInfo; | 49 SkISize sizes[3]; |
50 sizeInfo.fSizes[SkYUVSizeInfo::kY] = SkISize::Make(200, 200); | 50 sizes[0] = SkISize::Make(200, 200); |
51 sizeInfo.fSizes[SkYUVSizeInfo::kU] = SkISize::Make(100, 100); | 51 sizes[1] = SkISize::Make(100, 100); |
52 sizeInfo.fSizes[SkYUVSizeInfo::kV] = SkISize::Make( 50, 50); | 52 sizes[2] = SkISize::Make( 50, 50); |
53 sizeInfo.fWidthBytes[SkYUVSizeInfo::kY] = 0; | 53 void* planes[3] = { nullptr }; |
54 sizeInfo.fWidthBytes[SkYUVSizeInfo::kU] = 0; | 54 size_t rowBytes[3] = { 0 }; |
55 sizeInfo.fWidthBytes[SkYUVSizeInfo::kV] = 0; | |
56 void* planes[3] = { nullptr }; | |
57 SkYUVColorSpace colorSpace; | 55 SkYUVColorSpace colorSpace; |
58 | 56 |
59 // Check that the YUV decoding API does not cause any crashes | 57 // Check that the YUV decoding API does not cause any crashes |
60 ig.queryYUV8(&sizeInfo, nullptr); | 58 ig.getYUV8Planes(sizes, nullptr, nullptr, &colorSpace); |
61 ig.queryYUV8(&sizeInfo, &colorSpace); | 59 ig.getYUV8Planes(sizes, nullptr, nullptr, nullptr); |
62 sizeInfo.fWidthBytes[SkYUVSizeInfo::kY] = 250; | 60 ig.getYUV8Planes(sizes, planes, nullptr, nullptr); |
63 sizeInfo.fWidthBytes[SkYUVSizeInfo::kU] = 250; | 61 ig.getYUV8Planes(sizes, nullptr, rowBytes, nullptr); |
64 sizeInfo.fWidthBytes[SkYUVSizeInfo::kV] = 250; | 62 ig.getYUV8Planes(sizes, planes, rowBytes, nullptr); |
| 63 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace); |
| 64 |
65 int dummy; | 65 int dummy; |
66 planes[SkYUVSizeInfo::kY] = planes[SkYUVSizeInfo::kU] = planes[SkYUVSizeInfo
::kV] = &dummy; | 66 planes[0] = planes[1] = planes[2] = &dummy; |
67 ig.getYUV8Planes(sizeInfo, planes); | 67 rowBytes[0] = rowBytes[1] = rowBytes[2] = 250; |
| 68 |
| 69 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace); |
68 | 70 |
69 // Suppressed due to https://code.google.com/p/skia/issues/detail?id=4339 | 71 // Suppressed due to https://code.google.com/p/skia/issues/detail?id=4339 |
70 if (false) { | 72 if (false) { |
71 test_imagegenerator_factory(reporter); | 73 test_imagegenerator_factory(reporter); |
72 } | 74 } |
73 } | 75 } |
OLD | NEW |