sdrpaintwindow.cxx (f6e50924) | sdrpaintwindow.cxx (a56bd57b) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 90 unchanged lines hidden (view full) --- 99 aRegionPixel.EndEnumRects(aRegionHandle); 100 101 mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest); 102 maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource); 103} 104 105//////////////////////////////////////////////////////////////////////////////////////////////////// 106 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 90 unchanged lines hidden (view full) --- 99 aRegionPixel.EndEnumRects(aRegionHandle); 100 101 mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest); 102 maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource); 103} 104 105//////////////////////////////////////////////////////////////////////////////////////////////////// 106 |
107void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) | 107void SdrPaintWindow::impCreateOverlayManager() |
108{ | 108{ |
109 // When the buffer usage has changed then we have to create a new 110 // overlay manager. Save the current one so that later we can move its 111 // overlay objects to the new one. 112 sdr::overlay::OverlayManager* pOldOverlayManager = NULL; 113 114 if(mbUseBuffer != bUseBuffer) 115 { 116 mbUseBuffer = bUseBuffer; 117 pOldOverlayManager = mpOverlayManager; 118 mpOverlayManager = NULL; 119 } 120 | |
121 // not yet one created? 122 if(!mpOverlayManager) 123 { 124 // is it a window? 125 if(OUTDEV_WINDOW == GetOutputDevice().GetOutDevType()) 126 { 127 // decide which OverlayManager to use 128 if(GetPaintView().IsBufferedOverlayAllowed() && mbUseBuffer) 129 { 130 // buffered OverlayManager, buffers it's background and refreshes from there 131 // for pure overlay changes (no system redraw). The 3rd parameter specifies 132 // if that refresh itself will use a 2nd vdev to avoid flickering. 133 // Also hand over the evtl. existing old OverlayManager; this means to take over 134 // the registered OverlayObjects from it | 109 // not yet one created? 110 if(!mpOverlayManager) 111 { 112 // is it a window? 113 if(OUTDEV_WINDOW == GetOutputDevice().GetOutDevType()) 114 { 115 // decide which OverlayManager to use 116 if(GetPaintView().IsBufferedOverlayAllowed() && mbUseBuffer) 117 { 118 // buffered OverlayManager, buffers it's background and refreshes from there 119 // for pure overlay changes (no system redraw). The 3rd parameter specifies 120 // if that refresh itself will use a 2nd vdev to avoid flickering. 121 // Also hand over the evtl. existing old OverlayManager; this means to take over 122 // the registered OverlayObjects from it |
135 mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), pOldOverlayManager, true); | 123 mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), true); |
136 } 137 else 138 { 139 // unbuffered OverlayManager, just invalidates places where changes 140 // take place 141 // Also hand over the evtl. existing old OverlayManager; this means to take over 142 // the registered OverlayObjects from it | 124 } 125 else 126 { 127 // unbuffered OverlayManager, just invalidates places where changes 128 // take place 129 // Also hand over the evtl. existing old OverlayManager; this means to take over 130 // the registered OverlayObjects from it |
143 mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice(), pOldOverlayManager); | 131 mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice()); |
144 } 145 146 OSL_ENSURE(mpOverlayManager, "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)"); 147 148 // Request a repaint so that the buffered overlay manager fills 149 // its buffer properly. This is a workaround for missing buffer 150 // updates. 151 Window* pWindow = dynamic_cast<Window*>(&GetOutputDevice()); --- 9 unchanged lines hidden (view full) --- 161 aColB.Invert(); 162 } 163 164 mpOverlayManager->setStripeColorA(aColA); 165 mpOverlayManager->setStripeColorB(aColB); 166 mpOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength()); 167 } 168 } | 132 } 133 134 OSL_ENSURE(mpOverlayManager, "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)"); 135 136 // Request a repaint so that the buffered overlay manager fills 137 // its buffer properly. This is a workaround for missing buffer 138 // updates. 139 Window* pWindow = dynamic_cast<Window*>(&GetOutputDevice()); --- 9 unchanged lines hidden (view full) --- 149 aColB.Invert(); 150 } 151 152 mpOverlayManager->setStripeColorA(aColA); 153 mpOverlayManager->setStripeColorB(aColB); 154 mpOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength()); 155 } 156 } |
169 170 // OverlayObjects are transfered for the evtl. newly created OverlayManager by handing over 171 // at construction time 172 if(pOldOverlayManager) 173 { 174 // The old overlay manager is not used anymore and can be (has to be) deleted. 175 delete pOldOverlayManager; 176 } | |
177} 178 179SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut) 180: mrOutputDevice(rOut), 181 mrPaintView(rNewPaintView), 182 mpOverlayManager(0L), 183 mpPreRenderDevice(0L), 184 mbTemporaryTarget(false), // #i72889# --- 12 unchanged lines hidden (view full) --- 197 DestroyPreRenderDevice(); 198} 199 200::sdr::overlay::OverlayManager* SdrPaintWindow::GetOverlayManager() const 201{ 202 if(!mpOverlayManager) 203 { 204 // Create buffered overlay manager by default. | 157} 158 159SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut) 160: mrOutputDevice(rOut), 161 mrPaintView(rNewPaintView), 162 mpOverlayManager(0L), 163 mpPreRenderDevice(0L), 164 mbTemporaryTarget(false), // #i72889# --- 12 unchanged lines hidden (view full) --- 177 DestroyPreRenderDevice(); 178} 179 180::sdr::overlay::OverlayManager* SdrPaintWindow::GetOverlayManager() const 181{ 182 if(!mpOverlayManager) 183 { 184 // Create buffered overlay manager by default. |
205 const_cast< SdrPaintWindow* >(this)->impCreateOverlayManager(true); | 185 const_cast< SdrPaintWindow* >(this)->impCreateOverlayManager(); |
206 } 207 208 return mpOverlayManager; 209} 210 211Rectangle SdrPaintWindow::GetVisibleArea() const 212{ 213 Size aVisSizePixel(GetOutputDevice().GetOutputSizePixel()); --- 45 unchanged lines hidden (view full) --- 259{ 260 if(mpPreRenderDevice) 261 { 262 mpPreRenderDevice->OutputPreRenderDevice(rExpandedRegion); 263 } 264} 265 266// #i73602# add flag if buffer shall be used | 186 } 187 188 return mpOverlayManager; 189} 190 191Rectangle SdrPaintWindow::GetVisibleArea() const 192{ 193 Size aVisSizePixel(GetOutputDevice().GetOutputSizePixel()); --- 45 unchanged lines hidden (view full) --- 239{ 240 if(mpPreRenderDevice) 241 { 242 mpPreRenderDevice->OutputPreRenderDevice(rExpandedRegion); 243 } 244} 245 246// #i73602# add flag if buffer shall be used |
267void SdrPaintWindow::DrawOverlay(const Region& rRegion, bool bUseBuffer) | 247void SdrPaintWindow::DrawOverlay(const Region& rRegion) |
268{ 269 // ## force creation of OverlayManager since the first repaint needs to 270 // save the background to get a controlled start into overlay mechanism | 248{ 249 // ## force creation of OverlayManager since the first repaint needs to 250 // save the background to get a controlled start into overlay mechanism |
271 impCreateOverlayManager(bUseBuffer); | 251 impCreateOverlayManager(); |
272 273 if(mpOverlayManager && !OutputToPrinter()) 274 { | 252 253 if(mpOverlayManager && !OutputToPrinter()) 254 { |
275 if(mpPreRenderDevice && bUseBuffer) | 255 if(mpPreRenderDevice) |
276 { 277 mpOverlayManager->completeRedraw(rRegion, &mpPreRenderDevice->GetPreRenderDevice()); 278 } 279 else 280 { 281 mpOverlayManager->completeRedraw(rRegion); 282 } 283 } --- 25 unchanged lines hidden --- | 256 { 257 mpOverlayManager->completeRedraw(rRegion, &mpPreRenderDevice->GetPreRenderDevice()); 258 } 259 else 260 { 261 mpOverlayManager->completeRedraw(rRegion); 262 } 263 } --- 25 unchanged lines hidden --- |