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

Side by Side Diff: src/gpu/effects/GrCustomXfermode.cpp

Issue 1626553002: Revert of added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDisableColorXP.h » ('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 "effects/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 GR_STATIC_ASSERT(kExclusion_GrBlendEquation == SkXfermode::kExclusion_Mode + kOffset); 47 GR_STATIC_ASSERT(kExclusion_GrBlendEquation == SkXfermode::kExclusion_Mode + kOffset);
48 GR_STATIC_ASSERT(kMultiply_GrBlendEquation == SkXfermode::kMultiply_Mode + k Offset); 48 GR_STATIC_ASSERT(kMultiply_GrBlendEquation == SkXfermode::kMultiply_Mode + k Offset);
49 GR_STATIC_ASSERT(kHSLHue_GrBlendEquation == SkXfermode::kHue_Mode + kOffset) ; 49 GR_STATIC_ASSERT(kHSLHue_GrBlendEquation == SkXfermode::kHue_Mode + kOffset) ;
50 GR_STATIC_ASSERT(kHSLSaturation_GrBlendEquation == SkXfermode::kSaturation_M ode + kOffset); 50 GR_STATIC_ASSERT(kHSLSaturation_GrBlendEquation == SkXfermode::kSaturation_M ode + kOffset);
51 GR_STATIC_ASSERT(kHSLColor_GrBlendEquation == SkXfermode::kColor_Mode + kOff set); 51 GR_STATIC_ASSERT(kHSLColor_GrBlendEquation == SkXfermode::kColor_Mode + kOff set);
52 GR_STATIC_ASSERT(kHSLLuminosity_GrBlendEquation == SkXfermode::kLuminosity_M ode + kOffset); 52 GR_STATIC_ASSERT(kHSLLuminosity_GrBlendEquation == SkXfermode::kLuminosity_M ode + kOffset);
53 GR_STATIC_ASSERT(kGrBlendEquationCnt == SkXfermode::kLastMode + 1 + kOffset) ; 53 GR_STATIC_ASSERT(kGrBlendEquationCnt == SkXfermode::kLastMode + 1 + kOffset) ;
54 } 54 }
55 55
56 static bool can_use_hw_blend_equation(GrBlendEquation equation, 56 static bool can_use_hw_blend_equation(GrBlendEquation equation,
57 const GrPipelineOptimizations& opt, 57 const GrProcOptInfo& coveragePOI,
58 const GrCaps& caps) { 58 const GrCaps& caps) {
59 if (!caps.advancedBlendEquationSupport()) { 59 if (!caps.advancedBlendEquationSupport()) {
60 return false; 60 return false;
61 } 61 }
62 if (opt.fOverrides.fUsePLSDstRead) { 62 if (coveragePOI.isFourChannelOutput()) {
63 return false;
64 }
65 if (opt.fCoveragePOI.isFourChannelOutput()) {
66 return false; // LCD coverage must be applied after the blend equation. 63 return false; // LCD coverage must be applied after the blend equation.
67 } 64 }
68 if (caps.canUseAdvancedBlendEquation(equation)) { 65 if (caps.canUseAdvancedBlendEquation(equation)) {
69 return false; 66 return false;
70 } 67 }
71 return true; 68 return true;
72 } 69 }
73 70
74 /////////////////////////////////////////////////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////
75 // Xfer Processor 72 // Xfer Processor
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 336
340 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 337 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
341 GrXPFactory::InvariantBlendedColor*) const ove rride; 338 GrXPFactory::InvariantBlendedColor*) const ove rride;
342 339
343 private: 340 private:
344 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, 341 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
345 const GrPipelineOptimizations& optimi zations, 342 const GrPipelineOptimizations& optimi zations,
346 bool hasMixedSamples, 343 bool hasMixedSamples,
347 const DstTexture*) const override; 344 const DstTexture*) const override;
348 345
349 bool onWillReadDstColor(const GrCaps& caps, 346 bool willReadDstColor(const GrCaps& caps,
350 const GrPipelineOptimizations& optimizations, 347 const GrPipelineOptimizations& optimizations,
351 bool hasMixedSamples) const override; 348 bool hasMixedSamples) const override;
352 349
353 bool onIsEqual(const GrXPFactory& xpfBase) const override { 350 bool onIsEqual(const GrXPFactory& xpfBase) const override {
354 const CustomXPFactory& xpf = xpfBase.cast<CustomXPFactory>(); 351 const CustomXPFactory& xpf = xpfBase.cast<CustomXPFactory>();
355 return fMode == xpf.fMode; 352 return fMode == xpf.fMode;
356 } 353 }
357 354
358 GR_DECLARE_XP_FACTORY_TEST; 355 GR_DECLARE_XP_FACTORY_TEST;
359 356
360 SkXfermode::Mode fMode; 357 SkXfermode::Mode fMode;
361 GrBlendEquation fHWBlendEquation; 358 GrBlendEquation fHWBlendEquation;
362 359
363 typedef GrXPFactory INHERITED; 360 typedef GrXPFactory INHERITED;
364 }; 361 };
365 362
366 CustomXPFactory::CustomXPFactory(SkXfermode::Mode mode) 363 CustomXPFactory::CustomXPFactory(SkXfermode::Mode mode)
367 : fMode(mode), 364 : fMode(mode),
368 fHWBlendEquation(hw_blend_equation(mode)) { 365 fHWBlendEquation(hw_blend_equation(mode)) {
369 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); 366 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
370 this->initClassID<CustomXPFactory>(); 367 this->initClassID<CustomXPFactory>();
371 } 368 }
372 369
373 GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps, 370 GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
374 const GrPipelineOptimiza tions& opt, 371 const GrPipelineOptimiza tions& opt,
375 bool hasMixedSamples, 372 bool hasMixedSamples,
376 const DstTexture* dstTex ture) const { 373 const DstTexture* dstTex ture) const {
377 if (can_use_hw_blend_equation(fHWBlendEquation, opt, caps)) { 374 if (can_use_hw_blend_equation(fHWBlendEquation, opt.fCoveragePOI, caps)) {
378 SkASSERT(!dstTexture || !dstTexture->texture()); 375 SkASSERT(!dstTexture || !dstTexture->texture());
379 return new CustomXP(fMode, fHWBlendEquation); 376 return new CustomXP(fMode, fHWBlendEquation);
380 } 377 }
381 return new CustomXP(dstTexture, hasMixedSamples, fMode); 378 return new CustomXP(dstTexture, hasMixedSamples, fMode);
382 } 379 }
383 380
384 bool CustomXPFactory::onWillReadDstColor(const GrCaps& caps, 381 bool CustomXPFactory::willReadDstColor(const GrCaps& caps,
385 const GrPipelineOptimizations& optimiza tions, 382 const GrPipelineOptimizations& optimizati ons,
386 bool hasMixedSamples) const { 383 bool hasMixedSamples) const {
387 return !can_use_hw_blend_equation(fHWBlendEquation, optimizations, caps); 384 return !can_use_hw_blend_equation(fHWBlendEquation, optimizations.fCoverageP OI, caps);
388 } 385 }
389 386
390 void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 387 void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
391 InvariantBlendedColor* blendedCol or) const { 388 InvariantBlendedColor* blendedCol or) const {
392 blendedColor->fWillBlendWithDst = true; 389 blendedColor->fWillBlendWithDst = true;
393 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 390 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
394 } 391 }
395 392
396 GR_DEFINE_XP_FACTORY_TEST(CustomXPFactory); 393 GR_DEFINE_XP_FACTORY_TEST(CustomXPFactory);
397 const GrXPFactory* CustomXPFactory::TestCreate(GrProcessorTestData* d) { 394 const GrXPFactory* CustomXPFactory::TestCreate(GrProcessorTestData* d) {
398 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, 395 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1,
399 SkXfermode::kLastSeparableMode); 396 SkXfermode::kLastSeparableMode);
400 397
401 return new CustomXPFactory(static_cast<SkXfermode::Mode>(mode)); 398 return new CustomXPFactory(static_cast<SkXfermode::Mode>(mode));
402 } 399 }
403 400
404 /////////////////////////////////////////////////////////////////////////////// 401 ///////////////////////////////////////////////////////////////////////////////
405 402
406 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { 403 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
407 if (!GrCustomXfermode::IsSupportedMode(mode)) { 404 if (!GrCustomXfermode::IsSupportedMode(mode)) {
408 return nullptr; 405 return nullptr;
409 } else { 406 } else {
410 return new CustomXPFactory(mode); 407 return new CustomXPFactory(mode);
411 } 408 }
412 } 409 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDisableColorXP.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698