This file is indexed.

/usr/include/Wt/WCanvasPaintDevice is in libwt-dev 3.3.6+dfsg-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WCANVAS_PAINT_DEVICE_H_
#define WCANVAS_PAINT_DEVICE_H_

#include <Wt/WBrush>
#include <Wt/WFont>
#include <Wt/WObject>
#include <Wt/WPaintDevice>
#include <Wt/WPainterPath>
#include <Wt/WPen>
#include <Wt/WPointF>
#include <Wt/WShadow>
#include <Wt/WTransform>

#include <sstream>

namespace Wt {

class DomElement;
class WTransform;
class ServerSideFontMetrics;

/*! \class WCanvasPaintDevice Wt/WCanvasPaintDevice Wt/WCanvasPaintDevice
 *  \brief A paint device for rendering using the HTML 5 &lt;canvas&gt; element.
 *
 * The %WCanvasPaintDevice is used by WPaintedWidget to render to the
 * browser using the HTML 5 &lt;canvas&gt; element. You usually will
 * not use the device directly, but rather rely on WPaintedWidget to
 * use this device when appropriate.
 *
 * \note Older browsers do not have text support in &lt;canvas&gt;.
 * Text is then rendered in an overlayed DIV and a consequence text is
 * not subject to rotation and scaling components of the current
 * transformation (but does take into account translation). On most
 * browser you can use the WSvgImage or WVmlImage paint devices which
 * do support text natively.
 *
 * \ingroup painting
 */
class WT_API WCanvasPaintDevice : public WObject, public WPaintDevice
{
public:
  /*! \brief Create a canvas paint device.
   */
  WCanvasPaintDevice(const WLength& width, const WLength& height,
		     WObject *parent = 0,
		     bool paintUpdate = false);
  virtual ~WCanvasPaintDevice();

  virtual WFlags<FeatureFlag> features() const;
  virtual void setChanged(WFlags<ChangeFlag> flags);
  virtual void drawArc(const WRectF& rect, double startAngle, double spanAngle);
  virtual void drawImage(const WRectF& rect, const std::string& imgUri,
			 int imgWidth, int imgHeight, const WRectF& sourceRect);
  virtual void drawLine(double x1, double y1, double x2, double y2);
  virtual void drawPath(const WPainterPath& path);
  virtual void drawRect(const WRectF& rectangle);
  virtual void drawText(const WRectF& rect, 
			WFlags<AlignmentFlag> alignmentFlags,
			TextFlag textFlag,
			const WString& text,
			const WPointF *clipPoint);
  virtual WTextItem measureText(const WString& text, double maxWidth = -1,
				bool wordWrap = false);
  virtual WFontMetrics fontMetrics();
  virtual void init();
  virtual void done();
  virtual bool paintActive() const { return painter_ != 0; }

  void render(const std::string& canvasId, DomElement* text);
  void renderPaintCommands(std::stringstream& js, const std::string& element);

  virtual WLength width() const { return width_; }
  virtual WLength height() const { return height_; }

protected:
  virtual WPainter *painter() const { return painter_; }
  virtual void setPainter(WPainter *painter) { painter_ = painter; }

private:
  enum TextMethod { MozText, Html5Text, DomText };

  WLength     width_, height_;
  WPainter   *painter_;
  WFlags<ChangeFlag> changeFlags_;
  bool        paintUpdate_;

  TextMethod  textMethod_;

  bool        currentNoPen_, currentNoBrush_, lastTransformWasIdentity_;

  WTransform  currentTransform_;
  WBrush      currentBrush_;
  WPen        currentPen_;
  WShadow     currentShadow_;
  WFont       currentFont_;
  WPointF     pathTranslation_;
  AlignmentFlag currentTextHAlign_, currentTextVAlign_;
  WPainterPath currentClipPath_;
  WTransform currentClipTransform_;
  bool currentClippingEnabled_;
  ServerSideFontMetrics *fontMetrics_;

  std::stringstream js_;
  std::stringstream recordedJs_;
  std::vector<DomElement *> textElements_;
  std::vector<std::string> images_;

  void finishPath();
  void renderTransform(std::stringstream& s, const WTransform& t);
  void renderStateChanges(bool resetPathTranslation);
  void resetPathTranslation();
  void drawPlainPath(std::stringstream& s, const WPainterPath& path);

  int createImage(const std::string& imgUri);

  TextMethod textMethod() const { return textMethod_; }

  friend class WWidgetCanvasPainter;
};

}

#endif // WCANVAS_PAINT_DEVICE_H_