From d90cd3b2796b693b2d6af6fe13a8ca6c4795d80e Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 22 May 2018 10:48:08 -0400 Subject: Revert "Revert "IWYU for tests starting with 'D'."" This reverts commit edf8449d2c3663350b6b6e30d2fa4c70da02deef. Change-Id: Ibeedd9965855b3ccfe44486d15307bf3da15fd9c Reviewed-on: https://skia-review.googlesource.com/129516 Reviewed-by: Ben Wagner Commit-Queue: Ben Wagner --- gn/tests.gni | 1 - include/gpu/vk/GrVkDefines.h | 4 +- .../android/vulkan/Skia_Vulkan_Android.h | 4 +- tests/DFPathRendererTest.cpp | 84 ---------------------- tests/DashPathEffectTest.cpp | 16 +++-- tests/DataRefTest.cpp | 16 +++-- tests/DefaultPathRendererTest.cpp | 23 +++++- tests/DeferredDisplayListTest.cpp | 24 ++++++- tests/DetermineDomainModeTest.cpp | 14 +++- tests/DeviceTest.cpp | 14 +++- tests/DiscardableMemoryPoolTest.cpp | 6 +- tests/DiscardableMemoryTest.cpp | 6 +- tests/DrawBitmapRectTest.cpp | 11 +-- tests/DrawFilterTest.cpp | 2 + tests/DrawOpAtlasTest.cpp | 41 +++++++---- tests/DrawPathTest.cpp | 12 ++++ tests/DrawTextTest.cpp | 2 +- tests/DynamicHashTest.cpp | 3 + tools/gpu/vk/GrVulkanDefines.h | 4 +- 19 files changed, 158 insertions(+), 129 deletions(-) delete mode 100644 tests/DFPathRendererTest.cpp diff --git a/gn/tests.gni b/gn/tests.gni index 19017c45e6..4eef06e20f 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -55,7 +55,6 @@ tests_sources = [ "$_tests/DequeTest.cpp", "$_tests/DetermineDomainModeTest.cpp", "$_tests/DeviceTest.cpp", - "$_tests/DFPathRendererTest.cpp", "$_tests/DiscardableMemoryPoolTest.cpp", "$_tests/DiscardableMemoryTest.cpp", "$_tests/DrawBitmapRectTest.cpp", diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h index 8f697c02b4..d17300a550 100644 --- a/include/gpu/vk/GrVkDefines.h +++ b/include/gpu/vk/GrVkDefines.h @@ -12,7 +12,7 @@ #ifdef SK_VULKAN #ifdef SK_VULKAN_HEADER -#include SK_VULKAN_HEADER +#include SK_VULKAN_HEADER // IWYU pragma: export #else // This is deprecated and all clients should define their own custum header shim that sets up // defines and includes the vulkan.h header. Then they should define SK_VULKAN_HEADER or set the @@ -43,7 +43,7 @@ # define VK_NO_PROTOTYPES # endif -# include +# include // IWYU pragma: export #endif // SK_VULKAN_HEADER #define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17 diff --git a/platform_tools/android/vulkan/Skia_Vulkan_Android.h b/platform_tools/android/vulkan/Skia_Vulkan_Android.h index b0749810f0..65ff4aa582 100644 --- a/platform_tools/android/vulkan/Skia_Vulkan_Android.h +++ b/platform_tools/android/vulkan/Skia_Vulkan_Android.h @@ -8,6 +8,8 @@ #ifndef Skia_Vulkan_Android_DEFINED #define Skia_Vulkan_Android_DEFINED +#include "SkTypes.h" + #if !defined(SK_BUILD_FOR_ANDROID) #error "Must be building for android to use this header" #endif @@ -15,7 +17,7 @@ # define VK_USE_PLATFORM_ANDROID_KHR #endif -#include +#include // IWYU pragma: export #endif diff --git a/tests/DFPathRendererTest.cpp b/tests/DFPathRendererTest.cpp deleted file mode 100644 index 653db822f9..0000000000 --- a/tests/DFPathRendererTest.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "Test.h" - -#include "SkPath.h" - -#if SK_SUPPORT_GPU -#include "GrContext.h" -#include "ops/GrSmallPathRenderer.h" - -#if 0 -// This test case including path coords and matrix taken from crbug.com/627443. -// Because of inaccuracies in large floating point values this causes the -// the path renderer to attempt to add a path DF to its atlas that is larger -// than the plot size which used to crash rather than fail gracefully. -static void test_far_from_origin(GrContext* ctx, GrRenderTargetContext* renderTargetContext, - GrPathRenderer* pr) { - SkPath path; - path.lineTo(49.0255089839f, 0.473541f); - // This extra line wasn't in the original bug but was added to fake out GrShape's special - // handling of single line segments. - path.rLineTo(0.015f, 0.015f); - static constexpr SkScalar mvals[] = {14.0348252854f, 2.13026182736f, - 13.6122547187f, 118.309922702f, - 1912337682.09f, 2105391889.87f}; - SkMatrix matrix; - matrix.setAffine(mvals); - SkMatrix inverse; - SkAssertResult(matrix.invert(&inverse)); - path.transform(inverse); - - SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); - rec.setStrokeStyle(1.f); - rec.setStrokeParams(SkPaint::kRound_Cap, SkPaint::kRound_Join, 1.f); - GrStyle style(rec, nullptr); - - GrShape shape(path, style); - shape = shape.applyStyle(GrStyle::Apply::kPathEffectAndStrokeRec, 1.f); - - GrPaint paint; - paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); - - GrNoClip noClip; - GrPathRenderer::DrawPathArgs args{ctx, - std::move(paint), - &GrUserStencilSettings::kUnused, - renderTargetContext, - &noClip, - &matrix, - &shape, - GrAAType::kCoverage, - false}; - pr->drawPath(args); -} - -DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(SmallPathRenderer, reporter, ctxInfo) { - GrContext* ctx = ctxInfo.grContext(); - // The DF PR only works with contexts that support derivatives - if (!ctx->caps()->shaderCaps()->shaderDerivativeSupport()) { - return; - } - sk_sp rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox, - 800, 800, - kRGBA_8888_GrPixelConfig, - nullptr, - 0, - kTopLeft_GrSurfaceOrigin)); - if (!rtc) { - return; - } - - GrSmallPathRenderer spr; - - ctx->flush(); - test_far_from_origin(ctx, rtc.get(), &spr); - ctx->flush(); -} -#endif -#endif diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp index e3a380411d..f165207a4b 100644 --- a/tests/DashPathEffectTest.cpp +++ b/tests/DashPathEffectTest.cpp @@ -5,13 +5,21 @@ * found in the LICENSE file. */ -#include "Test.h" - +#include "SkCanvas.h" #include "SkDashPathEffect.h" -#include "SkWriteBuffer.h" +#include "SkImageInfo.h" +#include "SkMatrix.h" +#include "SkPaint.h" +#include "SkPath.h" +#include "SkPathEffect.h" +#include "SkPoint.h" +#include "SkRect.h" +#include "SkRefCnt.h" +#include "SkScalar.h" #include "SkStrokeRec.h" -#include "SkCanvas.h" #include "SkSurface.h" +#include "SkTypes.h" +#include "Test.h" // crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unflatten itself when // the effect is nonsense. Here we test that it fails when passed nonsense parameters. diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index 74d511cc28..e7ada5f09d 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -9,12 +9,21 @@ #include "SkDataTable.h" #include "SkOSFile.h" #include "SkOSPath.h" -#include "SkReadBuffer.h" -#include "SkWriteBuffer.h" +#include "SkRWBuffer.h" +#include "SkRefCnt.h" #include "SkStream.h" +#include "SkString.h" #include "SkTArray.h" +#include "SkTaskGroup.h" +#include "SkTemplates.h" +#include "SkTypes.h" #include "Test.h" +#include +#include +#include +#include + static void test_is_equal(skiatest::Reporter* reporter, const SkDataTable* a, const SkDataTable* b) { REPORTER_ASSERT(reporter, a->count() == b->count()); @@ -201,7 +210,6 @@ DEF_TEST(Data, reporter) { } /////////////////////////////////////////////////////////////////////////////////////////////////// -#include "SkRWBuffer.h" const char gABC[] = "abcdefghijklmnopqrstuvwxyz"; @@ -251,8 +259,6 @@ static void check_alphabet_buffer(skiatest::Reporter* reporter, const SkROBuffer check_abcs(reporter, storage.get(), size); } -#include "SkTaskGroup.h" - DEF_TEST(RWBuffer, reporter) { // Knowing that the default capacity is 4096, choose N large enough so we force it to use // multiple buffers internally. diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp index 054708d14f..8619f5ce32 100644 --- a/tests/DefaultPathRendererTest.cpp +++ b/tests/DefaultPathRendererTest.cpp @@ -5,17 +5,34 @@ * found in the LICENSE file. */ -#include "Test.h" -#include "SkBitmap.h" +#include "SkTypes.h" #if SK_SUPPORT_GPU #include "GrClip.h" +#include "GrColor.h" +#include "GrContext.h" +#include "GrContextFactory.h" +#include "GrContextOptions.h" +#include "GrContextPriv.h" +#include "GrFragmentProcessor.h" +#include "GrPaint.h" #include "GrRenderTargetContext.h" #include "GrStyle.h" #include "GrTypesPriv.h" - +#include "SkBitmap.h" +#include "SkColor.h" +#include "SkColorSpace.h" +#include "SkImageInfo.h" +#include "SkMatrix.h" +#include "SkPath.h" +#include "SkRect.h" +#include "SkRefCnt.h" +#include "SkStrokeRec.h" +#include "Test.h" #include "effects/GrConstColorProcessor.h" +#include + static void only_allow_default(GrContextOptions* options) { options->fGpuPathRenderers = GpuPathRenderers::kNone; } diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index d033f890d8..f67d3466c6 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -8,16 +8,30 @@ #include "SkTypes.h" #if SK_SUPPORT_GPU - #include "GrBackendSurface.h" +#include "GrCaps.h" +#include "GrContext.h" +#include "GrContextFactory.h" #include "GrContextPriv.h" #include "GrGpu.h" +#include "GrRenderTargetContext.h" +#include "GrRenderTargetProxy.h" +#include "GrTextureProxy.h" #include "GrTextureProxyPriv.h" +#include "GrTypes.h" +#include "GrTypesPriv.h" +#include "SkBitmap.h" #include "SkCanvas.h" -#include "SkColorSpacePriv.h" +#include "SkColorSpace.h" +#include "SkDeferredDisplayList.h" #include "SkDeferredDisplayListRecorder.h" #include "SkGpuDevice.h" +#include "SkImage.h" +#include "SkImageInfo.h" #include "SkImage_Gpu.h" +#include "SkPaint.h" +#include "SkRect.h" +#include "SkRefCnt.h" #include "SkSurface.h" #include "SkSurfaceCharacterization.h" #include "SkSurfaceProps.h" @@ -25,10 +39,16 @@ #include "Test.h" #include "gl/GrGLCaps.h" #include "gl/GrGLDefines.h" +#include "gl/GrGLTypes.h" + #ifdef SK_VULKAN #include "vk/GrVkDefines.h" #endif +#include +#include +#include + // Try to create a backend format from the provided colorType and config. Return an invalid // backend format if the combination is infeasible. static GrBackendFormat create_backend_format(GrContext* context, diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp index 9c9e198123..4310cbe2fe 100644 --- a/tests/DetermineDomainModeTest.cpp +++ b/tests/DetermineDomainModeTest.cpp @@ -5,15 +5,23 @@ * found in the LICENSE file. */ -#include "Test.h" +#include "SkTypes.h" #if SK_SUPPORT_GPU - +#include "GrContext.h" +#include "GrContextFactory.h" #include "GrContextPriv.h" #include "GrProxyProvider.h" -#include "GrSurfaceProxy.h" +#include "GrSamplerState.h" #include "GrTextureProducer.h" #include "GrTextureProxy.h" +#include "GrTypes.h" +#include "GrTypesPriv.h" +#include "SkRect.h" +#include "SkRefCnt.h" +#include "Test.h" + +#include // For DetermineDomainMode (in the MDB world) we have 3 rects: // 1) the final instantiated backing storage (i.e., the actual GrTexture's extent) diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp index 58369cc149..184da92fb7 100644 --- a/tests/DeviceTest.cpp +++ b/tests/DeviceTest.cpp @@ -5,16 +5,24 @@ * found in the LICENSE file. */ -#include "SkBitmapDevice.h" +#include "SkBitmap.h" #include "SkDevice.h" +#include "SkImage.h" +#include "SkImageInfo.h" +#include "SkRect.h" +#include "SkRefCnt.h" #include "SkSpecialImage.h" +#include "SkTypes.h" +#include "Test.h" +class SkColorSpace; #if SK_SUPPORT_GPU +#include "GrContextFactory.h" +#include "GrTypes.h" #include "SkGpuDevice.h" +class GrContext; #endif -#include "Test.h" - class DeviceTestingAccess { public: static sk_sp MakeSpecial(SkBaseDevice* dev, const SkBitmap& bm) { diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp index c91e827eb3..6ea0e9bb75 100644 --- a/tests/DiscardableMemoryPoolTest.cpp +++ b/tests/DiscardableMemoryPoolTest.cpp @@ -4,10 +4,14 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkDiscardableMemoryPool.h" +#include "SkDiscardableMemory.h" +#include "SkDiscardableMemoryPool.h" +#include "SkRefCnt.h" #include "Test.h" +#include + DEF_TEST(DiscardableMemoryPool, reporter) { sk_sp pool(SkDiscardableMemoryPool::Make(1)); pool->setRAMBudget(3); diff --git a/tests/DiscardableMemoryTest.cpp b/tests/DiscardableMemoryTest.cpp index 2b09533b0c..8447e4d45c 100644 --- a/tests/DiscardableMemoryTest.cpp +++ b/tests/DiscardableMemoryTest.cpp @@ -5,10 +5,14 @@ * found in the LICENSE file. */ +#include "SkDiscardableMemory.h" #include "SkDiscardableMemoryPool.h" - +#include "SkRefCnt.h" #include "Test.h" +#include +#include + namespace { constexpr char kTestString[] = "HELLO, WORLD!"; constexpr size_t kTestStringLength = sizeof(kTestString); diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 8ad177f5c1..43132e92f4 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -7,16 +7,17 @@ #include "SkBitmap.h" #include "SkCanvas.h" -#include "SkData.h" -#include "SkDiscardableMemoryPool.h" -#include "SkImageGenerator.h" +#include "SkColor.h" +#include "SkMatrix.h" #include "SkMatrixUtils.h" #include "SkPaint.h" #include "SkPath.h" -#include "SkPixelRef.h" #include "SkRandom.h" +#include "SkRect.h" +#include "SkScalar.h" #include "SkShader.h" -#include "SkSurface.h" +#include "SkSize.h" +#include "SkTypes.h" #include "Test.h" /////////////////////////////////////////////////////////////////////////////// diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp index 27c9659e43..ff8fae0316 100644 --- a/tests/DrawFilterTest.cpp +++ b/tests/DrawFilterTest.cpp @@ -7,8 +7,10 @@ #include "SkCanvas.h" #include "SkDrawFilter.h" +#include "SkRefCnt.h" #include "SkSurface.h" #include "Test.h" +class SkPaint; #ifdef SK_SUPPORT_LEGACY_DRAWFILTER diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp index 584ae64825..9388248c2f 100644 --- a/tests/DrawOpAtlasTest.cpp +++ b/tests/DrawOpAtlasTest.cpp @@ -8,10 +8,37 @@ #include "SkTypes.h" #if SK_SUPPORT_GPU - +#include "GrContext.h" +#include "GrContextFactory.h" #include "GrContextPriv.h" +#include "GrDeferredUpload.h" +#include "GrDrawOpAtlas.h" +#include "GrDrawingManager.h" +#include "GrOnFlushResourceProvider.h" +#include "GrOpFlushState.h" +#include "GrRenderTargetContext.h" +#include "GrSurfaceProxyPriv.h" +#include "GrTextureProxy.h" +#include "GrTypesPriv.h" +#include "GrXferProcessor.h" +#include "SkBitmap.h" +#include "SkColor.h" +#include "SkColorSpace.h" +#include "SkIPoint16.h" +#include "SkImageInfo.h" +#include "SkMatrix.h" +#include "SkPaint.h" +#include "SkPoint.h" +#include "SkRefCnt.h" #include "Test.h" -#include "text/GrGlyphCache.h" +#include "ops/GrDrawOp.h" +#include "text/GrAtlasManager.h" +#include "text/GrAtlasTextContext.h" +#include "text/GrTextUtils.h" + +#include + +class GrResourceProvider; static const int kNumPlots = 2; static const int kPlotSize = 32; @@ -145,16 +172,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BasicDrawOpAtlas, reporter, ctxInfo) { check(reporter, atlas.get(), 1, 4, 1); } -#include "GrTest.h" - -#include "GrDrawingManager.h" -#include "GrOpFlushState.h" -#include "GrProxyProvider.h" - -#include "effects/GrConstColorProcessor.h" -#include "ops/GrAtlasTextOp.h" -#include "text/GrAtlasTextContext.h" - // This test verifies that the GrAtlasTextOp::onPrepare method correctly handles a failure // when allocating an atlas page. DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo) { diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp index 0682319a01..5a692149b1 100644 --- a/tests/DrawPathTest.cpp +++ b/tests/DrawPathTest.cpp @@ -7,9 +7,21 @@ #include "SkBitmap.h" #include "SkCanvas.h" +#include "SkColor.h" #include "SkDashPathEffect.h" +#include "SkImageInfo.h" +#include "SkMatrix.h" +#include "SkPaint.h" +#include "SkPath.h" +#include "SkPathEffect.h" +#include "SkPoint.h" +#include "SkRRect.h" +#include "SkRect.h" +#include "SkRefCnt.h" +#include "SkScalar.h" #include "SkStrokeRec.h" #include "SkSurface.h" +#include "SkTypes.h" #include "Test.h" // test that we can draw an aa-rect at coordinates > 32K (bigger than fixedpoint) diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp index 062d935d67..ac13140507 100644 --- a/tests/DrawTextTest.cpp +++ b/tests/DrawTextTest.cpp @@ -20,7 +20,7 @@ #include "SkTypes.h" #include "Test.h" -#include +#include static const SkColor bgColor = SK_ColorWHITE; diff --git a/tests/DynamicHashTest.cpp b/tests/DynamicHashTest.cpp index a857506fd0..62c070aca1 100644 --- a/tests/DynamicHashTest.cpp +++ b/tests/DynamicHashTest.cpp @@ -6,8 +6,11 @@ */ #include "SkTDynamicHash.h" +#include "SkTypes.h" #include "Test.h" +#include + namespace { struct Entry { diff --git a/tools/gpu/vk/GrVulkanDefines.h b/tools/gpu/vk/GrVulkanDefines.h index 2eb49208fa..2052341dbb 100644 --- a/tools/gpu/vk/GrVulkanDefines.h +++ b/tools/gpu/vk/GrVulkanDefines.h @@ -8,6 +8,8 @@ #ifndef GrVulkanDefines_DEFINED #define GrVulkanDefines_DEFINED +#include "SkTypes.h" + #if defined(SK_BUILD_FOR_WIN) # if !defined(VK_USE_PLATFORM_WIN32_KHR) # define VK_USE_PLATFORM_WIN32_KHR @@ -28,6 +30,6 @@ #define VK_NO_PROTOTYPES #endif -#include +#include // IWYU pragma: export #endif -- cgit v1.2.3