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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 TEST_ASSERT(xpi.fBlendInfo.fWriteColor); | 1086 TEST_ASSERT(xpi.fBlendInfo.fWriteColor); |
1087 break; | 1087 break; |
1088 default: | 1088 default: |
1089 ERRORF(reporter, "Invalid xfermode."); | 1089 ERRORF(reporter, "Invalid xfermode."); |
1090 break; | 1090 break; |
1091 } | 1091 } |
1092 } | 1092 } |
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 : public GrVertexBatch { |
1097 public: | |
1098 DEFINE_BATCH_CLASS_ID | |
1099 | |
1100 TestLCDCoverageBatch() : INHERITED(ClassID()) {} | |
1101 | |
1102 private: | |
1103 void getInvariantOutputColor(GrInitInvariantOutput* out) const override
{ | 1097 void getInvariantOutputColor(GrInitInvariantOutput* out) const override
{ |
1104 out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); | 1098 out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); |
1105 } | 1099 } |
1106 | 1100 |
1107 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const overri
de { | 1101 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const overri
de { |
1108 out->setUnknownFourComponents(); | 1102 out->setUnknownFourComponents(); |
1109 out->setUsingLCDCoverage(); | 1103 out->setUsingLCDCoverage(); |
1110 } | 1104 } |
1111 | 1105 |
1112 const char* name() const override { return "Test LCD Text Batch"; } | 1106 const char* name() const override { return "Test LCD Text Batch"; } |
1113 void initBatchTracker(const GrPipelineOptimizations&) override {} | 1107 void initBatchTracker(const GrPipelineOptimizations&) override {} |
1114 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal
se; } | 1108 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal
se; } |
1115 void onPrepareDraws(Target*) override {}; | 1109 void onPrepareDraws(Target*) override {}; |
1116 | 1110 |
1117 typedef GrVertexBatch INHERITED; | |
1118 } testLCDCoverageBatch; | 1111 } testLCDCoverageBatch; |
1119 | 1112 |
1120 GrProcOptInfo colorPOI, covPOI; | 1113 GrProcOptInfo colorPOI, covPOI; |
1121 colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0); | 1114 colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0); |
1122 covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0); | 1115 covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0); |
1123 | 1116 |
1124 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); | 1117 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); |
1125 SkASSERT(covPOI.isFourChannelOutput()); | 1118 SkASSERT(covPOI.isFourChannelOutput()); |
1126 | 1119 |
1127 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc
Over_Mode)); | 1120 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc
Over_Mode)); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 TEST_ASSERT(!xp->hasSecondaryOutput()); | 1203 TEST_ASSERT(!xp->hasSecondaryOutput()); |
1211 xp->getOptimizations(colorPOI, covPOI, false, 0, caps); | 1204 xp->getOptimizations(colorPOI, covPOI, false, 0, caps); |
1212 TEST_ASSERT(!xp->hasSecondaryOutput()); | 1205 TEST_ASSERT(!xp->hasSecondaryOutput()); |
1213 } | 1206 } |
1214 } | 1207 } |
1215 } | 1208 } |
1216 } | 1209 } |
1217 | 1210 |
1218 #endif | 1211 #endif |
1219 | 1212 |
OLD | NEW |