[YAROTOWS] Reintegrate the branch. For a brighter future.
[reactos.git] / reactos / subsystems / win32 / win32k / eng / lineto.c
index 995ce32..d5db687 100644 (file)
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * $Id$
  */
 
-#include <w32k.h>
+#include <win32k.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -46,7 +46,7 @@ TranslateRects(RECT_ENUM *RectEnum, POINTL* Translate)
  */
 void FASTCALL
 NWtoSE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
-       BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
+       BRUSHOBJ* pbo, LONG x, LONG y, LONG deltax, LONG deltay,
        POINTL* Translate)
 {
     int i;
@@ -54,7 +54,7 @@ NWtoSE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
     BOOLEAN EnumMore;
     RECTL* ClipRect;
     RECT_ENUM RectEnum;
-    ULONG Pixel = Brush->iSolidColor;
+    ULONG Pixel = pbo->iSolidColor;
     LONG delta;
 
     CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
@@ -117,7 +117,7 @@ NWtoSE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
 
 void FASTCALL
 SWtoNE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
-       BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
+       BRUSHOBJ* pbo, LONG x, LONG y, LONG deltax, LONG deltay,
        POINTL* Translate)
 {
     int i;
@@ -125,7 +125,7 @@ SWtoNE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
     BOOLEAN EnumMore;
     RECTL* ClipRect;
     RECT_ENUM RectEnum;
-    ULONG Pixel = Brush->iSolidColor;
+    ULONG Pixel = pbo->iSolidColor;
     LONG delta;
 
     CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_RIGHTUP, 0);
@@ -187,7 +187,7 @@ SWtoNE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
 
 void FASTCALL
 NEtoSW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
-       BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
+       BRUSHOBJ* pbo, LONG x, LONG y, LONG deltax, LONG deltay,
        POINTL* Translate)
 {
     int i;
@@ -195,7 +195,7 @@ NEtoSW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
     BOOLEAN EnumMore;
     RECTL* ClipRect;
     RECT_ENUM RectEnum;
-    ULONG Pixel = Brush->iSolidColor;
+    ULONG Pixel = pbo->iSolidColor;
     LONG delta;
 
     CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_LEFTDOWN, 0);
@@ -257,7 +257,7 @@ NEtoSW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
 
 void FASTCALL
 SEtoNW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
-       BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
+       BRUSHOBJ* pbo, LONG x, LONG y, LONG deltax, LONG deltay,
        POINTL* Translate)
 {
     int i;
@@ -265,7 +265,7 @@ SEtoNW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
     BOOLEAN EnumMore;
     RECTL* ClipRect;
     RECT_ENUM RectEnum;
-    ULONG Pixel = Brush->iSolidColor;
+    ULONG Pixel = pbo->iSolidColor;
     LONG delta;
 
     CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_LEFTUP, 0);
@@ -331,7 +331,7 @@ SEtoNW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
 BOOL APIENTRY
 EngLineTo(SURFOBJ *DestObj,
           CLIPOBJ *Clip,
-          BRUSHOBJ *Brush,
+          BRUSHOBJ *pbo,
           LONG x1,
           LONG y1,
           LONG x2,
@@ -341,7 +341,7 @@ EngLineTo(SURFOBJ *DestObj,
 {
     LONG x, y, deltax, deltay, xchange, ychange, hx, vy;
     ULONG i;
-    ULONG Pixel = Brush->iSolidColor;
+    ULONG Pixel = pbo->iSolidColor;
     SURFOBJ *OutputObj;
     RECTL DestRect;
     POINTL Translate;
@@ -477,22 +477,22 @@ EngLineTo(SURFOBJ *DestObj,
         {
             if (0 < ychange)
             {
-                NWtoSE(OutputObj, Clip, Brush, x, y, deltax, deltay, &Translate);
+                NWtoSE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
             }
             else
             {
-                SWtoNE(OutputObj, Clip, Brush, x, y, deltax, deltay, &Translate);
+                SWtoNE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
             }
         }
         else
         {
             if (0 < ychange)
             {
-                NEtoSW(OutputObj, Clip, Brush, x, y, deltax, deltay, &Translate);
+                NEtoSW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
             }
             else
             {
-                SEtoNW(OutputObj, Clip, Brush, x, y, deltax, deltay, &Translate);
+                SEtoNW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
             }
         }
     }
@@ -506,9 +506,9 @@ EngLineTo(SURFOBJ *DestObj,
 }
 
 BOOL APIENTRY
-IntEngLineTo(SURFOBJ *DestSurf,
+IntEngLineTo(SURFOBJ *psoDest,
              CLIPOBJ *ClipObj,
-             BRUSHOBJ *Brush,
+             BRUSHOBJ *pbo,
              LONG x1,
              LONG y1,
              LONG x2,
@@ -517,22 +517,22 @@ IntEngLineTo(SURFOBJ *DestSurf,
              MIX Mix)
 {
     BOOLEAN ret;
-    BITMAPOBJ *DestObj;
-    PGDIBRUSHINST GdiBrush;
+    SURFACE *psurfDest;
+    PEBRUSHOBJ GdiBrush;
     RECTL b;
 
-    ASSERT(DestSurf);
-    DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
-    ASSERT(DestObj);
+    ASSERT(psoDest);
+    psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
+    ASSERT(psurfDest);
 
     GdiBrush = CONTAINING_RECORD(
-                   Brush,
-                   GDIBRUSHINST,
+                   pbo,
+                   EBRUSHOBJ,
                    BrushObject);
     ASSERT(GdiBrush);
-    ASSERT(GdiBrush->GdiBrushObject);
+    ASSERT(GdiBrush->pbrush);
 
-    if (GdiBrush->GdiBrushObject->flAttrs & GDIBRUSH_IS_NULL)
+    if (GdiBrush->pbrush->flAttrs & GDIBRUSH_IS_NULL)
         return TRUE;
 
     /* No success yet */
@@ -544,9 +544,9 @@ IntEngLineTo(SURFOBJ *DestSurf,
     if (NULL == ClipObj || DC_TRIVIAL == ClipObj->iDComplexity)
     {
         b.left = 0;
-        b.right = DestSurf->sizlBitmap.cx;
+        b.right = psoDest->sizlBitmap.cx;
         b.top = 0;
-        b.bottom = DestSurf->sizlBitmap.cy;
+        b.bottom = psoDest->sizlBitmap.cy;
     }
     else
     {
@@ -565,18 +565,15 @@ IntEngLineTo(SURFOBJ *DestSurf,
     if (b.left == b.right) b.right++;
     if (b.top == b.bottom) b.bottom++;
 
-    BITMAPOBJ_LockBitmapBits(DestObj);
-    MouseSafetyOnDrawStart(DestSurf, x1, y1, x2, y2);
-
-    if (DestObj->flHooks & HOOK_LINETO)
+    if (psurfDest->flags & HOOK_LINETO)
     {
         /* Call the driver's DrvLineTo */
-        ret = GDIDEVFUNCS(DestSurf).LineTo(
-                  DestSurf, ClipObj, Brush, x1, y1, x2, y2, &b, Mix);
+        ret = GDIDEVFUNCS(psoDest).LineTo(
+                  psoDest, ClipObj, pbo, x1, y1, x2, y2, &b, Mix);
     }
 
 #if 0
-    if (! ret && (DestObj->flHooks & HOOK_STROKEPATH))
+    if (! ret && (psurfDest->flags & HOOK_STROKEPATH))
     {
         /* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */
     }
@@ -584,19 +581,16 @@ IntEngLineTo(SURFOBJ *DestSurf,
 
     if (! ret)
     {
-        ret = EngLineTo(DestSurf, ClipObj, Brush, x1, y1, x2, y2, RectBounds, Mix);
+        ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
     }
 
-    MouseSafetyOnDrawEnd(DestSurf);
-    BITMAPOBJ_UnlockBitmapBits(DestObj);
-
     return ret;
 }
 
 BOOL APIENTRY
-IntEngPolyline(SURFOBJ *DestSurf,
+IntEngPolyline(SURFOBJ *psoDest,
                CLIPOBJ *Clip,
-               BRUSHOBJ *Brush,
+               BRUSHOBJ *pbo,
                CONST LPPOINT  pt,
                LONG dCount,
                MIX Mix)
@@ -612,9 +606,9 @@ IntEngPolyline(SURFOBJ *DestSurf,
         rect.top = min(pt[i-1].y, pt[i].y);
         rect.right = max(pt[i-1].x, pt[i].x);
         rect.bottom = max(pt[i-1].y, pt[i].y);
-        ret = IntEngLineTo(DestSurf,
+        ret = IntEngLineTo(psoDest,
                            Clip,
-                           Brush,
+                           pbo,
                            pt[i-1].x,
                            pt[i-1].y,
                            pt[i].x,