Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
10 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1999-2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * Scan operations
  8. *
  9. * Abstract:
  10. *
  11. * The internal portion of the ScanOperation namespace.
  12. *
  13. * This is kept separate from ScanOperation.hpp so that files which use
  14. * AlphaBlender.hpp or FormatConvert.hpp don't end up including all these
  15. * implementation details.
  16. *
  17. * See Gdiplus\Specs\ScanOperation.doc for an overview of scan operations.
  18. *
  19. * Created:
  20. *
  21. * 07/16/1999 agodfrey
  22. *
  23. \**************************************************************************/
  24. #ifndef _SCANOPERATIONINTERNAL_HPP
  25. #define _SCANOPERATIONINTERNAL_HPP
  26. #include "ScanOperation.hpp"
  27. #include "CPUSpecificOps.hpp"
  28. namespace ScanOperation
  29. {
  30. // Helper macros for defining scan operations
  31. #define DEFINE_POINTERS(srctype, dsttype) \
  32. const srctype* s = static_cast<const srctype *>(src); \
  33. dsttype* d = static_cast<dsttype *>(dst);
  34. #define DEFINE_BLEND_POINTER(type) \
  35. const type* bl = static_cast<const type *>(otherParams->BlendingScan);
  36. // Convert: Convert to a higher-precision format
  37. VOID FASTCALL Convert_1_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  38. VOID FASTCALL Convert_4_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  39. VOID FASTCALL Convert_8_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  40. VOID FASTCALL Convert_555_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  41. VOID FASTCALL Convert_565_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  42. VOID FASTCALL Convert_1555_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  43. VOID FASTCALL Convert_24_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  44. VOID FASTCALL Convert_24BGR_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  45. VOID FASTCALL Convert_32RGB_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  46. VOID FASTCALL Convert_48_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  47. // Quantize: Quickly convert to a lower-precision format
  48. VOID FASTCALL Quantize_sRGB_555(VOID *, const VOID *, INT, const OtherParams *);
  49. VOID FASTCALL Quantize_sRGB_565(VOID *, const VOID *, INT, const OtherParams *);
  50. VOID FASTCALL Quantize_sRGB_1555(VOID *, const VOID *, INT, const OtherParams *);
  51. VOID FASTCALL Quantize_sRGB_24(VOID *, const VOID *, INT, const OtherParams *);
  52. VOID FASTCALL Quantize_sRGB_24BGR(VOID *, const VOID *, INT, const OtherParams *);
  53. VOID FASTCALL Quantize_sRGB_32RGB(VOID *, const VOID *, INT, const OtherParams *);
  54. VOID FASTCALL Quantize_sRGB64_48(VOID *, const VOID *, INT, const OtherParams *);
  55. // Halftone: Halftone to a palettized screen format
  56. VOID FASTCALL HalftoneToScreen_sRGB_8_216(VOID *, const VOID *, INT, const OtherParams *);
  57. VOID FASTCALL HalftoneToScreen_sRGB_8_16(VOID *, const VOID *, INT, const OtherParams *);
  58. // Dither: Dither to a 16bpp format
  59. VOID FASTCALL Dither_sRGB_565(VOID *, const VOID *, INT, const OtherParams *);
  60. VOID FASTCALL Dither_sRGB_555(VOID *, const VOID *, INT, const OtherParams *);
  61. VOID FASTCALL Dither_sRGB_565_MMX(VOID *, const VOID *, INT, const OtherParams *);
  62. VOID FASTCALL Dither_sRGB_555_MMX(VOID *, const VOID *, INT, const OtherParams *);
  63. VOID FASTCALL Dither_Blend_sRGB_565(VOID *, const VOID *, INT, const OtherParams *);
  64. VOID FASTCALL Dither_Blend_sRGB_555(VOID *, const VOID *, INT, const OtherParams *);
  65. VOID FASTCALL Dither_Blend_sRGB_565_MMX(VOID *, const VOID *, INT, const OtherParams *);
  66. VOID FASTCALL Dither_Blend_sRGB_555_MMX(VOID *, const VOID *, INT, const OtherParams *);
  67. // Copy: Copy a scan, in the same format
  68. VOID FASTCALL Copy_1(VOID *, const VOID *, INT, const OtherParams *);
  69. VOID FASTCALL Copy_4(VOID *, const VOID *, INT, const OtherParams *);
  70. VOID FASTCALL Copy_8(VOID *, const VOID *, INT, const OtherParams *);
  71. VOID FASTCALL Copy_16(VOID *, const VOID *, INT, const OtherParams *);
  72. VOID FASTCALL Copy_24(VOID *, const VOID *, INT, const OtherParams *);
  73. VOID FASTCALL Copy_32(VOID *, const VOID *, INT, const OtherParams *);
  74. VOID FASTCALL Copy_48(VOID *, const VOID *, INT, const OtherParams *);
  75. VOID FASTCALL Copy_64(VOID *, const VOID *, INT, const OtherParams *);
  76. // GammaConvert: Convert between formats with differing gamma ramps
  77. VOID FASTCALL GammaConvert_sRGB64_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  78. VOID FASTCALL GammaConvert_sRGB_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  79. // Blend: An alpha-blend 'SourceOver' operation.
  80. VOID FASTCALL Blend_sRGB_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  81. VOID FASTCALL Blend_sRGB_sRGB_MMX(VOID *, const VOID *, INT, const OtherParams *);
  82. VOID FASTCALL Blend_sRGB64_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  83. VOID FASTCALL Blend_sRGB64_sRGB64_MMX(VOID *, const VOID *, INT, const OtherParams *);
  84. VOID FASTCALL Blend_sRGB_555(VOID *, const VOID *, INT, const OtherParams *);
  85. VOID FASTCALL Blend_sRGB_565(VOID *, const VOID *, INT, const OtherParams *);
  86. VOID FASTCALL Blend_sRGB_24(VOID *, const VOID *, INT, const OtherParams *);
  87. VOID FASTCALL Blend_sRGB_24BGR(VOID *, const VOID *, INT, const OtherParams *);
  88. VOID FASTCALL BlendLinear_sRGB_32RGB(VOID *, const VOID *, INT, const OtherParams *);
  89. VOID FASTCALL BlendLinear_sRGB_32RGB_MMX(VOID *, const VOID *, INT, const OtherParams *);
  90. VOID FASTCALL BlendLinear_sRGB_565(VOID *, const VOID *, INT, const OtherParams *);
  91. VOID FASTCALL BlendLinear_sRGB_565_MMX(VOID *, const VOID *, INT, const OtherParams *);
  92. VOID FASTCALL BlendLinear_sRGB_555(VOID *, const VOID *, INT, const OtherParams *);
  93. VOID FASTCALL BlendLinear_sRGB_555_MMX(VOID *, const VOID *, INT, const OtherParams *);
  94. // ReadRMW: For each pixel in "otherParams->blendingScan" that is
  95. // translucent (i.e. has (0 < alpha < 1)), copy the
  96. // corresponding pixel from "src" to "dst".
  97. VOID FASTCALL ReadRMW_8_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  98. VOID FASTCALL ReadRMW_8_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  99. VOID FASTCALL ReadRMW_16_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  100. VOID FASTCALL ReadRMW_16_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  101. VOID FASTCALL ReadRMW_24_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  102. VOID FASTCALL ReadRMW_24_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  103. VOID FASTCALL ReadRMW_32_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  104. VOID FASTCALL ReadRMW_32_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  105. // WriteRMW: For each pixel in "otherParams->blendingScan" that is not
  106. // completely transparent (i.e. has (alpha != 0)), copy the
  107. // corresponding pixel from "src" to "dst".
  108. VOID FASTCALL WriteRMW_8_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  109. VOID FASTCALL WriteRMW_8_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  110. VOID FASTCALL WriteRMW_16_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  111. VOID FASTCALL WriteRMW_16_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  112. VOID FASTCALL WriteRMW_24_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  113. VOID FASTCALL WriteRMW_24_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  114. VOID FASTCALL WriteRMW_32_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  115. VOID FASTCALL WriteRMW_32_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  116. // AlphaMultiply: Multiply each component by the alpha value
  117. VOID FASTCALL AlphaMultiply_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  118. VOID FASTCALL AlphaMultiply_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  119. // AlphaDivide: Divide each component by the alpha value
  120. VOID FASTCALL AlphaDivide_sRGB(VOID *, const VOID *, INT, const OtherParams *);
  121. VOID FASTCALL AlphaDivide_sRGB64(VOID *, const VOID *, INT, const OtherParams *);
  122. // ClearType blend
  123. // solid brush case
  124. VOID FASTCALL CTBlendSolid(VOID *, const VOID *, INT, const OtherParams *);
  125. VOID FASTCALL ReadRMW_16_CT_Solid(VOID *, const VOID *, INT, const OtherParams *);
  126. VOID FASTCALL WriteRMW_16_CT_Solid(VOID *, const VOID *, INT, const OtherParams *);
  127. VOID FASTCALL ReadRMW_24_CT_Solid(VOID *, const VOID *, INT, const OtherParams *);
  128. VOID FASTCALL WriteRMW_24_CT_Solid(VOID *, const VOID *, INT, const OtherParams *);
  129. // arbitrary brush case
  130. VOID FASTCALL CTBlendCARGB(VOID *, const VOID *, INT, const OtherParams *);
  131. VOID FASTCALL ReadRMW_16_CT_CARGB(VOID *, const VOID *, INT, const OtherParams *);
  132. VOID FASTCALL WriteRMW_16_CT_CARGB(VOID *, const VOID *, INT, const OtherParams *);
  133. VOID FASTCALL ReadRMW_24_CT_CARGB(VOID *, const VOID *, INT, const OtherParams *);
  134. VOID FASTCALL WriteRMW_24_CT_CARGB(VOID *, const VOID *, INT, const OtherParams *);
  135. // These arrays organize the operations according to their use,
  136. // indexed by a pixel format:
  137. //
  138. // ConvertCopyOps: Copy pixels of the given format
  139. // ConvertIntoCanonicalOps: Convert from the given format into the
  140. // closest canonical format.
  141. extern ScanOpFunc CopyOps[PIXFMT_MAX];
  142. extern ScanOpFunc ConvertIntoCanonicalOps[PIXFMT_MAX];
  143. // These are specific to EpAlphaBlender, and can't be used by
  144. // EpFormatConverter (not without changing its logic).
  145. //
  146. // All 16bpp/15bpp functions must fully support OtherParams::DoingDither.
  147. //
  148. // ABConvertFromCanonicalOps: Convert to the given format from the closest
  149. // canonical format.
  150. // BlendOpsLowQuality: Blend directly to the given format.
  151. // BlendOpsHighQuality: Gamma-corrected blend directly to the given format
  152. // (with the source data in 32BPP_PARGB format).
  153. extern ScanOpFunc ABConvertFromCanonicalOps[PIXFMT_MAX];
  154. extern ScanOpFunc BlendOpsLowQuality[PIXFMT_MAX];
  155. extern ScanOpFunc BlendOpsHighQuality[PIXFMT_MAX];
  156. };
  157. #endif