32x: drc: new smc handling, some bugfixes + refactoring
[picodrive.git] / pico / draw.c
index 168a6ea..5094e5c 100644 (file)
@@ -1421,7 +1421,7 @@ PICO_INTERNAL void PicoFrameStart(void)
     lines = 240;\r
   }\r
 \r
-  HighCol = HighColBase;\r
+  HighCol = HighColBase + offs * HighColIncrement;\r
   DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;\r
   DrawScanline = 0;\r
   skip_next_line = 0;\r
@@ -1566,10 +1566,12 @@ void PicoDrawSetOutFormat(pdso_t which, int allow_32x)
   rendstatus_old = -1;\r
 }\r
 \r
+// note: may be called on the middle of frame\r
 void PicoDrawSetOutBuf(void *dest, int increment)\r
 {\r
   DrawLineDestBase = dest;\r
   DrawLineDestIncrement = increment;\r
+  DrawLineDest = DrawLineDestBase + DrawScanline * increment;\r
 }\r
 \r
 void PicoDrawSetInternalBuf(void *dest, int increment)\r
@@ -1577,6 +1579,7 @@ void PicoDrawSetInternalBuf(void *dest, int increment)
   if (dest != NULL) {\r
     HighColBase = dest;\r
     HighColIncrement = increment;\r
+    HighCol = HighColBase + DrawScanline * increment;\r
   }\r
   else {\r
     HighColBase = DefHighCol;\r