LibreOffice Module vcl (master)  1
salgdilayout.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <config_features.h>
22 #include <sal/log.hxx>
23 #include <PhysicalFontFace.hxx>
24 #include <fontsubset.hxx>
25 #include <salgdi.hxx>
26 #include <salframe.hxx>
27 #include <sft.hxx>
31 #include <rtl/math.hxx>
32 
33 // The only common SalFrame method
34 
36 {
37  // mirror frame coordinates at parent
38  SalFrame *pParent = GetParent();
39  if( pParent && AllSettings::GetLayoutRTL() )
40  {
42  int parent_x = aGeom.nX - pParent->maGeometry.nX;
43  aGeom.nX = pParent->maGeometry.nX + pParent->maGeometry.nWidth - maGeometry.nWidth - parent_x;
44  return aGeom;
45  }
46  else
47  return maGeometry;
48 }
49 
51 : m_nLayout( SalLayoutFlags::NONE ),
52  m_aLastMirror(),
53  m_aLastMirrorW(0),
54  m_nLastMirrorDeviceLTRButBiDiRtlTranslate(0),
55  m_bLastMirrorDeviceLTRButBiDiRtlSet(false),
56  m_bAntiAlias(false)
57 {
58  // read global RTL settings
61 }
62 
64 {
65  bool bFileDefinitionsWidgetDraw = !!getenv("VCL_DRAW_WIDGETS_FROM_FILE");
66 
67  if (bFileDefinitionsWidgetDraw || bForce)
68  {
70  auto pFileDefinitionWidgetDraw = static_cast<vcl::FileDefinitionWidgetDraw*>(m_pWidgetDraw.get());
71  if (!pFileDefinitionWidgetDraw->isActive())
72  {
73  m_pWidgetDraw.reset();
74  return false;
75  }
76  return true;
77  }
78  return false;
79 }
80 
81 SalGraphics::~SalGraphics() COVERITY_NOEXCEPT_FALSE
82 {
83  // can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)!
84 }
85 
87  const basegfx::B2DPoint& /* rNull */,
88  const basegfx::B2DPoint& /* rX */,
89  const basegfx::B2DPoint& /* rY */,
90  const SalBitmap& /* rSourceBitmap */,
91  const SalBitmap* /* pAlphaBitmap */,
92  double /* fAlpha */)
93 {
94  // here direct support for transformed bitmaps can be implemented
95  return false;
96 }
97 
99 {
100  mirror(x, rOutDev);
101  return x;
102 }
103 
105 {
106  return rOutDev.IsVirtual() ? rOutDev.GetOutputWidthPixel() : GetGraphicsWidth();
107 }
108 
109 void SalGraphics::mirror( tools::Long& x, const OutputDevice& rOutDev ) const
110 {
111  const tools::Long w = GetDeviceWidth(rOutDev);
112  if( !w )
113  return;
114 
115  if (rOutDev.ImplIsAntiparallel() )
116  {
117  // mirror this window back
119  {
120  tools::Long devX = w - rOutDev.GetOutputWidthPixel() - rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
121  x = devX + (x - rOutDev.GetOutOffXPixel());
122  }
123  else
124  {
125  tools::Long devX = rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
126  x = rOutDev.GetOutputWidthPixel() - (x - devX) + rOutDev.GetOutOffXPixel() - 1;
127  }
128  }
130  x = w-1-x;
131 }
132 
133 void SalGraphics::mirror( tools::Long& x, tools::Long nWidth, const OutputDevice& rOutDev, bool bBack ) const
134 {
135  const tools::Long w = GetDeviceWidth(rOutDev);
136  if( !w )
137  return;
138 
139  if (rOutDev.ImplIsAntiparallel() )
140  {
141  // mirror this window back
143  {
144  tools::Long devX = w - rOutDev.GetOutputWidthPixel() - rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
145  if( bBack )
146  x = x - devX + rOutDev.GetOutOffXPixel();
147  else
148  x = devX + (x - rOutDev.GetOutOffXPixel());
149  }
150  else
151  {
152  tools::Long devX = rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
153  if( bBack )
154  x = devX + (rOutDev.GetOutputWidthPixel() + devX) - (x + nWidth);
155  else
156  x = rOutDev.GetOutputWidthPixel() - (x - devX) + rOutDev.GetOutOffXPixel() - nWidth;
157  }
158  }
160  x = w-nWidth-x;
161 }
162 
163 bool SalGraphics::mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice& rOutDev ) const
164 {
165  const tools::Long w = GetDeviceWidth(rOutDev);
166  if( w )
167  {
168  sal_uInt32 i, j;
169 
170  if (rOutDev.ImplIsAntiparallel())
171  {
172  // mirror this window back
174  {
175  tools::Long devX = w - rOutDev.GetOutputWidthPixel() - rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
176  for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
177  {
178  pPtAry2[j].setX( devX + (pPtAry[i].getX() - rOutDev.GetOutOffXPixel()) );
179  pPtAry2[j].setY( pPtAry[i].getY() );
180  }
181  }
182  else
183  {
184  tools::Long devX = rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
185  for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
186  {
187  pPtAry2[j].setX( rOutDev.GetOutputWidthPixel() - (pPtAry[i].getX() - devX) + rOutDev.GetOutOffXPixel() - 1 );
188  pPtAry2[j].setY( pPtAry[i].getY() );
189  }
190  }
191  }
193  {
194  for( i=0, j=nPoints-1; i<nPoints; i++,j-- )
195  {
196  pPtAry2[j].setX( w-1-pPtAry[i].getX() );
197  pPtAry2[j].setY( pPtAry[i].getY() );
198  }
199  }
200  return true;
201  }
202  else
203  return false;
204 }
205 
206 void SalGraphics::mirror( vcl::Region& rRgn, const OutputDevice& rOutDev ) const
207 {
208  if( rRgn.HasPolyPolygonOrB2DPolyPolygon() )
209  {
210  const basegfx::B2DPolyPolygon aPolyPoly(mirror(rRgn.GetAsB2DPolyPolygon(), rOutDev));
211 
212  rRgn = vcl::Region(aPolyPoly);
213  }
214  else
215  {
216  RectangleVector aRectangles;
217  rRgn.GetRegionRectangles(aRectangles);
218  rRgn.SetEmpty();
219 
220  for (auto & rectangle : aRectangles)
221  {
222  mirror(rectangle, rOutDev);
223  rRgn.Union(rectangle);
224  }
225 
226  //ImplRegionInfo aInfo;
227  //bool bRegionRect;
228  //Region aMirroredRegion;
229  //long nX, nY, nWidth, nHeight;
230 
231  //bRegionRect = rRgn.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
232  //while ( bRegionRect )
233  //{
234  // Rectangle aRect( Point(nX, nY), Size(nWidth, nHeight) );
235  // mirror( aRect, rOutDev, bBack );
236  // aMirroredRegion.Union( aRect );
237  // bRegionRect = rRgn.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
238  //}
239  //rRgn = aMirroredRegion;
240  }
241 }
242 
243 void SalGraphics::mirror( tools::Rectangle& rRect, const OutputDevice& rOutDev, bool bBack ) const
244 {
245  tools::Long nWidth = rRect.GetWidth();
246  tools::Long x = rRect.Left();
247  tools::Long x_org = x;
248 
249  mirror( x, nWidth, rOutDev, bBack );
250  rRect.Move( x - x_org, 0 );
251 }
252 
254 {
255  const basegfx::B2DHomMatrix& rMirror(getMirror(i_rOutDev));
256 
257  if(rMirror.isIdentity())
258  {
259  return i_rPoly;
260  }
261  else
262  {
263  basegfx::B2DPolyPolygon aRet(i_rPoly);
264  aRet.transform(rMirror);
265  aRet.flip();
266  return aRet;
267  }
268 }
269 
271 {
272  // get mirroring transformation
273  const tools::Long w = GetDeviceWidth(i_rOutDev);
274  SAL_WARN_IF( !w, "vcl", "missing graphics width" );
275 
276  const bool bMirrorDeviceLTRButBiDiRtlSet = !i_rOutDev.IsRTLEnabled();
277  tools::Long nMirrorDeviceLTRButBiDiRtlTranslate(0);
278  if (bMirrorDeviceLTRButBiDiRtlSet)
279  nMirrorDeviceLTRButBiDiRtlTranslate = w - i_rOutDev.GetOutputWidthPixel() - (2 * i_rOutDev.GetOutOffXPixel());
280 
281  // if the device width, or mirror state of the device changed, then m_aLastMirror is invalid
282  bool bLastMirrorValid = w == m_aLastMirrorW && bMirrorDeviceLTRButBiDiRtlSet == m_bLastMirrorDeviceLTRButBiDiRtlSet;
283  if (bLastMirrorValid && bMirrorDeviceLTRButBiDiRtlSet)
284  {
285  // if the device is in the unusual mode of a LTR device, but layout flags of SalLayoutFlags::BiDiRtl are
286  // in use, then the m_aLastMirror is invalid if the distance it should translate has changed
287  bLastMirrorValid = nMirrorDeviceLTRButBiDiRtlTranslate == m_nLastMirrorDeviceLTRButBiDiRtlTranslate;
288  }
289 
290  if (!bLastMirrorValid)
291  {
292  const_cast<SalGraphics*>(this)->m_aLastMirrorW = w;
293  const_cast<SalGraphics*>(this)->m_bLastMirrorDeviceLTRButBiDiRtlSet = bMirrorDeviceLTRButBiDiRtlSet;
294  const_cast<SalGraphics*>(this)->m_nLastMirrorDeviceLTRButBiDiRtlTranslate = nMirrorDeviceLTRButBiDiRtlTranslate;
295 
296  if(w)
297  {
298  if (bMirrorDeviceLTRButBiDiRtlSet)
299  {
300  /* This path gets exercised in calc's RTL UI (e.g. SAL_RTL_ENABLED=1)
301  with its LTR horizontal scrollbar */
302 
303  // Original code was:
304  // // mirror this window back
305  // double devX = w-i_rOutDev.GetOutputWidthPixel()-i_rOutDev.GetOutOffXPixel(); // re-mirrored mnOutOffX
306  // aRet.setX( devX + (i_rPoint.getX() - i_rOutDev.GetOutOffXPixel()) );
307  // I do not really understand the comment 'mirror this window back', so cannot guarantee
308  // that this works as before, but I have reduced this (by re-placing and re-formatting) to
309  // a simple translation:
311  nMirrorDeviceLTRButBiDiRtlTranslate, 0.0);
312  }
313  else
314  {
315  // Original code was:
316  // aRet.setX( w-1-i_rPoint.getX() );
317  // -mirror X -> scale(-1.0, 1.0)
318  // -translate X -> translate(w-1, 0)
319  // Checked this one, works as expected.
321  -1.0,
322  1.0,
323  w-1,
324  0.0);
325  }
326  }
327  else
328  {
329  const_cast<SalGraphics*>(this)->m_aLastMirror.identity();
330  }
331  }
332 
333  return m_aLastMirror;
334 }
335 
336 bool SalGraphics::SetClipRegion( const vcl::Region& i_rClip, const OutputDevice& rOutDev )
337 {
338  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
339  {
340  vcl::Region aMirror( i_rClip );
341  mirror( aMirror, rOutDev );
342  return setClipRegion( aMirror );
343  }
344  return setClipRegion( i_rClip );
345 }
346 
348 {
349  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
350  mirror( nX, rOutDev );
351  drawPixel( nX, nY );
352 }
353 
354 void SalGraphics::DrawPixel( tools::Long nX, tools::Long nY, Color nColor, const OutputDevice& rOutDev )
355 {
356  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
357  mirror( nX, rOutDev );
358  drawPixel( nX, nY, nColor );
359 }
360 
362 {
363  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
364  {
365  mirror( nX1, rOutDev );
366  mirror( nX2, rOutDev );
367  }
368  drawLine( nX1, nY1, nX2, nY2 );
369 }
370 
371 void SalGraphics::DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev )
372 {
373  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
374  mirror( nX, nWidth, rOutDev );
375  drawRect( nX, nY, nWidth, nHeight );
376 }
377 
378 void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice& rOutDev )
379 {
380  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
381  {
382  std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]);
383  bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
384  drawPolyLine( nPoints, bCopied ? pPtAry2.get() : pPtAry );
385  }
386  else
387  drawPolyLine( nPoints, pPtAry );
388 }
389 
390 void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice& rOutDev )
391 {
392  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
393  {
394  std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]);
395  bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
396  drawPolygon( nPoints, bCopied ? pPtAry2.get() : pPtAry );
397  }
398  else
399  drawPolygon( nPoints, pPtAry );
400 }
401 
402 void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry, const OutputDevice& rOutDev )
403 {
404  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
405  {
406  // TODO: optimize, reduce new/delete calls
407  std::unique_ptr<Point*[]> pPtAry2( new Point*[nPoly] );
408  sal_uLong i;
409  for(i=0; i<nPoly; i++)
410  {
411  sal_uLong nPoints = pPoints[i];
412  pPtAry2[i] = new Point[ nPoints ];
413  mirror( nPoints, pPtAry[i], pPtAry2[i], rOutDev );
414  }
415 
416  drawPolyPolygon( nPoly, pPoints, const_cast<const Point**>(pPtAry2.get()) );
417 
418  for(i=0; i<nPoly; i++)
419  delete [] pPtAry2[i];
420  }
421  else
422  drawPolyPolygon( nPoly, pPoints, pPtAry );
423 }
424 
425 namespace
426 {
427  basegfx::B2DHomMatrix createTranslateToMirroredBounds(const basegfx::B2DRange &rBoundingBox, const basegfx::B2DHomMatrix& rMirror)
428  {
429  basegfx::B2DRange aRTLBoundingBox(rBoundingBox);
430  aRTLBoundingBox *= rMirror;
431  return basegfx::utils::createTranslateB2DHomMatrix(aRTLBoundingBox.getMinX() - rBoundingBox.getMinX(), 0);
432  }
433 }
434 
436  const basegfx::B2DHomMatrix& rObjectToDevice,
437  const basegfx::B2DPolyPolygon& i_rPolyPolygon,
438  double i_fTransparency,
439  const OutputDevice& i_rOutDev)
440 {
441  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || i_rOutDev.IsRTLEnabled() )
442  {
443  // mirroring set
444  const basegfx::B2DHomMatrix& rMirror(getMirror(i_rOutDev));
445  if(!rMirror.isIdentity())
446  {
447  return drawPolyPolygon(
448  rMirror * rObjectToDevice,
449  i_rPolyPolygon,
450  i_fTransparency);
451  }
452  }
453 
454  return drawPolyPolygon(
455  rObjectToDevice,
456  i_rPolyPolygon,
457  i_fTransparency);
458 }
459 
460 bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry, const OutputDevice& rOutDev )
461 {
462  bool bResult = false;
463  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
464  {
465  std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]);
466  bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
467  bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry );
468  }
469  else
470  bResult = drawPolyLineBezier( nPoints, pPtAry, pFlgAry );
471  return bResult;
472 }
473 
474 bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry, const OutputDevice& rOutDev )
475 {
476  bool bResult = false;
477  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
478  {
479  std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]);
480  bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
481  bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2.get() : pPtAry, pFlgAry );
482  }
483  else
484  bResult = drawPolygonBezier( nPoints, pPtAry, pFlgAry );
485  return bResult;
486 }
487 
488 bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i_pPoints,
489  const Point* const* i_pPtAry, const PolyFlags* const* i_pFlgAry, const OutputDevice& i_rOutDev )
490 {
491  bool bRet = false;
492  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || i_rOutDev.IsRTLEnabled() )
493  {
494  // TODO: optimize, reduce new/delete calls
495  std::unique_ptr<Point*[]> pPtAry2( new Point*[i_nPoly] );
496  sal_uLong i;
497  for(i=0; i<i_nPoly; i++)
498  {
499  sal_uLong nPoints = i_pPoints[i];
500  pPtAry2[i] = new Point[ nPoints ];
501  mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_rOutDev );
502  }
503 
504  bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<const Point* const *>(pPtAry2.get()), i_pFlgAry );
505 
506  for(i=0; i<i_nPoly; i++)
507  delete [] pPtAry2[i];
508  }
509  else
510  bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, i_pPtAry, i_pFlgAry );
511  return bRet;
512 }
513 
515  const basegfx::B2DHomMatrix& rObjectToDevice,
516  const basegfx::B2DPolygon& i_rPolygon,
517  double i_fTransparency,
518  double i_rLineWidth,
519  const std::vector< double >* i_pStroke, // MM01
520  basegfx::B2DLineJoin i_eLineJoin,
521  css::drawing::LineCap i_eLineCap,
522  double i_fMiterMinimumAngle,
523  bool bPixelSnapHairline,
524  const OutputDevice& i_rOutDev)
525 {
526  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || i_rOutDev.IsRTLEnabled() )
527  {
528  // mirroring set
529  const basegfx::B2DHomMatrix& rMirror(getMirror(i_rOutDev));
530  if(!rMirror.isIdentity())
531  {
532  return drawPolyLine(
533  rMirror * rObjectToDevice,
534  i_rPolygon,
535  i_fTransparency,
536  i_rLineWidth,
537  i_pStroke, // MM01
538  i_eLineJoin,
539  i_eLineCap,
540  i_fMiterMinimumAngle,
541  bPixelSnapHairline);
542  }
543  }
544 
545  // no mirroring set (or identity), use standard call
546  return drawPolyLine(
547  rObjectToDevice,
548  i_rPolygon,
549  i_fTransparency,
550  i_rLineWidth,
551  i_pStroke, // MM01
552  i_eLineJoin,
553  i_eLineCap,
554  i_fMiterMinimumAngle,
555  bPixelSnapHairline);
556 }
557 
558 bool SalGraphics::DrawGradient(const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, const OutputDevice& rOutDev)
559 {
560  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
561  {
562  tools::PolyPolygon aMirrored(mirror(rPolyPoly.getB2DPolyPolygon(), rOutDev));
563  return drawGradient(aMirrored, rGradient);
564  }
565 
566  return drawGradient( rPolyPoly, rGradient );
567 }
568 
570  tools::Long nSrcX, tools::Long nSrcY,
571  tools::Long nSrcWidth, tools::Long nSrcHeight,
572  const OutputDevice& rOutDev )
573 {
574  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
575  {
576  mirror( nDestX, nSrcWidth, rOutDev );
577  mirror( nSrcX, nSrcWidth, rOutDev );
578  }
579  copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, true/*bWindowInvalidate*/ );
580 }
581 
582 void SalGraphics::CopyBits(const SalTwoRect& rPosAry, const OutputDevice& rOutDev)
583 {
584  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
585  {
586  SalTwoRect aPosAry2 = rPosAry;
587  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
588  copyBits( aPosAry2, nullptr );
589  }
590  else
591  copyBits( rPosAry, nullptr );
592 }
593 
594 void SalGraphics::CopyBits(const SalTwoRect& rPosAry, SalGraphics& rSrcGraphics,
595  const OutputDevice& rOutDev, const OutputDevice& rSrcOutDev)
596 {
597  if( ( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() ) ||
598  ( (rSrcGraphics.GetLayout() & SalLayoutFlags::BiDiRtl) || rSrcOutDev.IsRTLEnabled()) )
599  {
600  SalTwoRect aPosAry2 = rPosAry;
601  if( (rSrcGraphics.GetLayout() & SalLayoutFlags::BiDiRtl) || rSrcOutDev.IsRTLEnabled() )
602  mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, rSrcOutDev );
603  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
604  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
605  copyBits( aPosAry2, &rSrcGraphics );
606  }
607  else
608  copyBits( rPosAry, &rSrcGraphics );
609 }
610 
611 void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry,
612  const SalBitmap& rSalBitmap, const OutputDevice& rOutDev )
613 {
614  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
615  {
616  SalTwoRect aPosAry2 = rPosAry;
617  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
618  drawBitmap( aPosAry2, rSalBitmap );
619  }
620  else
621  drawBitmap( rPosAry, rSalBitmap );
622 }
623 
624 void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry,
625  const SalBitmap& rSalBitmap,
626  const SalBitmap& rTransparentBitmap, const OutputDevice& rOutDev )
627 {
628  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
629  {
630  SalTwoRect aPosAry2 = rPosAry;
631  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
632  drawBitmap( aPosAry2, rSalBitmap, rTransparentBitmap );
633  }
634  else
635  drawBitmap( rPosAry, rSalBitmap, rTransparentBitmap );
636 }
637 
638 void SalGraphics::DrawMask( const SalTwoRect& rPosAry,
639  const SalBitmap& rSalBitmap,
640  Color nMaskColor, const OutputDevice& rOutDev )
641 {
642  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
643  {
644  SalTwoRect aPosAry2 = rPosAry;
645  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
646  drawMask( aPosAry2, rSalBitmap, nMaskColor );
647  }
648  else
649  drawMask( rPosAry, rSalBitmap, nMaskColor );
650 }
651 
652 std::shared_ptr<SalBitmap> SalGraphics::GetBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev )
653 {
654  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
655  mirror( nX, nWidth, rOutDev );
656  return getBitmap( nX, nY, nWidth, nHeight );
657 }
658 
660 {
661  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
662  mirror( nX, rOutDev );
663  return getPixel( nX, nY );
664 }
665 
666 void SalGraphics::Invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags, const OutputDevice& rOutDev )
667 {
668  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
669  mirror( nX, nWidth, rOutDev );
670  invert( nX, nY, nWidth, nHeight, nFlags );
671 }
672 
673 void SalGraphics::Invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags, const OutputDevice& rOutDev )
674 {
675  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
676  {
677  std::unique_ptr<Point[]> pPtAry2(new Point[nPoints]);
678  bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), rOutDev );
679  invert( nPoints, bCopied ? pPtAry2.get() : pPtAry, nFlags );
680  }
681  else
682  invert( nPoints, pPtAry, nFlags );
683 }
684 
685 bool SalGraphics::DrawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize, const OutputDevice& rOutDev )
686 {
687  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
688  mirror( nX, nWidth, rOutDev );
689  return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize );
690 }
691 
693  const Point& aPos, bool& rIsInside, const OutputDevice& rOutDev)
694 {
695  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
696  {
697  Point pt( aPos );
698  tools::Rectangle rgn( rControlRegion );
699  pt.setX( mirror2( pt.X(), rOutDev ) );
700  mirror( rgn, rOutDev );
701  return forWidget()->hitTestNativeControl( ControlType::Scrollbar, nPart, rgn, pt, rIsInside );
702  }
703  else
704  return forWidget()->hitTestNativeControl( ControlType::Scrollbar, nPart, rControlRegion, aPos, rIsInside );
705 }
706 
707 void SalGraphics::mirror( ImplControlValue& rVal, const OutputDevice& rOutDev ) const
708 {
709  switch( rVal.getType() )
710  {
711  case ControlType::Slider:
712  {
713  SliderValue* pSlVal = static_cast<SliderValue*>(&rVal);
714  mirror(pSlVal->maThumbRect, rOutDev);
715  }
716  break;
718  {
719  ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(&rVal);
720  mirror(pScVal->maThumbRect, rOutDev);
721  mirror(pScVal->maButton1Rect, rOutDev);
722  mirror(pScVal->maButton2Rect, rOutDev);
723  }
724  break;
727  {
728  SpinbuttonValue* pSpVal = static_cast<SpinbuttonValue*>(&rVal);
729  mirror(pSpVal->maUpperRect, rOutDev);
730  mirror(pSpVal->maLowerRect, rOutDev);
731  }
732  break;
734  {
735  ToolbarValue* pTVal = static_cast<ToolbarValue*>(&rVal);
736  mirror(pTVal->maGripRect, rOutDev);
737  }
738  break;
739  default: break;
740  }
741 }
742 
743 bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
744  ControlState nState, const ImplControlValue& aValue,
745  const OUString& aCaption, const OutputDevice& rOutDev,
746  const Color& rBackgroundColor)
747 {
748  bool bRet = false;
749  tools::Rectangle aControlRegion(rControlRegion);
750  if (aControlRegion.IsEmpty() || aControlRegion.GetWidth() <= 0 || aControlRegion.GetHeight() <= 0)
751  return bRet;
752 
753  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
754  {
755  mirror(aControlRegion, rOutDev);
756  std::unique_ptr< ImplControlValue > mirrorValue( aValue.clone());
757  mirror( *mirrorValue, rOutDev );
758  bRet = forWidget()->drawNativeControl(nType, nPart, aControlRegion, nState, *mirrorValue, aCaption, rBackgroundColor);
759  }
760  else
761  bRet = forWidget()->drawNativeControl(nType, nPart, aControlRegion, nState, aValue, aCaption, rBackgroundColor);
762 
763  if (bRet && m_pWidgetDraw)
764  handleDamage(aControlRegion);
765  return bRet;
766 }
767 
769  const ImplControlValue& aValue,
770  tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion, const OutputDevice& rOutDev )
771 {
772  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
773  {
774  tools::Rectangle rgn( rControlRegion );
775  mirror( rgn, rOutDev );
776  std::unique_ptr< ImplControlValue > mirrorValue( aValue.clone());
777  mirror( *mirrorValue, rOutDev );
778  if (forWidget()->getNativeControlRegion(nType, nPart, rgn, nState, *mirrorValue, OUString(), rNativeBoundingRegion, rNativeContentRegion))
779  {
780  mirror( rNativeBoundingRegion, rOutDev, true );
781  mirror( rNativeContentRegion, rOutDev, true );
782  return true;
783  }
784  return false;
785  }
786  else
787  return forWidget()->getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, rNativeContentRegion);
788 }
789 
791  const SalBitmap& rBitmap,
792  const OutputDevice& rOutDev )
793 {
794  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
795  {
796  SalTwoRect aPosAry2 = rPosAry;
797  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
798  return blendBitmap( aPosAry2, rBitmap );
799  }
800  else
801  return blendBitmap( rPosAry, rBitmap );
802 }
803 
805  const SalBitmap& rSrcBitmap,
806  const SalBitmap& rMaskBitmap,
807  const SalBitmap& rAlphaBitmap,
808  const OutputDevice& rOutDev )
809 {
810  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
811  {
812  SalTwoRect aPosAry2 = rPosAry;
813  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
814  return blendAlphaBitmap( aPosAry2, rSrcBitmap, rMaskBitmap, rAlphaBitmap );
815  }
816  else
817  return blendAlphaBitmap( rPosAry, rSrcBitmap, rMaskBitmap, rAlphaBitmap );
818 }
819 
821  const SalBitmap& rSourceBitmap,
822  const SalBitmap& rAlphaBitmap,
823  const OutputDevice& rOutDev )
824 {
825  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
826  {
827  SalTwoRect aPosAry2 = rPosAry;
828  mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
829  return drawAlphaBitmap( aPosAry2, rSourceBitmap, rAlphaBitmap );
830  }
831  else
832  return drawAlphaBitmap( rPosAry, rSourceBitmap, rAlphaBitmap );
833 }
834 
836  const basegfx::B2DPoint& rNull,
837  const basegfx::B2DPoint& rX,
838  const basegfx::B2DPoint& rY,
839  const SalBitmap& rSourceBitmap,
840  const SalBitmap* pAlphaBitmap,
841  double fAlpha,
842  const OutputDevice& rOutDev)
843 {
844  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
845  {
846  // mirroring set
847  const basegfx::B2DHomMatrix& rMirror(getMirror(rOutDev));
848  if (!rMirror.isIdentity())
849  {
850  basegfx::B2DPolygon aPoints({rNull, rX, rY});
851  basegfx::B2DRange aBoundingBox(aPoints.getB2DRange());
852  auto aTranslateToMirroredBounds = createTranslateToMirroredBounds(aBoundingBox, rMirror);
853 
854  basegfx::B2DPoint aNull = aTranslateToMirroredBounds * rNull;
855  basegfx::B2DPoint aX = aTranslateToMirroredBounds * rX;
856  basegfx::B2DPoint aY = aTranslateToMirroredBounds * rY;
857 
858  return drawTransformedBitmap(aNull, aX, aY, rSourceBitmap, pAlphaBitmap, fAlpha);
859  }
860  }
861 
862  return drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
863 }
864 
866 {
868 }
869 
871  sal_uInt8 nTransparency, const OutputDevice& rOutDev )
872 {
873  if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() )
874  mirror( nX, nWidth, rOutDev );
875 
876  return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency );
877 }
878 
880 {
881  if (GetImpl())
882  return GetImpl()->getRenderBackendName();
883  return OUString();
884 }
885 
887  const PhysicalFontFace& rFontFace, const bool bVertical,
888  std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc)
889 {
890  rWidths.clear();
891  rUnicodeEnc.clear();
892 
893  const int nGlyphCount = rTTF.glyphCount();
894  if (nGlyphCount <= 0)
895  return;
896 
897  FontCharMapRef xFCMap = rFontFace.GetFontCharMap();
898  if (!xFCMap.is() || !xFCMap->GetCharCount())
899  {
900  SAL_WARN("vcl.fonts", "no charmap");
901  return;
902  }
903 
904  rWidths.resize(nGlyphCount);
905  std::vector<sal_uInt16> aGlyphIds(nGlyphCount);
906  for (int i = 0; i < nGlyphCount; i++)
907  aGlyphIds[i] = static_cast<sal_uInt16>(i);
908 
909  std::unique_ptr<sal_uInt16[]> pGlyphMetrics
910  = GetTTSimpleGlyphMetrics(&rTTF, aGlyphIds.data(), nGlyphCount, bVertical);
911  if (pGlyphMetrics)
912  {
913  for (int i = 0; i < nGlyphCount; ++i)
914  rWidths[i] = pGlyphMetrics[i];
915  pGlyphMetrics.reset();
916  }
917 
918  int nCharCount = xFCMap->GetCharCount();
919  sal_uInt32 nChar = xFCMap->GetFirstChar();
920  for (; --nCharCount >= 0; nChar = xFCMap->GetNextChar(nChar))
921  {
922  if (nChar > 0xFFFF)
923  continue;
924 
925  sal_Ucs nUcsChar = static_cast<sal_Ucs>(nChar);
926  sal_uInt32 nGlyph = xFCMap->GetGlyphIndex(nUcsChar);
927  if (nGlyph > 0)
928  rUnicodeEnc[nUcsChar] = nGlyph;
929  }
930 }
931 
933  const bool bVertical, const sal_GlyphId* pGlyphIds,
934  const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
935  const int nOrigGlyphCount)
936 {
937  // Multiple questions:
938  // - Why is there a glyph limit?
939  // MacOS used to handle 257 glyphs...
940  // Also the much more complex PrintFontManager variant has this limit.
941  // Also the very first implementation has the limit in
942  // commit 8789ed701e98031f2a1657ea0dfd6f7a0b050992
943  // - Why doesn't the PrintFontManager care about the fake glyph? It
944  // is used on all unx platforms to create the subset font.
945  // - Should the SAL_WARN actually be asserts, like on MacOS?
946  if (nOrigGlyphCount > 256)
947  {
948  SAL_WARN("vcl.fonts", "too many glyphs for subsetting");
949  return false;
950  }
951 
952  int nGlyphCount = nOrigGlyphCount;
953  sal_uInt16 aShortIDs[256];
954  sal_uInt8 aTempEncs[256];
955 
956  // handle the undefined / first font glyph
957  int nNotDef = -1, i;
958  for (i = 0; i < nGlyphCount; ++i)
959  {
960  aTempEncs[i] = pEncoding[i];
961  aShortIDs[i] = static_cast<sal_uInt16>(pGlyphIds[i]);
962  if (!aShortIDs[i])
963  if (nNotDef < 0)
964  nNotDef = i;
965  }
966 
967  // nNotDef glyph must be in pos 0 => swap glyphids
968  if (nNotDef != 0)
969  {
970  if (nNotDef < 0)
971  {
972  if (nGlyphCount == 256)
973  {
974  SAL_WARN("vcl.fonts", "too many glyphs for subsetting");
975  return false;
976  }
977  nNotDef = nGlyphCount++;
978  }
979 
980  aShortIDs[nNotDef] = aShortIDs[0];
981  aTempEncs[nNotDef] = aTempEncs[0];
982  aShortIDs[0] = 0;
983  aTempEncs[0] = 0;
984  }
985 
986  std::unique_ptr<sal_uInt16[]> pMetrics
987  = GetTTSimpleGlyphMetrics(&rTTF, aShortIDs, nGlyphCount, bVertical);
988  if (!pMetrics)
989  return false;
990 
991  sal_uInt16 nNotDefAdv = pMetrics[0];
992  pMetrics[0] = pMetrics[nNotDef];
993  pMetrics[nNotDef] = nNotDefAdv;
994  for (i = 0; i < nOrigGlyphCount; ++i)
995  pGlyphWidths[i] = pMetrics[i];
996  pMetrics.reset();
997 
998  // write subset into destination file
999  return (CreateTTFromTTGlyphs(&rTTF, rSysPath.getStr(), aShortIDs, aTempEncs, nGlyphCount)
1000  == vcl::SFErrCodes::Ok);
1001 }
1002 
1003 bool SalGraphics::CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
1004  const OString& rSysPath, const sal_GlyphId* pGlyphIds,
1005  const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
1006  int nGlyphCount, FontSubsetInfo& rInfo)
1007 {
1008  FILE* pOutFile = fopen(rSysPath.getStr(), "wb");
1009  if (!pOutFile)
1010  return false;
1011  rInfo.LoadFont(FontType::CFF_FONT, pFontBytes, nByteLength);
1012  bool bRet = rInfo.CreateFontSubset(FontType::TYPE1_PFB, pOutFile, nullptr, pGlyphIds, pEncoding,
1013  nGlyphCount, pGlyphWidths);
1014  fclose(pOutFile);
1015  return bRet;
1016 }
1017 
1018 void SalGraphics::FillFontSubsetInfo(const vcl::TTGlobalFontInfo& rTTInfo, const OUString& pPSName,
1019  FontSubsetInfo& rInfo)
1020 {
1021  rInfo.m_aPSName = pPSName;
1023  rInfo.m_aFontBBox
1024  = tools::Rectangle(Point(rTTInfo.xMin, rTTInfo.yMin), Point(rTTInfo.xMax, rTTInfo.yMax));
1025  rInfo.m_nCapHeight = rTTInfo.yMax; // Well ...
1026  rInfo.m_nAscent = rTTInfo.winAscent;
1027  rInfo.m_nDescent = rTTInfo.winDescent;
1028 
1029  // mac fonts usually do not have an OS2-table
1030  // => get valid ascent/descent values from other tables
1031  if (!rInfo.m_nAscent)
1032  rInfo.m_nAscent = +rTTInfo.typoAscender;
1033  if (!rInfo.m_nAscent)
1034  rInfo.m_nAscent = +rTTInfo.ascender;
1035  if (!rInfo.m_nDescent)
1036  rInfo.m_nDescent = +rTTInfo.typoDescender;
1037  if (!rInfo.m_nDescent)
1038  rInfo.m_nDescent = -rTTInfo.descender;
1039 }
1040 
1041 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SalFrame * GetParent() const =0
FontType m_nFontType
font-type of subset result
Definition: fontsubset.hxx:70
bool is() const
int winDescent
descender metric for Windows
Definition: sft.hxx:170
virtual bool drawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap)=0
Render bitmap with alpha channel.
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const OutputDevice &rOutDev, const Color &rBackgroundColor=COL_AUTO)
void DrawPixel(tools::Long nX, tools::Long nY, const OutputDevice &rOutDev)
bool SetClipRegion(const vcl::Region &, const OutputDevice &rOutDev)
virtual OUString getRenderBackendName() const
static void FillFontSubsetInfo(const vcl::TTGlobalFontInfo &rTTInfo, const OUString &pPSName, FontSubsetInfo &rInfo)
static bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont &aTTF, const OString &rSysPath, const bool bVertical, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncoding, sal_Int32 *pGlyphWidths, int nGlyphCount)
bool BlendBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, const OutputDevice &rOutDev)
SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, int nGlyphs)
Generates a new TrueType font and dumps it to outf file.
Definition: sft.cxx:1582
virtual std::shared_ptr< SalBitmap > getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
bool HasFastDrawTransformedBitmap() const
void DrawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice &rOutDev)
CFF-container with PSType2 glyphs.
bool CreateFontSubset(FontType nOutFontTypeMask, FILE *pOutFile, const char *pOutFontName, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncodedIds, int nReqGlyphCount, sal_Int32 *pOutGlyphWidths=nullptr)
Definition: fontsubset.cxx:68
sal_Unicode sal_Ucs
Definition: salgdi.hxx:63
virtual bool IsVirtual() const
Definition: outdev.cxx:180
virtual bool blendAlphaBitmap(const SalTwoRect &, const SalBitmap &rSrcBitmap, const SalBitmap &rMaskBitmap, const SalBitmap &rAlphaBitmap)=0
Draw the bitmap by blending using the mask and alpha channel.
void Invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags, const OutputDevice &rOutDev)
SalFrameGeometry GetGeometry() const
ControlType getType() const
std::unique_ptr< sal_uInt16[]> GetTTSimpleGlyphMetrics(AbstractTrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical)
Queries glyph metrics.
Definition: sft.cxx:1938
tools::Long mnDestX
Definition: salgtype.hxx:45
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:508
sal_uInt32 glyphCount() const
Definition: sft.hxx:739
sal_uIntPtr sal_uLong
long Long
tools::Long GetOutOffXPixel() const
Definition: outdev.hxx:445
virtual void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2)=0
tools::Rectangle maButton2Rect
void CopyBits(const SalTwoRect &rPosAry, const OutputDevice &rOutDev)
void DrawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry, const OutputDevice &rOutDev)
bool DrawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency, const OutputDevice &rOutDev)
tools::Long GetWidth() const
void LoadFont(FontType eInFontType, const unsigned char *pFontBytes, int nByteLength)
Definition: fontsubset.cxx:50
tools::Long mnSrcWidth
Definition: salgtype.hxx:43
virtual bool blendBitmap(const SalTwoRect &, const SalBitmap &rBitmap)=0
Blend the bitmap with the current buffer.
float x
tools::Rectangle maLowerRect
bool DrawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha, const OutputDevice &rOutDev)
sal_uInt16 sal_GlyphId
Definition: glyphitem.hxx:26
virtual bool drawNativeControl(ControlType eType, ControlPart ePart, const tools::Rectangle &rBoundingControlRegion, ControlState eState, const ImplControlValue &aValue, const OUString &aCaptions, const Color &rBackgroundColor)
Draw the requested control.
bool DrawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize, const OutputDevice &rOutDev)
tools::Long mnDestWidth
Definition: salgtype.hxx:47
virtual Color getPixel(tools::Long nX, tools::Long nY)=0
bool DrawGradient(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient, const OutputDevice &rOutDev)
NONE
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
int yMin
global bounding box: yMin
Definition: sft.hxx:159
bool IsEmpty() const
tools::Rectangle maUpperRect
virtual void drawPixel(tools::Long nX, tools::Long nY)=0
OUString m_aPSName
Definition: fontsubset.hxx:65
tools::Long Left() const
void DrawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor, const OutputDevice &rOutDev)
virtual void drawPolygon(sal_uInt32 nPoints, const Point *pPtAry)=0
virtual bool drawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha)=0
draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system ...
void DrawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, const OutputDevice &rOutDev)
bool initWidgetDrawBackends(bool bForce=false)
basegfx::B2DHomMatrix m_aLastMirror
Definition: salgdi.hxx:613
virtual void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
int GetCharCount() const
Get the number of characters in the font character map.
int winAscent
ascender metric for Windows
Definition: sft.hxx:169
virtual bool hitTestNativeControl(ControlType eType, ControlPart ePart, const tools::Rectangle &rBoundingControlRegion, const Point &aPos, bool &rIsInside)
Query if a position is inside the native widget part.
bool BlendAlphaBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalSrcBitmap, const SalBitmap &rSalMaskBitmap, const SalBitmap &rSalAlphaBitmap, const OutputDevice &rOutDev)
virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry)=0
virtual void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap)=0
abstract base class for physical font faces
void DrawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice &rOutDev)
SalLayoutFlags m_nLayout
Definition: salgdi.hxx:610
void DrawPolygon(sal_uInt32 nPoints, const Point *pPtAry, const OutputDevice &rOutDev)
sal_UCS4 GetFirstChar() const
Get the first character in the font character map.
tools::Long mirror2(tools::Long nX, const OutputDevice &rOutDev) const
virtual bool setClipRegion(const vcl::Region &)=0
bool IsRTLEnabled() const
Definition: outdev.hxx:1364
virtual ImplControlValue * clone() const
int i
int typoAscender
OS/2 portable typographic ascender.
Definition: sft.hxx:166
int ascender
typographic ascent.
Definition: sft.hxx:162
void SetEmpty()
Definition: region.cxx:1417
tools::Rectangle maButton1Rect
virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
int descender
typographic descent.
Definition: sft.hxx:163
static bool CreateCFFfontSubset(const unsigned char *pFontBytes, int nByteLength, const OString &rSysPath, const sal_GlyphId *pGlyphIds, const sal_uInt8 *pEncoding, sal_Int32 *pGlyphWidths, int nGlyphCount, FontSubsetInfo &rInfo)
virtual bool getNativeControlRegion(ControlType eType, ControlPart ePart, const tools::Rectangle &rBoundingControlRegion, ControlState eState, const ImplControlValue &aValue, const OUString &aCaption, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion)
Get the native control regions for the control part.
int GetGlyphIndex(sal_UCS4) const
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:579
void CopyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, const OutputDevice &rOutDev)
virtual void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags)=0
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:303
virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize)=0
static bool GetLayoutRTL()
void transform(const basegfx::B2DHomMatrix &rMatrix)
void DrawPolyLine(sal_uInt32 nPoints, Point const *pPtAry, const OutputDevice &rOutDev)
SalFrameGeometry maGeometry
absolute, unmirrored values
Definition: salframe.hxx:127
sal_Int32 w
std::unique_ptr< vcl::WidgetDrawInterface > m_pWidgetDraw
Definition: salgdi.hxx:637
SalInvert
Definition: salgtype.hxx:75
virtual tools::Long GetGraphicsWidth() const =0
tools::Long m_nLastMirrorDeviceLTRButBiDiRtlTranslate
Definition: salgdi.hxx:615
virtual bool drawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
virtual OUString getRenderBackendName() const =0
bool isIdentity() const
SFNT container with TrueType glyphs.
virtual SalGraphicsImpl * GetImpl() const =0
void mirror(tools::Long &nX, const OutputDevice &rOutDev) const
virtual bool hasFastDrawTransformedBitmap() const =0
Used e.g.
int yMax
global bounding box: yMax
Definition: sft.hxx:161
virtual void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics)=0
tools::Rectangle maThumbRect
tools::Long mnSrcX
Definition: salgtype.hxx:41
tools::Long nX
Definition: salgeom.hxx:30
bool DrawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry, const OutputDevice &rOutDev)
tools::ULong nWidth
Definition: salgeom.hxx:32
vcl::WidgetDrawInterface * forWidget()
Definition: salgdi.hxx:638
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion, const OutputDevice &rOutDev)
bool DrawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap, const OutputDevice &rOutDev)
int xMax
global bounding box: xMax
Definition: sft.hxx:160
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
int xMin
global bounding box: xMin
Definition: sft.hxx:158
virtual void GetGlyphWidths(const PhysicalFontFace *pFont, bool bVertical, std::vector< sal_Int32 > &rWidths, Ucs2UIntMap &rUnicodeEnc)=0
sal_UCS4 GetNextChar(sal_UCS4 cChar) const
Get the next character in the font character map.
SalLayoutFlags
Definition: outdev.hxx:120
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
def rectangle(l)
bool DrawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry, const OutputDevice &rOutDev)
::basegfx::B2DPolyPolygon getB2DPolyPolygon() const
#define SAL_WARN_IF(condition, area, stream)
unsigned char sal_uInt8
SalLayoutFlags GetLayout() const
Definition: salgdi.hxx:199
bool m_bLastMirrorDeviceLTRButBiDiRtlSet
Definition: salgdi.hxx:616
tools::Long m_aLastMirrorW
Definition: salgdi.hxx:614
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1659
Sun Font Tools.
virtual void drawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor)=0
virtual FontCharMapRef GetFontCharMap() const =0
const basegfx::B2DHomMatrix & getMirror(const OutputDevice &rOutDev) const
bool HasPolyPolygonOrB2DPolyPolygon() const
Definition: region.hxx:110
~SalGraphics() COVERITY_NOEXCEPT_FALSE override
tools::Long GetDeviceWidth(const OutputDevice &rOutDev) const
int m_nAscent
all metrics in PS font units
Definition: fontsubset.hxx:66
PSType1 Postscript Font Binary.
virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry)=0
tools::Long GetHeight() const
basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const
Definition: region.cxx:1289
bool HitTestNativeScrollbar(ControlPart nPart, const tools::Rectangle &rControlRegion, const Point &aPos, bool &rIsInside, const OutputDevice &rOutDev)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
virtual void drawPolyLine(sal_uInt32 nPoints, const Point *pPtAry)=0
tools::Rectangle maGripRect
#define SAL_WARN(area, stream)
virtual bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency)=0
Render solid rectangle with given transparency.
bool DrawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry, const OutputDevice &rOutDev)
double getMinX() const
Color GetPixel(tools::Long nX, tools::Long nY, const OutputDevice &rOutDev)
virtual void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate)=0
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap
Definition: salgdi.hxx:64
tools::Rectangle m_aFontBBox
Definition: fontsubset.hxx:69
virtual bool drawGradient(const tools::PolyPolygon &rPolyPoly, const Gradient &rGradient)=0
tools::Rectangle maThumbRect
tools::Long GetOutputWidthPixel() const
Definition: outdev.hxx:443
int typoDescender
OS/2 portable typographic descender.
Definition: sft.hxx:167
virtual void handleDamage(const tools::Rectangle &rDamagedRegion)
Handle damage done by drawing with a widget draw override.
Definition: salgdi.hxx:668
Return value of GetTTGlobalFontInfo()
Definition: sft.hxx:147
PolyFlags
std::shared_ptr< SalBitmap > GetBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice &rOutDev)