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

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

Issue 776843004: Use static XPF for porter duff xp factories. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Block case statements 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/GrXferProcessor.h ('k') | src/gpu/GrDrawState.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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, Coeff* dst) { 693 Coeff* src, Coeff* dst) {
694 Mode mode;
694 if (NULL == xfermode) { 695 if (NULL == xfermode) {
695 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst)); 696 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst));
696 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); 697 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
697 return true; 698 return true;
699 } else if (xfermode->asMode(&mode) && mode <= kLastCoeffMode) {
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));
704 return true;
698 } else if (xfermode->asCoeff(src, dst)) { 705 } else if (xfermode->asCoeff(src, dst)) {
699 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); 706 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
700 return true; 707 return true;
701 } else if (xfermode->asXPFactory(xpf)) { 708 } else if (xfermode->asXPFactory(xpf)) {
702 *src = SkXfermode::kOne_Coeff; 709 *src = SkXfermode::kOne_Coeff;
703 *dst = SkXfermode::kZero_Coeff; 710 *dst = SkXfermode::kZero_Coeff;
704 return true; 711 return true;
705 } else { 712 } else {
706 return xfermode->asFragmentProcessor(fp); 713 return xfermode->asFragmentProcessor(fp);
707 } 714 }
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 } else { 1955 } else {
1949 proc16 = rec.fProc16_General; 1956 proc16 = rec.fProc16_General;
1950 } 1957 }
1951 } 1958 }
1952 return proc16; 1959 return proc16;
1953 } 1960 }
1954 1961
1955 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1956 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1957 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1964 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698