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

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

Issue 264923004: remove code behind SK_SUPPORT_LEGACY_PROCXFERMODE (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove dead comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | src/utils/debugger/SkDebugCanvas.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 9
10 #include "SkXfermode.h" 10 #include "SkXfermode.h"
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 (SkPMColor)(dstA << SK_A32_SHIFT))); 767 (SkPMColor)(dstA << SK_A32_SHIFT)));
768 if (0xFF != a) { 768 if (0xFF != a) {
769 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a)); 769 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a));
770 } 770 }
771 dst[i] = SkToU8(A); 771 dst[i] = SkToU8(A);
772 } 772 }
773 } 773 }
774 } 774 }
775 } 775 }
776 776
777 ///////////////////////////////////////////////////////////////////////////////
778 #ifdef SK_SUPPORT_LEGACY_PROCXFERMODE
779
780 void SkProcXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
781 const SkPMColor* SK_RESTRICT src, int count,
782 const SkAlpha* SK_RESTRICT aa) const {
783 SkASSERT(dst && src && count >= 0);
784
785 SkXfermodeProc proc = fProc;
786
787 if (NULL != proc) {
788 if (NULL == aa) {
789 for (int i = count - 1; i >= 0; --i) {
790 dst[i] = proc(src[i], dst[i]);
791 }
792 } else {
793 for (int i = count - 1; i >= 0; --i) {
794 unsigned a = aa[i];
795 if (0 != a) {
796 SkPMColor dstC = dst[i];
797 SkPMColor C = proc(src[i], dstC);
798 if (a != 0xFF) {
799 C = SkFourByteInterp(C, dstC, a);
800 }
801 dst[i] = C;
802 }
803 }
804 }
805 }
806 }
807
808 void SkProcXfermode::xfer16(uint16_t* SK_RESTRICT dst,
809 const SkPMColor* SK_RESTRICT src, int count,
810 const SkAlpha* SK_RESTRICT aa) const {
811 SkASSERT(dst && src && count >= 0);
812
813 SkXfermodeProc proc = fProc;
814
815 if (NULL != proc) {
816 if (NULL == aa) {
817 for (int i = count - 1; i >= 0; --i) {
818 SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
819 dst[i] = SkPixel32ToPixel16_ToU16(proc(src[i], dstC));
820 }
821 } else {
822 for (int i = count - 1; i >= 0; --i) {
823 unsigned a = aa[i];
824 if (0 != a) {
825 SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
826 SkPMColor C = proc(src[i], dstC);
827 if (0xFF != a) {
828 C = SkFourByteInterp(C, dstC, a);
829 }
830 dst[i] = SkPixel32ToPixel16_ToU16(C);
831 }
832 }
833 }
834 }
835 }
836
837 void SkProcXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
838 const SkPMColor* SK_RESTRICT src, int count,
839 const SkAlpha* SK_RESTRICT aa) const {
840 SkASSERT(dst && src && count >= 0);
841
842 SkXfermodeProc proc = fProc;
843
844 if (NULL != proc) {
845 if (NULL == aa) {
846 for (int i = count - 1; i >= 0; --i) {
847 SkPMColor res = proc(src[i], dst[i] << SK_A32_SHIFT);
848 dst[i] = SkToU8(SkGetPackedA32(res));
849 }
850 } else {
851 for (int i = count - 1; i >= 0; --i) {
852 unsigned a = aa[i];
853 if (0 != a) {
854 SkAlpha dstA = dst[i];
855 SkPMColor res = proc(src[i], dstA << SK_A32_SHIFT);
856 unsigned A = SkGetPackedA32(res);
857 if (0xFF != a) {
858 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a));
859 }
860 dst[i] = SkToU8(A);
861 }
862 }
863 }
864 }
865 }
866
867 SkProcXfermode::SkProcXfermode(SkReadBuffer& buffer)
868 : SkXfermode(buffer) {
869 fProc = NULL;
870 if (!buffer.isCrossProcess()) {
871 fProc = (SkXfermodeProc)buffer.readFunctionPtr();
872 }
873 }
874
875 void SkProcXfermode::flatten(SkWriteBuffer& buffer) const {
876 this->INHERITED::flatten(buffer);
877 if (!buffer.isCrossProcess()) {
878 buffer.writeFunctionPtr((void*)fProc);
879 }
880 }
881
882 #ifndef SK_IGNORE_TO_STRING
883 void SkProcXfermode::toString(SkString* str) const {
884 str->appendf("SkProcXfermode: %p", fProc);
885 }
886 #endif
887
888 #endif
889 ////////////////////////////////////////////////////////////////////////////// 777 //////////////////////////////////////////////////////////////////////////////
890 778
891 #if SK_SUPPORT_GPU 779 #if SK_SUPPORT_GPU
892 780
893 #include "GrEffect.h" 781 #include "GrEffect.h"
894 #include "GrCoordTransform.h" 782 #include "GrCoordTransform.h"
895 #include "GrEffectUnitTest.h" 783 #include "GrEffectUnitTest.h"
896 #include "GrTBackendEffectFactory.h" 784 #include "GrTBackendEffectFactory.h"
897 #include "gl/GrGLEffect.h" 785 #include "gl/GrGLEffect.h"
898 786
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) 1970 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode)
2083 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) 1971 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode)
2084 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) 1972 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode)
2085 #if !SK_ARM_NEON_IS_NONE 1973 #if !SK_ARM_NEON_IS_NONE
2086 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) 1974 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode)
2087 #endif 1975 #endif
2088 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) 1976 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
2089 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode) 1977 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode)
2090 #endif 1978 #endif
2091 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1979 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698