Skip to content

Commit 94ce77a

Browse files
committed
gdi: fix render issue in TextOut
fixes render issue when scrolling a text box (ie notepad) from left to right
1 parent af4f08f commit 94ce77a

File tree

2 files changed

+37
-83
lines changed

2 files changed

+37
-83
lines changed

fpgx35dll/source/draw.c

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ RECTL *prclDest,
391391
POINTL *pptlSrc)
392392
{
393393
RECTL rcl;
394+
POINTL point = {0};
394395

395396
if (pco == NULL || pco->iDComplexity == DC_TRIVIAL) {
396397
rcl.left = max(0, prclDest->left);
@@ -407,6 +408,12 @@ POINTL *pptlSrc)
407408
if (rcl.top >= rcl.bottom) return TRUE;
408409
if (rcl.left >= rcl.right) return TRUE;
409410

411+
if (pptlSrc == NULL) {
412+
pptlSrc = &point;
413+
point.x = rcl.left;
414+
point.y = rcl.top;
415+
}
416+
410417
switch (psoSrc->iBitmapFormat) {
411418
default:
412419
return FALSE;
@@ -454,9 +461,6 @@ POINTL *pptlSrc)
454461
if (psoDest->iType != STYPE_OURSURFACE && psoSrc->iType != STYPE_OURSURFACE) {
455462
return EngCopyBits(psoDest, psoSrc, pco, pxlo, prclDest, pptlSrc);
456463
}
457-
POINTL point = {0};
458-
point.x = prclDest->left;
459-
point.y = prclDest->top;
460464

461465
// Get the pdev. At least one of dest or src must be devbitmap.
462466
PPDEV ppDev = NULL;
@@ -476,7 +480,7 @@ POINTL *pptlSrc)
476480
return FALSE;
477481
}
478482
psoDest = ppDev->psurfBigFb;
479-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
483+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
480484
}
481485

482486
// Copying to framebuffer
@@ -489,7 +493,7 @@ POINTL *pptlSrc)
489493
}
490494
psoSrc = psoDest;
491495
psoDest = ppDev->psurfBigFb;
492-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
496+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
493497
}
494498

495499
// Copying from framebuffer
@@ -538,17 +542,13 @@ MIX mix)
538542
destRect.right = (PathBounds.xRight >> 4) + 2;
539543
destRect.bottom = (PathBounds.yBottom >> 4) + 2;
540544

541-
POINTL point = {0};
542-
point.x = destRect.left;
543-
point.y = destRect.top;
544-
545545
// Call via the double buffer
546546
if (!EngStrokePath(ppdev->psurfDouble, ppo, pco, pxo, pbo, pptlBrush, pla, mix)) {
547547
return FALSE;
548548
}
549549

550550
// Copy back to the framebuffer
551-
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, &point);
551+
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, NULL);
552552
}
553553

554554
BOOL DrvTextOut(
@@ -576,20 +576,17 @@ MIX mix)
576576
// Copy to the double buffer
577577
RECTL* prclDest = (prclOpaque != NULL) ? prclOpaque : &pstro->rclBkGround;
578578
PPDEV ppdev = (PPDEV)pso->dhpdev;
579-
POINTL point = {0};
580579

581580
RECTL rclDest;
582581
memcpy(&rclDest, prclDest, sizeof(rclDest));
583-
point.x = prclDest->left;
584-
point.y = prclDest->top;
585582

586583
// Call via the double buffer
587584
if (!EngTextOut(ppdev->psurfDouble, pstro, pfo, pco, prclExtra, prclOpaque, pboFore, pboOpaque, pptlOrg, mix)) {
588585
return FALSE;
589586
}
590587

591588
// Copy back to the framebuffer
592-
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, NULL, NULL, &rclDest, &point);
589+
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &rclDest, NULL);
593590
}
594591

595592
BOOL DrvBitBlt(
@@ -614,9 +611,6 @@ ROP4 rop4
614611
if (psoDest->iType != STYPE_OURSURFACE && (psoSrc == NULL || psoSrc->iType != STYPE_OURSURFACE)) {
615612
return EngBitBlt(psoDest, psoSrc, psoMask, pco, pxlo, prclDest, pptlSrc, pptlMask, pbo, pptlBrush, rop4);
616613
}
617-
POINTL point = {0};
618-
point.x = prclDest->left;
619-
point.y = prclDest->top;
620614

621615
// Get the pdev. At least one of dest or src must be devbitmap.
622616
PPDEV ppDev = NULL;
@@ -637,7 +631,7 @@ ROP4 rop4
637631
}
638632
psoDest = ppDev->psurfBigFb;
639633
psoSrc = ppDev->psurfDouble;
640-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
634+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
641635
}
642636

643637
// Drawing to framebuffer
@@ -650,7 +644,7 @@ ROP4 rop4
650644
}
651645
psoSrc = psoDest;
652646
psoDest = ppDev->psurfBigFb;
653-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
647+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
654648
}
655649

656650
// Drawing from framebuffer
@@ -688,9 +682,6 @@ ULONG iMode
688682
if (psoDest->iType != STYPE_OURSURFACE && (psoSrc == NULL || psoSrc->iType != STYPE_OURSURFACE)) {
689683
return EngStretchBlt(psoDest, psoSrc, psoMask, pco, pxlo, pca, pptlHTOrg, prclDest, prclSrc, pptlMask, iMode);
690684
}
691-
POINTL point = {0};
692-
point.x = prclDest->left;
693-
point.y = prclDest->top;
694685

695686
// Get the pdev. At least one of dest or src must be devbitmap.
696687
PPDEV ppDev = NULL;
@@ -711,7 +702,7 @@ ULONG iMode
711702
}
712703
psoDest = ppDev->psurfBigFb;
713704
psoSrc = ppDev->psurfDouble;
714-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
705+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
715706
}
716707

717708
// Drawing to framebuffer
@@ -724,7 +715,7 @@ ULONG iMode
724715
}
725716
psoSrc = psoDest;
726717
psoDest = ppDev->psurfBigFb;
727-
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, &point);
718+
return CopyBitsSwap(psoDest, psoSrc, pco, NULL, prclDest, NULL);
728719
}
729720

730721
// Drawing from framebuffer
@@ -761,12 +752,8 @@ MIX mix
761752
return FALSE;
762753
}
763754

764-
POINTL point = {0};
765-
point.x = pco->rclBounds.left;
766-
point.y = pco->rclBounds.top;
767-
768755
// Copy back to the framebuffer
769-
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &pco->rclBounds, &point);
756+
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &pco->rclBounds, NULL);
770757
}
771758

772759
BOOL DrvFillPath(
@@ -803,12 +790,8 @@ FLONG flOptions
803790
destRect.bottom = (PathBounds.yBottom >> 4) + 2;
804791
EngDeletePath(ppo);
805792

806-
POINTL point = {0};
807-
point.x = destRect.left;
808-
point.y = destRect.top;
809-
810793
// Copy back to the framebuffer
811-
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, &point);
794+
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, NULL);
812795
}
813796

814797
BOOL DrvStrokeAndFillPath(
@@ -843,15 +826,11 @@ FLONG flOptions
843826
destRect.right = (PathBounds.xRight >> 4) + 2;
844827
destRect.bottom = (PathBounds.yBottom >> 4) + 2;
845828

846-
POINTL point = {0};
847-
point.x = destRect.left;
848-
point.y = destRect.top;
849-
850829
// Call via the double buffer
851830
if (!EngStrokeAndFillPath(ppdev->psurfDouble, ppo, pco, pxo, pboStroke, plineattrs, pboFill, pptlBrushOrg, mixFill, flOptions)) {
852831
return FALSE;
853832
}
854833

855834
// Copy back to the framebuffer
856-
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, &point);
835+
return CopyBitsSwap(ppdev->psurfBigFb, ppdev->psurfDouble, pco, NULL, &destRect, NULL);
857836
}

0 commit comments

Comments
 (0)