7#include <QtGui/private/qpixmap_blitter_p.h>
35 DFBSurfaceCapabilities surfaceCaps;
37 m_premult = (surfaceCaps & DSCAPS_PREMULTIPLIED);
47 DFBSurfaceDescription surfaceDesc;
48 memset(&surfaceDesc,0,
sizeof(DFBSurfaceDescription));
49 surfaceDesc.width =
rect.width();
50 surfaceDesc.height =
rect.height();
57 surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
59 surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT);
61 surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
109 rect.toRect().getRect(&
x, &
y ,&
w, &
h);
110 if ((
w <= 0) || (
h <= 0))
return;
116 DFBSurfaceDrawingFlags(m_premult ? (DSDRAW_NOFX | DSDRAW_SRC_PREMULTIPLY) : DSDRAW_NOFX));
123 if (
color.alpha() == 0)
127 DFBSurfaceDrawingFlags(m_premult ? (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY) : DSDRAW_BLEND));
137 DirectFBError(
"QDirectFBBlitter::alphaFillRect()",
result);
146 DFBRectangle sRect(sQRect.
x(), sQRect.
y(), sQRect.
width(), sQRect.
height());
147 DFBRectangle dRect(dQRect.
x(), dQRect.
y(), dQRect.
width(), dQRect.
height());
151 if ((dRect.w <= 0) || (dRect.h <= 0))
return;
154 if (sRect.w <= 0) sRect.w = 1;
155 if (sRect.h <= 0) sRect.h = 1;
163 DFBSurfaceBlittingFlags blittingFlags = DFBSurfaceBlittingFlags(DSBLIT_BLEND_ALPHACHANNEL);
168 blittingFlags = DFBSurfaceBlittingFlags(blittingFlags | DSBLIT_BLEND_COLORALPHA | (m_premult ? DSBLIT_SRC_PREMULTCOLOR : 0));
178 if ((sRect.w == dRect.w) && (sRect.h == dRect.h)) {
181 DirectFBError(
"QDirectFBBlitter::drawPixmapOpacity()",
result);
187 DirectFBError(
"QDirectFBBlitter::drawPixmapOpacity()",
result);
205 cache->fillInPendingGlyphs();
207 if (
cache->image().width() == 0 ||
cache->image().height() == 0)
210 const int margin = fontEngine->
glyphMargin(glyphFormat);
235 sourceRects[nGlyphs].x =
c.x;
236 sourceRects[nGlyphs].y =
c.y;
237 sourceRects[nGlyphs].w =
c.w;
238 sourceRects[nGlyphs].h =
c.h;
239 destPoints[nGlyphs].x =
x;
240 destPoints[nGlyphs].y =
y;
250 int flags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
251 if (
color.alpha() != 0xff)
252 flags |= DSBLIT_BLEND_COLORALPHA;
269 for (
int i = 0;
i < nGlyphs; ++
i) {
288 DFBSurfacePixelFormat dfbFormat;
289 DFBSurfaceCapabilities dfbCaps;
297 DirectFBError(
"Failed to lock image",
result);
303bool QDirectFbBlitterPlatformPixmap::fromDataBufferDescription(
const DFBDataBufferDescription &dataBufferDescription)
310 result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, dataBuffer.
outPtr());
318 result = dataBuffer->CreateImageProvider(dataBuffer.
data(), provider.
outPtr());
325 DFBImageDescription imageDescription;
326 result = provider->GetImageDescription(provider.
data(), &imageDescription);
333 if (imageDescription.caps & DICAPS_COLORKEY)
336 DFBSurfaceDescription surfaceDescription;
337 result = provider->GetSurfaceDescription(provider.
data(), &surfaceDescription);
343 m_alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
344 resize(surfaceDescription.width, surfaceDescription.height);
358 Qt::ImageConversionFlags
flags)
374 DFBDataBufferDescription description;
375 description.flags = DBDESC_FILE;
377 description.file = fileNameData.
constData();
378 if (fromDataBufferDescription(description))
397 if ((
w <= 0) || (
h <= 0))
return;
400 DFBSurfaceDrawingFlags(m_premult ? (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY) : DSDRAW_BLEND));
408 DirectFBError(
"QDirectFBBlitter::drawDebugRect()",
result);
411 DirectFBError(
"QDirectFBBlitter::drawDebugRect()",
result);
414 DirectFBError(
"QDirectFBBlitter::drawDebugRect()",
result);
417 DirectFBError(
"QDirectFBBlitter::drawDebugRect()",
result);
422 DirectFBError(
"QDirectFBBlitter::drawDebugRect()",
result);
435 DFBSurfaceDescription
desc;
437 desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED | DSDESC_CAPS);
440 desc.caps = DSCAPS_SYSTEMONLY;
442 switch (
source.format()) {
444 desc.pixelformat = DSPF_A1;
447 desc.pixelformat = DSPF_A8;
450 qFatal(
"QDirectFBTextureGlyphCache: Unsupported source texture image format.");
454 desc.preallocated[0].data =
const_cast<void*
>(
static_cast<const void*
>(
source.bits()));
455 desc.preallocated[0].pitch =
source.bytesPerLine();
456 desc.preallocated[1].data = 0;
457 desc.preallocated[1].pitch = 0;
460 dfb->CreateSurface(dfb , &
desc, m_surface.
outPtr());
462 return m_surface.
data();
@ SourceOverPixmapCapability
@ DrawScaledCachedGlyphsCapability
@ OpacityPixmapCapability
@ AlphaFillRectCapability
@ SourceOverScaledPixmapCapability
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
The QColor class provides colors based on RGB, HSV or CMYK values.
virtual ~QDirectFbBlitter()
static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha)
bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) override
void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) override
QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface)
static DFBSurfacePixelFormat pixmapFormat()
QImage * doLock() override
QDirectFBPointer< IDirectFBSurface > m_surface
void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity) override
static DFBSurfacePixelFormat alphaPixmapFormat()
void fillRect(const QRectF &rect, const QColor &color) override
void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) override
static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps)
static IDirectFB * dfbInterface()
void resizeTextureData(int width, int height) override
IDirectFBSurface * sourceSurface()
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setGlyphCache(const void *key, QFontEngineGlyphCache *data)
virtual int glyphMargin(GlyphFormat format)
QFixed subPixelPositionForX(QFixed x) const
QFontEngineGlyphCache * glyphCache(const void *key, GlyphFormat format, const QTransform &transform, const QColor &color=QColor()) const
virtual void resizeTextureData(int width, int height) override
const QImage & image() const
Format
The following image formats are available in Qt.
The QPaintEngineState class provides information about the active paint engine's current state....
CompositionMode
Defines the modes supported for digital image compositing.
@ CompositionMode_SourceOver
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QByteArray toLocal8Bit() const &
const T * constData() const
QCache< int, Employee > cache
[0]
Combined button and popup list for selecting options.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
static QT_BEGIN_NAMESPACE QBlittable::Capabilities dfb_blitter_capabilities()
int qRound(qfloat16 d) noexcept
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum const void GLbitfield GLsizei numGlyphs
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLchar * source
GLfloat GLfloat GLfloat alpha
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept