diff options
Diffstat (limited to 'src/corelib/render')
-rw-r--r-- | src/corelib/render/software/agg_mode.inc | 60 | ||||
-rw-r--r-- | src/corelib/render/software/agg_platform_gdi.inc | 57 |
2 files changed, 82 insertions, 35 deletions
diff --git a/src/corelib/render/software/agg_mode.inc b/src/corelib/render/software/agg_mode.inc index b222f4ff..421095bb 100644 --- a/src/corelib/render/software/agg_mode.inc +++ b/src/corelib/render/software/agg_mode.inc @@ -7,35 +7,29 @@ //---------------------------------------------------------------------------- {$IFDEF CPUPOWERPC } {$DEFINE AGG_CPU_PPC } - {$ENDIF } {$IFDEF CPUI386 } {$DEFINE AGG_CPU_386 } - {$ENDIF } {$IFDEF CPU386 } {$DEFINE AGG_CPU_386 } - {$ENDIF } {$IFDEF CPUx86_64 } {$DEFINE AGG_CPU_x86_64 } - {$ENDIF } {$IFDEF FPC } {$MODE DELPHI } - {$ENDIF } // OS {$IFDEF WIN32 } {$DEFINE AGG_WINDOWS } - {$ENDIF } {$IFDEF WINDOWS } @@ -70,7 +64,6 @@ //---------------------------------------------------------------------------- {$IFDEF AGG_DEBUG } {$DEFINE AGG_FULL_DEBUG } - {$ENDIF } //---------------------------------------------------------------------------- @@ -88,41 +81,40 @@ {$X+ }{ Extended syntax } {$IFDEF AGG_FULL_DEBUG } - {$R+ }{ Range checking } - {$I+ }{ IO checking } - {$Q+ }{ Overflow checking } + {$R+ }{ Range checking } + {$I+ }{ IO checking } + {$Q+ }{ Overflow checking } - {$IFNDEF FPC } - {$O- }{ Code Optimization } - {$ENDIF } + {$IFNDEF FPC } + {$O- }{ Code Optimization } + {$ENDIF } - {$D+ }{ Debug Info ON } - {$Y+ }{ References Info ON } + {$D+ }{ Debug Info ON } + {$Y+ }{ References Info ON } {$ELSE } - {$R- }{ Range checking } - {$I- }{ IO checking } - {$Q- }{ Overflow checking } - - { Code Optimization } - {$IFNDEF FPC } - {$IFDEF AGG_OPTIMIZE } - {$O+ } - {$ELSE } - {$O- } + {$R- }{ Range checking } + {$I- }{ IO checking } + {$Q- }{ Overflow checking } + + { Code Optimization } + {$IFNDEF FPC } + {$IFDEF AGG_OPTIMIZE } + {$O+ } + {$ELSE } + {$O- } + {$ENDIF } {$ENDIF } - {$ENDIF } - - {$D- }{ Debug Info OFF } - {$IFNDEF FPC} - {$Y- }{ References Info OFF } - {$ENDIF} + {$D- }{ Debug Info OFF } + {$IFNDEF FPC} + {$Y- }{ References Info OFF } + {$ENDIF} {$ENDIF } {$IFNDEF AGG2D_USE_WINFONTS} - {$IFNDEF AGG2D_USE_FREETYPE} - {$DEFINE AGG2D_NO_FONT} - {$ENDIF} + {$IFNDEF AGG2D_USE_FREETYPE} + {$DEFINE AGG2D_NO_FONT} + {$ENDIF} {$ENDIF} diff --git a/src/corelib/render/software/agg_platform_gdi.inc b/src/corelib/render/software/agg_platform_gdi.inc index e33ed09d..88d3b586 100644 --- a/src/corelib/render/software/agg_platform_gdi.inc +++ b/src/corelib/render/software/agg_platform_gdi.inc @@ -12,17 +12,72 @@ {$ifdef uses_implementation} - // nothing + fpg_gdi, {$endif} {$ifdef agg_platform_implementation} +type + // to get access to protected methods (seeing that FPC doesn't support Friend-classes) + TImageHack = class(TfpgImage); procedure TAgg2D.DoPutBufferToScreen(x, y, w, h: TfpgCoord); +var + srcdc: HDC; + destdc: HDC; begin + if TfpgWindow(FWindow).WinHandle <= 0 then + begin + debugln(' no winhandle available'); + exit; + end; + FImg.UpdateImage; + destdc := Windows.GetDC(TfpgWindow(FWindow).WinHandle); + srcdc := CreateCompatibleDC(fpgApplication.Display); + SelectObject(srcdc, TImageHack(FImg).BMPHandle); + BitBlt(destdc, x, y, w, h, srcdc, 0, 0, SRCCOPY); + DeleteDC(srcdc); + ReleaseDC(TfpgWindow(FWindow).WinHandle, destdc); +(* + if (dvc_width <> bmp_width ) or + (dvc_height <> bmp_height ) then + begin + SetStretchBltMode(h_dc ,COLORONCOLOR ); + StretchDIBits( + h_dc , // handle of device context + dvc_x , // x-coordinate of upper-left corner of source rect. + dvc_y , // y-coordinate of upper-left corner of source rect. + dvc_width , // width of source rectangle + dvc_height , // height of source rectangle + bmp_x , + bmp_y , // x, y -coordinates of upper-left corner of dest. rect. + bmp_width , // width of destination rectangle + bmp_height , // height of destination rectangle + m_buf , // address of bitmap bits + m_bmp^ , // address of bitmap data + DIB_RGB_COLORS , // usage + SRCCOPY ); // raster operation code + end + else + begin + err:=SetDIBitsToDevice( + h_dc , // handle to device context + dvc_x , // x-coordinate of upper-left corner of + dvc_y , // y-coordinate of upper-left corner of + dvc_width , // source rectangle width + dvc_height , // source rectangle height + bmp_x , // x-coordinate of lower-left corner of + bmp_y , // y-coordinate of lower-left corner of + 0 , // first scan line in array + bmp_height , // number of scan lines + m_buf , // address of array with DIB bits + m_bmp^ , // address of structure with bitmap info. + DIB_RGB_COLORS ); // RGB or palette indexes + end +*) end; {$endif} |