OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkXfermode.h" | 8 #include "SkXfermode.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 } | 1093 } |
1094 | 1094 |
1095 static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
GrCaps& caps) { | 1095 static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
GrCaps& caps) { |
1096 class TestLCDCoverageBatch: public GrVertexBatch { | 1096 class TestLCDCoverageBatch: public GrVertexBatch { |
1097 public: | 1097 public: |
1098 DEFINE_BATCH_CLASS_ID | 1098 DEFINE_BATCH_CLASS_ID |
1099 | 1099 |
1100 TestLCDCoverageBatch() : INHERITED(ClassID()) {} | 1100 TestLCDCoverageBatch() : INHERITED(ClassID()) {} |
1101 | 1101 |
1102 private: | 1102 private: |
1103 void getInvariantOutputColor(GrInitInvariantOutput* out) const override
{ | 1103 void computePipelineOptimizations(GrInitInvariantOutput* color, |
1104 out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); | 1104 GrInitInvariantOutput* coverage, |
1105 } | 1105 GrBatchToXPOverrides* overrides) const
override { |
1106 | 1106 color->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); |
1107 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const overri
de { | 1107 coverage->setUnknownFourComponents(); |
1108 out->setUnknownFourComponents(); | 1108 coverage->setUsingLCDCoverage(); |
1109 out->setUsingLCDCoverage(); | 1109 overrides->fUsePLSDstRead = false; |
1110 } | 1110 } |
1111 | 1111 |
1112 const char* name() const override { return "Test LCD Text Batch"; } | 1112 const char* name() const override { return "Test LCD Text Batch"; } |
1113 void initBatchTracker(const GrPipelineOptimizations&) override {} | 1113 void initBatchTracker(const GrXPOverridesForBatch&) override {} |
1114 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal
se; } | 1114 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal
se; } |
1115 void onPrepareDraws(Target*) override {}; | 1115 void onPrepareDraws(Target*) override {}; |
1116 | 1116 |
1117 typedef GrVertexBatch INHERITED; | 1117 typedef GrVertexBatch INHERITED; |
1118 } testLCDCoverageBatch; | 1118 } testLCDCoverageBatch; |
1119 | 1119 |
1120 GrProcOptInfo colorPOI, covPOI; | 1120 GrPipelineOptimizations opts; |
1121 colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0); | 1121 testLCDCoverageBatch.getPipelineOptimizations(&opts); |
1122 covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0); | 1122 GrProcOptInfo colorPOI = opts.fColorPOI; |
| 1123 GrProcOptInfo covPOI = opts.fCoveragePOI; |
1123 | 1124 |
1124 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); | 1125 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); |
1125 SkASSERT(covPOI.isFourChannelOutput()); | 1126 SkASSERT(covPOI.isFourChannelOutput()); |
1126 | 1127 |
1127 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc
Over_Mode)); | 1128 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc
Over_Mode)); |
1128 TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false)); | 1129 TEST_ASSERT(!xpf->willNeedDstTexture(caps, colorPOI, covPOI, false)); |
1129 | 1130 |
1130 SkAutoTUnref<GrXferProcessor> xp( | 1131 SkAutoTUnref<GrXferProcessor> xp( |
1131 xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps)); | 1132 xpf->createXferProcessor(colorPOI, covPOI, false, nullptr, caps)); |
1132 if (!xp) { | 1133 if (!xp) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 xp->getOptimizations(colorPOI, covPOI, false, 0, caps); | 1214 xp->getOptimizations(colorPOI, covPOI, false, 0, caps); |
1214 TEST_ASSERT(!xp->hasSecondaryOutput()); | 1215 TEST_ASSERT(!xp->hasSecondaryOutput()); |
1215 } | 1216 } |
1216 } | 1217 } |
1217 } | 1218 } |
1218 ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex); | 1219 ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex); |
1219 } | 1220 } |
1220 | 1221 |
1221 #endif | 1222 #endif |
1222 | 1223 |
OLD | NEW |