7#include <private/qquickitem_p.h>
8#include <QtQuick/private/qsgplaintexture_p.h>
10#include <QtCore/QThread>
11#include <QtGui/QGuiApplication>
21 , m_canvasDevicePixelRatio(1)
22 , m_canvasWindowChanged(
false)
23 , m_dirtyTexture(
false)
25 , m_antialiasing(
false)
26 , m_tiledCanvas(
false)
88 static qreal overriddenDevicePixelRatio =
91 qreal canvasDevicePixelRatio = overriddenDevicePixelRatio;
92 if (overriddenDevicePixelRatio == 0.0) {
97 qCDebug(lcCanvas,
"%s device pixel ratio %.1lf -> %.1lf",
114 bool doDirty =
false;
117 bool dirty =
t->rect().intersected(
r).isValid();
141 if (canvasSize == canvasWindow.
size()) {
203 dirtyRect = tile->rect();
205 dirtyRect |= tile->rect();
214 tile->drawFinished();
215 tile->markDirty(
false);
234 const int h1 =
window.left() / tw;
237 const int htiles = ((
window.right() - h1 * tw) + tw - 1)/tw;
238 const int vtiles = ((
window.bottom() -
v1 * th) + th - 1)/th;
240 return QRect(h1 * tw,
v1 * th, htiles * tw, vtiles * th);
256 const int h1 =
window.left() / tw;
260 const int htiles =
r.width() / tw;
261 const int vtiles =
r.height() / th;
263 for (
int yy = 0; yy < vtiles; ++yy) {
264 for (
int xx = 0; xx < htiles; ++xx) {
273 for (
int i = 0;
i < oldTiles.
size();
i++) {
375 m_image.
fill(0x00000000);
377 qCDebug(lcCanvas,
"%s size %.1lf x %.1lf painting with size %d x %d DPR %.1lf",
390 m_displayImage = m_image;
405 m_painter.
begin(&m_image);
414#include "moc_qquickcontext2dtexture_p.cpp"
IOBluetoothDevice * device
float toFloat(bool *ok=nullptr) const
Returns the byte array converted to a float value.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
QSize size() const
Returns the size of the image, i.e.
@ Format_ARGB32_Premultiplied
void fill(uint pixel)
Fills the entire image with the given pixelValue.
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the image.
qsizetype size() const noexcept
void append(parameter_type t)
void unlock() noexcept
Unlocks the mutex.
void lock() noexcept
Locks the mutex.
QString objectName
the name of this object
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
The QPainter class performs low-level painting on widgets and other paint devices.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
@ CompositionMode_SourceOver
\inmodule QtCore\reentrant
void replay(QPainter *painter, QQuickContext2D::State &state, const QVector2D &scaleFactor)
QQuickContext2DTile * createTile() const override
~QQuickContext2DImageTexture()
void endPainting() override
QQuickCanvasItem::RenderTarget renderTarget() const override
void grabImage(const QRectF ®ion=QRectF()) override
QQuickContext2DImageTexture()
void compositeTile(QQuickContext2DTile *tile) override
QPaintDevice * beginPainting() override
QSGTexture * textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window) override
QQuickContext2DCommandBuffer * buffer
bool event(QEvent *e) override
This virtual function receives events to an object and should return true if the event e was recogniz...
void setItem(QQuickCanvasItem *item)
virtual void compositeTile(QQuickContext2DTile *tile)=0
bool setCanvasWindow(const QRect &canvasWindow)
virtual QVector2D scaleFactor() const
QRect createTiles(const QRect &window)
void canvasChanged(const QSize &canvasSize, const QSize &tileSize, const QRect &canvasWindow, const QRect &dirtyRect, bool smooth, bool antialiasing)
virtual QQuickContext2DTile * createTile() const =0
~QQuickContext2DTexture()
void paint(QQuickContext2DCommandBuffer *ccb)
QQuickContext2D::State m_state
virtual QSize adjustedTileSize(const QSize &ts)
virtual void endPainting()
bool setCanvasSize(const QSize &size)
bool setTileSize(const QSize &size)
static QRect tiledRect(const QRectF &window, const QSize &tileSize)
void setSmooth(bool smooth)
qreal m_canvasDevicePixelRatio
uint m_canvasWindowChanged
void paintWithoutTiles(QQuickContext2DCommandBuffer *ccb)
void setAntialiasing(bool antialiasing)
bool setDirtyRect(const QRect &dirtyRect)
QList< QQuickContext2DTile * > m_tiles
QQuickContext2D * m_context
virtual QPaintDevice * beginPainting()
QQuickCanvasItem * m_item
virtual void setRect(const QRect &r)=0
void setGrabbedImage(const QImage &grab)
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
QRect intersected(const QRect &other) const noexcept
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
static QT_BEGIN_NAMESPACE const int tileSize
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLsizei GLchar * source
#define qPrintable(string)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept