~ubuntu-branches/ubuntu/utopic/freerdp/utopic

« back to all changes in this revision

Viewing changes to libfreerdp-gdi/8bpp.c

  • Committer: Package Import Robot
  • Author(s): Otavio Salvador, Jeremy Bicha
  • Date: 2012-02-11 10:34:05 UTC
  • mfrom: (1.1.7) (9.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120211103405-mk0gjhjn70eeyxul
Tags: 1.0.1-1
[ Jeremy Bicha ]
* New upstream release. Closes: #659332.
* Updated symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
795
795
        *pixel = 0xFF;
796
796
}
797
797
 
798
 
pSetPixel8_ROP2 SetPixel8_ROP2_[16] =
 
798
#define PIXEL_TYPE              uint8
 
799
#define GDI_GET_POINTER         gdi_GetPointer_8bpp
 
800
#define GDI_GET_PEN_COLOR       gdi_GetPenColor_8bpp
 
801
 
 
802
#define LINE_TO                 LineTo_BLACK_8bpp
 
803
#define SET_PIXEL_ROP2          SetPixel_BLACK_8bpp
 
804
#include "include/line.c"
 
805
#undef LINE_TO
 
806
#undef SET_PIXEL_ROP2
 
807
 
 
808
#define LINE_TO                 LineTo_NOTMERGEPEN_8bpp
 
809
#define SET_PIXEL_ROP2          SetPixel_NOTMERGEPEN_8bpp
 
810
#include "include/line.c"
 
811
#undef LINE_TO
 
812
#undef SET_PIXEL_ROP2
 
813
 
 
814
#define LINE_TO                 LineTo_MASKNOTPEN_8bpp
 
815
#define SET_PIXEL_ROP2          SetPixel_MASKNOTPEN_8bpp
 
816
#include "include/line.c"
 
817
#undef LINE_TO
 
818
#undef SET_PIXEL_ROP2
 
819
 
 
820
#define LINE_TO                 LineTo_NOTCOPYPEN_8bpp
 
821
#define SET_PIXEL_ROP2          SetPixel_NOTCOPYPEN_8bpp
 
822
#include "include/line.c"
 
823
#undef LINE_TO
 
824
#undef SET_PIXEL_ROP2
 
825
 
 
826
#define LINE_TO                 LineTo_MASKPENNOT_8bpp
 
827
#define SET_PIXEL_ROP2          SetPixel_MASKPENNOT_8bpp
 
828
#include "include/line.c"
 
829
#undef LINE_TO
 
830
#undef SET_PIXEL_ROP2
 
831
 
 
832
#define LINE_TO                 LineTo_NOT_8bpp
 
833
#define SET_PIXEL_ROP2          SetPixel_NOT_8bpp
 
834
#include "include/line.c"
 
835
#undef LINE_TO
 
836
#undef SET_PIXEL_ROP2
 
837
 
 
838
#define LINE_TO                 LineTo_XORPEN_8bpp
 
839
#define SET_PIXEL_ROP2          SetPixel_XORPEN_8bpp
 
840
#include "include/line.c"
 
841
#undef LINE_TO
 
842
#undef SET_PIXEL_ROP2
 
843
 
 
844
#define LINE_TO                 LineTo_NOTMASKPEN_8bpp
 
845
#define SET_PIXEL_ROP2          SetPixel_NOTMASKPEN_8bpp
 
846
#include "include/line.c"
 
847
#undef LINE_TO
 
848
#undef SET_PIXEL_ROP2
 
849
 
 
850
#define LINE_TO                 LineTo_MASKPEN_8bpp
 
851
#define SET_PIXEL_ROP2          SetPixel_MASKPEN_8bpp
 
852
#include "include/line.c"
 
853
#undef LINE_TO
 
854
#undef SET_PIXEL_ROP2
 
855
 
 
856
#define LINE_TO                 LineTo_NOTXORPEN_8bpp
 
857
#define SET_PIXEL_ROP2          SetPixel_NOTXORPEN_8bpp
 
858
#include "include/line.c"
 
859
#undef LINE_TO
 
860
#undef SET_PIXEL_ROP2
 
861
 
 
862
#define LINE_TO                 LineTo_NOP_8bpp
 
863
#define SET_PIXEL_ROP2          SetPixel_NOP_8bpp
 
864
#include "include/line.c"
 
865
#undef LINE_TO
 
866
#undef SET_PIXEL_ROP2
 
867
 
 
868
#define LINE_TO                 LineTo_MERGENOTPEN_8bpp
 
869
#define SET_PIXEL_ROP2          SetPixel_MERGENOTPEN_8bpp
 
870
#include "include/line.c"
 
871
#undef LINE_TO
 
872
#undef SET_PIXEL_ROP2
 
873
 
 
874
#define LINE_TO                 LineTo_COPYPEN_8bpp
 
875
#define SET_PIXEL_ROP2          SetPixel_COPYPEN_8bpp
 
876
#include "include/line.c"
 
877
#undef LINE_TO
 
878
#undef SET_PIXEL_ROP2
 
879
 
 
880
#define LINE_TO                 LineTo_MERGEPENNOT_8bpp
 
881
#define SET_PIXEL_ROP2          SetPixel_MERGEPENNOT_8bpp
 
882
#include "include/line.c"
 
883
#undef LINE_TO
 
884
#undef SET_PIXEL_ROP2
 
885
 
 
886
#define LINE_TO                 LineTo_MERGEPEN_8bpp
 
887
#define SET_PIXEL_ROP2          SetPixel_MERGEPEN_8bpp
 
888
#include "include/line.c"
 
889
#undef LINE_TO
 
890
#undef SET_PIXEL_ROP2
 
891
 
 
892
#define LINE_TO                 LineTo_WHITE_8bpp
 
893
#define SET_PIXEL_ROP2          SetPixel_WHITE_8bpp
 
894
#include "include/line.c"
 
895
#undef LINE_TO
 
896
#undef SET_PIXEL_ROP2
 
897
 
 
898
#undef PIXEL_TYPE
 
899
#undef GDI_GET_POINTER
 
900
#undef GDI_GET_PEN_COLOR
 
901
 
 
902
pLineTo_8bpp LineTo_ROP2_8bpp[32] =
799
903
{
800
 
        SetPixel_BLACK_8bpp,
801
 
        SetPixel_NOTMERGEPEN_8bpp,
802
 
        SetPixel_MASKNOTPEN_8bpp,
803
 
        SetPixel_NOTCOPYPEN_8bpp,
804
 
        SetPixel_MASKPENNOT_8bpp,
805
 
        SetPixel_NOT_8bpp,
806
 
        SetPixel_XORPEN_8bpp,
807
 
        SetPixel_NOTMASKPEN_8bpp,
808
 
        SetPixel_MASKPEN_8bpp,
809
 
        SetPixel_NOTXORPEN_8bpp,
810
 
        SetPixel_NOP_8bpp,
811
 
        SetPixel_MERGENOTPEN_8bpp,
812
 
        SetPixel_COPYPEN_8bpp,
813
 
        SetPixel_MERGEPENNOT_8bpp,
814
 
        SetPixel_MERGEPEN_8bpp,
815
 
        SetPixel_WHITE_8bpp
 
904
        LineTo_BLACK_8bpp,
 
905
        LineTo_NOTMERGEPEN_8bpp,
 
906
        LineTo_MASKNOTPEN_8bpp,
 
907
        LineTo_NOTCOPYPEN_8bpp,
 
908
        LineTo_MASKPENNOT_8bpp,
 
909
        LineTo_NOT_8bpp,
 
910
        LineTo_XORPEN_8bpp,
 
911
        LineTo_NOTMASKPEN_8bpp,
 
912
        LineTo_MASKPEN_8bpp,
 
913
        LineTo_NOTXORPEN_8bpp,
 
914
        LineTo_NOP_8bpp,
 
915
        LineTo_MERGENOTPEN_8bpp,
 
916
        LineTo_COPYPEN_8bpp,
 
917
        LineTo_MERGEPENNOT_8bpp,
 
918
        LineTo_MERGEPEN_8bpp,
 
919
        LineTo_WHITE_8bpp
816
920
};
817
921
 
818
922
int LineTo_8bpp(HGDI_DC hdc, int nXEnd, int nYEnd)
819
923
{
820
 
        int x, y;
821
 
        int x1, y1;
822
 
        int x2, y2;
823
 
        int e, e2;
824
 
        int dx, dy;
825
 
        int sx, sy;
826
 
        HGDI_BITMAP bmp;
827
 
        int bx1, by1;
828
 
        int bx2, by2;
829
 
 
830
 
        int irop2;
831
 
        uint8 pen;
832
 
        uint8* pixel;
833
 
 
834
 
        x1 = hdc->pen->posX;
835
 
        y1 = hdc->pen->posY;
836
 
        x2 = nXEnd;
837
 
        y2 = nYEnd;
838
 
 
839
 
        dx = (x1 > x2) ? x1 - x2 : x2 - x1;
840
 
        dy = (y1 > y2) ? y1 - y2 : y2 - y1;
841
 
 
842
 
        sx = (x1 < x2) ? 1 : -1;
843
 
        sy = (y1 < y2) ? 1 : -1;
844
 
 
845
 
        e = dx - dy;
846
 
 
847
 
        x = x1;
848
 
        y = y1;
849
 
 
850
 
        irop2 = gdi_GetROP2(hdc) - 1;
851
 
        bmp = (HGDI_BITMAP) hdc->selectedObject;
852
 
 
853
 
        if (hdc->clip->null)
854
 
        {
855
 
                bx1 = (x1 < x2) ? x1 : x2;
856
 
                by1 = (y1 < y2) ? y1 : y2;
857
 
                bx2 = (x1 > x2) ? x1 : x2;
858
 
                by2 = (y1 > y2) ? y1 : y2;
859
 
        }
 
924
        pLineTo_8bpp _LineTo;
 
925
        int rop2 = gdi_GetROP2(hdc) - 1;
 
926
 
 
927
        _LineTo = LineTo_ROP2_8bpp[rop2];
 
928
 
 
929
        if (_LineTo != NULL)
 
930
                return _LineTo(hdc, nXEnd, nYEnd);
860
931
        else
861
 
        {
862
 
                bx1 = hdc->clip->x;
863
 
                by1 = hdc->clip->y;
864
 
                bx2 = bx1 + hdc->clip->w - 1;
865
 
                by2 = by1 + hdc->clip->h - 1;
866
 
        }
867
 
 
868
 
        pen = gdi_GetPenColor_8bpp(hdc->pen);
869
 
 
870
 
        while (1)
871
 
        {
872
 
                if (!(x == x2 && y == y2))
873
 
                {
874
 
                        if ((x >= bx1 && x <= bx2) && (y >= by1 && y <= by2))
875
 
                        {
876
 
                                pixel = gdi_GetPointer_8bpp(bmp, x, y);
877
 
                                SetPixel8_ROP2_[irop2](pixel, &pen);
878
 
                        }
879
 
                }
880
 
                else
881
 
                {
882
 
                        break;
883
 
                }
884
 
 
885
 
                e2 = 2 * e;
886
 
 
887
 
                if (e2 > -dy)
888
 
                {
889
 
                        e -= dy;
890
 
                        x += sx;
891
 
                }
892
 
 
893
 
                if (e2 < dx)
894
 
                {
895
 
                        e += dx;
896
 
                        y += sy;
897
 
                }
898
 
        }
899
 
 
900
 
        return 1;
 
932
                return 0;
901
933
}