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

Side by Side Diff: tests/GrPorterDuffTest.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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 | « tests/GpuColorFilterTest.cpp ('k') | tests/TessellatingPathRendererTests.cpp » ('j') | 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag, 62 kIgnoreColor_OptFlag = GrXferProcessor::kIgnoreColor_OptFlag,
63 kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_OptFlag , 63 kIgnoreCoverage_OptFlag = GrXferProcessor::kIgnoreCoverage_OptFlag ,
64 kCanTweakAlphaForCoverage_OptFlag = GrXferProcessor::kCanTweakAlphaForCovera ge_OptFlag 64 kCanTweakAlphaForCoverage_OptFlag = GrXferProcessor::kCanTweakAlphaForCovera ge_OptFlag
65 }; 65 };
66 66
67 class GrPorterDuffTest { 67 class GrPorterDuffTest {
68 public: 68 public:
69 struct XPInfo { 69 struct XPInfo {
70 XPInfo(skiatest::Reporter* reporter, SkXfermode::Mode xfermode, const Gr Caps& caps, 70 XPInfo(skiatest::Reporter* reporter, SkXfermode::Mode xfermode, const Gr Caps& caps,
71 const GrPipelineOptimizations& optimizations) { 71 const GrPipelineOptimizations& optimizations) {
72 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfermode )); 72 sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
73 SkAutoTUnref<GrXferProcessor> xp( 73 SkAutoTUnref<GrXferProcessor> xp(
74 xpf->createXferProcessor(optimizations, false, nullptr, caps)); 74 xpf->createXferProcessor(optimizations, false, nullptr, caps));
75 TEST_ASSERT(!xpf->willNeedDstTexture(caps, optimizations)); 75 TEST_ASSERT(!xpf->willNeedDstTexture(caps, optimizations));
76 xpf->getInvariantBlendedColor(optimizations.fColorPOI, &fBlendedColo r); 76 xpf->getInvariantBlendedColor(optimizations.fColorPOI, &fBlendedColo r);
77 fOptFlags = xp->getOptimizations(optimizations, false, nullptr, caps ); 77 fOptFlags = xp->getOptimizations(optimizations, false, nullptr, caps );
78 GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType); 78 GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType);
79 xp->getBlendInfo(&fBlendInfo); 79 xp->getBlendInfo(&fBlendInfo);
80 TEST_ASSERT(!xp->willReadDstColor()); 80 TEST_ASSERT(!xp->willReadDstColor());
81 TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendI nfo.fDstBlend)); 81 TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendI nfo.fDstBlend));
82 } 82 }
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 } testLCDCoverageBatch; 1114 } testLCDCoverageBatch;
1115 1115
1116 GrPipelineOptimizations opts; 1116 GrPipelineOptimizations opts;
1117 testLCDCoverageBatch.getPipelineOptimizations(&opts); 1117 testLCDCoverageBatch.getPipelineOptimizations(&opts);
1118 GrProcOptInfo colorPOI = opts.fColorPOI; 1118 GrProcOptInfo colorPOI = opts.fColorPOI;
1119 GrProcOptInfo covPOI = opts.fCoveragePOI; 1119 GrProcOptInfo covPOI = opts.fCoveragePOI;
1120 1120
1121 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags()); 1121 SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
1122 SkASSERT(covPOI.isFourChannelOutput()); 1122 SkASSERT(covPOI.isFourChannelOutput());
1123 1123
1124 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrc Over_Mode)); 1124 sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(SkXfermode::kSrcOver_Mode ));
1125 TEST_ASSERT(!xpf->willNeedDstTexture(caps, opts)); 1125 TEST_ASSERT(!xpf->willNeedDstTexture(caps, opts));
1126 1126
1127 SkAutoTUnref<GrXferProcessor> xp( 1127 SkAutoTUnref<GrXferProcessor> xp(
1128 xpf->createXferProcessor(opts, false, nullptr, caps)); 1128 xpf->createXferProcessor(opts, false, nullptr, caps));
1129 if (!xp) { 1129 if (!xp) {
1130 ERRORF(reporter, "Failed to create an XP with LCD coverage."); 1130 ERRORF(reporter, "Failed to create an XP with LCD coverage.");
1131 return; 1131 return;
1132 } 1132 }
1133 1133
1134 GrXPFactory::InvariantBlendedColor blendedColor; 1134 GrXPFactory::InvariantBlendedColor blendedColor;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 for (int f = 0; f <= 1; f++) { 1191 for (int f = 0; f <= 1; f++) {
1192 if (!f) { 1192 if (!f) {
1193 optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, 0, 1193 optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, 0,
1194 kNone_GrColorCo mponentFlags, true); 1194 kNone_GrColorCo mponentFlags, true);
1195 } else { 1195 } else {
1196 optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, GrC olorPackA4(255), 1196 optimizations.fCoveragePOI.calcWithInitialValues(nullptr, 0, GrC olorPackA4(255),
1197 kRGBA_GrColorCo mponentFlags, true); 1197 kRGBA_GrColorCo mponentFlags, true);
1198 } 1198 }
1199 for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) { 1199 for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
1200 SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m); 1200 SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
1201 SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(xfer mode)); 1201 sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
1202 GrXferProcessor::DstTexture* dstTexture = 1202 GrXferProcessor::DstTexture* dstTexture =
1203 xpf->willNeedDstTexture(caps, optimizations) ? &fakeDstTextu re : 0; 1203 xpf->willNeedDstTexture(caps, optimizations) ? &fakeDstTextu re : 0;
1204 SkAutoTUnref<GrXferProcessor> xp( 1204 SkAutoTUnref<GrXferProcessor> xp(
1205 xpf->createXferProcessor(optimizations, false, dstTexture, c aps)); 1205 xpf->createXferProcessor(optimizations, false, dstTexture, c aps));
1206 if (!xp) { 1206 if (!xp) {
1207 ERRORF(reporter, "Failed to create an XP without dual source blending."); 1207 ERRORF(reporter, "Failed to create an XP without dual source blending.");
1208 return; 1208 return;
1209 } 1209 }
1210 TEST_ASSERT(!xp->hasSecondaryOutput()); 1210 TEST_ASSERT(!xp->hasSecondaryOutput());
1211 xp->getOptimizations(optimizations, false, 0, caps); 1211 xp->getOptimizations(optimizations, false, 0, caps);
1212 TEST_ASSERT(!xp->hasSecondaryOutput()); 1212 TEST_ASSERT(!xp->hasSecondaryOutput());
1213 } 1213 }
1214 } 1214 }
1215 } 1215 }
1216 ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex); 1216 ctx->getGpu()->deleteTestingOnlyBackendTexture(backendTex);
1217 } 1217 }
1218 1218
1219 #endif 1219 #endif
OLDNEW
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/TessellatingPathRendererTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698