~ubuntu-branches/ubuntu/raring/mesa/raring

« back to all changes in this revision

Viewing changes to src/mesa/state_tracker/st_format.c

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2013-01-22 11:54:09 UTC
  • mfrom: (1.7.13)
  • Revision ID: package-import@ubuntu.com-20130122115409-5e9xii2ee1whab3e
Tags: 9.0.2-0ubuntu1
* New upstream release.
* Decrease size of mesa's libgl1-mesa-dri again
  - re-enable 117-static-gallium.patch
  - add 118-dricore-gallium.patch to link against libdricore again

Show diffs side-by-side

added added

removed removed

Lines of Context:
1699
1699
 * Similarly for texture border colors.
1700
1700
 */
1701
1701
void
1702
 
st_translate_color(const GLfloat colorIn[4], GLenum baseFormat,
1703
 
                   GLfloat colorOut[4])
 
1702
st_translate_color(union gl_color_union *colorIn,
 
1703
                   union pipe_color_union *colorOut,
 
1704
                   GLenum baseFormat, GLboolean is_integer)
1704
1705
{
1705
 
   switch (baseFormat) {
1706
 
   case GL_RED:
1707
 
      colorOut[0] = colorIn[0];
1708
 
      colorOut[1] = 0.0F;
1709
 
      colorOut[2] = 0.0F;
1710
 
      colorOut[3] = 1.0F;
1711
 
      break;
1712
 
   case GL_RG:
1713
 
      colorOut[0] = colorIn[0];
1714
 
      colorOut[1] = colorIn[1];
1715
 
      colorOut[2] = 0.0F;
1716
 
      colorOut[3] = 1.0F;
1717
 
      break;
1718
 
   case GL_RGB:
1719
 
      colorOut[0] = colorIn[0];
1720
 
      colorOut[1] = colorIn[1];
1721
 
      colorOut[2] = colorIn[2];
1722
 
      colorOut[3] = 1.0F;
1723
 
      break;
1724
 
   case GL_ALPHA:
1725
 
      colorOut[0] = colorOut[1] = colorOut[2] = 0.0;
1726
 
      colorOut[3] = colorIn[3];
1727
 
      break;
1728
 
   case GL_LUMINANCE:
1729
 
      colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
1730
 
      colorOut[3] = 1.0;
1731
 
      break;
1732
 
   case GL_LUMINANCE_ALPHA:
1733
 
      colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
1734
 
      colorOut[3] = colorIn[3];
1735
 
      break;
1736
 
   case GL_INTENSITY:
1737
 
      colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0];
1738
 
      break;
1739
 
   default:
1740
 
      COPY_4V(colorOut, colorIn);
 
1706
   if (is_integer) {
 
1707
      int *in = colorIn->i;
 
1708
      int *out = colorOut->i;
 
1709
 
 
1710
      switch (baseFormat) {
 
1711
      case GL_RED:
 
1712
         out[0] = in[0];
 
1713
         out[1] = 0;
 
1714
         out[2] = 0;
 
1715
         out[3] = 1;
 
1716
         break;
 
1717
      case GL_RG:
 
1718
         out[0] = in[0];
 
1719
         out[1] = in[1];
 
1720
         out[2] = 0;
 
1721
         out[3] = 1;
 
1722
         break;
 
1723
      case GL_RGB:
 
1724
         out[0] = in[0];
 
1725
         out[1] = in[1];
 
1726
         out[2] = in[2];
 
1727
         out[3] = 1;
 
1728
         break;
 
1729
      case GL_ALPHA:
 
1730
         out[0] = out[1] = out[2] = 0;
 
1731
         out[3] = in[3];
 
1732
         break;
 
1733
      case GL_LUMINANCE:
 
1734
         out[0] = out[1] = out[2] = in[0];
 
1735
         out[3] = 1;
 
1736
         break;
 
1737
      case GL_LUMINANCE_ALPHA:
 
1738
         out[0] = out[1] = out[2] = in[0];
 
1739
         out[3] = in[3];
 
1740
         break;
 
1741
      case GL_INTENSITY:
 
1742
         out[0] = out[1] = out[2] = out[3] = in[0];
 
1743
         break;
 
1744
      default:
 
1745
         COPY_4V(out, in);
 
1746
      }
 
1747
   }
 
1748
   else {
 
1749
      float *in = colorIn->f;
 
1750
      float *out = colorOut->f;
 
1751
 
 
1752
      switch (baseFormat) {
 
1753
      case GL_RED:
 
1754
         out[0] = in[0];
 
1755
         out[1] = 0.0F;
 
1756
         out[2] = 0.0F;
 
1757
         out[3] = 1.0F;
 
1758
         break;
 
1759
      case GL_RG:
 
1760
         out[0] = in[0];
 
1761
         out[1] = in[1];
 
1762
         out[2] = 0.0F;
 
1763
         out[3] = 1.0F;
 
1764
         break;
 
1765
      case GL_RGB:
 
1766
         out[0] = in[0];
 
1767
         out[1] = in[1];
 
1768
         out[2] = in[2];
 
1769
         out[3] = 1.0F;
 
1770
         break;
 
1771
      case GL_ALPHA:
 
1772
         out[0] = out[1] = out[2] = 0.0F;
 
1773
         out[3] = in[3];
 
1774
         break;
 
1775
      case GL_LUMINANCE:
 
1776
         out[0] = out[1] = out[2] = in[0];
 
1777
         out[3] = 1.0F;
 
1778
         break;
 
1779
      case GL_LUMINANCE_ALPHA:
 
1780
         out[0] = out[1] = out[2] = in[0];
 
1781
         out[3] = in[3];
 
1782
         break;
 
1783
      case GL_INTENSITY:
 
1784
         out[0] = out[1] = out[2] = out[3] = in[0];
 
1785
         break;
 
1786
      default:
 
1787
         COPY_4V(out, in);
 
1788
      }
1741
1789
   }
1742
1790
}