00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 /* AbiWord 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef FV_VIEW_DOUBLE_BUFFERING_H 00021 #define FV_VIEW_DOUBLE_BUFFERING_H 00022 00023 #include "gr_Graphics.h" 00024 #include "gr_Painter.h" 00025 #include "fv_View.h" 00026 #include "ut_types.h" 00027 00028 class FV_ViewDoubleBuffering 00029 { 00030 00031 public: 00032 FV_ViewDoubleBuffering(FV_View *pView, bool suspendDirectDrawing, bool callDrawOnlyAtTheEnd); 00033 ~FV_ViewDoubleBuffering(); 00034 00035 void beginDoubleBuffering(); 00036 void endDoubleBuffering(); 00037 bool getCallDrawOnlyAtTheEnd(); 00038 void recordViewDrawCall( 00039 UT_sint32 x, UT_sint32 y, 00040 UT_sint32 width, UT_sint32 height, 00041 bool bDirtyRunsOnly, bool bClip); 00042 00043 private: 00044 GR_Painter *m_pPainter; // used for accessing double buffering code in GR_Graphics 00045 FV_View *m_pView; // used to handle calls to _draw 00046 00047 bool m_bCallDrawOnlyAtTheEnd; 00048 bool m_bSuspendDirectDrawing; 00049 00050 void callUnifiedDraw(); 00051 void redrawEntireScreen(); 00052 00053 struct ViewDrawFunctionArguments 00054 { 00055 UT_Rect clipRect; 00056 UT_Rect fullRect; 00057 bool bDirtyRunsOnly; 00058 bool bClip; 00059 UT_sint32 callCount; 00060 }; 00061 00062 ViewDrawFunctionArguments mostExtArgs; 00063 bool noRecordedDrawCalls(); 00064 void initMostExtArgs(); 00065 void extendDrawArgsIfNeccessary( 00066 UT_Rect *thisCallRect, 00067 const UT_Rect *clipRectFromGraphics, 00068 bool bDirtyRunsOnly); 00069 }; 00070 00071 #endif