aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-11 13:42:54 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-11 19:56:48 +0000
commit82f44319159bb98dcacdbbec7ea643dde5ed024b (patch)
treedcd8c8a5caaac2675fcfdf48c5af67f946200c24 /tests
parentab273facbfe496a3d5dd798e6b4b57c41eed7f16 (diff)
Make GrPaints move their GrProcessor ownership into GrPipelineBuilder.
This makes GrPaints usable only once. In some places we must make copies in order to issue draws with the same paint state. Change-Id: Ie816e5185ce93a064111cad64c6880e1e21184c2 Reviewed-on: https://skia-review.googlesource.com/6844 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/DFPathRendererTest.cpp19
-rw-r--r--tests/GLProgramsTest.cpp6
-rw-r--r--tests/ImageStorageTest.cpp2
-rw-r--r--tests/IntTextureTest.cpp2
-rw-r--r--tests/PrimitiveProcessorTest.cpp4
-rw-r--r--tests/ProcessorTest.cpp2
-rw-r--r--tests/RectangleTextureTest.cpp2
-rw-r--r--tests/SRGBMipMapTest.cpp6
-rw-r--r--tests/TessellatingPathRendererTests.cpp18
9 files changed, 30 insertions, 31 deletions
diff --git a/tests/DFPathRendererTest.cpp b/tests/DFPathRendererTest.cpp
index ca437da4ed..7fb8c8a120 100644
--- a/tests/DFPathRendererTest.cpp
+++ b/tests/DFPathRendererTest.cpp
@@ -45,16 +45,15 @@ static void test_far_from_origin(GrRenderTargetContext* renderTargetContext, GrP
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
GrNoClip noClip;
- GrPathRenderer::DrawPathArgs args;
- args.fPaint = &paint;
- args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
- args.fRenderTargetContext = renderTargetContext;
- args.fClip = &noClip;
- args.fResourceProvider = rp;
- args.fViewMatrix = &matrix;
- args.fShape = &shape;
- args.fAAType = GrAAType::kCoverage;
- args.fGammaCorrect = false;
+ GrPathRenderer::DrawPathArgs args{rp,
+ std::move(paint),
+ &GrUserStencilSettings::kUnused,
+ renderTargetContext,
+ &noClip,
+ &matrix,
+ &shape,
+ GrAAType::kCoverage,
+ false};
pr->drawPath(args);
}
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 94abd1c9ee..ce79d0e494 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -339,8 +339,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage};
GrAAType aaType = kAATypes[random.nextULessThan(SK_ARRAY_COUNT(kAATypes))];
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, aaType, std::move(op), uss,
- snapToCenters);
+ renderTargetContext->priv().testingOnly_addDrawOp(std::move(grPaint), aaType, std::move(op),
+ uss, snapToCenters);
}
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
drawingManager->flush();
@@ -374,7 +374,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
BlockInputFragmentProcessor::Make(std::move(fp)));
grPaint.addColorFragmentProcessor(std::move(blockFP));
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+ renderTargetContext->priv().testingOnly_addDrawOp(std::move(grPaint), GrAAType::kNone,
std::move(op));
drawingManager->flush();
}
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index 835aec5468..8ffb82d690 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -139,7 +139,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(TestFP::Make(imageStorageTexture, mm, restrict));
- rtContext->drawPaint(GrNoClip(), paint, SkMatrix::I());
+ rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
std::unique_ptr<uint32_t[]> readData(new uint32_t[kS * kS]);
SkImageInfo info = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index ee0b0a82a7..a3e17bf644 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -219,7 +219,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(fp);
- rtContext->drawPaint(GrNoClip(), paint, SkMatrix::I());
+ rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
SkImageInfo readInfo = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
rtContext->readPixels(readInfo, actualData.get(), 0, 0, 0);
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index c4c4a9bdb2..a0b3a353ea 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -125,7 +125,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
#endif
GrPaint grPaint;
// This one should succeed.
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+ renderTargetContext->priv().testingOnly_addDrawOp(GrPaint(grPaint), GrAAType::kNone,
Op::Make(attribCnt));
context->flush();
#if GR_GPU_STATS
@@ -133,7 +133,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
#endif
context->resetGpuStats();
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+ renderTargetContext->priv().testingOnly_addDrawOp(std::move(grPaint), GrAAType::kNone,
Op::Make(attribCnt + 1));
context->flush();
#if GR_GPU_STATS
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index b6cacccb95..8b7f99b6cc 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -163,7 +163,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
fp = TestFP::Make(std::move(fp));
}
paint.addColorFragmentProcessor(std::move(fp));
- renderTargetContext->priv().testingOnly_addDrawOp(paint, GrAAType::kNone,
+ renderTargetContext->priv().testingOnly_addDrawOp(std::move(paint), GrAAType::kNone,
std::move(op));
}
int refCnt, readCnt, writeCnt;
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 587160448c..a0c5409142 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -118,7 +118,7 @@ static void test_basic_draw(skiatest::Reporter* reporter, GrContext* context,
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
- rtContext->drawPaint(GrNoClip(), paint, SkMatrix::I());
+ rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
test_read_pixels(reporter, context, rtContext->asTexture().get(), expectedPixelValues);
}
}
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index afe81678f2..79d86911ff 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -136,13 +136,13 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);
- s32RenderTargetContext->drawRect(noClip, paint, GrAA::kNo, SkMatrix::I(), rect);
+ s32RenderTargetContext->drawRect(noClip, GrPaint(paint), GrAA::kNo, SkMatrix::I(), rect);
read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
"first render of sRGB");
// 2) Draw texture to L32 surface (should generate/use linear mips)
paint.setGammaCorrect(false);
- l32RenderTargetContext->drawRect(noClip, paint, GrAA::kNo, SkMatrix::I(), rect);
+ l32RenderTargetContext->drawRect(noClip, GrPaint(paint), GrAA::kNo, SkMatrix::I(), rect);
// Right now, this test only runs on GL (because Vulkan doesn't support legacy mip-mapping
// skbug.com/5048). On GL, we may not have sRGB decode support. In that case, rendering sRGB
@@ -162,7 +162,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// 3) Go back to sRGB
paint.setGammaCorrect(true);
- s32RenderTargetContext->drawRect(noClip, paint, GrAA::kNo, SkMatrix::I(), rect);
+ s32RenderTargetContext->drawRect(noClip, std::move(paint), GrAA::kNo, SkMatrix::I(), rect);
read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
"re-render as sRGB");
}
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index fc93772106..b03db18713 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -258,16 +258,16 @@ static void test_path(GrRenderTargetContext* renderTargetContext, GrResourceProv
GrNoClip noClip;
GrStyle style(SkStrokeRec::kFill_InitStyle);
- GrPathRenderer::DrawPathArgs args;
- args.fPaint = &paint;
- args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
- args.fRenderTargetContext = renderTargetContext;
- args.fClip = &noClip;
- args.fResourceProvider = rp;
- args.fViewMatrix = &SkMatrix::I();
GrShape shape(path, style);
- args.fShape = &shape;
- args.fAAType = GrAAType::kNone;
+ GrPathRenderer::DrawPathArgs args{rp,
+ std::move(paint),
+ &GrUserStencilSettings::kUnused,
+ renderTargetContext,
+ &noClip,
+ &SkMatrix::I(),
+ &shape,
+ GrAAType::kNone,
+ false};
tess.drawPath(args);
}