Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: tests/ImageGeneratorTest.cpp

Issue 1716523002: Update Skia's YUV API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/YUVCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SkISize sizes[3]; 49 SkYUVSizeInfo sizeInfo;
50 sizes[0] = SkISize::Make(200, 200); 50 sizeInfo.fSizes[SkYUVSizeInfo::kY] = SkISize::Make(200, 200);
51 sizes[1] = SkISize::Make(100, 100); 51 sizeInfo.fSizes[SkYUVSizeInfo::kU] = SkISize::Make(100, 100);
52 sizes[2] = SkISize::Make( 50, 50); 52 sizeInfo.fSizes[SkYUVSizeInfo::kV] = SkISize::Make( 50, 50);
53 void* planes[3] = { nullptr }; 53 sizeInfo.fWidthBytes[SkYUVSizeInfo::kY] = 0;
54 size_t rowBytes[3] = { 0 }; 54 sizeInfo.fWidthBytes[SkYUVSizeInfo::kU] = 0;
55 sizeInfo.fWidthBytes[SkYUVSizeInfo::kV] = 0;
56 void* planes[3] = { nullptr };
55 SkYUVColorSpace colorSpace; 57 SkYUVColorSpace colorSpace;
56 58
57 // Check that the YUV decoding API does not cause any crashes 59 // Check that the YUV decoding API does not cause any crashes
58 ig.getYUV8Planes(sizes, nullptr, nullptr, &colorSpace); 60 ig.queryYUV8(&sizeInfo, nullptr);
59 ig.getYUV8Planes(sizes, nullptr, nullptr, nullptr); 61 ig.queryYUV8(&sizeInfo, &colorSpace);
60 ig.getYUV8Planes(sizes, planes, nullptr, nullptr); 62 sizeInfo.fWidthBytes[SkYUVSizeInfo::kY] = 250;
61 ig.getYUV8Planes(sizes, nullptr, rowBytes, nullptr); 63 sizeInfo.fWidthBytes[SkYUVSizeInfo::kU] = 250;
62 ig.getYUV8Planes(sizes, planes, rowBytes, nullptr); 64 sizeInfo.fWidthBytes[SkYUVSizeInfo::kV] = 250;
63 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace);
64
65 int dummy; 65 int dummy;
66 planes[0] = planes[1] = planes[2] = &dummy; 66 planes[SkYUVSizeInfo::kY] = planes[SkYUVSizeInfo::kU] = planes[SkYUVSizeInfo ::kV] = &dummy;
67 rowBytes[0] = rowBytes[1] = rowBytes[2] = 250; 67 ig.getYUV8Planes(sizeInfo, planes);
68
69 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace);
70 68
71 // Suppressed due to https://code.google.com/p/skia/issues/detail?id=4339 69 // Suppressed due to https://code.google.com/p/skia/issues/detail?id=4339
72 if (false) { 70 if (false) {
73 test_imagegenerator_factory(reporter); 71 test_imagegenerator_factory(reporter);
74 } 72 }
75 } 73 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/YUVCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698