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

Side by Side Diff: src/core/SkXfermode.cpp

Issue 766653008: Revert of Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Created 6 years 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 | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/effects/SkAlphaThresholdFilter.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkXfermode.h" 9 #include "SkXfermode.h"
10 #include "SkXfermode_opts_SSE2.h" 10 #include "SkXfermode_opts_SSE2.h"
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 bool SkXfermode::asXPFactory(GrXPFactory**) const { 682 bool SkXfermode::asXPFactory(GrXPFactory**) const {
683 return false; 683 return false;
684 } 684 }
685 685
686 686
687 #if SK_SUPPORT_GPU 687 #if SK_SUPPORT_GPU
688 #include "effects/GrPorterDuffXferProcessor.h" 688 #include "effects/GrPorterDuffXferProcessor.h"
689 689
690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, 690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode,
691 GrFragmentProcessor** fp, 691 GrFragmentProcessor** fp,
692 GrXPFactory** xpf) { 692 GrXPFactory** xpf,
693 Coeff src, dst; 693 Coeff* src, Coeff* dst) {
694 Mode mode; 694 Mode mode;
695 if (NULL == xfermode) { 695 if (NULL == xfermode) {
696 *xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode); 696 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst));
697 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
697 return true; 698 return true;
698 } else if (xfermode->asMode(&mode) && mode <= kLastCoeffMode) { 699 } else if (xfermode->asMode(&mode) && mode <= kLastCoeffMode) {
699 *xpf = GrPorterDuffXPFactory::Create(mode); 700 *xpf = GrPorterDuffXPFactory::Create(mode);
701 // TODO: This Line will be removed in follow up cl that handles blending and thus we won't
702 // have to set coeffs here.
703 SkAssertResult(ModeAsCoeff(mode, src, dst));
700 return true; 704 return true;
701 } else if (xfermode->asCoeff(&src, &dst)) { 705 } else if (xfermode->asCoeff(src, dst)) {
702 *xpf = GrPorterDuffXPFactory::Create(src, dst); 706 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
703 return true; 707 return true;
704 } else if (xfermode->asXPFactory(xpf)) { 708 } else if (xfermode->asXPFactory(xpf)) {
709 *src = SkXfermode::kOne_Coeff;
710 *dst = SkXfermode::kZero_Coeff;
705 return true; 711 return true;
706 } else { 712 } else {
707 return xfermode->asFragmentProcessor(fp); 713 return xfermode->asFragmentProcessor(fp);
708 } 714 }
709 } 715 }
710 #else 716 #else
711 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, 717 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode,
712 GrFragmentProcessor** fp, 718 GrFragmentProcessor** fp,
713 GrXPFactory** xpf) { 719 GrXPFactory** xpf,
720 Coeff* src, Coeff* dst) {
714 return false; 721 return false;
715 } 722 }
716 #endif 723 #endif
717 724
718 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ 725 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{
719 // no-op. subclasses should override this 726 // no-op. subclasses should override this
720 return dst; 727 return dst;
721 } 728 }
722 729
723 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 730 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 } else { 1959 } else {
1953 proc16 = rec.fProc16_General; 1960 proc16 = rec.fProc16_General;
1954 } 1961 }
1955 } 1962 }
1956 return proc16; 1963 return proc16;
1957 } 1964 }
1958 1965
1959 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1966 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1960 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1967 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1961 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1968 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698