"Fossies" - the Fresh Open Source Software Archive

Member "xorgxrdp-0.2.10/module/rdpGC.c" (9 Aug 2017, 6501 Bytes) of package /linux/misc/xorgxrdp-0.2.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rdpGC.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2 Copyright 2005-2017 Jay Sorg
    3 
    4 Permission to use, copy, modify, distribute, and sell this software and its
    5 documentation for any purpose is hereby granted without fee, provided that
    6 the above copyright notice appear in all copies and that both that
    7 copyright notice and this permission notice appear in supporting
    8 documentation.
    9 
   10 The above copyright notice and this permission notice shall be included in
   11 all copies or substantial portions of the Software.
   12 
   13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
   16 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
   17 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   18 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   19 
   20 GC related calls
   21 
   22 */
   23 
   24 #if defined(HAVE_CONFIG_H)
   25 #include "config_ac.h"
   26 #endif
   27 
   28 #include <stdio.h>
   29 #include <stdlib.h>
   30 #include <string.h>
   31 
   32 /* this should be before all X11 .h files */
   33 #include <xorg-server.h>
   34 #include <xorgVersion.h>
   35 
   36 /* all driver need this */
   37 #include <xf86.h>
   38 #include <xf86_OSproc.h>
   39 
   40 #include <mipointer.h>
   41 #include <fb.h>
   42 #include <micmap.h>
   43 #include <mi.h>
   44 
   45 #include "rdp.h"
   46 #include "rdpFillSpans.h"
   47 #include "rdpSetSpans.h"
   48 #include "rdpPutImage.h"
   49 #include "rdpCopyArea.h"
   50 #include "rdpCopyPlane.h"
   51 #include "rdpPolyPoint.h"
   52 #include "rdpPolylines.h"
   53 #include "rdpPolySegment.h"
   54 #include "rdpPolyRectangle.h"
   55 #include "rdpPolyArc.h"
   56 #include "rdpFillPolygon.h"
   57 #include "rdpPolyFillRect.h"
   58 #include "rdpPolyFillArc.h"
   59 #include "rdpPolyText8.h"
   60 #include "rdpPolyText16.h"
   61 #include "rdpImageText8.h"
   62 #include "rdpImageText16.h"
   63 #include "rdpImageGlyphBlt.h"
   64 #include "rdpPolyGlyphBlt.h"
   65 #include "rdpPushPixels.h"
   66 #include "rdpDraw.h"
   67 #include "rdpGC.h"
   68 
   69 /******************************************************************************/
   70 #define LOG_LEVEL 1
   71 #define LLOGLN(_level, _args) \
   72     do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
   73 
   74 /******************************************************************************/
   75 #define GC_FUNC_VARS rdpPtr dev; rdpGCPtr priv;
   76 
   77 /******************************************************************************/
   78 #define GC_FUNC_PROLOGUE(_pGC) \
   79     do { \
   80         dev = rdpGetDevFromScreen((_pGC)->pScreen); \
   81         priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
   82         (_pGC)->funcs = priv->funcs; \
   83         if (priv->ops != 0) \
   84         { \
   85             (_pGC)->ops = priv->ops; \
   86         } \
   87     } while (0)
   88 
   89 /******************************************************************************/
   90 #define GC_FUNC_EPILOGUE(_pGC) \
   91     do { \
   92         priv->funcs = (_pGC)->funcs; \
   93         (_pGC)->funcs = &g_rdpGCFuncs; \
   94         if (priv->ops != 0) \
   95         { \
   96             priv->ops = (_pGC)->ops; \
   97             (_pGC)->ops = &g_rdpGCOps; \
   98         } \
   99     } while (0)
  100 
  101 static void
  102 rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d);
  103 static void
  104 rdpChangeGC(GCPtr pGC, unsigned long mask);
  105 static void
  106 rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst);
  107 static void
  108 rdpDestroyGC(GCPtr pGC);
  109 static void
  110 rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
  111 static void
  112 rdpDestroyClip(GCPtr pGC);
  113 static void
  114 rdpCopyClip(GCPtr dst, GCPtr src);
  115 
  116 GCFuncs g_rdpGCFuncs =
  117 {
  118     rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
  119     rdpDestroyClip, rdpCopyClip
  120 };
  121 
  122 GCOps g_rdpGCOps =
  123 {
  124     rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
  125     rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
  126     rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
  127     rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
  128     rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
  129 };
  130 
  131 /******************************************************************************/
  132 static void
  133 rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
  134 {
  135     GC_FUNC_VARS;
  136 
  137     LLOGLN(10, ("rdpValidateGC:"));
  138     GC_FUNC_PROLOGUE(pGC);
  139     pGC->funcs->ValidateGC(pGC, changes, d);
  140     priv->ops = pGC->ops;
  141     GC_FUNC_EPILOGUE(pGC);
  142 }
  143 
  144 /******************************************************************************/
  145 static void
  146 rdpChangeGC(GCPtr pGC, unsigned long mask)
  147 {
  148     GC_FUNC_VARS;
  149 
  150     LLOGLN(10, ("rdpChangeGC:"));
  151     GC_FUNC_PROLOGUE(pGC);
  152     pGC->funcs->ChangeGC(pGC, mask);
  153     GC_FUNC_EPILOGUE(pGC);
  154 }
  155 
  156 /******************************************************************************/
  157 static void
  158 rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
  159 {
  160     GC_FUNC_VARS;
  161 
  162     LLOGLN(10, ("rdpCopyGC:"));
  163     GC_FUNC_PROLOGUE(dst);
  164     dst->funcs->CopyGC(src, mask, dst);
  165     GC_FUNC_EPILOGUE(dst);
  166 }
  167 
  168 /******************************************************************************/
  169 static void
  170 rdpDestroyGC(GCPtr pGC)
  171 {
  172     GC_FUNC_VARS;
  173 
  174     LLOGLN(10, ("rdpDestroyGC:"));
  175     GC_FUNC_PROLOGUE(pGC);
  176     pGC->funcs->DestroyGC(pGC);
  177     GC_FUNC_EPILOGUE(pGC);
  178 }
  179 
  180 /******************************************************************************/
  181 static void
  182 rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
  183 {
  184     GC_FUNC_VARS;
  185 
  186     LLOGLN(10, ("rdpChangeClip:"));
  187     GC_FUNC_PROLOGUE(pGC);
  188     pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
  189     GC_FUNC_EPILOGUE(pGC);
  190 }
  191 
  192 /******************************************************************************/
  193 static void
  194 rdpDestroyClip(GCPtr pGC)
  195 {
  196     GC_FUNC_VARS;
  197 
  198     LLOGLN(10, ("rdpDestroyClip:"));
  199     GC_FUNC_PROLOGUE(pGC);
  200     pGC->funcs->DestroyClip(pGC);
  201     GC_FUNC_EPILOGUE(pGC);
  202 }
  203 
  204 /******************************************************************************/
  205 static void
  206 rdpCopyClip(GCPtr dst, GCPtr src)
  207 {
  208     GC_FUNC_VARS;
  209 
  210     LLOGLN(10, ("rdpCopyClip:"));
  211     GC_FUNC_PROLOGUE(dst);
  212     dst->funcs->CopyClip(dst, src);
  213     GC_FUNC_EPILOGUE(dst);
  214 }
  215 
  216 /*****************************************************************************/
  217 Bool
  218 rdpCreateGC(GCPtr pGC)
  219 {
  220     Bool rv;
  221     rdpPtr dev;
  222     ScreenPtr pScreen;
  223     rdpGCPtr priv;
  224 
  225     LLOGLN(10, ("rdpCreateGC:"));
  226     pScreen = pGC->pScreen;
  227     dev = rdpGetDevFromScreen(pScreen);
  228     priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
  229     pScreen->CreateGC = dev->CreateGC;
  230     rv = pScreen->CreateGC(pGC);
  231     if (rv)
  232     {
  233         priv->funcs = pGC->funcs;
  234         priv->ops = 0;
  235         pGC->funcs = &g_rdpGCFuncs;
  236     }
  237     pScreen->CreateGC = rdpCreateGC;
  238     return rv;
  239 }