~ubuntu-branches/ubuntu/trusty/libsdl1.2/trusty

« back to all changes in this revision

Viewing changes to src/video/SDL_blit.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2009-12-08 01:50:15 UTC
  • mfrom: (2.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20091208015015-mr68dcbbctrhi5at
Tags: 1.2.14-1ubuntu1
* Merge from Debian experimental, remaining changes:
  + debian/control:
    + add libglu1-mesa-dev as a build dependency, so SDL gets built
      with OpenGL support (LP: #328932)
    - dropped build-depends on libarts1-dev, libartsc0-dev. These
      packages will disappear as part of the arts removal
      (LP: #320915)
    - Removed Package: libsdl1.2debian-arts section entirely
    - dropped depends on libsdl1.2debian-arts (= ${binary:Version})
      for libsdl1.2-debian
    - dropped recommends on libartsc0-dev for libsdl1.2-dev
    - Remove svgalib support.
  + debian/rules:
    + set --enable-arts-shared=no and --enable-arts=no in confflags
    - removed --disable-audio-arts from udeb_confflags
    - dropped arts from FLAVOURS=
    + Link using -Wl,-Bsymbolic-functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    SDL - Simple DirectMedia Layer
3
 
    Copyright (C) 1997-2006 Sam Lantinga
 
3
    Copyright (C) 1997-2009 Sam Lantinga
4
4
 
5
5
    This library is free software; you can redistribute it and/or
6
6
    modify it under the terms of the GNU Lesser General Public
166
166
} while(0)
167
167
 
168
168
/* Assemble R-G-B values into a specified pixel format and store them */
169
 
#ifdef __NDS__ // FIXME
 
169
#ifdef __NDS__ /* FIXME */
170
170
#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)                             \
171
171
{                                                                       \
172
172
        Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                         \
180
180
                ((g>>fmt->Gloss)<<fmt->Gshift)|                         \
181
181
                ((b>>fmt->Bloss)<<fmt->Bshift);                         \
182
182
}
183
 
#endif // __NDS__ FIXME
 
183
#endif /* __NDS__ FIXME */
184
184
#define RGB565_FROM_RGB(Pixel, r, g, b)                                 \
185
185
{                                                                       \
186
186
        Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);                        \
330
330
} while(0)
331
331
 
332
332
/* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
333
 
#ifdef __NDS__ // FIXME
 
333
#ifdef __NDS__ /* FIXME */
334
334
#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)                         \
335
335
{                                                                       \
336
336
        Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                         \
346
346
                ((b>>fmt->Bloss)<<fmt->Bshift)|                         \
347
347
                ((a>>fmt->Aloss)<<fmt->Ashift);                         \
348
348
}
349
 
#endif // __NDS__ FIXME
 
349
#endif /* __NDS__ FIXME */
350
350
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)                        \
351
351
{                                                                       \
352
352
        switch (bpp) {                                                  \
384
384
/* Blend the RGB values of two Pixels based on a source alpha value */
385
385
#define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)  \
386
386
do {                                            \
387
 
        dR = (((sR-dR)*(A))>>8)+dR;             \
388
 
        dG = (((sG-dG)*(A))>>8)+dG;             \
389
 
        dB = (((sB-dB)*(A))>>8)+dB;             \
390
 
} while(0)
391
 
 
392
 
/* Blend the RGB values of two Pixels based on a source alpha value */
393
 
#define ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB)        \
394
 
do {                                            \
395
 
    unsigned tR, tG, tB, tA; \
396
 
    tA = 255 - sA; \
397
 
    tR = 1 + (sR * sA) + (dR * tA); \
398
 
    dR = (tR + (tR >> 8)) >> 8; \
399
 
    tG = 1 + (sG * sA) + (dG * tA); \
400
 
    dG = (tG + (tG >> 8)) >> 8; \
401
 
    tB = 1 + (sB * sA) + (dB * tA); \
402
 
    dB = (tB + (tB >> 8)) >> 8; \
 
387
        dR = (((sR-dR)*(A)+255)>>8)+dR;         \
 
388
        dG = (((sG-dG)*(A)+255)>>8)+dG;         \
 
389
        dB = (((sB-dB)*(A)+255)>>8)+dB;         \
403
390
} while(0)
404
391
 
405
392