aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DeferredDisplayListTest.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-04 14:38:06 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-04 14:38:15 +0000
commit8172c0a24a79f9b4c3e48c79759f0e0f7059ddf5 (patch)
treedc74901cce0149c60823e53a840d5c30318ac142 /tests/DeferredDisplayListTest.cpp
parent3e794595fdcb90f47e80cd8c69f0a1f09176efa2 (diff)
Revert "Add unit test for SkDeferredDisplayLists"
This reverts commit 8458a2807b4a7220c9849f8032dc611438818641. Reason for revert: ?? Original change's description: > Add unit test for SkDeferredDisplayLists > > Change-Id: I015094145cb0af6cfe368c570a5d5280c11c8f28 > Reviewed-on: https://skia-review.googlesource.com/78660 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: Iec3abb18d3ed41fcfbec72bc2de14603f659f8ce No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/79720 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/DeferredDisplayListTest.cpp')
-rw-r--r--tests/DeferredDisplayListTest.cpp142
1 files changed, 0 insertions, 142 deletions
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
deleted file mode 100644
index b6839afa1a..0000000000
--- a/tests/DeferredDisplayListTest.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypes.h"
-
-#if SK_SUPPORT_GPU
-
-#include "SkCanvas.h"
-#include "SkDeferredDisplayListRecorder.h"
-#include "SkGpuDevice.h"
-#include "SkSurface.h"
-#include "SkSurface_Gpu.h"
-#include "SkSurfaceCharacterization.h"
-#include "SkSurfaceProps.h"
-#include "Test.h"
-
-class SurfaceParameters {
-public:
- static const int kNumParams = 8;
- static const int kSampleCount = 5;
-
- SurfaceParameters()
- : fWidth(64)
- , fHeight(64)
- , fOrigin(kTopLeft_GrSurfaceOrigin)
- , fColorType(kRGBA_8888_SkColorType)
- , fColorSpace(SkColorSpace::MakeSRGB())
- , fSampleCount(0)
- , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) {
- }
-
- int sampleCount() const { return fSampleCount; }
-
- // Modify the SurfaceParameters in just one way
- void modify(int i) {
- switch (i) {
- case 0:
- fWidth = 63;
- break;
- case 1:
- fHeight = 63;
- break;
- case 2:
- fOrigin = kBottomLeft_GrSurfaceOrigin;
- break;
- case 3:
- fColorType = kRGBA_F16_SkColorType;
- break;
- case 4:
- fColorSpace = SkColorSpace::MakeSRGBLinear();
- break;
- case kSampleCount:
- fSampleCount = 4;
- break;
- case 6:
- fSurfaceProps = SkSurfaceProps(0x0, kRGB_H_SkPixelGeometry);
- break;
- case 7:
- fSurfaceProps = SkSurfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
- kUnknown_SkPixelGeometry);
- break;
- }
- }
-
- // Create the surface with the current set of parameters
- sk_sp<SkSurface> make(GrContext* context) const {
- // Note that Ganesh doesn't make use of the SkImageInfo's alphaType
- SkImageInfo ii = SkImageInfo::Make(fWidth, fHeight, fColorType,
- kPremul_SkAlphaType, fColorSpace);
-
- return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, ii, fSampleCount,
- fOrigin, &fSurfaceProps);
- }
-
-private:
- int fWidth;
- int fHeight;
- GrSurfaceOrigin fOrigin;
- SkColorType fColorType;
- sk_sp<SkColorSpace> fColorSpace;
- int fSampleCount;
- SkSurfaceProps fSurfaceProps;
-};
-
-// This tests SkSurfaceCharacterization/SkSurface compatibility
-DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
-
- std::unique_ptr<SkDeferredDisplayList> ddl;
-
- // First, create a DDL using the stock SkSurface parameters
- {
- SurfaceParameters params;
-
- sk_sp<SkSurface> s = params.make(context);
- if (!s) {
- return;
- }
-
- SkSurfaceCharacterization c;
- SkAssertResult(s->characterize(&c));
-
- SkDeferredDisplayListRecorder r(c);
- SkCanvas* canvas = r.getCanvas();
- canvas->drawRect(SkRect::MakeXYWH(10, 10, 10, 10), SkPaint());
- ddl = r.detach();
-
- REPORTER_ASSERT(reporter, s->draw(ddl.get()));
- }
-
- // Then, alter each parameter in turn and check that the DDL & surface are incompatible
- for (int i = 0; i < SurfaceParameters::kNumParams; ++i) {
- SurfaceParameters params;
- params.modify(i);
-
- sk_sp<SkSurface> s = params.make(context);
- if (!s) {
- continue;
- }
-
- if (SurfaceParameters::kSampleCount == i) {
- SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get());
-
- int supportedSampleCount = context->caps()->getSampleCount(
- params.sampleCount(),
- gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config());
- if (0 == supportedSampleCount) {
- // If changing the sample count won't result in a different
- // surface characterization, skip this step
- continue;
- }
- }
-
- REPORTER_ASSERT(reporter, !s->draw(ddl.get()));
- }
-}
-
-#endif