254 (this, d->pixelShaderFragment); |
254 (this, d->pixelShaderFragment); |
255 } |
255 } |
256 bool usingShader = d->customShaderStage->setOnPainter(painter); |
256 bool usingShader = d->customShaderStage->setOnPainter(painter); |
257 |
257 |
258 QPoint offset; |
258 QPoint offset; |
259 if (source->isPixmap()) { |
259 if (sourceIsPixmap()) { |
260 // No point in drawing in device coordinates (pixmap will be scaled anyways). |
260 // No point in drawing in device coordinates (pixmap will be scaled anyways). |
261 const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); |
261 const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset); |
262 painter->drawPixmap(offset, pixmap); |
262 painter->drawPixmap(offset, pixmap); |
263 } else { |
263 } else { |
264 // Draw pixmap in device coordinates to avoid pixmap scaling. |
264 // Draw pixmap in device coordinates to avoid pixmap scaling. |
265 const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); |
265 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset); |
266 QTransform restoreTransform = painter->worldTransform(); |
266 QTransform restoreTransform = painter->worldTransform(); |
267 painter->setWorldTransform(QTransform()); |
267 painter->setWorldTransform(QTransform()); |
268 painter->drawPixmap(offset, pixmap); |
268 painter->drawPixmap(offset, pixmap); |
269 painter->setWorldTransform(restoreTransform); |
269 painter->setWorldTransform(restoreTransform); |
270 } |
270 } |
271 |
271 |
272 // Remove the custom shader to return to normal painting operations. |
272 // Remove the custom shader to return to normal painting operations. |
273 if (usingShader) |
273 if (usingShader) |
274 d->customShaderStage->removeFromPainter(painter); |
274 d->customShaderStage->removeFromPainter(painter); |
275 #else |
275 #else |
276 source->draw(painter); |
276 drawSource(painter); |
277 #endif |
277 #endif |
278 } |
278 } |
279 |
279 |
280 /*# |
280 /*# |
281 Sets the custom uniform variables on this shader effect to |
281 Sets the custom uniform variables on this shader effect to |