Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/GrPorterDuffTest.cpp

Issue 1352813003: add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 : public GrVertexBatch { 1096 class TestLCDCoverageBatch: public GrVertexBatch {
1097 public:
1098 DEFINE_BATCH_CLASS_ID
1099
1100 TestLCDCoverageBatch() : INHERITED(ClassID()) {}
1101
1102 private:
1097 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1103 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
1098 out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221)); 1104 out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221));
1099 } 1105 }
1100 1106
1101 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const overri de { 1107 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const overri de {
1102 out->setUnknownFourComponents(); 1108 out->setUnknownFourComponents();
1103 out->setUsingLCDCoverage(); 1109 out->setUsingLCDCoverage();
1104 } 1110 }
1105 1111
1106 const char* name() const override { return "Test LCD Text Batch"; } 1112 const char* name() const override { return "Test LCD Text Batch"; }
1107 void initBatchTracker(const GrPipelineOptimizations&) override {} 1113 void initBatchTracker(const GrPipelineOptimizations&) override {}
1108 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal se; } 1114 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return fal se; }
1109 void onPrepareDraws(Target*) override {}; 1115 void onPrepareDraws(Target*) override {};
1110 1116
1117 typedef GrVertexBatch INHERITED;
1111 } testLCDCoverageBatch; 1118 } testLCDCoverageBatch;
1112 1119
1113 GrProcOptInfo colorPOI, covPOI; 1120 GrProcOptInfo colorPOI, covPOI;
1114 colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0); 1121 colorPOI.calcColorWithBatch(&testLCDCoverageBatch, nullptr, 0);
1115 covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0); 1122 covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, nullptr, 0);
1116 1123
1117 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); 1124 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
1118 SkASSERT(covPOI.isFourChannelOutput()); 1125 SkASSERT(covPOI.isFourChannelOutput());
1119 1126
1120 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc Over_Mode)); 1127 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc Over_Mode));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 TEST_ASSERT(!xp->hasSecondaryOutput()); 1210 TEST_ASSERT(!xp->hasSecondaryOutput());
1204 xp->getOptimizations(colorPOI, covPOI, false, 0, caps); 1211 xp->getOptimizations(colorPOI, covPOI, false, 0, caps);
1205 TEST_ASSERT(!xp->hasSecondaryOutput()); 1212 TEST_ASSERT(!xp->hasSecondaryOutput());
1206 } 1213 }
1207 } 1214 }
1208 } 1215 }
1209 } 1216 }
1210 1217
1211 #endif 1218 #endif
1212 1219
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698