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

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

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comiple bug 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/GrBitmapTextContext.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
10 #include "SkXfermode.h" 9 #include "SkXfermode.h"
11 #include "SkXfermode_opts_SSE2.h" 10 #include "SkXfermode_opts_SSE2.h"
12 #include "SkXfermode_proccoeff.h" 11 #include "SkXfermode_proccoeff.h"
13 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
14 #include "SkLazyPtr.h" 13 #include "SkLazyPtr.h"
15 #include "SkMathPriv.h" 14 #include "SkMathPriv.h"
16 #include "SkReadBuffer.h" 15 #include "SkReadBuffer.h"
17 #include "SkString.h" 16 #include "SkString.h"
18 #include "SkUtilsArm.h" 17 #include "SkUtilsArm.h"
19 #include "SkWriteBuffer.h" 18 #include "SkWriteBuffer.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 672 }
674 673
675 bool SkXfermode::asMode(Mode* mode) const { 674 bool SkXfermode::asMode(Mode* mode) const {
676 return false; 675 return false;
677 } 676 }
678 677
679 bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const { 678 bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const {
680 return false; 679 return false;
681 } 680 }
682 681
683 bool SkXfermode::asFragmentProcessorOrCoeff(SkXfermode* xfermode, GrFragmentProc essor** fp, 682 bool SkXfermode::asXPFactory(GrXPFactory**) const {
684 Coeff* src, Coeff* dst, GrTexture* b ackground) { 683 return false;
684 }
685
686
687 #if SK_SUPPORT_GPU
688 #include "effects/GrPorterDuffXferProcessor.h"
689
690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode,
691 GrFragmentProcessor** fp,
692 GrXPFactory** xpf,
693 Coeff* src, Coeff* dst) {
685 if (NULL == xfermode) { 694 if (NULL == xfermode) {
686 return ModeAsCoeff(kSrcOver_Mode, src, dst); 695 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst));
696 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
697 return true;
687 } else if (xfermode->asCoeff(src, dst)) { 698 } else if (xfermode->asCoeff(src, dst)) {
699 *xpf = GrPorterDuffXPFactory::Create(*src, *dst);
700 return true;
701 } else if (xfermode->asXPFactory(xpf)) {
702 *src = SkXfermode::kOne_Coeff;
703 *dst = SkXfermode::kZero_Coeff;
688 return true; 704 return true;
689 } else { 705 } else {
690 return xfermode->asFragmentProcessor(fp, background); 706 return xfermode->asFragmentProcessor(fp);
691 } 707 }
692 } 708 }
709 #else
710 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode,
711 GrFragmentProcessor** fp,
712 GrXPFactory** xpf,
713 Coeff* src, Coeff* dst) {
714 return false;
715 }
716 #endif
693 717
694 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ 718 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{
695 // no-op. subclasses should override this 719 // no-op. subclasses should override this
696 return dst; 720 return dst;
697 } 721 }
698 722
699 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 723 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
700 const SkPMColor* SK_RESTRICT src, int count, 724 const SkPMColor* SK_RESTRICT src, int count,
701 const SkAlpha* SK_RESTRICT aa) const { 725 const SkAlpha* SK_RESTRICT aa) const {
702 SkASSERT(dst && src && count >= 0); 726 SkASSERT(dst && src && count >= 0);
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 } else { 1948 } else {
1925 proc16 = rec.fProc16_General; 1949 proc16 = rec.fProc16_General;
1926 } 1950 }
1927 } 1951 }
1928 return proc16; 1952 return proc16;
1929 } 1953 }
1930 1954
1931 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1955 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1932 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1956 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1933 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1957 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698