diff options
Diffstat (limited to 'src')
334 files changed, 12378 insertions, 6349 deletions
diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp index 2c56af7..6ed0145 100644 --- a/src/3rdparty/phonon/ds9/backend.cpp +++ b/src/3rdparty/phonon/ds9/backend.cpp @@ -64,6 +64,11 @@ namespace Phonon ::CoUninitialize(); } + QMutex *Backend::directShowMutex() + { + return &qobject_cast<Backend*>(qt_plugin_instance())->m_directShowMutex; + } + QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) { switch (c) @@ -131,6 +136,7 @@ namespace Phonon QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { + QMutexLocker locker(&m_directShowMutex); QList<int> ret; switch(type) @@ -157,7 +163,7 @@ namespace Phonon while (S_OK == enumMon->Next(1, mon.pparam(), 0)) { LPOLESTR str = 0; mon->GetDisplayName(0,0,&str); - const QString name = QString::fromUtf16((unsigned short*)str); + const QString name = QString::fromWCharArray(str); ComPointer<IMalloc> alloc; ::CoGetMalloc(1, alloc.pparam()); alloc->Free(str); @@ -204,6 +210,7 @@ namespace Phonon QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const { + QMutexLocker locker(&m_directShowMutex); QHash<QByteArray, QVariant> ret; switch (type) { @@ -216,7 +223,7 @@ namespace Phonon LPOLESTR str = 0; HRESULT hr = mon->GetDisplayName(0,0, &str); if (SUCCEEDED(hr)) { - QString name = QString::fromUtf16((unsigned short*)str); + QString name = QString::fromWCharArray(str); ComPointer<IMalloc> alloc; ::CoGetMalloc(1, alloc.pparam()); alloc->Free(str); @@ -231,7 +238,7 @@ namespace Phonon WCHAR name[80]; // 80 is clearly stated in the MSDN doc HRESULT hr = ::DMOGetName(m_audioEffects[index], name); if (SUCCEEDED(hr)) { - ret["name"] = QString::fromUtf16((unsigned short*)name); + ret["name"] = QString::fromWCharArray(name); } } break; diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index ad638f2..8b020c2 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -23,6 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/phononnamespace.h> #include <QtCore/QList> +#include <QtCore/QMutex> #include "compointer.h" #include "backendnode.h" @@ -63,6 +64,8 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; + static QMutex *directShowMutex(); + Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); @@ -74,6 +77,7 @@ namespace Phonon }; mutable QVector<AudioMoniker> m_audioOutputs; mutable QVector<CLSID> m_audioEffects; + mutable QMutex m_directShowMutex; }; } } diff --git a/src/3rdparty/phonon/ds9/ds9.desktop b/src/3rdparty/phonon/ds9/ds9.desktop index 370011e..ece3c9c 100644 --- a/src/3rdparty/phonon/ds9/ds9.desktop +++ b/src/3rdparty/phonon/ds9/ds9.desktop @@ -5,7 +5,7 @@ MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;app X-KDE-Library=phonon_ds9 X-KDE-PhononBackendInfo-InterfaceVersion=1 X-KDE-PhononBackendInfo-Version=0.1 -X-KDE-PhononBackendInfo-Website=http://www.trolltech.com/ +X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/ InitialPreference=15 Name=DirectShow9 diff --git a/src/3rdparty/phonon/ds9/effect.cpp b/src/3rdparty/phonon/ds9/effect.cpp index 104a3c1..ebe976b 100644 --- a/src/3rdparty/phonon/ds9/effect.cpp +++ b/src/3rdparty/phonon/ds9/effect.cpp @@ -82,7 +82,7 @@ namespace Phonon current += wcslen(current) + 1; //skip the name current += wcslen(current) + 1; //skip the unit for(; *current; current += wcslen(current) + 1) { - values.append( QString::fromUtf16((unsigned short*)current) ); + values.append( QString::fromWCharArray(current) ); } } //FALLTHROUGH @@ -107,7 +107,7 @@ namespace Phonon Phonon::EffectParameter::Hints hint = info.mopCaps == MP_CAPS_CURVE_INVSQUARE ? Phonon::EffectParameter::LogarithmicHint : Phonon::EffectParameter::Hints(0); - const QString n = QString::fromUtf16((unsigned short*)name); + const QString n = QString::fromWCharArray(name); ret.append(Phonon::EffectParameter(i, n, hint, def, min, max, values)); ::CoTaskMemFree(name); //let's free the memory } diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp index a885a69..e0c505c 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.cpp +++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp @@ -63,7 +63,6 @@ namespace Phonon //for Phonon::StreamInterface void writeData(const QByteArray &data) { - QWriteLocker locker(&m_lock); m_pos += data.size(); m_buffer += data; } @@ -74,54 +73,22 @@ namespace Phonon void setStreamSize(qint64 newSize) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_size = newSize; } - qint64 streamSize() const - { - QReadLocker locker(&m_lock); - return m_size; - } - void setStreamSeekable(bool s) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_seekable = s; } - bool streamSeekable() const - { - QReadLocker locker(&m_lock); - return m_seekable; - } - - void setCurrentPos(qint64 pos) - { - QWriteLocker locker(&m_lock); - m_pos = pos; - seekStream(pos); - m_buffer.clear(); - } - - qint64 currentPos() const - { - QReadLocker locker(&m_lock); - return m_pos; - } - - int currentBufferSize() const - { - QReadLocker locker(&m_lock); - return m_buffer.size(); - } - //virtual pure members //implementation from IAsyncReader STDMETHODIMP Length(LONGLONG *total, LONGLONG *available) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (total) { *total = m_size; } @@ -136,44 +103,42 @@ namespace Phonon HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) { - QMutexLocker locker(&m_mutexRead); - + Q_ASSERT(!m_mutex.tryLock()); if (m_mediaGraph->isStopping()) { return VFW_E_WRONG_STATE; } - if(streamSize() != 1 && pos + length > streamSize()) { + if(m_size != 1 && pos + length > m_size) { //it tries to read outside of the boundaries return E_FAIL; } - if (currentPos() - currentBufferSize() != pos) { - if (!streamSeekable()) { + if (m_pos - m_buffer.size() != pos) { + if (!m_seekable) { return S_FALSE; } - setCurrentPos(pos); + m_pos = pos; + seekStream(pos); + m_buffer.clear(); } - int oldSize = currentBufferSize(); - while (currentBufferSize() < int(length)) { + int oldSize = m_buffer.size(); + while (m_buffer.size() < int(length)) { needData(); if (m_mediaGraph->isStopping()) { return VFW_E_WRONG_STATE; } - if (oldSize == currentBufferSize()) { + if (oldSize == m_buffer.size()) { break; //we didn't get any data } - oldSize = currentBufferSize(); + oldSize = m_buffer.size(); } - int bytesRead = qMin(currentBufferSize(), int(length)); - { - QWriteLocker locker(&m_lock); - qMemCopy(buffer, m_buffer.data(), bytesRead); - //truncate the buffer - m_buffer = m_buffer.mid(bytesRead); - } + int bytesRead = qMin(m_buffer.size(), int(length)); + qMemCopy(buffer, m_buffer.data(), bytesRead); + //truncate the buffer + m_buffer = m_buffer.mid(bytesRead); if (actual) { *actual = bytesRead; //initialization @@ -189,7 +154,6 @@ namespace Phonon qint64 m_pos; qint64 m_size; - QMutex m_mutexRead; const MediaGraph *m_mediaGraph; }; @@ -203,14 +167,6 @@ namespace Phonon IODeviceReader::~IODeviceReader() { } - - STDMETHODIMP IODeviceReader::Stop() - { - HRESULT hr = QBaseFilter::Stop(); - m_streamReader->enoughData(); //this asks to cancel any blocked call to needData - return hr; - } - } } diff --git a/src/3rdparty/phonon/ds9/iodevicereader.h b/src/3rdparty/phonon/ds9/iodevicereader.h index af4b271..c8b91c3 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.h +++ b/src/3rdparty/phonon/ds9/iodevicereader.h @@ -41,7 +41,6 @@ namespace Phonon public: IODeviceReader(const MediaSource &source, const MediaGraph *); ~IODeviceReader(); - STDMETHODIMP Stop(); private: StreamReader *m_streamReader; diff --git a/src/3rdparty/phonon/ds9/mediagraph.cpp b/src/3rdparty/phonon/ds9/mediagraph.cpp index 7b10176..a467dd7 100644 --- a/src/3rdparty/phonon/ds9/mediagraph.cpp +++ b/src/3rdparty/phonon/ds9/mediagraph.cpp @@ -383,7 +383,8 @@ namespace Phonon #endif if (info.pGraph) { info.pGraph->Release(); - return m_graph->RemoveFilter(filter); + if (info.pGraph == m_graph) + return m_graph->RemoveFilter(filter); } //already removed @@ -681,7 +682,6 @@ namespace Phonon #ifndef QT_NO_PHONON_MEDIACONTROLLER } else if (source.discType() == Phonon::Cd) { m_realSource = Filter(new QAudioCDPlayer); - m_result = m_graph->AddFilter(m_realSource, 0); #endif //QT_NO_PHONON_MEDIACONTROLLER } else { @@ -1008,27 +1008,27 @@ namespace Phonon BSTR str; HRESULT hr = mediaContent->get_AuthorName(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("ARTIST"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("ARTIST"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Title(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("TITLE"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("TITLE"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Description(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("DESCRIPTION"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("DESCRIPTION"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Copyright(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("COPYRIGHT"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("COPYRIGHT"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_MoreInfoText(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("MOREINFO"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("MOREINFO"), QString::fromWCharArray(str)); SysFreeString(str); } } diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index de2078a..e42dff9 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -21,9 +21,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/QTime> #include <QtCore/QLibrary> -#ifndef Q_CC_MSVC #include <dshow.h> -#endif //Q_CC_MSVC #include <objbase.h> #include <initguid.h> #include <qnetwork.h> @@ -49,7 +47,7 @@ namespace Phonon //first the definition of the WorkerThread class WorkerThread::WorkerThread() - : QThread(), m_currentRenderId(0), m_finished(false), m_currentWorkId(1) + : QThread(), m_finished(false), m_currentWorkId(1) { } @@ -157,6 +155,7 @@ namespace Phonon //we create a new graph w.graph = Graph(CLSID_FilterGraph, IID_IGraphBuilder); w.filter = filter; + w.graph->AddFilter(filter, 0); w.id = m_currentWorkId++; m_queue.enqueue(w); m_waitCondition.set(); @@ -176,31 +175,29 @@ namespace Phonon void WorkerThread::handleTask() { - QMutexLocker locker(&m_mutex); - if (m_finished || m_queue.isEmpty()) { - return; - } + QMutexLocker locker(Backend::directShowMutex()); + { + QMutexLocker locker(&m_mutex); + if (m_finished || m_queue.isEmpty()) { + return; + } - const Work w = m_queue.dequeue(); + m_currentWork = m_queue.dequeue(); - //we ensure to have the wait condition in the right state - if (m_queue.isEmpty()) { - m_waitCondition.reset(); - } else { - m_waitCondition.set(); + //we ensure to have the wait condition in the right state + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } else { + m_waitCondition.set(); + } } HRESULT hr = S_OK; - { - QMutexLocker locker(&m_currentMutex); - m_currentRender = w.graph; - m_currentRenderId = w.id; - } - if (w.task == ReplaceGraph) { + if (m_currentWork.task == ReplaceGraph) { int index = -1; for(int i = 0; i < FILTER_COUNT; ++i) { - if (m_graphHandle[i].graph == w.oldGraph) { + if (m_graphHandle[i].graph == m_currentWork.oldGraph) { m_graphHandle[i].graph = Graph(); index = i; break; @@ -214,51 +211,39 @@ namespace Phonon //add the new graph HANDLE h; - if (SUCCEEDED(ComPointer<IMediaEvent>(w.graph, IID_IMediaEvent) + if (SUCCEEDED(ComPointer<IMediaEvent>(m_currentWork.graph, IID_IMediaEvent) ->GetEventHandle(reinterpret_cast<OAEVENT*>(&h)))) { - m_graphHandle[index].graph = w.graph; + m_graphHandle[index].graph = m_currentWork.graph; m_graphHandle[index].handle = h; } - } else if (w.task == Render) { - if (w.filter) { + } else if (m_currentWork.task == Render) { + if (m_currentWork.filter) { //let's render pins - w.graph->AddFilter(w.filter, 0); - const QList<OutputPin> outputs = BackendNode::pins(w.filter, PINDIR_OUTPUT); - for (int i = 0; i < outputs.count(); ++i) { - //blocking call - hr = w.graph->Render(outputs.at(i)); - if (FAILED(hr)) { - break; - } + const QList<OutputPin> outputs = BackendNode::pins(m_currentWork.filter, PINDIR_OUTPUT); + for (int i = 0; SUCCEEDED(hr) && i < outputs.count(); ++i) { + hr = m_currentWork.graph->Render(outputs.at(i)); } - } else if (!w.url.isEmpty()) { + } else if (!m_currentWork.url.isEmpty()) { //let's render a url (blocking call) - hr = w.graph->RenderFile(reinterpret_cast<const wchar_t *>(w.url.utf16()), 0); + hr = m_currentWork.graph->RenderFile(reinterpret_cast<const wchar_t *>(m_currentWork.url.utf16()), 0); } if (hr != E_ABORT) { - emit asyncRenderFinished(w.id, hr, w.graph); + emit asyncRenderFinished(m_currentWork.id, hr, m_currentWork.graph); } - } else if (w.task == Seek) { + } else if (m_currentWork.task == Seek) { //that's a seekrequest - ComPointer<IMediaSeeking> mediaSeeking(w.graph, IID_IMediaSeeking); - qint64 newtime = w.time * 10000; + ComPointer<IMediaSeeking> mediaSeeking(m_currentWork.graph, IID_IMediaSeeking); + qint64 newtime = m_currentWork.time * 10000; hr = mediaSeeking->SetPositions(&newtime, AM_SEEKING_AbsolutePositioning, 0, AM_SEEKING_NoPositioning); - qint64 currentTime = -1; - if (SUCCEEDED(hr)) { - hr = mediaSeeking->GetCurrentPosition(¤tTime); - if (SUCCEEDED(hr)) { - currentTime /= 10000; //convert to ms - } - } - emit asyncSeekingFinished(w.id, currentTime); + emit asyncSeekingFinished(m_currentWork.id, newtime / 10000); hr = E_ABORT; //to avoid emitting asyncRenderFinished - } else if (w.task == ChangeState) { + } else if (m_currentWork.task == ChangeState) { //remove useless decoders QList<Filter> unused; - for (int i = 0; i < w.decoders.count(); ++i) { - const Filter &filter = w.decoders.at(i); + for (int i = 0; i < m_currentWork.decoders.count(); ++i) { + const Filter &filter = m_currentWork.decoders.at(i); bool used = false; const QList<OutputPin> pins = BackendNode::pins(filter, PINDIR_OUTPUT); for( int i = 0; i < pins.count(); ++i) { @@ -275,15 +260,15 @@ namespace Phonon //we can get the state for (int i = 0; i < unused.count(); ++i) { //we should remove this filter from the graph - w.graph->RemoveFilter(unused.at(i)); + m_currentWork.graph->RemoveFilter(unused.at(i)); } //we can get the state - ComPointer<IMediaControl> mc(w.graph, IID_IMediaControl); + ComPointer<IMediaControl> mc(m_currentWork.graph, IID_IMediaControl); //we change the state here - switch(w.state) + switch(m_currentWork.state) { case State_Stopped: mc->Stop(); @@ -301,32 +286,27 @@ namespace Phonon if (SUCCEEDED(hr)) { if (s == State_Stopped) { - emit stateReady(w.graph, Phonon::StoppedState); + emit stateReady(m_currentWork.graph, Phonon::StoppedState); } else if (s == State_Paused) { - emit stateReady(w.graph, Phonon::PausedState); + emit stateReady(m_currentWork.graph, Phonon::PausedState); } else /*if (s == State_Running)*/ { - emit stateReady(w.graph, Phonon::PlayingState); + emit stateReady(m_currentWork.graph, Phonon::PlayingState); } } } { - QMutexLocker locker(&m_currentMutex); - m_currentRender = Graph(); - m_currentRenderId = 0; + QMutexLocker locker(&m_mutex); + m_currentWork = Work(); //reinitialize } } void WorkerThread::abortCurrentRender(qint16 renderId) { - { - QMutexLocker locker(&m_currentMutex); - if (m_currentRender && m_currentRenderId == renderId) { - m_currentRender->Abort(); - } - } - QMutexLocker locker(&m_mutex); + if (m_currentWork.id == renderId) { + m_currentWork.graph->Abort(); + } bool found = false; for(int i = 0; !found && i < m_queue.size(); ++i) { const Work &w = m_queue.at(i); @@ -345,9 +325,9 @@ namespace Phonon { QMutexLocker locker(&m_mutex); m_queue.clear(); - if (m_currentRender) { + if (m_currentWork.graph) { //in case we're currently rendering something - m_currentRender->Abort(); + m_currentWork.graph->Abort(); } @@ -835,9 +815,9 @@ namespace Phonon #endif LPAMGETERRORTEXT getErrorText = (LPAMGETERRORTEXT)QLibrary::resolve(QLatin1String("quartz"), "AMGetErrorTextW"); - ushort buffer[MAX_ERROR_TEXT_LEN]; - if (getErrorText && getErrorText(hr, (WCHAR*)buffer, MAX_ERROR_TEXT_LEN)) { - m_errorString = QString::fromUtf16(buffer); + WCHAR buffer[MAX_ERROR_TEXT_LEN]; + if (getErrorText && getErrorText(hr, buffer, MAX_ERROR_TEXT_LEN)) { + m_errorString = QString::fromWCharArray(buffer); } else { m_errorString = QString::fromLatin1("Unknown error"); } diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h index a6beb5f..34aa666 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.h +++ b/src/3rdparty/phonon/ds9/mediaobject.h @@ -114,6 +114,7 @@ namespace Phonon enum Task { + None, Render, Seek, ChangeState, @@ -122,6 +123,7 @@ namespace Phonon struct Work { + Work() : task(None), id(0), time(0) { } Task task; quint16 id; Graph graph; @@ -137,14 +139,12 @@ namespace Phonon }; void handleTask(); - Graph m_currentRender; - qint16 m_currentRenderId; + Work m_currentWork; QQueue<Work> m_queue; bool m_finished; quint16 m_currentWorkId; QWinWaitCondition m_waitCondition; QMutex m_mutex; // mutex for the m_queue, m_finished and m_currentWorkId - QMutex m_currentMutex; //mutex for current renderer and id //this is for WaitForMultipleObjects struct diff --git a/src/3rdparty/phonon/ds9/qasyncreader.cpp b/src/3rdparty/phonon/ds9/qasyncreader.cpp index 68ec1f8..a3f9cda 100644 --- a/src/3rdparty/phonon/ds9/qasyncreader.cpp +++ b/src/3rdparty/phonon/ds9/qasyncreader.cpp @@ -15,8 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#include <QtCore/QFile> - #include "qasyncreader.h" #include "qbasefilter.h" @@ -80,8 +78,7 @@ namespace Phonon STDMETHODIMP QAsyncReader::Request(IMediaSample *sample,DWORD_PTR user) { - QMutexLocker mutexLocker(&m_mutexWait); - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (m_flushing) { return VFW_E_WRONG_STATE; } @@ -93,33 +90,28 @@ namespace Phonon STDMETHODIMP QAsyncReader::WaitForNext(DWORD timeout, IMediaSample **sample, DWORD_PTR *user) { - QMutexLocker locker(&m_mutexWait); + QMutexLocker locker(&m_mutex); if (!sample ||!user) { return E_POINTER; } + //msdn says to return immediately if we're flushing but that doesn't seem to be true + //since it triggers a dead-lock somewhere inside directshow (see task 258830) + *sample = 0; *user = 0; - AsyncRequest r = getNextRequest(); - - if (r.sample == 0) { - //there is no request in the queue - if (isFlushing()) { + if (m_requestQueue.isEmpty()) { + if (m_requestWait.wait(&m_mutex, timeout) == false) { + return VFW_E_TIMEOUT; + } + if (m_requestQueue.isEmpty()) { return VFW_E_WRONG_STATE; - } else { - //First we need to lock the mutex - if (m_requestWait.wait(&m_mutexWait, timeout) == false) { - return VFW_E_TIMEOUT; - } - if (isFlushing()) { - return VFW_E_WRONG_STATE; - } - - r = getNextRequest(); } } + AsyncRequest r = m_requestQueue.dequeue(); + //at this point we're sure to have a request to proceed if (r.sample == 0) { return E_FAIL; @@ -127,14 +119,12 @@ namespace Phonon *sample = r.sample; *user = r.user; - - return SyncReadAligned(r.sample); + return syncReadAlignedUnlocked(r.sample); } STDMETHODIMP QAsyncReader::BeginFlush() { - QMutexLocker mutexLocker(&m_mutexWait); - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = true; m_requestWait.wakeOne(); return S_OK; @@ -142,13 +132,28 @@ namespace Phonon STDMETHODIMP QAsyncReader::EndFlush() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = false; return S_OK; } STDMETHODIMP QAsyncReader::SyncReadAligned(IMediaSample *sample) { + QMutexLocker locker(&m_mutex); + return syncReadAlignedUnlocked(sample); + } + + STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer) + { + QMutexLocker locker(&m_mutex); + return read(pos, length, buffer, 0); + } + + + STDMETHODIMP QAsyncReader::syncReadAlignedUnlocked(IMediaSample *sample) + { + Q_ASSERT(!m_mutex.tryLock()); + if (!sample) { return E_POINTER; } @@ -175,23 +180,6 @@ namespace Phonon return sample->SetActualDataLength(actual); } - STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer) - { - return read(pos, length, buffer, 0); - } - - - //addition - QAsyncReader::AsyncRequest QAsyncReader::getNextRequest() - { - QWriteLocker locker(&m_lock); - AsyncRequest ret; - if (!m_requestQueue.isEmpty()) { - ret = m_requestQueue.dequeue(); - } - - return ret; - } } } diff --git a/src/3rdparty/phonon/ds9/qasyncreader.h b/src/3rdparty/phonon/ds9/qasyncreader.h index cb789ee..95872f9 100644 --- a/src/3rdparty/phonon/ds9/qasyncreader.h +++ b/src/3rdparty/phonon/ds9/qasyncreader.h @@ -48,11 +48,12 @@ namespace Phonon STDMETHODIMP WaitForNext(DWORD,IMediaSample **,DWORD_PTR *); STDMETHODIMP SyncReadAligned(IMediaSample *); STDMETHODIMP SyncRead(LONGLONG,LONG,BYTE *); - virtual STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0; + STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0; STDMETHODIMP BeginFlush(); STDMETHODIMP EndFlush(); protected: + STDMETHODIMP syncReadAlignedUnlocked(IMediaSample *); virtual HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) = 0; private: @@ -62,9 +63,6 @@ namespace Phonon IMediaSample *sample; DWORD_PTR user; }; - AsyncRequest getNextRequest(); - - QMutex m_mutexWait; QQueue<AsyncRequest> m_requestQueue; QWaitCondition m_requestWait; diff --git a/src/3rdparty/phonon/ds9/qbasefilter.cpp b/src/3rdparty/phonon/ds9/qbasefilter.cpp index c950c41..78b8b8f 100644 --- a/src/3rdparty/phonon/ds9/qbasefilter.cpp +++ b/src/3rdparty/phonon/ds9/qbasefilter.cpp @@ -166,19 +166,19 @@ namespace Phonon const QList<QPin *> QBaseFilter::pins() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_pins; } void QBaseFilter::addPin(QPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_pins.append(pin); } void QBaseFilter::removePin(QPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_pins.removeAll(pin); } @@ -251,35 +251,35 @@ namespace Phonon STDMETHODIMP QBaseFilter::GetClassID(CLSID *clsid) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); *clsid = m_clsid; return S_OK; } STDMETHODIMP QBaseFilter::Stop() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Stopped; return S_OK; } STDMETHODIMP QBaseFilter::Pause() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Paused; return S_OK; } STDMETHODIMP QBaseFilter::Run(REFERENCE_TIME) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Running; return S_OK; } STDMETHODIMP QBaseFilter::GetState(DWORD, FILTER_STATE *state) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!state) { return E_POINTER; } @@ -290,7 +290,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::SetSyncSource(IReferenceClock *clock) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (clock) { clock->AddRef(); } @@ -303,7 +303,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::GetSyncSource(IReferenceClock **clock) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!clock) { return E_POINTER; } @@ -342,7 +342,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::QueryFilterInfo(FILTER_INFO *info ) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!info) { return E_POINTER; } @@ -356,9 +356,9 @@ namespace Phonon STDMETHODIMP QBaseFilter::JoinFilterGraph(IFilterGraph *graph, LPCWSTR name) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_graph = graph; - m_name = QString::fromUtf16((const unsigned short*)name); + m_name = QString::fromWCharArray(name); return S_OK; } diff --git a/src/3rdparty/phonon/ds9/qbasefilter.h b/src/3rdparty/phonon/ds9/qbasefilter.h index 85f1431..a72d6fe 100644 --- a/src/3rdparty/phonon/ds9/qbasefilter.h +++ b/src/3rdparty/phonon/ds9/qbasefilter.h @@ -22,7 +22,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/QString> #include <QtCore/QList> -#include <QtCore/QReadWriteLock> +#include <QtCore/QMutex> #include <dshow.h> @@ -127,7 +127,7 @@ namespace Phonon IFilterGraph *m_graph; FILTER_STATE m_state; QList<QPin *> m_pins; - mutable QReadWriteLock m_lock; + mutable QMutex m_mutex; }; } } diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.cpp b/src/3rdparty/phonon/ds9/qmeminputpin.cpp index 865b8af..a21fbe7 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.cpp +++ b/src/3rdparty/phonon/ds9/qmeminputpin.cpp @@ -28,8 +28,8 @@ namespace Phonon namespace DS9 { - QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) : - QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform) + QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform, QPin *output) : + QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform), m_output(output) { } @@ -66,11 +66,9 @@ namespace Phonon { //this allows to serialize with Receive calls QMutexLocker locker(&m_mutexReceive); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndOfStream(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndOfStream(); } return S_OK; } @@ -78,13 +76,11 @@ namespace Phonon STDMETHODIMP QMemInputPin::BeginFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->BeginFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->BeginFlush(); } - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = true; return S_OK; } @@ -92,22 +88,19 @@ namespace Phonon STDMETHODIMP QMemInputPin::EndFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndFlush(); } - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = false; return S_OK; } STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - for(int i = 0; i < m_outputs.count(); ++i) { - m_outputs.at(i)->NewSegment(start, stop, rate); - } + if (m_output) + m_output->NewSegment(start, stop, rate); return S_OK; } @@ -119,14 +112,9 @@ namespace Phonon if (hr == S_OK && mt->majortype != MEDIATYPE_NULL && mt->subtype != MEDIASUBTYPE_NULL && - mt->formattype != GUID_NULL) { - //we tell the output pins that they should connect with this type - for(int i = 0; i < m_outputs.count(); ++i) { - hr = m_outputs.at(i)->setAcceptedMediaType(connectedType()); - if (FAILED(hr)) { - break; - } - } + mt->formattype != GUID_NULL && m_output) { + //we tell the output pin that it should connect with this type + hr = m_output->setAcceptedMediaType(connectedType()); } return hr; } @@ -152,18 +140,15 @@ namespace Phonon } { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_shouldDuplicateSamples = m_transform && readonly; } setMemoryAllocator(alloc); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *pin = m_outputs.at(i)->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - input->NotifyAllocator(alloc, m_shouldDuplicateSamples); - } + if (m_output) { + ComPointer<IMemInputPin> input(m_output, IID_IMemInputPin); + input->NotifyAllocator(alloc, m_shouldDuplicateSamples); } return S_OK; @@ -202,22 +187,18 @@ namespace Phonon } } - for (int i = 0; i < m_outputs.count(); ++i) { - QPin *current = m_outputs.at(i); + if (m_output) { IMediaSample *outSample = m_shouldDuplicateSamples ? - duplicateSampleForOutput(sample, current->memoryAllocator()) + duplicateSampleForOutput(sample, m_output->memoryAllocator()) : sample; if (m_shouldDuplicateSamples) { m_parent->processSample(outSample); } - IPin *pin = current->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - if (input) { - input->Receive(outSample); - } + ComPointer<IMemInputPin> input(m_output->connected(), IID_IMemInputPin); + if (input) { + input->Receive(outSample); } if (m_shouldDuplicateSamples) { @@ -248,39 +229,16 @@ namespace Phonon STDMETHODIMP QMemInputPin::ReceiveCanBlock() { - //we test the output to see if they can block - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *input = m_outputs.at(i)->connected(); - if (input) { - ComPointer<IMemInputPin> meminput(input, IID_IMemInputPin); - if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { - return S_OK; - } + //we test the output to see if it can block + if (m_output) { + ComPointer<IMemInputPin> meminput(m_output->connected(), IID_IMemInputPin); + if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { + return S_OK; } } return S_FALSE; } - //addition - //this should be used by the filter to tell its input pins to which output they should route the samples - - void QMemInputPin::addOutput(QPin *output) - { - QWriteLocker locker(&m_lock); - m_outputs += output; - } - - void QMemInputPin::removeOutput(QPin *output) - { - QWriteLocker locker(&m_lock); - m_outputs.removeOne(output); - } - - QList<QPin*> QMemInputPin::outputs() const - { - QReadLocker locker(&m_lock); - return m_outputs; - } ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const { diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.h b/src/3rdparty/phonon/ds9/qmeminputpin.h index c449721..d74c451 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.h +++ b/src/3rdparty/phonon/ds9/qmeminputpin.h @@ -37,7 +37,7 @@ namespace Phonon class QMemInputPin : public QPin, public IMemInputPin { public: - QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform); + QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output); ~QMemInputPin(); //reimplementation from IUnknown @@ -60,18 +60,13 @@ namespace Phonon STDMETHODIMP ReceiveMultiple(IMediaSample **,long,long *); STDMETHODIMP ReceiveCanBlock(); - //addition - void addOutput(QPin *output); - void removeOutput(QPin *output); - QList<QPin*> outputs() const; - private: IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *); ALLOCATOR_PROPERTIES getDefaultAllocatorProperties() const; bool m_shouldDuplicateSamples; const bool m_transform; //defines if the pin is transforming the samples - QList<QPin*> m_outputs; + QPin* const m_output; QMutex m_mutexReceive; }; } diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp index d14876b..b4afd10 100644 --- a/src/3rdparty/phonon/ds9/qpin.cpp +++ b/src/3rdparty/phonon/ds9/qpin.cpp @@ -323,7 +323,7 @@ namespace Phonon STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!type) { return E_POINTER; } @@ -338,7 +338,6 @@ namespace Phonon STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info) { - QReadLocker locker(&m_lock); if (!info) { return E_POINTER; } @@ -346,14 +345,12 @@ namespace Phonon info->dir = m_direction; info->pFilter = m_parent; m_parent->AddRef(); - qMemCopy(info->achName, m_name.utf16(), qMin(MAX_FILTER_NAME, m_name.length()+1) *2); - + info->achName[0] = 0; return S_OK; } STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir) { - QReadLocker locker(&m_lock); if (!dir) { return E_POINTER; } @@ -364,20 +361,18 @@ namespace Phonon STDMETHODIMP QPin::QueryId(LPWSTR *id) { - QReadLocker locker(&m_lock); if (!id) { return E_POINTER; } - int nbBytes = (m_name.length()+1)*2; - *id = static_cast<LPWSTR>(::CoTaskMemAlloc(nbBytes)); - qMemCopy(*id, m_name.utf16(), nbBytes); + *id = static_cast<LPWSTR>(::CoTaskMemAlloc(2)); + *id[0] = 0; return S_OK; } STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!type) { return E_POINTER; } @@ -424,7 +419,7 @@ namespace Phonon STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (m_direction == PINDIR_OUTPUT && m_connected) { //we deliver this downstream m_connected->NewSegment(start, stop, rate); @@ -505,7 +500,7 @@ namespace Phonon void QPin::setConnectedType(const AM_MEDIA_TYPE &type) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); //1st we free memory freeMediaType(m_connectedType); @@ -515,13 +510,13 @@ namespace Phonon const AM_MEDIA_TYPE &QPin::connectedType() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_connectedType; } void QPin::setConnected(IPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (pin) { pin->AddRef(); } @@ -533,7 +528,7 @@ namespace Phonon IPin *QPin::connected(bool addref) const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (addref && m_connected) { m_connected->AddRef(); } @@ -542,13 +537,12 @@ namespace Phonon bool QPin::isFlushing() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_flushing; } FILTER_STATE QPin::filterState() const { - QReadLocker locker(&m_lock); FILTER_STATE fstate = State_Stopped; m_parent->GetState(0, &fstate); return fstate; @@ -556,7 +550,7 @@ namespace Phonon QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_mediaTypes; } @@ -592,7 +586,7 @@ namespace Phonon void QPin::setMemoryAllocator(IMemAllocator *alloc) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (alloc) { alloc->AddRef(); } @@ -604,7 +598,7 @@ namespace Phonon IMemAllocator *QPin::memoryAllocator(bool addref) const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (addref && m_memAlloc) { m_memAlloc->AddRef(); } diff --git a/src/3rdparty/phonon/ds9/qpin.h b/src/3rdparty/phonon/ds9/qpin.h index a3287c4..280ad61 100644 --- a/src/3rdparty/phonon/ds9/qpin.h +++ b/src/3rdparty/phonon/ds9/qpin.h @@ -22,7 +22,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/QString> #include <QtCore/QVector> -#include <QtCore/QReadWriteLock> +#include <QtCore/QMutex> #include <dshow.h> @@ -85,8 +85,8 @@ namespace Phonon protected: //this can be used by sub-classes - mutable QReadWriteLock m_lock; - QBaseFilter *m_parent; + mutable QMutex m_mutex; + QBaseFilter * const m_parent; bool m_flushing; private: @@ -98,7 +98,6 @@ namespace Phonon const PIN_DIRECTION m_direction; QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types AM_MEDIA_TYPE m_connectedType; - QString m_name; IMemAllocator *m_memAlloc; }; diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index cf5ce96..82d6235 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -365,7 +365,7 @@ namespace Phonon { public: VideoRendererSoftPin(VideoRendererSoftFilter *parent) : - QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/), + QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/, 0), m_renderer(parent) { } diff --git a/src/3rdparty/phonon/ds9/volumeeffect.cpp b/src/3rdparty/phonon/ds9/volumeeffect.cpp index b9a5fce..a93b074 100644 --- a/src/3rdparty/phonon/ds9/volumeeffect.cpp +++ b/src/3rdparty/phonon/ds9/volumeeffect.cpp @@ -76,7 +76,7 @@ namespace Phonon class VolumeMemInputPin : public QMemInputPin { public: - VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt) : QMemInputPin(parent, mt, true /*transform*/) + VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, QPin *output) : QMemInputPin(parent, mt, true /*transform*/, output) { } @@ -139,8 +139,7 @@ namespace Phonon //then creating the input mt << audioMediaType(); - m_input = new VolumeMemInputPin(this, mt); - m_input->addOutput(m_output); //make the connection here + m_input = new VolumeMemInputPin(this, mt, m_output); } void VolumeEffectFilter::treatOneSamplePerChannel(BYTE **buffer, int sampleSize, int channelCount, int frequency) diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 4b943c2..596d89a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1261,6 +1261,7 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode) #endif , m_needsFullScopeChain(false) , m_usesEval(false) + , m_usesArguments(false) , m_isNumericCompareFunction(false) , m_codeType(NativeCode) , m_source(0) @@ -1283,6 +1284,7 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceP #endif , m_needsFullScopeChain(ownerNode->needsActivation()) , m_usesEval(ownerNode->usesEval()) + , m_usesArguments(ownerNode->usesArguments()) , m_isNumericCompareFunction(false) , m_codeType(codeType) , m_source(sourceProvider) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index b669dfa..8371229 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -763,6 +763,7 @@ void JIT::emit_op_debug(Instruction* currentInstruction) stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.addArgument(Imm32(currentInstruction[2].u.operand)); stubCall.addArgument(Imm32(currentInstruction[3].u.operand)); + stubCall.addArgument(Imm32(currentInstruction[4].u.operand)); stubCall.call(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 40d2182..2563848 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -58,6 +58,10 @@ #include "SamplingTool.h" #include <stdio.h> +#ifdef QT_BUILD_SCRIPT_LIB +#include "bridge/qscriptobject_p.h" +#endif + using namespace std; namespace JSC { @@ -1470,7 +1474,11 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct) structure = asObject(stackFrame.args[3].jsValue())->inheritorID(); else structure = constructor->scope().node()->globalObject()->emptyObjectStructure(); +#ifdef QT_BUILD_SCRIPT_LIB + return new (stackFrame.globalData) QScriptObject(structure); +#else return new (stackFrame.globalData) JSObject(structure); +#endif } DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct) diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/SourcePoolQt.h b/src/3rdparty/webkit/JavaScriptCore/parser/SourcePoolQt.h index baed3ba..da58edb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/SourcePoolQt.h +++ b/src/3rdparty/webkit/JavaScriptCore/parser/SourcePoolQt.h @@ -28,6 +28,8 @@ namespace JSC { + QT_USE_NAMESPACE + class SourceCode; class Debugger; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp index f64219c..fa19932 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp @@ -40,6 +40,7 @@ #include <wtf/MathExtras.h> #include <wtf/Vector.h> #include <wtf/unicode/UTF8.h> +#include <wtf/StringExtras.h> #if HAVE(STRING_H) #include <string.h> diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h index 0a53c50..ab64f52 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h @@ -366,12 +366,13 @@ namespace JSC { } #if PLATFORM(QT) - operator QString() const + operator QT_PREPEND_NAMESPACE(QString)() const { + QT_USE_NAMESPACE; return QString(reinterpret_cast<const QChar*>(this->data()), this->size()); } - UString(const QString& str) + UString(const QT_PREPEND_NAMESPACE(QString)& str) { *this = JSC::UString(reinterpret_cast<const UChar*>(str.constData()), str.length()); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h index 1be7455..d691357 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h @@ -144,7 +144,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #if ASSERT_DISABLED #define ASSERT(assertion) ((void)0) -#if COMPILER(MSVC7) +#if COMPILER(MSVC7) || COMPILER(WINSCW) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) @@ -160,7 +160,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann CRASH(); \ } \ while (0) -#if COMPILER(MSVC7) +#if COMPILER(MSVC7) || COMPILER(WINSCW) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) do \ @@ -203,7 +203,7 @@ while (0) /* FATAL */ -#if FATAL_DISABLED && !COMPILER(MSVC7) +#if FATAL_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) #define FATAL(...) ((void)0) #elif COMPILER(MSVC7) #define FATAL() ((void)0) @@ -216,9 +216,9 @@ while (0) /* LOG_ERROR */ -#if ERROR_DISABLED && !COMPILER(MSVC7) +#if ERROR_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) #define LOG_ERROR(...) ((void)0) -#elif COMPILER(MSVC7) +#elif COMPILER(MSVC7) || COMPILER(WINSCW) #define LOG_ERROR() ((void)0) #else #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) @@ -226,9 +226,9 @@ while (0) /* LOG */ -#if LOG_DISABLED && !COMPILER(MSVC7) +#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) #define LOG(channel, ...) ((void)0) -#elif COMPILER(MSVC7) +#elif COMPILER(MSVC7) || COMPILER(WINSCW) #define LOG() ((void)0) #else #define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) @@ -238,9 +238,9 @@ while (0) /* LOG_VERBOSE */ -#if LOG_DISABLED && !COMPILER(MSVC7) +#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) #define LOG_VERBOSE(channel, ...) ((void)0) -#elif COMPILER(MSVC7) +#elif COMPILER(MSVC7) || COMPILER(WINSCW) #define LOG_VERBOSE(channel) ((void)0) #else #define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index bff770c..e3cb718 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -580,6 +580,7 @@ namespace WTF { }; #if PLATFORM(QT) + QT_USE_NAMESPACE template<typename T> QDataStream& operator<<(QDataStream& stream, const Vector<T>& data) { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp index 7b2d0f2..0ac2717 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp @@ -37,6 +37,8 @@ namespace WTF { +QT_USE_NAMESPACE + class MainThreadInvoker : public QObject { Q_OBJECT public: diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp index 1fdd2bb..5a84764 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp @@ -41,6 +41,8 @@ namespace WTF { +QT_USE_NAMESPACE + class ThreadPrivate : public QThread { public: ThreadPrivate(ThreadFunction entryPoint, void* data); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h index 1531694..65b3e79 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h @@ -108,6 +108,8 @@ typedef uint32_t UChar32; namespace WTF { namespace Unicode { +QT_USE_NAMESPACE + enum Direction { LeftToRight = QChar::DirL, RightToLeft = QChar::DirR, diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index e4c9d42..621c836 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -1535,9 +1535,10 @@ HRESULT WINAPI QAxClientSite::SetBorderSpace(LPCBORDERWIDTHS pborderwidths) HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName) { AX_DEBUG(QAxClientSite::SetActiveObject); - - if (pszObjName && widget) - widget->setWindowTitle(QString::fromWCharArray(pszObjName)); + + Q_UNUSED(pszObjName); + // we are ignoring the name of the object, as suggested by MSDN documentation + // for IOleInPlaceUIWindow::SetActiveObject(). if (m_spInPlaceActiveObject) { if (!inPlaceModelessEnabled) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index efe1fb0..49bd8e9 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -161,7 +161,9 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) -QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), consistentTiming(false) +QUnifiedTimer::QUnifiedTimer() : + QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), + currentAnimationIdx(0), consistentTiming(false) { } @@ -200,18 +202,19 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) } } else if (event->timerId() == animationTimer.timerId()) { const int delta = lastTick - oldLastTick; - for (int i = 0; i < animations.count(); ++i) { - QAbstractAnimation *animation = animations.at(i); + for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { + QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); } + currentAnimationIdx = 0; } } void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation) { - if (animations.contains(animation) ||animationsToStart.contains(animation)) + if (animations.contains(animation) || animationsToStart.contains(animation)) return; animationsToStart << animation; startStopAnimationTimer.start(0, this); // we delay the check if we should start/stop the global timer @@ -219,8 +222,17 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation) void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) { - animations.removeAll(animation); - animationsToStart.removeAll(animation); + Q_ASSERT(animations.count(animation) + animationsToStart.count(animation) <= 1); + + int idx = animations.indexOf(animation); + if (idx != -1) { + animations.removeAt(idx); + // this is needed if we unregister an animation while its running + if (idx <= currentAnimationIdx) + --currentAnimationIdx; + } else { + animationsToStart.removeOne(animation); + } startStopAnimationTimer.start(0, this); // we delay the check if we should start/stop the global timer } @@ -247,28 +259,33 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) } state = newState; - QPointer<QAbstractAnimation> guard(q); + QWeakPointer<QAbstractAnimation> guard(q); - guard->updateState(oldState, newState); + q->updateState(oldState, newState); + if (!guard) + return; //this is to be safe if updateState changes the state if (state == oldState) return; // Notify state change - if (guard) - emit guard->stateChanged(oldState, newState); + emit q->stateChanged(oldState, newState); + if (!guard) + return; - switch (state) - { + switch (state) { case QAbstractAnimation::Paused: case QAbstractAnimation::Running: //this ensures that the value is updated now that the animation is running - if(oldState == QAbstractAnimation::Stopped && guard) - guard->setCurrentTime(currentTime); + if(oldState == QAbstractAnimation::Stopped) { + q->setCurrentTime(currentTime); + if (!guard) + return; + } // Register timer if our parent is not running. - if (state == QAbstractAnimation::Running && guard) { + if (state == QAbstractAnimation::Running) { if (!group || group->state() == QAbstractAnimation::Stopped) { QUnifiedTimer::instance()->registerAnimation(q); } @@ -280,7 +297,10 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) case QAbstractAnimation::Stopped: // Leave running state. int dura = q->duration(); - if (deleteWhenStopped && guard) + if (!guard) + return; + + if (deleteWhenStopped) q->deleteLater(); QUnifiedTimer::instance()->unregisterAnimation(q); @@ -288,8 +308,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) if (dura == -1 || loopCount < 0 || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)) || (oldDirection == QAbstractAnimation::Backward && oldCurrentTime == 0)) { - if (guard) - emit q->finished(); + emit q->finished(); } break; } diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 32189f5..bcd7354 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -141,6 +141,7 @@ private: QTime time; int lastTick; int timingInterval; + int currentAnimationIdx; bool consistentTiming; QList<QAbstractAnimation*> animations, animationsToStart; }; diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 35d65d0..49862d2 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -92,8 +92,6 @@ #include "qanimationgroup.h" #include "qpropertyanimation_p.h" -#include <QtCore/qmath.h> -#include <QtCore/qmutex.h> #include <private/qmutexpool_p.h> #ifndef QT_NO_ANIMATION @@ -102,50 +100,38 @@ QT_BEGIN_NAMESPACE void QPropertyAnimationPrivate::updateMetaProperty() { - if (!target || propertyName.isEmpty()) + if (!target || propertyName.isEmpty()) { + propertyType = QVariant::Invalid; + propertyIndex = -1; return; - - if (!hasMetaProperty && !property.isValid()) { - const QMetaObject *mo = target->metaObject(); - propertyIndex = mo->indexOfProperty(propertyName); - if (propertyIndex != -1) { - hasMetaProperty = true; - property = mo->property(propertyIndex); - propertyType = property.userType(); - } else { - if (!target->dynamicPropertyNames().contains(propertyName)) - qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); - } } - if (property.isValid()) + propertyType = targetValue->property(propertyName).userType(); + propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName); + if (propertyIndex == -1 && !targetValue->dynamicPropertyNames().contains(propertyName)) + qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); + + if (propertyType != QVariant::Invalid) convertValues(propertyType); } void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) { - if (!target || state == QAbstractAnimation::Stopped) + if (state == QAbstractAnimation::Stopped) return; - if (hasMetaProperty) { - if (newValue.userType() == propertyType) { - //no conversion is needed, we directly call the QObject::qt_metacall - void *data = const_cast<void*>(newValue.constData()); - target->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data); - } else { - property.write(target, newValue); - } - } else { - target->setProperty(propertyName.constData(), newValue); + if (!target) { + q_func()->stop(); //the target was destroyed we need to stop the animation + return; } -} -void QPropertyAnimationPrivate::_q_targetDestroyed() -{ - Q_Q(QPropertyAnimation); - //we stop here so that this animation is removed from the global hash - q->stop(); - target = 0; + if (propertyIndex != -1 && newValue.userType() == propertyType) { + //no conversion is needed, we directly call the QObject::qt_metacall + void *data = const_cast<void*>(newValue.constData()); + targetValue->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data); + } else { + targetValue->setProperty(propertyName.constData(), newValue); + } } /*! @@ -187,14 +173,13 @@ QPropertyAnimation::~QPropertyAnimation() */ QObject *QPropertyAnimation::targetObject() const { - Q_D(const QPropertyAnimation); - return d->target; + return d_func()->target.data(); } void QPropertyAnimation::setTargetObject(QObject *target) { Q_D(QPropertyAnimation); - if (d->target == target) + if (d->targetValue == target) return; if (d->state != QAbstractAnimation::Stopped) { @@ -202,15 +187,7 @@ void QPropertyAnimation::setTargetObject(QObject *target) return; } - //we need to get notified when the target is destroyed - if (d->target) - disconnect(d->target, SIGNAL(destroyed()), this, SLOT(_q_targetDestroyed())); - - if (target) - connect(target, SIGNAL(destroyed()), SLOT(_q_targetDestroyed())); - - d->target = target; - d->hasMetaProperty = false; + d->target = d->targetValue = target; d->updateMetaProperty(); } @@ -236,7 +213,6 @@ void QPropertyAnimation::setPropertyName(const QByteArray &propertyName) } d->propertyName = propertyName; - d->hasMetaProperty = false; d->updateMetaProperty(); } @@ -273,7 +249,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, { Q_D(QPropertyAnimation); - if (!d->target) { + if (!d->target && oldState == Stopped) { qWarning("QPropertyAnimation::updateState: Changing state of an animation without target"); return; } @@ -286,14 +262,16 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; static QPropertyAnimationHash hash; - QPropertyAnimationPair key(d->target, d->propertyName); + //here we need to use value because we need to know to which pointer + //the animation was referring in case stopped because the target was destroyed + QPropertyAnimationPair key(d->targetValue, d->propertyName); if (newState == Running) { d->updateMetaProperty(); animToStop = hash.value(key, 0); hash.insert(key, this); // update the default start value if (oldState == Stopped) { - d->setDefaultStartEndValue(d->target->property(d->propertyName.constData())); + d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); //let's check if we have a start value and an end value if (d->direction == Forward && !startValue().isValid() && !d->defaultStartEndValue.isValid()) qWarning("QPropertyAnimation::updateState: starting an animation without start value"); diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h index e12508d..56fb4b1 100644 --- a/src/corelib/animation/qpropertyanimation.h +++ b/src/corelib/animation/qpropertyanimation.h @@ -76,7 +76,6 @@ protected: void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); private: - Q_PRIVATE_SLOT(d_func(), void _q_targetDestroyed()) Q_DISABLE_COPY(QPropertyAnimation) Q_DECLARE_PRIVATE(QPropertyAnimation) }; diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h index ffa6114..3777aa0 100644 --- a/src/corelib/animation/qpropertyanimation_p.h +++ b/src/corelib/animation/qpropertyanimation_p.h @@ -54,7 +54,6 @@ // #include "qpropertyanimation.h" -#include <QtCore/qmetaobject.h> #include "private/qvariantanimation_p.h" @@ -67,20 +66,18 @@ class QPropertyAnimationPrivate : public QVariantAnimationPrivate Q_DECLARE_PUBLIC(QPropertyAnimation) public: QPropertyAnimationPrivate() - : target(0), propertyType(0), propertyIndex(0), hasMetaProperty(false) + : targetValue(0), propertyType(0), propertyIndex(-1) { } - void _q_targetDestroyed(); - - QObject *target; + QWeakPointer<QObject> target; + //we use targetValue to be able to unregister the target from the global hash + QObject *targetValue; //for the QProperty - QMetaProperty property; int propertyType; int propertyIndex; - bool hasMetaProperty; QByteArray propertyName; void updateProperty(const QVariant &); void updateMetaProperty(); diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index ce625f1..da120df 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -78,10 +78,7 @@ public: void setDefaultStartEndValue(const QVariant &value); - int duration; - QEasingCurve easing; - QVariantAnimation::KeyValues keyValues; QVariant currentValue; QVariant defaultStartEndValue; @@ -91,6 +88,9 @@ public: QVariantAnimation::KeyValue start, end; } currentInterval; + QEasingCurve easing; + int duration; + QVariantAnimation::KeyValues keyValues; QVariantAnimation::Interpolator interpolator; void setCurrentValueForProgress(const qreal progress); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index ab9a3ca..97026ad 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -91,7 +91,8 @@ Qt { Q_FLAGS(MatchFlags) Q_FLAGS(KeyboardModifiers MouseButtons) Q_ENUMS(WindowType WindowState WindowModality WidgetAttribute ApplicationAttribute) - Q_FLAGS(WindowFlags WindowStates) + Q_ENUMS(InputMethodHint) + Q_FLAGS(WindowFlags WindowStates InputMethodHints) Q_ENUMS(ConnectionType) #endif // (defined(Q_MOC_RUN) || defined(QT_JAMBI_RUN)) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 657e367..134cbcc 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2445,7 +2445,7 @@ \value ImhNone No hints. \value ImhHiddenText Characters should be hidden, as is typically used when entering passwords. This is automatically set when setting QLineEdit::echoMode to \c Password. - \value ImhNumbersOnly Only number input is allowed. + \value ImhDigitsOnly Only number input is allowed. \value ImhUppercaseOnly Only upper case letter input is allowed. \value ImhLowercaseOnly Only lower case letter input is allowed. \value ImhNoAutoUppercase The input method should not try to automatically switch to upper case @@ -2456,6 +2456,9 @@ \value ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. \value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed. + \omitvalue ImhFormattedNumbersOnly + \omitvalue ImhExclusiveInputMask + \note If several flags ending with \c Only are ORed together, the resulting character set will consist of the union of the specified sets. For instance specifying \c ImhNumbersOnly and \c ImhUppercaseOnly would yield a set consisting of numbers and uppercase letters. diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index a7919d3..ec20e4a 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -46,9 +46,6 @@ #ifndef QT_NO_FSFILEENGINE -#ifndef QT_NO_REGEXP -# include "qregexp.h" -#endif #include "qfile.h" #include "qdir.h" #include "qdatetime.h" @@ -71,7 +68,7 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_SYMBIAN +#if defined(Q_OS_SYMBIAN) /*! \internal @@ -409,7 +406,7 @@ bool QFSFileEngine::copy(const QString &newName) QString oldNative(QDir::toNativeSeparators(d->filePath)); TPtrC oldPtr(qt_QString2TPtrC(oldNative)); QFileInfo fi(newName); - QString absoluteNewName = fi.absolutePath() + QDir::separator() + fi.fileName(); + QString absoluteNewName = fi.absoluteFilePath(); QString newNative(QDir::toNativeSeparators(absoluteNewName)); TPtrC newPtr(qt_QString2TPtrC(newNative)); TRAPD (err, @@ -422,8 +419,10 @@ bool QFSFileEngine::copy(const QString &newName) } ) // End TRAP delete fm; + // ### Add error reporting on failure return (err == KErrNone); #else + Q_UNUSED(newName); // ### Add copy code for Unix here setError(QFile::UnspecifiedError, QLatin1String("Not implemented!")); return false; @@ -457,10 +456,9 @@ bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) con { QString dirName = name; if (createParentDirectories) { -#if defined(Q_OS_SYMBIAN) - dirName = QDir::toNativeSeparators(QDir::cleanPath(dirName)); -#else dirName = QDir::cleanPath(dirName); +#if defined(Q_OS_SYMBIAN) + dirName = QDir::toNativeSeparators(dirName); #endif for(int oldslash = -1, slash=0; slash != -1; oldslash = slash) { slash = dirName.indexOf(QDir::separator(), oldslash+1); @@ -493,10 +491,9 @@ bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) co { QString dirName = name; if (recurseParentDirectories) { -#if defined(Q_OS_SYMBIAN) - dirName = QDir::toNativeSeparators(QDir::cleanPath(dirName)); -#else dirName = QDir::cleanPath(dirName); +#if defined(Q_OS_SYMBIAN) + dirName = QDir::toNativeSeparators(dirName); #endif for(int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) { QByteArray chunk = QFile::encodeName(dirName.left(slash)); @@ -537,12 +534,12 @@ QString QFSFileEngine::currentPath(const QString &) QString result; QT_STATBUF st; #if defined(Q_OS_SYMBIAN) - char currentName[PATH_MAX+1]; - if (::getcwd(currentName, PATH_MAX)) - result = QDir::fromNativeSeparators(QFile::decodeName(QByteArray(currentName))); + char nativeCurrentName[PATH_MAX+1]; + if (::getcwd(nativeCurrentName, PATH_MAX)) + result = QDir::fromNativeSeparators(QFile::decodeName(QByteArray(nativeCurrentName))); if (result.isEmpty()) { # if defined(QT_DEBUG) - qWarning("QDir::currentPath: getcwd() failed"); + qWarning("QFSFileEngine::currentPath: getcwd() failed"); # endif } else #endif @@ -559,7 +556,7 @@ QString QFSFileEngine::currentPath(const QString &) result = QFile::decodeName(QByteArray(currentName)); # if defined(QT_DEBUG) if (result.isNull()) - qWarning("QDir::currentPath: getcwd() failed"); + qWarning("QFSFileEngine::currentPath: getcwd() failed"); # endif #endif } else { @@ -568,10 +565,10 @@ QString QFSFileEngine::currentPath(const QString &) // try to create it (can happen with application private dirs) // Ignore mkdir failures; we want to be consistent with Open C // current path regardless. - ::mkdir(QFile::encodeName(currentName), 0777); + QT_MKDIR(QFile::encodeName(nativeCurrentName), 0777); #else # if defined(QT_DEBUG) - qWarning("QDir::currentPath: stat(\".\") failed"); + qWarning("QFSFileEngine::currentPath: stat(\".\") failed"); # endif #endif } @@ -607,11 +604,14 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { -#ifdef Q_OS_SYMBIAN +#if defined(Q_OS_SYMBIAN) # ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); temp += QLatin1String( "temp/"); + + // Just to verify that folder really exist on hardware + QT_MKDIR(QFile::encodeName(temp), 0777); # else # warning No fallback implementation of QFSFileEngine::tempPath() return QString(); @@ -632,14 +632,16 @@ QFileInfoList QFSFileEngine::drives() RFs rfs = qt_s60GetRFs(); TInt err = rfs.DriveList(driveList); if (err == KErrNone) { + char driveName[] = "A:/"; + for (char i = 0; i < KMaxDrives; i++) { if (driveList[i]) { - ret.append(QString("%1:/").arg(QChar('A' + i))); + driveName[0] = 'A' + i; + ret.append(QFileInfo(QLatin1String(driveName))); } } - } - else { - qWarning("QDir::drives: Getting drives failed"); + } else { + qWarning("QFSFileEngine::drives: Getting drives failed"); } #else ret.append(QFileInfo(rootPath())); @@ -680,22 +682,16 @@ bool QFSFileEnginePrivate::isSymlink() const #if defined(Q_OS_SYMBIAN) static bool _q_isSymbianHidden(const QString &path, bool isDir) { - bool retval = false; RFs rfs = qt_s60GetRFs(); QFileInfo fi(path); QString absPath = fi.absoluteFilePath(); - if (isDir && absPath.at(absPath.size()-1) != QChar('/')) { - absPath += QChar('/'); - } + if (isDir && !absPath.endsWith(QLatin1Char('/'))) + absPath.append(QLatin1Char('/')); QString native(QDir::toNativeSeparators(absPath)); TPtrC ptr(qt_QString2TPtrC(native)); TUint attributes; TInt err = rfs.Att(ptr, attributes); - if (err == KErrNone && (attributes & KEntryAttHidden)) { - retval = true; - } - - return retval; + return (err == KErrNone && (attributes & KEntryAttHidden)); } #endif @@ -805,16 +801,16 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const ret |= ExistsFlag; #if defined(Q_OS_SYMBIAN) if (d->filePath == QLatin1String("/") - || (d->filePath.at(0).isLetter() - && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/"))) + || (d->filePath.length() == 3 && d->filePath.at(0).isLetter() + && d->filePath.at(1) == QLatin1Char(':') && d->filePath.at(2) == QLatin1Char('/'))) { ret |= RootFlag; - - // In Symbian, all symlinks have hidden attribute for some reason; - // lets make them visible for better compatibility with other platforms. - // If somebody actually wants a hidden link, then they are out of luck. - if (!(ret & RootFlag) && !d->isSymlink()) - if(_q_isSymbianHidden(d->filePath, ret & DirectoryType)) - ret |= HiddenFlag; + } else { + // In Symbian, all symlinks have hidden attribute for some reason; + // lets make them visible for better compatibility with other platforms. + // If somebody actually wants a hidden link, then they are out of luck. + if (!d->isSymlink() && _q_isSymbianHidden(d->filePath, ret & DirectoryType)) + ret |= HiddenFlag; + } #else if (d->filePath == QLatin1String("/")) { ret |= RootFlag; @@ -825,7 +821,7 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const # if !defined(QWS) && defined(Q_OS_MAC) || _q_isMacHidden(d->filePath) # endif - ) { + ) { ret |= HiddenFlag; } } @@ -834,12 +830,12 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const return ret; } -#ifdef Q_OS_SYMBIAN -static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFileEngine *engine, - const QFSFileEnginePrivate * const d) +#if defined(Q_OS_SYMBIAN) +QString QFSFileEngine::fileName(FileName file) const { + Q_D(const QFSFileEngine); const QLatin1Char slashChar('/'); - if(file == QAbstractFileEngine::BaseName) { + if(file == BaseName) { int slash = d->filePath.lastIndexOf(slashChar); if(slash == -1) { int colon = d->filePath.lastIndexOf(QLatin1Char(':')); @@ -848,7 +844,7 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile return d->filePath; } return d->filePath.mid(slash + 1); - } else if(file == QAbstractFileEngine::PathName) { + } else if(file == PathName) { if(!d->filePath.size()) return d->filePath; @@ -864,7 +860,7 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile slash++; return d->filePath.left(slash); } - } else if(file == QAbstractFileEngine::AbsoluteName || file == QAbstractFileEngine::AbsolutePathName) { + } else if(file == AbsoluteName || file == AbsolutePathName) { QString ret; if (!isRelativePathSymbian(d->filePath)) { if (d->filePath.size() > 2 && d->filePath.at(1) == QLatin1Char(':') @@ -892,7 +888,7 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile ret[0] = ret.at(0).toUpper(); } - if (file == QAbstractFileEngine::AbsolutePathName) { + if (file == AbsolutePathName) { int slash = ret.lastIndexOf(slashChar); if (slash < 0) return ret; @@ -902,12 +898,12 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile return ret.left(slash > 0 ? slash : 1); } return ret; - } else if(file == QAbstractFileEngine::CanonicalName || file == QAbstractFileEngine::CanonicalPathName) { - if (!(engine->fileFlags(QAbstractFileEngine::ExistsFlag) & QAbstractFileEngine::ExistsFlag)) + } else if(file == CanonicalName || file == CanonicalPathName) { + if (!(fileFlags(ExistsFlag) & ExistsFlag)) return QString(); - QString ret = QFSFileEnginePrivate::canonicalized(symbianFileName(QAbstractFileEngine::AbsoluteName, engine, d)); - if (!ret.isEmpty() && file == QAbstractFileEngine::CanonicalPathName) { + QString ret = QFSFileEnginePrivate::canonicalized(fileName(AbsoluteName)); + if (file == CanonicalPathName && !ret.isEmpty()) { int slash = ret.lastIndexOf(slashChar); if (slash == -1) ret = QDir::fromNativeSeparators(QDir::currentPath()); @@ -916,7 +912,7 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile ret = ret.left(slash); } return ret; - } else if(file == QAbstractFileEngine::LinkName) { + } else if(file == LinkName) { if (d->isSymlink()) { char s[PATH_MAX+1]; int len = readlink(d->nativeFilePath.constData(), s, PATH_MAX); @@ -939,19 +935,17 @@ static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFile } } return QString(); - } else if(file == QAbstractFileEngine::BundleName) { + } else if(file == BundleName) { return QString(); } return d->filePath; } -#endif + +#else QString QFSFileEngine::fileName(FileName file) const { Q_D(const QFSFileEngine); -#ifdef Q_OS_SYMBIAN - return symbianFileName(file, this, d); -#else if (file == BundleName) { #if !defined(QWS) && defined(Q_OS_MAC) QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(d->filePath), @@ -1004,7 +998,7 @@ QString QFSFileEngine::fileName(FileName file) const return QString(); QString ret = QFSFileEnginePrivate::canonicalized(fileName(AbsoluteName)); - if (!ret.isEmpty() && file == CanonicalPathName) { + if (file == CanonicalPathName && !ret.isEmpty()) { int slash = ret.lastIndexOf(QLatin1Char('/')); if (slash == -1) ret = QDir::currentPath(); @@ -1085,19 +1079,16 @@ QString QFSFileEngine::fileName(FileName file) const return QString(); } return d->filePath; -#endif // Q_OS_SYMBIAN } +#endif // Q_OS_SYMBIAN bool QFSFileEngine::isRelativePath() const { Q_D(const QFSFileEngine); -#ifdef Q_OS_SYMBIAN +#if defined(Q_OS_SYMBIAN) return isRelativePathSymbian(d->filePath); #else - int len = d->filePath.length(); - if (len == 0) - return true; - return d->filePath[0] != QLatin1Char('/'); + return d->filePath.length() ? d->filePath[0] != QLatin1Char('/') : true; #endif } @@ -1134,9 +1125,7 @@ QString QFSFileEngine::owner(FileOwner own) const if (pw) return QFile::decodeName(QByteArray(pw->pw_name)); } else if (own == OwnerGroup) { -#ifdef Q_OS_SYMBIAN - return QString(); -#endif +#if !defined(Q_OS_SYMBIAN) struct group *gr = 0; #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); @@ -1154,12 +1143,12 @@ QString QFSFileEngine::owner(FileOwner own) const || errno != ERANGE) break; } - #else gr = getgrgid(ownerId(own)); #endif if (gr) return QFile::decodeName(QByteArray(gr->gr_name)); +#endif } return QString(); } diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index f1f69e7..4e142a9 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -117,7 +117,15 @@ typedef struct _REPARSE_DATA_BUFFER { } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; # define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) -# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 +# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE +# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 +# endif +# ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +# endif +# ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) +# endif #endif QT_BEGIN_NAMESPACE @@ -453,6 +461,9 @@ bool QFSFileEnginePrivate::nativeClose() q->setError(QFile::UnspecifiedError, qt_error_string()); ok = false; } +#ifdef Q_USE_DEPRECATED_MAP_API + fileMapHandle = INVALID_HANDLE_VALUE; +#endif fileHandle = INVALID_HANDLE_VALUE; cachedFd = -1; // gets closed by CloseHandle above @@ -1281,6 +1292,8 @@ static QString readSymLink(const QString &link) qFree(rdb); CloseHandle(handle); } +#else + Q_UNUSED(link); #endif // Q_OS_WINCE return result; } @@ -1922,10 +1935,11 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, #ifndef Q_OS_WINCE if (handle == INVALID_HANDLE_VALUE && fh) handle = (HANDLE)_get_osfhandle(QT_FILENO(fh)); -#else - #ifdef Q_USE_DEPRECATED_MAP_API - nativeClose(); +#endif + +#ifdef Q_USE_DEPRECATED_MAP_API if (fileMapHandle == INVALID_HANDLE_VALUE) { + nativeClose(); fileMapHandle = CreateFileForMapping((const wchar_t*)nativeFilePath.constData(), GENERIC_READ | (openMode & QIODevice::WriteOnly ? GENERIC_WRITE : 0), 0, @@ -1935,11 +1949,13 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, NULL); } handle = fileMapHandle; - #endif - if (handle == INVALID_HANDLE_VALUE && fh) - return 0; #endif + if (handle == INVALID_HANDLE_VALUE) { + q->setError(QFile::UnspecifiedError, QLatin1String("No handle on file")); + return 0; + } + // first create the file mapping handle DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; HANDLE mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 764304d..f4bf5cc 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1646,7 +1646,8 @@ bool QProcess::waitForBytesWritten(int msecs) has been emitted, or until \a msecs milliseconds have passed. Returns true if the process finished; otherwise returns false (if - the operation timed out or if an error occurred). + the operation timed out, if an error occurred, or if this QProcess + is already finished). This function can operate without an event loop. It is useful when writing non-GUI applications and when performing diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 4c19cbf..de483ed 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -223,7 +223,8 @@ QConfFile::QConfFile(const QString &fileName, bool _userPerms) QConfFile::~QConfFile() { - usedHashFunc()->remove(name); + if (usedHashFunc()) + usedHashFunc()->remove(name); } ParsedSettingsMap QConfFile::mergedKeyMap() const @@ -2117,12 +2118,12 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Custom types registered using qRegisterMetaType() and qRegisterMetaTypeStreamOperators() can be stored using QSettings. - \section1 Key Syntax + \section1 Section and Key Syntax Setting keys can contain any Unicode characters. The Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses case-sensitive keys. To - avoid portability problems, follow these two simple rules: + avoid portability problems, follow these simple rules: \list 1 \o Always refer to the same key using the same case. For example, @@ -2133,7 +2134,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, example, if you have a key called "MainWindow", don't try to save another key as "mainwindow". - \o Do not use slashes ('/' and '\\') in key names; the + \o Do not use slashes ('/' and '\\') in section or key names; the backslash character is used to separate sub keys (see below). On windows '\\' are converted by QSettings to '/', which makes them identical. @@ -3198,8 +3199,8 @@ bool QSettings::isWritable() const Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. Example: @@ -3233,8 +3234,8 @@ void QSettings::setValue(const QString &key, const QVariant &value) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. \sa setValue(), value(), contains() */ @@ -3268,8 +3269,8 @@ void QSettings::remove(const QString &key) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. \sa value(), setValue() */ @@ -3330,8 +3331,8 @@ bool QSettings::event(QEvent *event) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. Example: diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3db0564..adfcf5e 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -514,10 +514,6 @@ QTemporaryFile::QTemporaryFile() { Q_D(QTemporaryFile); d->templateName = QDir::tempPath() + QLatin1String("/qt_temp.XXXXXX"); -#ifdef Q_OS_SYMBIAN - //Just to verify that folder really exist on hardware - fileEngine()->mkdir(QDir::tempPath(), true); -#endif } /*! diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 3b7059b..5e8848b 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -599,6 +599,118 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, } } +void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) +{ + Q_Q(QAbstractItemModel); + QVector<QPersistentModelIndexData *> persistent_moved_explicitly; + QVector<QPersistentModelIndexData *> persistent_moved_in_source; + QVector<QPersistentModelIndexData *> persistent_moved_in_destination; + + QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it; + const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator begin = persistent.indexes.constBegin(); + const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator end = persistent.indexes.constEnd(); + + const bool sameParent = (srcParent == destinationParent); + const bool movingUp = (srcFirst > destinationChild); + + for ( it = begin; it != end; ++it) { + QPersistentModelIndexData *data = *it; + const QModelIndex &index = data->index; + const QModelIndex &parent = index.parent(); + const bool isSourceIndex = (parent == srcParent); + const bool isDestinationIndex = (parent == destinationParent); + + int childPosition; + if (orientation == Qt::Vertical) + childPosition = index.row(); + else + childPosition = index.column(); + + if (!index.isValid() || !(isSourceIndex || isDestinationIndex ) ) + continue; + + if (!sameParent && isDestinationIndex) { + if (childPosition >= destinationChild) + persistent_moved_in_destination.append(data); + continue; + } + + if (sameParent && movingUp && childPosition < destinationChild) + continue; + + if (sameParent && !movingUp && childPosition < srcFirst ) + continue; + + if (!sameParent && childPosition < srcFirst) + continue; + + if (sameParent && (childPosition > srcLast) && (childPosition >= destinationChild )) + continue; + + if ((childPosition <= srcLast) && (childPosition >= srcFirst)) { + persistent_moved_explicitly.append(data); + } else { + persistent_moved_in_source.append(data); + } + } + persistent.moved.push(persistent_moved_explicitly); + persistent.moved.push(persistent_moved_in_source); + persistent.moved.push(persistent_moved_in_destination); +} + +/*! + \internal + + Moves persistent indexes \a indexes by amount \a change. The change will be either a change in row value or a change in + column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent + differs from the existing parent for the index. +*/ +void QAbstractItemModelPrivate::movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation) +{ + QVector<QPersistentModelIndexData *>::const_iterator it; + const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin(); + const QVector<QPersistentModelIndexData *>::const_iterator end = indexes.constEnd(); + + for (it = begin; it != end; ++it) + { + QPersistentModelIndexData *data = *it; + + int row = data->index.row(); + int column = data->index.column(); + + if (Qt::Vertical == orientation) + row += change; + else + column += change; + + persistent.indexes.erase(persistent.indexes.find(data->index)); + data->index = q_func()->index(row, column, parent); + if (data->index.isValid()) { + persistent.insertMultiAtEnd(data->index, data); + } else { + qWarning() << "QAbstractItemModel::endMoveRows: Invalid index (" << row << "," << column << ") in model" << q_func(); + } + } +} + +void QAbstractItemModelPrivate::itemsMoved(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) +{ + QVector<QPersistentModelIndexData *> moved_in_destination = persistent.moved.pop(); + QVector<QPersistentModelIndexData *> moved_in_source = persistent.moved.pop(); + QVector<QPersistentModelIndexData *> moved_explicitly = persistent.moved.pop(); + + const bool sameParent = (sourceParent == destinationParent); + const bool movingUp = (sourceFirst > destinationChild); + + const int explicit_change = (!sameParent || movingUp) ? destinationChild - sourceFirst : destinationChild - sourceLast - 1 ; + const int source_change = (!sameParent || !movingUp) ? -1*(sourceLast - sourceFirst + 1) : sourceLast - sourceFirst + 1 ; + const int destination_change = sourceLast - sourceFirst + 1; + + movePersistentIndexes(moved_explicitly, explicit_change, destinationParent, orientation); + movePersistentIndexes(moved_in_source, source_change, sourceParent, orientation); + movePersistentIndexes(moved_in_destination, destination_change, destinationParent, orientation); +} + void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last) { @@ -1227,7 +1339,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \endlist - \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), reset(), + \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(), changePersistentIndex() */ @@ -1370,6 +1482,70 @@ QAbstractItemModel::~QAbstractItemModel() */ /*! + \fn void QAbstractItemModel::rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + \since 4.6 + + This signal is emitted after rows have been moved within the + model. The items between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item have been moved to \a destinationParent + starting at the row \a destinationRow. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! + \fn void QAbstractItemModel::rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + \since 4.6 + + This signal is emitted just before rows are moved within the + model. The items that will be moved are those between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent + starting at the row \a destinationRow. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! + \fn void QAbstractItemModel::columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) + \since 4.6 + + This signal is emitted after columns have been moved within the + model. The items between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item have been moved to \a destinationParent + starting at the column \a destinationColumn. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! + \fn void QAbstractItemModel::columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) + \since 4.6 + + This signal is emitted just before columns are moved within the + model. The items that will be moved are those between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent + starting at the column \a destinationColumn. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! \fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int start, int end) This signal is emitted after columns have been inserted into the model. The @@ -2284,6 +2460,116 @@ void QAbstractItemModel::endRemoveRows() } /*! + Returns whether a move operation is valid. + + A move operation is not allowed if it moves a continuous range of rows to a destination within + itself, or if it attempts to move a row to one of its own descendants. + + \internal +*/ +bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation) +{ + Q_Q(QAbstractItemModel); + // Don't move the range within itself. + if ( ( destinationParent == srcParent ) + && ( destinationStart >= start ) + && ( destinationStart <= end + 1) ) + return false; + + QModelIndex destinationAncestor = destinationParent; + int pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); + forever { + if (destinationAncestor == srcParent) { + if (pos >= start && pos <= end) + return false; + break; + } + + if (!destinationAncestor.isValid()) + break; + + pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); + destinationAncestor = destinationAncestor.parent(); + } + + return true; +} + +/*! + Begins a row move operation. + + When reimplementing a subclass, this method simplifies moving entities + in your model. This method is responsible for moving persistent indexes + in the model, which you would otherwise be required to do yourself. + + Using beginMoveRows and endMoveRows is an alternative to emitting + layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. + layoutAboutToBeChanged is emitted by this method for compatibility reasons. + + The \a sourceParent index corresponds to the parent from which the + rows are moved; \a sourceFirst and \a sourceLast are the row numbers of the + rows to be moved. The \a destinationParent index corresponds to the parent into which + the rows are moved. The \a destinationRow is the row to which the rows will be moved. + That is, the index at row \a sourceFirst in \a sourceParent will become row \a destinationRow + in \a destinationParent. Its siblings will be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the same, in which case you must + ensure that the \a destinationRow is not within the range of \a sourceFirst and \a sourceLast. + You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. + This method returns false if either condition is true, in which case you should abort your move operation. + + \sa endMoveRows() + + \since 4.6 +*/ +bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceFirst >= 0); + Q_ASSERT(sourceLast >= sourceFirst); + Q_ASSERT(destinationChild >= 0); + Q_D(QAbstractItemModel); + + if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical)) { + return false; + } + + d->changes.push(QAbstractItemModelPrivate::Change(sourceParent, sourceFirst, sourceLast)); + int destinationLast = destinationChild + (sourceLast - sourceFirst); + d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast)); + + d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical); + emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); + emit layoutAboutToBeChanged(); + return true; +} + +/*! + Ends a row move operation. + + When implementing a subclass, you must call this + function \e after moving data within the model's underlying data + store. + + layoutChanged is emitted by this method for compatibility reasons. + + \sa beginMoveRows() + + \since 4.6 +*/ +void QAbstractItemModel::endMoveRows() +{ + Q_D(QAbstractItemModel); + + QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); + QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); + + d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical); + + emit rowsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first); + emit layoutChanged(); +} + +/*! Begins a column insertion operation. When reimplementing insertColumns() in a subclass, you must call this @@ -2406,9 +2692,101 @@ void QAbstractItemModel::endRemoveColumns() } /*! + Begins a column move operation. + + When reimplementing a subclass, this method simplifies moving entities + in your model. This method is responsible for moving persistent indexes + in the model, which you would otherwise be required to do yourself. + + Using beginMoveColumns and endMoveColumns is an alternative to emitting + layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. + layoutAboutToBeChanged is emitted by this method for compatibility reasons. + + The \a sourceParent index corresponds to the parent from which the + columns are moved; \a sourceFirst and \a sourceLast are the column numbers of the + columns to be moved. The \a destinationParent index corresponds to the parent into which + the columns are moved. The \a destinationColumn is the column to which the columns will be moved. + That is, the index at column \a sourceFirst in \a sourceParent will become column \a destinationColumn + in \a destinationParent. Its siblings will be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the same, in which case you must + ensure that the \a destinationColumn is not within the range of \a sourceFirst and \a sourceLast. + You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. + This method returns false if either condition is true, in which case you should abort your move operation. + + \sa endMoveColumns() + + \since 4.6 +*/ +bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceFirst >= 0); + Q_ASSERT(sourceLast >= sourceFirst); + Q_ASSERT(destinationChild >= 0); + Q_D(QAbstractItemModel); + + if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal)) { + return false; + } + + d->changes.push(QAbstractItemModelPrivate::Change(sourceParent, sourceFirst, sourceLast)); + int destinationLast = destinationChild + (sourceLast - sourceFirst); + d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast)); + + d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal); + + emit columnsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); + emit layoutAboutToBeChanged(); + return true; +} + +/*! + Ends a column move operation. + + When implementing a subclass, you must call this + function \e after moving data within the model's underlying data + store. + + layoutChanged is emitted by this method for compatibility reasons. + + \sa beginMoveColumns() + + \since 4.6 +*/ +void QAbstractItemModel::endMoveColumns() +{ + Q_D(QAbstractItemModel); + + QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); + QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); + + d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal); + + emit columnsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first); + emit layoutChanged(); +} + +/*! Resets the model to its original state in any attached views. - The view to which the model is attached to will be reset as well. + \note Use beginResetModel() and endResetModel() instead whenever possible. + Use this method only if there is no way to call beginResetModel() before invalidating the model. + Otherwise it could lead to unexcpected behaviour, especially when used with proxy models. +*/ +void QAbstractItemModel::reset() +{ + Q_D(QAbstractItemModel); + emit modelAboutToBeReset(); + d->invalidatePersistentIndexes(); + emit modelReset(); +} + +/*! + Begins a model reset operation. + + A reset operation resets the model to its current state in any attached views. + + \note Any views attached to this model will be reset as well. When a model is reset it means that any previous data reported from the model is now invalid and has to be queried for again. This also means that @@ -2418,12 +2796,29 @@ void QAbstractItemModel::endRemoveColumns() call this function rather than emit dataChanged() to inform other components when the underlying data source, or its structure, has changed. - \sa modelAboutToBeReset(), modelReset() + You must call this function before resetting any internal data structures in your model + or proxy model. + + \sa modelAboutToBeReset(), modelReset(), endResetModel() + \since 4.6 */ -void QAbstractItemModel::reset() +void QAbstractItemModel::beginResetModel() { - Q_D(QAbstractItemModel); emit modelAboutToBeReset(); +} + +/*! + Completes a model reset operation. + + You must call this function after resetting any internal data structure in your model + or proxy model. + + \sa beginResetModel() + \since 4.6 +*/ +void QAbstractItemModel::endResetModel() +{ + Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); emit modelReset(); } @@ -2895,7 +3290,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti This signal is emitted when reset() is called, before the model's internal state (e.g. persistent model indexes) has been invalidated. - \sa reset(), modelReset() + \sa beginResetModel(), modelReset() */ /*! @@ -2905,7 +3300,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti This signal is emitted when reset() is called, after the model's internal state (e.g. persistent model indexes) has been invalidated. - \sa reset(), modelAboutToBeReset() + \sa endResetModel(), modelAboutToBeReset() */ /*! diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index 00f6cb2..1ca6cbe 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -252,6 +252,13 @@ private: // can only be emitted by QAbstractItemModel void modelAboutToBeReset(); void modelReset(); + void rowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow ); + void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row ); + + void columnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn ); + void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column ); + + public Q_SLOTS: virtual bool submit(); virtual void revert(); @@ -272,14 +279,23 @@ protected: void beginRemoveRows(const QModelIndex &parent, int first, int last); void endRemoveRows(); + bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow); + void endMoveRows(); + void beginInsertColumns(const QModelIndex &parent, int first, int last); void endInsertColumns(); void beginRemoveColumns(const QModelIndex &parent, int first, int last); void endRemoveColumns(); + bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn); + void endMoveColumns(); + void reset(); + void beginResetModel(); + void endResetModel(); + void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to); QModelIndexList persistentIndexList() const; diff --git a/src/corelib/kernel/qabstractitemmodel_p.h b/src/corelib/kernel/qabstractitemmodel_p.h index e81e627..aae3cba 100644 --- a/src/corelib/kernel/qabstractitemmodel_p.h +++ b/src/corelib/kernel/qabstractitemmodel_p.h @@ -80,6 +80,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate public: QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {} void removePersistentIndexData(QPersistentModelIndexData *data); + void movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); void rowsInserted(const QModelIndex &parent, int first, int last); void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); @@ -91,6 +92,10 @@ public: static QAbstractItemModel *staticEmptyModel(); static bool variantLessThan(const QVariant &v1, const QVariant &v2); + void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation); + void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + inline QModelIndex createIndex(int row, int column, void *data = 0) const { return q_func()->createIndex(row, column, data); } @@ -132,6 +137,8 @@ public: Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l) {} QModelIndex parent; int first, last; + + bool isValid() { return first >= 0 && last >= 0; } }; QStack<Change> changes; diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 6d3616f..a7f71a7 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -145,6 +145,9 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); Q_CORE_EXPORT RFs& qt_s60GetRFs(); +// Defined in qlocale_symbian.cpp. +Q_CORE_EXPORT QByteArray qt_symbianLocaleName(int code); + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6d88d92..183809e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -393,43 +393,61 @@ QString qAppName() application's initialization and finalization, as well as system-wide and application-wide settings. - The command line arguments which QCoreApplication's constructor - should be called with are accessible using arguments(). The - event loop is started with a call to exec(). Long running + \section1 The Event Loop and Event Handling + + The event loop is started with a call to exec(). Long running operations can call processEvents() to keep the application responsive. Some Qt classes, such as QString, can be used without a QCoreApplication object. However, in general, we recommend that you create a QCoreApplication or a QApplication object in your \c - main() function as early as possible. The application will enter - the event loop when exec() is called. exit() will not return - until the event loop exits, e.g., when quit() is called. + main() function as early as possible. exit() will not return + until the event loop exits; e.g., when quit() is called. + + Several static convenience functions are also provided. The + QCoreApplication object is available from instance(). Events can + be sent or posted using sendEvent(), postEvent(), and + sendPostedEvents(). Pending events can be removed with + removePostedEvents() or flushed with flush(). + + The class provides a quit() slot and an aboutToQuit() signal. + + \section1 Application and Library Paths An application has an applicationDirPath() and an - applicationFilePath(). Translation files can be added or removed + applicationFilePath(). Library paths (see QLibrary) can be retrieved + with libraryPaths() and manipulated by setLibraryPaths(), addLibraryPath(), + and removeLibraryPath(). + + \section1 Internationalization and Translations + + Translation files can be added or removed using installTranslator() and removeTranslator(). Application strings can be translated using translate(). The QObject::tr() and QObject::trUtf8() functions are implemented in terms of translate(). - The class provides a quit() slot and an aboutToQuit() signal. + \section1 Accessing Command Line Arguments - Several static convenience functions are also provided. The - QCoreApplication object is available from instance(). Events can - be sent or posted using sendEvent(), postEvent(), and - sendPostedEvents(). Pending events can be removed with - removePostedEvents() or flushed with flush(). Library paths (see - QLibrary) can be retrieved with libraryPaths() and manipulated by - setLibraryPaths(), addLibraryPath(), and removeLibraryPath(). - - On Unix/Linux Qt is configured to use the system local settings by - default. This can cause a conflict when using POSIX functions, for - instance, when converting between data types such as floats and - strings, since the notation may differ between locales. To get - around this problem call the POSIX function setlocale(LC_NUMERIC,"C") - right after initializing QApplication or QCoreApplication to reset - the locale that is used for number formatting to "C"-locale. + The command line arguments which are passed to QCoreApplication's + constructor should be accessed using the arguments() function. + Note that some arguments supplied by the user may have been + processed and removed by QCoreApplication. + + In cases where command line arguments need to be obtained using the + argv() function, you must convert them from the local string encoding + using QString::fromLocal8Bit(). + + \section1 Locale Settings + + On Unix/Linux Qt is configured to use the system locale settings by + default. This can cause a conflict when using POSIX functions, for + instance, when converting between data types such as floats and + strings, since the notation may differ between locales. To get + around this problem, call the POSIX function \c{setlocale(LC_NUMERIC,"C")} + right after initializing QApplication or QCoreApplication to reset + the locale that is used for number formatting to "C"-locale. \sa QApplication, QAbstractEventDispatcher, QEventLoop, {Semaphores Example}, {Wait Conditions Example} @@ -1975,9 +1993,9 @@ char **QCoreApplication::argv() \warning On Unix, this list is built from the argc and argv parameters passed to the constructor in the main() function. The string-data in argv is interpreted using QString::fromLocal8Bit(); hence it is not possible to - pass i.e. Japanese command line arguments on a system that runs in a latin1 - locale. Most modern Unix systems do not have this limitation, as they are - Unicode based. + pass, for example, Japanese command line arguments on a system that runs in a + Latin1 locale. Most modern Unix systems do not have this limitation, as they are + Unicode-based. On NT-based Windows, this limitation does not apply either. On Windows, the arguments() are not built from the contents of argv/argc, as diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index babb89d..75af3e7 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -324,6 +324,7 @@ private: friend class QGraphicsView; friend class QGraphicsViewPrivate; friend class QGraphicsScenePrivate; + friend class QGraphicsWidget; }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 881e546..daeb0e1 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -238,7 +238,6 @@ void QTimerActiveObject::Run() if (m_timerInfo->interval > 0) { // Start a new timer immediately so that we don't lose time. - iStatus = KRequestPending; SetActive(); m_rTimer.After(iStatus, m_timerInfo->interval*1000); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 040efc9..1f35c73 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1089,10 +1089,9 @@ QObjectPrivate::Connection::~Connection() \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 4 - (\l QLayoutItem is not a QObject.) - - Consider using qobject_cast<Type *>(object) instead. The method - is both faster and safer. + If you need to determine whether an object is an instance of a particular + class for the purpose of casting it, consider using qobject_cast<Type *>(object) + instead. \sa metaObject(), qobject_cast() */ @@ -2459,7 +2458,7 @@ QObject *QObject::sender() const { Q_D(const QObject); - QMutexLocker(signalSlotLock(this)); + QMutexLocker locker(signalSlotLock(this)); if (!d->currentSender) return 0; @@ -2981,12 +2980,16 @@ void QObject::disconnectNotify(const char *) bool QMetaObject::connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type, int *types) { - const QMetaObject *mo = sender->metaObject(); - while (mo && mo->methodOffset() > signal_index) - mo = mo->superClass(); - int signalOffset, methodOffset; - computeOffsets(mo, &signalOffset, &methodOffset); - signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; + if (signal_index > 0) { + const QMetaObject *mo = sender->metaObject(); + while (mo && mo->methodOffset() > signal_index) + mo = mo->superClass(); + if (mo) { + int signalOffset, methodOffset; + computeOffsets(mo, &signalOffset, &methodOffset); + signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; + } + } return QMetaObjectPrivate::connect(sender, signal_index, receiver, method_index, type, types); } @@ -3059,12 +3062,16 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, bool QMetaObject::disconnect(const QObject *sender, int signal_index, const QObject *receiver, int method_index) { - const QMetaObject *mo = sender->metaObject(); - while (mo && mo->methodOffset() > signal_index) - mo = mo->superClass(); - int signalOffset, methodOffset; - computeOffsets(mo, &signalOffset, &methodOffset); - signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; + if (signal_index > 0) { + const QMetaObject *mo = sender->metaObject(); + while (mo && mo->methodOffset() > signal_index) + mo = mo->superClass(); + if (mo) { + int signalOffset, methodOffset; + computeOffsets(mo, &signalOffset, &methodOffset); + signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; + } + } return QMetaObjectPrivate::disconnect(sender, signal_index, receiver, method_index); } diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 5cf6513..51b3a50 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -436,7 +436,8 @@ Q_GLOBAL_STATIC(LibraryData, libraryData) static LibraryMap *libraryMap() { - return &(libraryData()->libraryMap); + LibraryData *data = libraryData(); + return data ? &data->libraryMap : 0; } QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version) diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h index 328be16..33e4474 100644 --- a/src/corelib/statemachine/qabstracttransition_p.h +++ b/src/corelib/statemachine/qabstracttransition_p.h @@ -75,7 +75,7 @@ public: static QAbstractTransitionPrivate *get(QAbstractTransition *q); bool callEventTest(QEvent *e); - void callOnTransition(QEvent *e); + virtual void callOnTransition(QEvent *e); QState *sourceState() const; QStateMachine *machine() const; void emitTriggered(); diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h index 7e5d888..de166f4 100644 --- a/src/corelib/statemachine/qsignalevent.h +++ b/src/corelib/statemachine/qsignalevent.h @@ -70,6 +70,8 @@ private: QObject *m_sender; int m_signalIndex; QList<QVariant> m_arguments; + + friend class QSignalTransitionPrivate; }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index e34448f..fb28c08 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -245,6 +245,23 @@ bool QSignalTransition::event(QEvent *e) return QAbstractTransition::event(e); } +void QSignalTransitionPrivate::callOnTransition(QEvent *e) +{ + Q_Q(QSignalTransition); + + QSignalEvent *se = static_cast<QSignalEvent *>(e); + int savedSignalIndex; + if (e->type() == QEvent::Signal) { + savedSignalIndex = se->m_signalIndex; + se->m_signalIndex = originalSignalIndex; + } + + q->onTransition(e); + + if (e->type() == QEvent::Signal) + se->m_signalIndex = savedSignalIndex; +} + QT_END_NAMESPACE #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h index 21082ab..69bbcc9 100644 --- a/src/corelib/statemachine/qsignaltransition_p.h +++ b/src/corelib/statemachine/qsignaltransition_p.h @@ -69,9 +69,12 @@ public: void unregister(); void maybeRegister(); + virtual void callOnTransition(QEvent *e); + QObject *sender; QByteArray signal; int signalIndex; + int originalSignalIndex; }; QT_END_NAMESPACE diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index d6946de..e5bca2c 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1408,6 +1408,7 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio signal.remove(0, 1); const QMetaObject *meta = sender->metaObject(); int signalIndex = meta->indexOfSignal(signal); + int originalSignalIndex = signalIndex; if (signalIndex == -1) { signalIndex = meta->indexOfSignal(QMetaObject::normalizedSignature(signal)); if (signalIndex == -1) { @@ -1416,6 +1417,11 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio return; } } + // The signal index we actually want to connect to is the one + // that is going to be sent, i.e. the non-cloned original index. + while (meta->method(signalIndex).attributes() & QMetaMethod::Cloned) + --signalIndex; + QVector<int> &connectedSignalIndexes = connections[sender]; if (connectedSignalIndexes.size() <= signalIndex) connectedSignalIndexes.resize(signalIndex+1); @@ -1435,6 +1441,7 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio } ++connectedSignalIndexes[signalIndex]; QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex; + QSignalTransitionPrivate::get(transition)->originalSignalIndex = originalSignalIndex; #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": added signal transition from" << transition->sourceState() << ": ( sender =" << sender << ", signal =" << signal diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index d954160..1335c30 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -98,12 +98,45 @@ QListData::Data *QListData::detach() * * \internal */ +#if QT_VERSION >= 0x050000 +# error "Remove QListData::detach2(), it is only required for binary compatibility for 4.3.x to 4.5.x" +#endif QListData::Data *QListData::detach2() { Data *x = d; Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + x->alloc * sizeof(void *))); Q_CHECK_PTR(t); + ::memcpy(t, d, DataHeaderSize + d->alloc * sizeof(void *)); + + t->ref = 1; + t->sharable = true; + t->alloc = x->alloc; + if (!t->alloc) { + t->begin = 0; + t->end = 0; + } else { + t->begin = x->begin; + t->end = x->end; + } + d = t; + + return x; +} + +/*! + * Detaches the QListData by reallocating new memory. + * Returns the old (shared) data, it is up to the caller to deref() and free() + * For the new data node_copy needs to be called. + * + * \internal + */ +QListData::Data *QListData::detach3() +{ + Data *x = d; + Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + x->alloc * sizeof(void *))); + Q_CHECK_PTR(t); + t->ref = 1; t->sharable = true; t->alloc = x->alloc; @@ -150,6 +183,9 @@ void **QListData::append() } // ensures that enough space is available to append the list +#if QT_VERSION >= 0x050000 +# error "Remove QListData::append(), it is only required for binary compatibility up to 4.5.x" +#endif void **QListData::append(const QListData& l) { Q_ASSERT(d->ref == 1); @@ -158,6 +194,21 @@ void **QListData::append(const QListData& l) if (n) { if (e + n > d->alloc) realloc(grow(e + l.d->end - l.d->begin)); + ::memcpy(d->array + d->end, l.d->array + l.d->begin, n*sizeof(void*)); + d->end += n; + } + return d->array + e; +} + +// ensures that enough space is available to append the list +void **QListData::append2(const QListData& l) +{ + Q_ASSERT(d->ref == 1); + int e = d->end; + int n = l.d->end - l.d->begin; + if (n) { + if (e + n > d->alloc) + realloc(grow(e + l.d->end - l.d->begin)); d->end += n; } return d->array + e; diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index ab6f7bd..331f448 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -72,13 +72,15 @@ struct Q_CORE_EXPORT QListData { enum { DataHeaderSize = sizeof(Data) - sizeof(void *) }; Data *detach(); // remove in 5.0 - Data *detach2(); + Data *detach2(); // remove in 5.0 + Data *detach3(); void realloc(int alloc); static Data shared_null; Data *d; void **erase(void **xi); void **append(); void **append(const QListData &l); + void **append2(const QListData &l); // remove in 5.0 void **prepend(); void **insert(int i); void remove(int i); @@ -593,7 +595,7 @@ template <typename T> Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper() { Node *n = reinterpret_cast<Node *>(p.begin()); - QListData::Data *x = p.detach2(); + QListData::Data *x = p.detach3(); QT_TRY { node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n); } QT_CATCH(...) { @@ -693,7 +695,7 @@ template <typename T> Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l) { detach(); - Node *n = reinterpret_cast<Node *>(p.append(l.p)); + Node *n = reinterpret_cast<Node *>(p.append2(l.p)); QT_TRY{ node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin())); } QT_CATCH(...) { diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index a534560..3103ba1 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -156,7 +156,7 @@ static const symbianToISO symbian_to_iso_list[] = { /*! Returns ISO name corresponding to the Symbian locale code \a sys_fmt. */ -static QByteArray symbianLocaleName(int code) +QByteArray qt_symbianLocaleName(int code) { //Number of Symbian to ISO locale mappings static const int symbian_to_iso_count @@ -797,7 +797,7 @@ QLocale QSystemLocale::fallbackLocale() const } TLanguage lang = User::Language(); - QString locale = symbianLocaleName(lang); + QString locale = qt_symbianLocaleName(lang); return QLocale(locale); } @@ -853,7 +853,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case LanguageId: case CountryId: { TLanguage language = User::Language(); - QString locale = symbianLocaleName(language); + QString locale = qt_symbianLocaleName(language); QLocale::Language lang; QLocale::Country cntry; getLangAndCountry(locale, lang, cntry); diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index e913232..9f8e05c 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -93,6 +93,9 @@ void QMapData::continueFreeData(int offset) could be several pointers to this node on different levels. \a offset is an amount of bytes that needs to reserved just before the QMapData::Node structure. + + \internal + \since 4.6 */ QMapData::Node *QMapData::node_create(Node *update[], int offset) { @@ -128,7 +131,6 @@ QMapData::Node *QMapData::node_create(Node *update[], int offset) update[i]->forward[i] = abstractNode; update[i] = abstractNode; } - // update[level+1]=reinterpret_cast<Node *>(this); ++size; return abstractNode; } @@ -191,7 +193,7 @@ void QMapData::dump() update[i] = node->forward[i]; } for (int j = level + 1; j <= topLevel; ++j) - output[j] += QString("---------------"); + output[j] += QLatin1String("---------------"); node = node->forward[0]; } diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 7a3ee14..f801366 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -166,6 +166,11 @@ public: return oldD; } + inline void swap(QScopedPointer<T, Cleanup> &other) + { + qSwap(d, other.d); + } + typedef T *pointer; protected: @@ -175,6 +180,10 @@ private: Q_DISABLE_COPY(QScopedPointer) }; +template <class T, class Cleanup> +Q_INLINE_TEMPLATE void qSwap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) +{ p1.swap(p2); } + template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > class QScopedArrayPointer : public QScopedPointer<T, Cleanup> { diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index a93a638..9be57c5 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -44,6 +44,12 @@ #include <QtCore/qstring.h> +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) +# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) +# include <QtCore/qmap.h> +# endif +#endif + #include <string.h> QT_BEGIN_HEADER diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index 356b14c..ca0147a 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "qdbus_symbols_p.h" #include <QtCore/qglobal.h> #include <QtCore/qlibrary.h> #include <QtCore/qmutex.h> @@ -53,7 +52,7 @@ void *qdbus_resolve_me(const char *name); static QLibrary *qdbus_libdbus = 0; -static void qdbus_unloadLibDBus() +void qdbus_unloadLibDBus() { delete qdbus_libdbus; qdbus_libdbus = 0; @@ -77,11 +76,8 @@ bool qdbus_loadLibDBus() lib->setFileName(QLatin1String("dbus-1")); for (uint i = 0; i < sizeof(majorversions) / sizeof(majorversions[0]); ++i) { lib->setFileNameAndVersion(lib->fileName(), majorversions[i]); - if (lib->load() && lib->resolve("dbus_connection_open_private")) { - struct Unloader { ~Unloader() { qdbus_unloadLibDBus(); } }; - static Unloader unloader; + if (lib->load() && lib->resolve("dbus_connection_open_private")) return true; - } lib->unload(); } @@ -111,6 +107,8 @@ void *qdbus_resolve_me(const char *name) return ptr; } +Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus) + QT_END_NAMESPACE #endif diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm index 502827c..41a2566 100644 --- a/src/gui/accessible/qaccessible_mac_cocoa.mm +++ b/src/gui/accessible/qaccessible_mac_cocoa.mm @@ -59,9 +59,9 @@ QT_BEGIN_NAMESPACE //#define MAC_ACCESSIBILTY_DEVELOPER_MODE #ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE -#define MAC_ACCESSIBILTY_DEBUG qDebug +#define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug) #else -#define MAC_ACCESSIBILTY_DEBUG if (0) qDebug +#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug) #endif typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap; @@ -195,13 +195,13 @@ QT_END_NAMESPACE - (BOOL)accessibilityIsIgnored { - QAInterface interface = interfaceForView(self); + QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self); return isInterfaceIgnored(interface); } - (NSArray *)accessibilityAttributeNames { - QAInterface interface = interfaceForView(self); + QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self); static NSArray *attributes = nil; if (attributes == nil) { @@ -213,9 +213,10 @@ QT_END_NAMESPACE - (id)accessibilityAttributeValue:(NSString *)attribute { - MAC_ACCESSIBILTY_DEBUG() << "accessibilityAttributeValue" << self << QCFString::toQString(reinterpret_cast<CFStringRef>(attribute)); + MAC_ACCESSIBILTY_DEBUG() << "accessibilityAttributeValue" << self << + QT_PREPEND_NAMESPACE(QCFString)::toQString(reinterpret_cast<CFStringRef>(attribute)); - QAInterface interface = interfaceForView(self); + QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self); // Switch on the attribute name and call the appropriate handler function. // Pass the call on to the NSView class for attributes we don't handle. diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 2c46ae4..bdf0909 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -381,16 +381,12 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) { - if (!pathElements.at(0).contains(QLatin1String(":"))) -#if defined(Q_CC_NOKIAX86) - { - // Workaround for bizarre compiler crash. + if (!pathElements.at(0).contains(QLatin1String(":"))) { + // The reason we express it like this instead of with anonymous, temporary + // variables, is to workaround a compiler crash with Q_CC_NOKIAX86. QString rootPath = QDir(longPath).rootPath(); pathElements.prepend(rootPath); } -#else - pathElements.prepend(QDir(longPath).rootPath()); -#endif if (pathElements.at(0).endsWith(QLatin1Char('/'))) pathElements[0].chop(1); } diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/gui/dialogs/qfscompleter_p.h index 2e5a674..fde7706 100644 --- a/src/gui/dialogs/qfscompleter_p.h +++ b/src/gui/dialogs/qfscompleter_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QCOMPLETOR_P_H -#define QCOMPLETOR_P_H +#ifndef QFSCOMPLETOR_P_H +#define QFSCOMPLETOR_P_H // // W A R N I N G @@ -78,5 +78,5 @@ public: }; #endif // QT_NO_COMPLETER QT_END_NAMESPACE -#endif // QCOMPLETOR_P_H +#endif // QFSCOMPLETOR_P_H diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 949922a..5f64698 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,62 +34,69 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \class QGraphicsEffect - \brief The QGraphicsEffect class is the base class for all graphics effects. + \brief The QGraphicsEffect class is the base class for all graphics + effects. \since 4.6 \ingroup multimedia \ingroup graphicsview-api Effects alter the appearance of elements by hooking into the rendering - pipeline and operating between the source (e.g., a QGraphicsPixmapItem), + pipeline and operating between the source (e.g., a QGraphicsPixmapItem) and the destination device (e.g., QGraphicsView's viewport). Effects can be - disabled by calling setEnabled(); if the effect is disabled, the source is - rendered directly. + disabled by calling setEnabled(false). If effects are disabled, the source + is rendered directly. - If you want to add a visual effect to a QGraphicsItem, you can either use - one of the standard effects, or create your own effect by making a subclass - of QGraphicsEffect. + To add a visual effect to a QGraphicsItem, for example, you can use one of + the standard effects, or alternately, create your own effect by creating a + subclass of QGraphicsEffect. The effect can then be installed on the item + using QGraphicsItem::setGraphicsEffect(). - Qt provides several standard effects, including: + Qt provides the following standard effects: \list - \o QGraphicsGrayScaleEffect - renders the item in shades of gray - \o QGraphicsColorizeEffect - renders the item in shades of any given color - \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size \o QGraphicsBlurEffect - blurs the item by a given radius \o QGraphicsDropShadowEffect - renders a dropshadow behind the item + \o QGraphicsColorizeEffect - renders the item in shades of any given color + \o QGraphicsOpacityEffect - renders the item with an opacity + \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size + \o QGraphicsGrayscaleEffect - renders the item in shades of gray + \o QGraphicsShaderEffect - renders the item with a pixel shader fragment \endlist - If all you want is to add an effect to an item, you should visit the - documentation for the specific effect to learn more about how each effect - can be used. - - If you want to create your own custom effect, you can start by creating a - subclass of QGraphicsEffect (or any of the existing effects), and - reimplement the virtual function draw(). This function is called whenever - the effect needs to redraw. draw() has two arguments: the painter, and a - pointer to the source (QGraphicsEffectSource). The source provides extra - context information, such as a pointer to the item that is rendering the - effect, any cached pixmap data, and the device rect bounds. See the draw() - documentation for more details. You can also get a pointer to the current - source by calling source(). - - If your effect changes, you can call update() to request a redraw. If your - custom effect changes the bounding rectangle of the source (e.g., a radial - glow effect may need to apply an extra margin), you can reimplement the + \img graphicseffect-effects.png + \img graphicseffect-widget.png + + For more information on how to use each effect, refer to the specific + effect's documentation. + + To create your own custom effect, create a subclass of QGraphicsEffect (or + any other existing effects) and reimplement the virtual function draw(). + This function is called whenever the effect needs to redraw. The draw() + function accepts two arguments: the painter and a pointer to the source + (QGraphicsEffectSource). The source provides extra context information, + such as a pointer to the item that is rendering the effect, any cached + pixmap data, or the device rectangle bounds. For more information, refer to + the documenation for draw(). To obtain a pointer to the current source, + simply call source(). + + If your effect changes, use update() to request for a redraw. If your + custom effect changes the bounding rectangle of the source, e.g., a radial + glow effect may need to apply an extra margin, you can reimplement the virtual boundingRectFor() function, and call updateBoundingRect() to notify the framework whenever this rectangle changes. The virtual sourceBoundingRectChanged() function is called to notify the effects that - the source's bounding rectangle has changed (e.g., if the source is a - QGraphicsRectItem, then if the rectangle parameters have changed). + the source's bounding rectangle has changed - e.g., if the source is a + QGraphicsRectItem and its rectangle parameters have changed. - \sa QGraphicsItem::setGraphicsEffect() + \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect(), + QGraphicsEffectSource */ #include "qgraphicseffect_p.h" @@ -101,53 +108,148 @@ QT_BEGIN_NAMESPACE +/*! + \class QGraphicsEffectSource + \brief The QGraphicsEffectSource class represents the source on which a + QGraphicsEffect is installed on. + \since 4.6 + + When a QGraphicsEffect is installed on a QGraphicsItem, for example, this + class will act as a wrapper around QGraphicsItem. Then, calling update() is + effectively the same as calling QGraphicsItem::update(). + + QGraphicsEffectSource also provides a pixmap() function which creates a + pixmap with the source painted into it. + + \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect(). +*/ + +/*! + \internal +*/ QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent) : QObject(dd, parent) {} +/*! + Destroys the effect source. +*/ QGraphicsEffectSource::~QGraphicsEffectSource() {} +/*! + Returns the bounds of the current painter's device. + + This function is useful when you want to draw something in device + coordinates and ensure the size of the pixmap is not bigger than the size + of the device. + + Calling QGraphicsEffectSource::pixmap(Qt::DeviceCoordinates) always returns + a pixmap which is bound to the device's size. + + \sa pixmap() +*/ QRect QGraphicsEffectSource::deviceRect() const { return d_func()->deviceRect(); } +/*! + Returns the bounding rectangle of the source mapped to the given \a system. + + \sa draw() +*/ QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const { return d_func()->boundingRect(system); } +/*! + Returns a pointer to the item if this source is a QGraphicsItem; otherwise + returns 0. + + \sa widget() +*/ const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const { return d_func()->graphicsItem(); } +/*! + Returns a pointer to the widget if this source is a QWidget; otherwise + returns 0. + + \sa graphicsItem() +*/ const QWidget *QGraphicsEffectSource::widget() const { return d_func()->widget(); } +/*! + Returns a pointer to the style options (used when drawing the source) if + available; otherwise returns 0. + + \sa graphicsItem(), widget() +*/ const QStyleOption *QGraphicsEffectSource::styleOption() const { return d_func()->styleOption(); } +/*! + Draws the source using the given \a painter. + + This function should only be called from QGraphicsEffect::draw(). + + For example: + + \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 0 + + \sa QGraphicsEffect::draw() +*/ void QGraphicsEffectSource::draw(QPainter *painter) { d_func()->draw(painter); } +/*! + Schedules a redraw of the source. Call this function whenever the source + needs to be redrawn. + + \sa QGraphicsEffect::updateBoundingRect(), QWidget::update(), + QGraphicsItem::update(), +*/ void QGraphicsEffectSource::update() { d_func()->update(); } +/*! + Returns true if the source effectively is a pixmap, e.g., a + QGraphicsPixmapItem. + + This function is useful for optimization purposes. For instance, there's no + point in drawing the source in device coordinates to avoid pixmap scaling + if this function returns true - the source pixmap will be scaled anyways. +*/ bool QGraphicsEffectSource::isPixmap() const { return d_func()->isPixmap(); } +/*! + Returns a pixmap with the source painted into it. + + The \a system specifies which coordinate system to be used for the source. + The optional \a offset parameter returns the offset where the pixmap should + be painted at using the current painter. + + The returned pixmap is bound to the current painter's device rectangle when + \a system is Qt::DeviceCoordinates. + + \sa QGraphicsEffect::draw(), boundingRect(), deviceRect() +*/ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset) const { return d_func()->pixmap(system, offset); @@ -179,9 +281,9 @@ QGraphicsEffect::~QGraphicsEffect() } /*! - Returns the bounding rectangle for this effect (i.e., the bounding + Returns the bounding rectangle for this effect, i.e., the bounding rectangle of the source, adjusted by any margins applied by the effect - itself). + itself. \sa boundingRectFor(), updateBoundingRect() */ @@ -211,11 +313,13 @@ QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const \brief whether the effect is enabled or not. If an effect is disabled, the source will be rendered with as normal, with - no interference from the effect. If the effect is enabled (default), the - source will be rendered with the effect applied. + no interference from the effect. If the effect is enabled, the source will + be rendered with the effect applied. - This property is provided so that you can disable certain effects on slow - platforms, in order to ensure that the user interface is responsive. + This property is enabled by default. + + Using this property, you can disable certain effects on slow platforms, in + order to ensure that the user interface is responsive. */ bool QGraphicsEffect::isEnabled() const { @@ -236,6 +340,15 @@ void QGraphicsEffect::setEnabled(bool enable) } /*! + \fn void QGraphicsEffect::enabledChanged(bool enabled) + + This signal is emitted whenever the effect is enabled or disabled. + The \a enabled parameter holds the effects's new enabled state. + + \sa isEnabled() +*/ + +/*! Returns a pointer to the source, which provides extra context information that can be useful for the effect. @@ -248,7 +361,7 @@ QGraphicsEffectSource *QGraphicsEffect::source() const } /*! - This function notifies the effect framework that the effect's bounding + This function notifies the effect framework when the effect's bounding rectangle has changed. As a custom effect author, you must call this function whenever you change any parameters that will cause the virtual boundingRectFor() function to return a different value. @@ -263,6 +376,39 @@ void QGraphicsEffect::updateBoundingRect() } /*! + \fn virtual void QGraphicsEffect::draw(QPainter *painter, + QGraphicsEffectSource *source) = 0 + + This pure virtual function draws the effect and is called whenever the + source() needs to be drawn. + + Reimplement this function in a QGraphicsEffect subclass to provide the + effect's drawing implementation, using \a painter. The \a source parameter + is provided for convenience; its value is the same as source(). + + For example: + + \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 1 + + This function should not be called explicitly by the user, since it is + meant for reimplementation purposes only. + + \sa QGraphicsEffectSource +*/ + +/*! + \enum QGraphicsEffect::ChangeFlag + + This enum describes what has changed in QGraphicsEffectSource. + + \value SourceAttached The effect is installed on a source. + \value SourceDetached The effect is uninstalled on a source. + \value SourceBoundingRectChanged The bounding rect of the source has + changed. + \value SourceInvalidated The visual appearance of the source has changed. +*/ + +/*! This virtual function is called by QGraphicsEffect to notify the effect that the source has changed. If the effect applies any cache, then this cache must be purged in order to reflect the new appearance of the source. @@ -274,15 +420,38 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags) Q_UNUSED(flags); } +/*! + \class QGraphicsGrayscaleEffect + \brief The QGraphicsGrayscaleEffect class provides a grayscale effect. + \since 4.6 + + A grayscale effect renders the source in shades of gray. + + \img graphicseffect-grayscale.png + + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect +*/ + +/*! + Constructs a new QGraphicsGrayscale instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsGrayscaleEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect() { } +/*! + \reimp +*/ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsGrayscaleEffect); @@ -303,31 +472,70 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so } +/*! + \class QGraphicsColorizeEffect + \brief The QGraphicsColorizeEffect class provides a colorize effect. + \since 4.6 + + A colorize effect renders the source with a tint of its color(). The color + can be modified using the setColor() function. + + By default, the color is light blue (QColor(0, 0, 192)). + + \img graphicseffect-colorize.png + + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsGrayscaleEffect, QGraphicsOpacityEffect +*/ + +/*! + Constructs a new QGraphicsColorizeEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsColorizeEffect::~QGraphicsColorizeEffect() { } +/*! + \property QGraphicsColorizeEffect::color + \brief the color of the effect. + + By default, the color is light blue (QColor(0, 0, 192)). +*/; QColor QGraphicsColorizeEffect::color() const { Q_D(const QGraphicsColorizeEffect); return d->filter->color(); } -void QGraphicsColorizeEffect::setColor(const QColor &c) +void QGraphicsColorizeEffect::setColor(const QColor &color) { Q_D(QGraphicsColorizeEffect); - if (d->filter->color() == c) + if (d->filter->color() == color) return; - d->filter->setColor(c); - emit colorChanged(c); + d->filter->setColor(color); + emit colorChanged(color); } +/*! + \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color) + + This signal is emitted whenever the effect's color changes. + The \a color parameter holds the effect's new color. +*/ + +/*! + \reimp +*/ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsColorizeEffect); @@ -347,15 +555,48 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou painter->setWorldTransform(restoreTransform); } +/*! + \class QGraphicsPixelizeEffect + \brief The QGraphicsPixelizeEffect class provides a pixelize effect. + \since 4.6 + + A pixelize effect renders the source in lower resolution. This effect is + useful for reducing details, like censorship. The resolution can be + modified using the setPixelSize() function. + + By default, the pixel size is 3. + + \img graphicseffect-pixelize.png + + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect +*/ + +/*! + Constructs a new QGraphicsPixelizeEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsPixelizeEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect() { } +/*! + \property QGraphicsPixelizeEffect::pixelSize + \brief the size of a pixel in the effect. + + Setting the pixel size to 2 means two pixels in the source will be used to + represent one pixel. Using a bigger size results in lower resolution. + + By default, the pixel size is 3. +*/ int QGraphicsPixelizeEffect::pixelSize() const { Q_D(const QGraphicsPixelizeEffect); @@ -372,6 +613,13 @@ void QGraphicsPixelizeEffect::setPixelSize(int size) emit pixelSizeChanged(size); } +/*! + \fn void QGraphicsPixelizeEffect::pixelSizeChanged(int size) + + This signal is emitted whenever the effect's pixel size changes. + The \a size parameter holds the effect's new pixel size. +*/ + static inline void pixelize(QImage *image, int pixelSize) { Q_ASSERT(pixelSize > 0); @@ -393,6 +641,9 @@ static inline void pixelize(QImage *image, int pixelSize) } } +/*! + \reimp +*/ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsPixelizeEffect); @@ -423,15 +674,49 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou painter->setWorldTransform(restoreTransform); } +/*! + \class QGraphicsBlurEffect + \brief The QGraphicsBlurEffect class provides a blur effect. + \since 4.6 + + A blur effect blurs the source. This effect is useful for reducing details, + such as when the source loses focus and you want to draw attention to other + elements. The level of detail can be modified using the setBlurRadius() + function. + + By default, the blur radius is 5 pixels. + + \img graphicseffect-blur.png + + \sa QGraphicsDropShadowEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect +*/ + +/*! + Constructs a new QGraphicsBlurEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsBlurEffect::~QGraphicsBlurEffect() { } +/*! + \property QGraphicsBlurEffect::blurRadius + \brief the blur radius of the effect. + + Using a smaller radius results in a sharper appearance, whereas a bigger + radius results in a more blurred appearance. + + By default, the blur radius is 5 pixels. +*/ int QGraphicsBlurEffect::blurRadius() const { Q_D(const QGraphicsBlurEffect); @@ -449,12 +734,25 @@ void QGraphicsBlurEffect::setBlurRadius(int radius) emit blurRadiusChanged(radius); } +/*! + \fn void QGraphicsBlurEffect::blurRadiusChanged(int radius) + + This signal is emitted whenever the effect's blur radius changes. + The \a radius parameter holds the effect's new blur radius. +*/ + +/*! + \reimp +*/ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const { Q_D(const QGraphicsBlurEffect); return d->filter->boundingRectFor(rect); } +/*! + \reimp +*/ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsBlurEffect); @@ -479,32 +777,86 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) painter->setWorldTransform(restoreTransform); } +/*! + \class QGraphicsDropShadowEffect + \brief The QGraphicsDropShadowEffect class provides a drop shadow effect. + \since 4.6 + + A drop shadow effect renders the source with a drop shadow. The color of + the drop shadow can be modified using the setColor() function. The drop + shadow offset can be modified using the setOffset() function and the blur + radius of the drop shadow can be changed with the setBlurRadius() + function. + + By default, the drop shadow is a semi-transparent dark gray + (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset + of 8 pixels towards the lower right. + + \img graphicseffect-drop-shadow.png + + \sa QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect +*/ + +/*! + Constructs a new QGraphicsDropShadowEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect() { } +/*! + \property QGraphicsDropShadowEffect::offset + \brief the shadow offset in pixels. + + By default, the offset is 8 pixels towards the lower right. + + \sa blurRadius(), color() +*/ QPointF QGraphicsDropShadowEffect::offset() const { Q_D(const QGraphicsDropShadowEffect); return d->filter->offset(); } -void QGraphicsDropShadowEffect::setOffset(const QPointF &ofs) +void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) { Q_D(QGraphicsDropShadowEffect); - if (d->filter->offset() == ofs) + if (d->filter->offset() == offset) return; - d->filter->setOffset(ofs); + d->filter->setOffset(offset); updateBoundingRect(); - emit offsetChanged(ofs); + emit offsetChanged(offset); } +/*! + \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset) + + This signal is emitted whenever the effect's shadow offset changes. + The \a offset parameter holds the effect's new shadow offset. +*/ + +/*! + \property QGraphicsDropShadowEffect::blurRadius + \brief the blur radius in pixels of the drop shadow. + + Using a smaller radius results in a sharper shadow, whereas using a bigger + radius results in a more blurred shadow. + + By default, the blur radius is 1 pixel. + + \sa color(), offset(). +*/ int QGraphicsDropShadowEffect::blurRadius() const { Q_D(const QGraphicsDropShadowEffect); @@ -522,6 +874,22 @@ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius) emit blurRadiusChanged(blurRadius); } +/*! + \fn void QGraphicsDropShadowEffect::blurRadiusChanged(int blurRadius) + + This signal is emitted whenever the effect's blur radius changes. + The \a blurRadius parameter holds the effect's new blur radius. +*/ + +/*! + \property QGraphicsDropShadowEffect::color + \brief the color of the drop shadow. + + By default, the drop color is a semi-transparent dark gray + (QColor(63, 63, 63, 180)). + + \sa offset(), blurRadius() +*/ QColor QGraphicsDropShadowEffect::color() const { Q_D(const QGraphicsDropShadowEffect); @@ -538,12 +906,25 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color) emit colorChanged(color); } +/*! + \fn void QGraphicsDropShadowEffect::colorChanged(const QColor &color) + + This signal is emitted whenever the effect's color changes. + The \a color parameter holds the effect's new color. +*/ + +/*! + \reimp +*/ QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const { Q_D(const QGraphicsDropShadowEffect); return d->filter->boundingRectFor(rect); } +/*! + \reimp +*/ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsDropShadowEffect); @@ -568,5 +949,107 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s painter->setWorldTransform(restoreTransform); } +/*! + \class QGraphicsOpacityEffect + \brief The QGraphicsOpacityEffect class provides an opacity effect. + \since 4.6 + + An opacity effect renders the source with an opacity. This effect is useful + for making the source semi-transparent, similar to a fade-in/fade-out + sequence. The opacity can be modified using the setOpacity() function. + + By default, the opacity is 0.7. + + \img graphicseffect-opacity.png + + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsGrayscaleEffect, QGraphicsColorizeEffect +*/ + +/*! + Constructs a new QGraphicsOpacityEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ +QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent) + : QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent) +{ +} + +/*! + Destroys the effect. +*/ +QGraphicsOpacityEffect::~QGraphicsOpacityEffect() +{ +} + +/*! + \property QGraphicsOpacityEffect::opacity + \brief the opacity of the effect. + + The value should be in the range of 0.0 to 1.0, where 0.0 is + fully transparent and 1.0 is fully opaque. + + By default, the opacity is 0.7. +*/ +qreal QGraphicsOpacityEffect::opacity() const +{ + Q_D(const QGraphicsOpacityEffect); + return d->opacity; +} + +void QGraphicsOpacityEffect::setOpacity(qreal opacity) +{ + Q_D(QGraphicsOpacityEffect); + opacity = qBound(qreal(0.0), opacity, qreal(1.0)); + + if (qFuzzyCompare(d->opacity, opacity)) + return; + + d->opacity = opacity; + emit opacityChanged(opacity); +} + +/*! + \fn void QGraphicsOpacityEffect::opacityChanged(qreal opacity) + + This signal is emitted whenever the effect's opacity changes. + The \a opacity parameter holds the effect's new opacity. +*/ + +/*! + \reimp +*/ +void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +{ + Q_D(QGraphicsOpacityEffect); + + // Transparent; nothing to draw. + if (qFuzzyIsNull(d->opacity)) + return; + + // Opaque; draw directly without going through a pixmap. + if (qFuzzyIsNull(d->opacity - 1)) { + source->draw(painter); + return; + } + + painter->save(); + painter->setOpacity(d->opacity); + + QPoint offset; + if (source->isPixmap()) { + // No point in drawing in device coordinates (pixmap will be scaled anyways). + const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + painter->drawPixmap(offset, pixmap); + } else { + // Draw pixmap in device coordinates to avoid pixmap scaling; + const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + } + + painter->restore(); +} + QT_END_NAMESPACE diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index d4dba4c..fef6531 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -137,7 +137,7 @@ private: friend class QWidget; friend class QWidgetPrivate; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags); +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) class QGraphicsGrayscaleEffectPrivate; class Q_GUI_EXPORT QGraphicsGrayscaleEffect: public QGraphicsEffect @@ -269,6 +269,31 @@ private: Q_DISABLE_COPY(QGraphicsDropShadowEffect) }; +class QGraphicsOpacityEffectPrivate; +class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect +{ + Q_OBJECT + Q_PROPERTY(int opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) +public: + QGraphicsOpacityEffect(QObject *parent = 0); + ~QGraphicsOpacityEffect(); + + qreal opacity() const; + +public Q_SLOTS: + void setOpacity(qreal opacity); + +Q_SIGNALS: + void opacityChanged(qreal opacity); + +protected: + void draw(QPainter *painter, QGraphicsEffectSource *source); + +private: + Q_DECLARE_PRIVATE(QGraphicsOpacityEffect) + Q_DISABLE_COPY(QGraphicsOpacityEffect) +}; + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 35f2d40..6ce5cda 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -160,6 +160,16 @@ public: QPixmapDropShadowFilter *filter; }; +class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate +{ + Q_DECLARE_PUBLIC(QGraphicsOpacityEffect) +public: + QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)) {} + ~QGraphicsOpacityEffectPrivate() {} + + qreal opacity; +}; + QT_END_NAMESPACE #endif // QGRAPHICSEFFECT_P_H diff --git a/src/gui/embedded/qkbd_defaultmap_qws_p.h b/src/gui/embedded/qkbd_defaultmap_qws_p.h index 2903492..a6c2d25 100644 --- a/src/gui/embedded/qkbd_defaultmap_qws_p.h +++ b/src/gui/embedded/qkbd_defaultmap_qws_p.h @@ -53,6 +53,8 @@ // We mean it. // +// no QT_BEGIN_NAMESPACE, since we include it internally... + const QWSKeyboard::Mapping QWSKbPrivate::s_keymap_default[] = { { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 }, { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 }, diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h index df7ce1b..5af8f7c 100644 --- a/src/gui/embedded/qkbd_qws_p.h +++ b/src/gui/embedded/qkbd_qws_p.h @@ -55,6 +55,8 @@ #include <QDataStream> +QT_BEGIN_NAMESPACE + namespace QWSKeyboard { const quint32 FileMagic = 0x514d4150; // 'QMAP' @@ -127,4 +129,6 @@ inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c) } #endif // QT_NO_DATASTREAM +QT_END_NAMESPACE + #endif // QWSKEYBOARD_H diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp index 4f0b9de..6e147dd 100644 --- a/src/gui/embedded/qkbdqnx_qws.cpp +++ b/src/gui/embedded/qkbdqnx_qws.cpp @@ -49,6 +49,9 @@ #include "qplatformdefs.h" #include <errno.h> + +QT_BEGIN_NAMESPACE + /*! \class QWSQnxKeyboardHandler \preliminary @@ -229,3 +232,5 @@ void QWSQnxKeyboardHandler::socketActivated() // (on QNX, isPress is not set when the key event is repeated). processKeyEvent(unicode, key, modifiers, isPress || isRepeat, isRepeat); } + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index c32e9b5..9f2d3b8 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -41,10 +41,11 @@ #include "qlock_p.h" -QT_BEGIN_NAMESPACE #ifdef QT_NO_QWS_MULTIPROCESS +QT_BEGIN_NAMESPACE + /* no multiprocess - use a dummy */ QLock::QLock(const QString & /*filename*/, char /*id*/, bool /*create*/) @@ -77,6 +78,8 @@ bool QLock::locked() const return data; } +QT_END_NAMESPACE + #else // QT_NO_QWS_MULTIPROCESS #include "qwssignalhandler_p.h" @@ -110,6 +113,9 @@ union semun { #include <private/qcore_unix_p.h> // overrides QT_OPEN + +QT_BEGIN_NAMESPACE + #define MAX_LOCKS 200 // maximum simultaneous read locks class QLockData @@ -324,6 +330,7 @@ bool QLock::locked() const return (data->count > 0); } +QT_END_NAMESPACE + #endif // QT_NO_QWS_MULTIPROCESS -QT_END_NAMESPACE diff --git a/src/gui/embedded/qmousetslib_qws.h b/src/gui/embedded/qmousetslib_qws.h index 4dd39b5..71672f0 100644 --- a/src/gui/embedded/qmousetslib_qws.h +++ b/src/gui/embedded/qmousetslib_qws.h @@ -73,8 +73,8 @@ protected: }; -QT_END_NAMESPACE #endif // QT_NO_QWS_MOUSE_TSLIB +QT_END_NAMESPACE QT_END_HEADER #endif // QMOUSETSLIB_QWS_H diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index 275e83f..307c2fd 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -50,6 +50,8 @@ #include <QtGui/qimage.h> #include <QtGui/qregion.h> +struct fb_cmap; + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -169,8 +171,6 @@ private: #endif // QT_NO_QWS_CURSOR -struct fb_cmap; - // A (used) chunk of offscreen memory class QPoolEntry diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 69e5808..1679ef2 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -291,8 +291,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); } - fb_fix_screeninfo finfo; - fb_var_screeninfo vinfo; + ::fb_fix_screeninfo finfo; + ::fb_var_screeninfo vinfo; //####################### // Shut up Valgrind memset(&vinfo, 0, sizeof(vinfo)); @@ -429,7 +429,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; int loopc; - fb_cmap startcmap; + ::fb_cmap startcmap; startcmap.start=0; startcmap.len=screencols; startcmap.red=(unsigned short int *) diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h index eb47848..e3c712a 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.h +++ b/src/gui/embedded/qscreenlinuxfb_qws.h @@ -44,6 +44,11 @@ #include <QtGui/qscreen_qws.h> +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -70,9 +75,6 @@ public: }; -struct fb_cmap; -struct fb_var_screeninfo; -struct fb_fix_screeninfo; class QLinuxFbScreenPrivate; class Q_GUI_EXPORT QLinuxFbScreen : public QScreen diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp index b566dc0..b87fdd1 100644 --- a/src/gui/embedded/qscreenproxy_qws.cpp +++ b/src/gui/embedded/qscreenproxy_qws.cpp @@ -45,6 +45,7 @@ #include <qregexp.h> +QT_BEGIN_NAMESPACE #ifndef QT_NO_QWS_CURSOR /*! @@ -629,4 +630,6 @@ QRegion QProxyScreen::region() const return QScreen::region(); } +QT_END_NAMESPACE + #endif // QT_NO_QWS_PROXYSCREEN diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp index 70f6d6b..77fe13e 100644 --- a/src/gui/embedded/qscreenqnx_qws.cpp +++ b/src/gui/embedded/qscreenqnx_qws.cpp @@ -44,6 +44,8 @@ #include <gf/gf.h> +QT_BEGIN_NAMESPACE + // This struct holds all the pointers to QNX's internals struct QQnxScreenContext { @@ -445,3 +447,4 @@ void QQnxScreen::exposeRegion(QRegion r, int changing) gf_draw_end(d->context); } +QT_END_NAMESPACE diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp index 2f5f39a..811943a 100644 --- a/src/gui/embedded/qsoundqss_qws.cpp +++ b/src/gui/embedded/qsoundqss_qws.cpp @@ -67,10 +67,10 @@ #include <qdebug.h> -QT_BEGIN_NAMESPACE - extern int errno; +QT_BEGIN_NAMESPACE + #define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0 #define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0 diff --git a/src/gui/embedded/qwsutils_qws.h b/src/gui/embedded/qwsutils_qws.h index 23e0104..fe959ef 100644 --- a/src/gui/embedded/qwsutils_qws.h +++ b/src/gui/embedded/qwsutils_qws.h @@ -44,6 +44,12 @@ #include <QtCore/QIODevice> +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + #ifndef QT_NO_SXE #define QWS_SOCK_BASE QUnixSocket #define QWS_SOCK_SERVER_BASE QUnixSocketServer @@ -58,12 +64,6 @@ class QTcpServer; class QWSSocket; class QWSServerSocket; -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - /******************************************************************** * * Convenient socket functions diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h index 7130003..895ee0c 100644 --- a/src/gui/graphicsview/qgraph_p.h +++ b/src/gui/graphicsview/qgraph_p.h @@ -1,3 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPH_P_H +#define QGRAPH_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QHash> #include <QtCore/QQueue> #include <QtCore/QString> @@ -100,8 +155,7 @@ public: #endif if (edgeData(first, second)) { #ifdef QT_DEBUG - qWarning(qPrintable(QString::fromAscii("%1-%2 already has an edge") - .arg(first->toString()).arg(second->toString()))); + qWarning("%s-%s already has an edge", qPrintable(first->toString()), qPrintable(second->toString())); #endif } createDirectedEdge(first, second, data); @@ -238,3 +292,5 @@ private: }; QT_END_NAMESPACE + +#endif diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 3c2ea37..95561b7 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -65,8 +65,9 @@ automatically added to the layout, and if items are removed, all their anchors will be automatically removed - \section1 Size Hints and Size Policies in QGraphicsLinearLayout - QGraphicsLinearLayout respects each item's size hints and size policies. However it does + \section1 Size Hints and Size Policies in QGraphicsAnchorLayout + + QGraphicsAnchorLayout respects each item's size hints and size policies. However it does not respect stretch factors currently. This might change in the future, so please refrain from using stretch factors in anchor layout to avoid any future regressions. @@ -83,6 +84,10 @@ QT_BEGIN_NAMESPACE +/*! + Constructs a QGraphicsAnchorLayout instance. \a parent is passed to + QGraphicsLayout's constructor. + */ QGraphicsAnchorLayout::QGraphicsAnchorLayout(QGraphicsLayoutItem *parent) : QGraphicsLayout(*new QGraphicsAnchorLayoutPrivate(), parent) { @@ -90,6 +95,9 @@ QGraphicsAnchorLayout::QGraphicsAnchorLayout(QGraphicsLayoutItem *parent) d->createLayoutEdges(); } +/*! + Destroys the QGraphicsAnchorLayout object. +*/ QGraphicsAnchorLayout::~QGraphicsAnchorLayout() { Q_D(QGraphicsAnchorLayout); @@ -187,32 +195,41 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem, } /*! - \fn QGraphicsAnchorLayout::addLeftAndRightAnchors(QGraphicsLayoutItem *firstEdge, QGraphicsLayoutItem *secondEdge) + \fn QGraphicsAnchorLayout::addLeftAndRightAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) + + Anchors the left and right edges of \a firstItem to the same edges of + \a secondItem. This convenience function is equivalent to calling \code - l->addAnchor(firstEdge, Qt::AnchorLeft, secondEdge, Qt::AnchorLeft); - l->addAnchor(firstEdge, Qt::AnchorRight, secondEdge, Qt::AnchorRight); + l->addAnchor(firstItem, Qt::AnchorLeft, secondItem, Qt::AnchorLeft); + l->addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); \endcode */ /*! - \fn QGraphicsAnchorLayout::addTopAndBottomAnchors(QGraphicsLayoutItem *firstEdge, QGraphicsLayoutItem *secondEdge) + \fn QGraphicsAnchorLayout::addTopAndBottomAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) + + Anchors the top and bottom edges of \a firstItem to the same edges of + \a secondItem. This convenience function is equivalent to calling \code - l->addAnchor(firstEdge, Qt::AnchorTop, secondEdge, Qt::AnchorTop); - l->addAnchor(firstEdge, Qt::AnchorBottom, secondEdge, Qt::AnchorBottom); + l->addAnchor(firstItem, Qt::AnchorTop, secondItem, Qt::AnchorTop); + l->addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom); \endcode */ /*! - \fn QGraphicsAnchorLayout::addAllAnchors(QGraphicsLayoutItem *firstEdge, QGraphicsLayoutItem *secondEdge) + \fn QGraphicsAnchorLayout::addAllAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) + + Anchors all edges (left, right, top and bottom) of \a firstItem to the same edges of + \a secondItem. This convenience function is equivalent to calling \code - l->addLeftAndRightAnchors(firstEdge, secondEdge); - l->addTopAndBottomAnchors(firstEdge, secondEdge); + l->addLeftAndRightAnchors(firstItem, secondItem); + l->addTopAndBottomAnchors(firstItem, secondItem); \endcode */ @@ -228,6 +245,7 @@ void QGraphicsAnchorLayout::setAnchorSpacing(const QGraphicsLayoutItem *firstIte if (!d->setAnchorSize(firstItem, firstEdge, secondItem, secondEdge, &spacing)) { qWarning("setAnchorSpacing: The anchor does not exist."); + return; } invalidate(); } @@ -369,7 +387,12 @@ void QGraphicsAnchorLayout::setGeometry(const QRectF &geom) } /*! + Removes the layout item at \a index without destroying it. Ownership of + the item is transferred to the caller. + Removing an item will also remove any of the anchors associated with it. + + \sa itemAt(), count() */ void QGraphicsAnchorLayout::removeAt(int index) { diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h index 3de9ae5..4b3dbc6 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 9a34ad5..d4afa5b 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -554,7 +554,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP qDebug("candidate list for sequential simplification:\n[%s]", qPrintable(strPath)); #endif - bool forward; + bool forward = true; AnchorVertex *prev = beforeSequence; int intervalFrom = 0; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 15a1b44..1ce6ef5 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,11 +34,25 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef QGRAPHICSANCHORLAYOUT_P_H +#define QGRAPHICSANCHORLAYOUT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QGraphicsWidget> #include "qgraphicslayout_p.h" @@ -475,3 +489,5 @@ public: }; QT_END_NAMESPACE + +#endif diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 620f6f4..8860677 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -335,6 +335,13 @@ \value ItemAutoDetectsFocusProxy The item will assign any child that gains input focus as its focus proxy. See also focusProxy(). This flag was introduced in Qt 4.6. + + \value ItemIsPanel. The item is a panel. A panel provides activation and + contained focus handling. Only one panel can be active at a time (see + QGraphicsItem::isActive()). When no panel is active, QGraphicsScene + activates all non-panel items. Window items (i.e., + QGraphicsItem::isWindow() returns true) are panels. This flag was + introduced in Qt 4.6. */ /*! @@ -1363,14 +1370,29 @@ QGraphicsWidget *QGraphicsItem::topLevelWidget() const */ QGraphicsWidget *QGraphicsItem::window() const { - if (isWidget() && static_cast<const QGraphicsWidget *>(this)->isWindow()) - return static_cast<QGraphicsWidget *>(const_cast<QGraphicsItem *>(this)); - if (QGraphicsWidget *parent = parentWidget()) - return parent->window(); + QGraphicsItem *p = panel(); + if (p && p->isWindow()) + return static_cast<QGraphicsWidget *>(p); return 0; } /*! + \since 4.6 + + Returns the item's panel, or 0 if this item does not have a panel. If the + item is a panel, it will return itself. Otherwise it will return the + closest ancestor that is a panel. + + \sa isPanel(), ItemIsPanel +*/ +QGraphicsItem *QGraphicsItem::panel() const +{ + if (d_ptr->flags & ItemIsPanel) + return const_cast<QGraphicsItem *>(this); + return d_ptr->parent ? d_ptr->parent->panel() : 0; +} + +/*! \since 4.6 Return the graphics item cast to a QGraphicsObject, if the class is actually a @@ -1456,6 +1478,17 @@ bool QGraphicsItem::isWindow() const } /*! + \since 4.6 + Returns true if the item is a panel; otherwise returns false. + + \sa QGraphicsItem::panel(), ItemIsPanel +*/ +bool QGraphicsItem::isPanel() const +{ + return d_ptr->flags & ItemIsPanel; +} + +/*! Returns this item's flags. The flags describe what configurable features of the item are enabled and not. For example, if the flags include ItemIsFocusable, the item can accept input focus. @@ -1518,6 +1551,9 @@ static void _q_qgraphicsItemSetFlag(QGraphicsItem *item, QGraphicsItem::Graphics */ void QGraphicsItem::setFlags(GraphicsItemFlags flags) { + if (isWindow()) + flags |= ItemIsPanel; + // Notify change and check for adjustment. if (quint32(d_ptr->flags) == quint32(flags)) return; @@ -1872,16 +1908,16 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo q->ungrabKeyboard(); } if (q_ptr->hasFocus() && scene) { - // Hiding the closest non-window ancestor of the focus item + // Hiding the closest non-panel ancestor of the focus item QGraphicsItem *focusItem = scene->focusItem(); bool clear = true; - if (isWidget && !focusItem->isWindow()) { + if (isWidget && !focusItem->isPanel()) { do { if (focusItem == q_ptr) { clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true); break; } - } while ((focusItem = focusItem->parentWidget()) && !focusItem->isWindow()); + } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel()); } if (clear) q_ptr->clearFocus(); @@ -2003,17 +2039,17 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo if (scene && scene->mouseGrabberItem() == q_ptr) q_ptr->ungrabMouse(); if (q_ptr->hasFocus()) { - // Disabling the closest non-window ancestor of the focus item + // Disabling the closest non-panel ancestor of the focus item // causes focus to pop to the next item, otherwise it's cleared. QGraphicsItem *focusItem = scene->focusItem(); bool clear = true; - if (isWidget && !focusItem->isWindow() && q_ptr->isAncestorOf(focusItem)) { + if (isWidget && !focusItem->isPanel() && q_ptr->isAncestorOf(focusItem)) { do { if (focusItem == q_ptr) { clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true); break; } - } while ((focusItem = focusItem->parentWidget()) && !focusItem->isWindow()); + } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel()); } if (clear) q_ptr->clearFocus(); @@ -2610,12 +2646,33 @@ void QGraphicsItem::setHandlesChildEvents(bool enabled) d_ptr->handlesChildEvents = enabled; d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); } +/*! + \since 4.6 + Returns true if this item is active; otherwise returns false. + + An item can only be active if the scene is active. An item is active + if it is, or is a descendent of, an active panel. Items in non-active + panels are not active. + + Items that are not part of a panel follow scene activation when the + scene has no active panel. + + Only active items can gain input focus. + + \sa QGraphicsScene::isActive(), QGraphicsScene::activePanel(), panel(), isPanel() +*/ +bool QGraphicsItem::isActive() const +{ + if (!d_ptr->scene || !d_ptr->scene->isActive()) + return false; + return panel() == d_ptr->scene->activePanel(); +} /*! - Returns true if this item or its \l{focusProxy()}{focus proxy} has keyboard - input focus; otherwise, returns false. + Returns true if this item is active, and it or its \l{focusProxy()}{focus + proxy} has keyboard input focus; otherwise, returns false. - \sa focusItem(), setFocus(), QGraphicsScene::setFocusItem() + \sa focusItem(), setFocus(), QGraphicsScene::setFocusItem(), isActive() */ bool QGraphicsItem::hasFocus() const { @@ -2632,9 +2689,10 @@ bool QGraphicsItem::hasFocus() const Only enabled items that set the ItemIsFocusable flag can accept keyboard focus. - If this item is not visible, or not associated with a scene, it will not - gain immediate input focus. However, it will be registered as the preferred - focus item for its subtree of items, should it later become visible. + If this item is not visible, not active, or not associated with a scene, + it will not gain immediate input focus. However, it will be registered as + the preferred focus item for its subtree of items, should it later become + visible. As a result of calling this function, this item will receive a \l{focusInEvent()}{focus in event} with \a focusReason. If another item @@ -2663,8 +2721,8 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) // Update the scene's focus item. if (d_ptr->scene) { - QGraphicsWidget *w = window(); - if (!w || w->isActiveWindow()) { + QGraphicsItem *p = panel(); + if (!p || p->isActive()) { // Visible items immediately gain focus from scene. d_ptr->scene->d_func()->setFocusItemHelper(f, focusReason); } @@ -2674,8 +2732,8 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) /*! Takes keyboard input focus from the item. - If it has focus, a \l{focusOutEvent()}{focus out event} is sent to this item - to tell it that it is about to lose the focus. + If it has focus, a \l{focusOutEvent()}{focus out event} is sent to this + item to tell it that it is about to lose the focus. Only items that set the ItemIsFocusable flag, or widgets that set an appropriate focus policy, can accept keyboard focus. @@ -4770,7 +4828,7 @@ void QGraphicsItemPrivate::setSubFocus() bool hidden = !visible; do { parent->d_func()->subFocusItem = item; - } while (!parent->isWindow() && (parent = parent->d_ptr->parent) && (!hidden || !parent->d_func()->visible)); + } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (!hidden || !parent->d_func()->visible)); } /*! @@ -4784,7 +4842,7 @@ void QGraphicsItemPrivate::clearSubFocus() if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; - } while (!parent->isWindow() && (parent = parent->d_ptr->parent)); + } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } /*! @@ -6035,6 +6093,17 @@ bool QGraphicsItem::sceneEvent(QEvent *event) case QEvent::InputMethod: inputMethodEvent(static_cast<QInputMethodEvent *>(event)); break; + case QEvent::WindowActivate: + case QEvent::WindowDeactivate: + // Propagate panel activation. + if (d_ptr->scene) { + for (int i = 0; i < d_ptr->children.size(); ++i) { + QGraphicsItem *child = d_ptr->children.at(i); + if (!(child->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents)) + d_ptr->scene->sendEvent(child, event); + } + } + break; default: return false; } @@ -10440,6 +10509,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemAutoDetectsFocusProxy: str = "ItemAutoDetectsFocusProxy"; break; + case QGraphicsItem::ItemIsPanel: + str = "ItemIsPanel"; + break; } debug << str; return debug; @@ -10449,7 +10521,7 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags) { debug << '('; bool f = false; - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < 16; ++i) { if (flags & (1 << i)) { if (f) debug << '|'; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 7af7c2f..b23941d 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -104,7 +104,8 @@ public: ItemSendsGeometryChanges = 0x800, ItemAcceptsInputMethod = 0x1000, ItemAutoDetectsFocusProxy = 0x2000, - ItemNegativeZStacksBehindParent = 0x4000 + ItemNegativeZStacksBehindParent = 0x4000, + ItemIsPanel = 0x8000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) @@ -161,11 +162,13 @@ public: QGraphicsWidget *parentWidget() const; QGraphicsWidget *topLevelWidget() const; QGraphicsWidget *window() const; + QGraphicsItem *panel() const; void setParentItem(QGraphicsItem *parent); QList<QGraphicsItem *> children() const; // ### obsolete QList<QGraphicsItem *> childItems() const; bool isWidget() const; bool isWindow() const; + bool isPanel() const; QGraphicsObject *toGraphicsObject(); const QGraphicsObject *toGraphicsObject() const; @@ -231,6 +234,7 @@ public: bool handlesChildEvents() const; void setHandlesChildEvents(bool enabled); + bool isActive() const; bool hasFocus() const; void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); void clearFocus(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 11f6f53..2b897d1 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // @@ -463,7 +463,7 @@ public: // New 32 bits quint32 fullUpdatePending : 1; - quint32 flags : 15; + quint32 flags : 16; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -479,7 +479,6 @@ public: quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; quint32 mouseSetsFocus : 1; - quint32 unused : 1; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 58c174c..df6be90 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -390,8 +390,10 @@ void QGraphicsLayout::widgetEvent(QEvent *e) QGraphicsLayout to return a pointer to the item at index \a i. The reimplementation can assume that \a i is valid (i.e., it respects the value of count()). + Together with count(), it is provided as a means of iterating over all items in a layout. - The subclass is free to decide how to store the items. + The subclass is free to decide how to store the items, and the visual arrangement + does not have to be reflected through this function. \sa count(), removeAt() */ diff --git a/src/gui/graphicsview/qgraphicslayout_p.h b/src/gui/graphicsview/qgraphicslayout_p.h index 2ad853b..0e43b55 100644 --- a/src/gui/graphicsview/qgraphicslayout_p.h +++ b/src/gui/graphicsview/qgraphicslayout_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index 5bda3ca..4d9a8c9 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 185780a..1b271e5 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -277,7 +277,7 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item) Q_ASSERT(item); d->fixIndex(&index); d->engine.insertRow(index, d->orientation); - new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index)); + new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); invalidate(); } @@ -471,6 +471,7 @@ int QGraphicsLinearLayout::count() const /*! \reimp + When iterating from 0 and up, it will return the items in the visual arranged order. */ QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const { diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h index e2be89c..04fe40a 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a819822..7dbc996 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -288,7 +288,8 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() focusItem(0), lastFocusItem(0), tabFocusFirst(0), - activeWindow(0), + activePanel(0), + lastActivePanel(0), activationRefCount(0), lastMouseGrabberItem(0), lastMouseGrabberItemHasImplicitMouseGrab(false), @@ -516,10 +517,12 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) focusItem = 0; if (item == lastFocusItem) lastFocusItem = 0; - if (item == activeWindow) { + if (item == activePanel) { // ### deactivate... - activeWindow = 0; + activePanel = 0; } + if (item == lastActivePanel) + lastActivePanel = 0; // Disable selectionChanged() for individual items ++selectionChanging; @@ -1076,8 +1079,9 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou } // Update window activation. - QGraphicsWidget *newActiveWindow = windowForItem(cachedItemsUnderMouse.value(0)); - if (newActiveWindow != activeWindow) + QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); + QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0; + if (newActiveWindow != q->activeWindow()) q->setActiveWindow(newActiveWindow); // Set focus on the topmost enabled item that can take focus. @@ -1112,7 +1116,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // check if the item we are sending to are disabled (before we send the event) bool disabled = !item->isEnabled(); - bool isWindow = item->isWindow(); + bool isPanel = item->isPanel(); if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick && item != lastMouseGrabberItem && lastMouseGrabberItem) { // If this item is different from the item that received the last @@ -1153,8 +1157,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou } ungrabMouse(item, /* itemIsDying = */ dontSendUngrabEvents); - // Don't propagate through windows. - if (isWindow) + // Don't propagate through panels. + if (isPanel) break; } @@ -1176,18 +1180,6 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou } } -QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) const -{ - if (!item) - return 0; - do { - if (item->isWidget()) - return static_cast<const QGraphicsWidget *>(item)->window(); - item = item->parentItem(); - } while (item); - return 0; -} - /*! \internal @@ -2234,6 +2226,9 @@ void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group) moved to this scene), QGraphicsScene will send an addition notification as the item is removed from its previous scene. + If the item is a panel, the scene is active, and there is no active panel + in the scene, then the item will be activated. + \sa removeItem(), addEllipse(), addLine(), addPath(), addPixmap(), addRect(), addText(), addWidget() */ @@ -2356,9 +2351,9 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Deliver post-change notification item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); - // Auto-activate the first inactive window if the scene is active. - if (d->activationRefCount > 0 && !d->activeWindow && item->isWindow()) - setActiveWindow(static_cast<QGraphicsWidget *>(item)); + // Auto-activate the first inactive panel if the scene is active. + if (isActive() && !d->activePanel && item->isPanel()) + setActivePanel(item); // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. @@ -3130,40 +3125,43 @@ bool QGraphicsScene::event(QEvent *event) case QEvent::InputMethod: inputMethodEvent(static_cast<QInputMethodEvent *>(event)); break; - case QEvent::WindowActivate: { + case QEvent::WindowActivate: if (!d->activationRefCount++) { - // Notify all non-window widgets. - foreach (QGraphicsItem *item, items()) { - if (item->isWidget() && item->isVisible() && !item->isWindow() && !item->parentWidget()) { - QEvent event(QEvent::WindowActivate); - QApplication::sendEvent(static_cast<QGraphicsWidget *>(item), &event); + if (d->lastActivePanel) { + // Activate the last panel. + setActivePanel(d->lastActivePanel); + } else if (d->tabFocusFirst && d->tabFocusFirst->isPanel()) { + // Activate the panel of the first item in the tab focus + // chain. + setActivePanel(d->tabFocusFirst); + } else { + // Activate all toplevel items. + QEvent event(QEvent::WindowActivate); + foreach (QGraphicsItem *item, items()) { + if (item->isVisible() && !item->isPanel() && !item->parentItem()) + sendEvent(item, &event); } } - - // Restore window activation. - QGraphicsItem *nextFocusItem = d->focusItem ? d->focusItem : d->lastFocusItem; - if (nextFocusItem && nextFocusItem->window()) - setActiveWindow(static_cast<QGraphicsWidget *>(nextFocusItem)); - else if (d->tabFocusFirst && d->tabFocusFirst->isWindow()) - setActiveWindow(d->tabFocusFirst); } break; - } - case QEvent::WindowDeactivate: { + case QEvent::WindowDeactivate: if (!--d->activationRefCount) { - // Remove window activation. - setActiveWindow(0); - - // Notify all non-window widgets. - foreach (QGraphicsItem *item, items()) { - if (item->isWidget() && item->isVisible() && !item->isWindow() && !item->parentWidget()) { - QEvent event(QEvent::WindowDeactivate); - QApplication::sendEvent(static_cast<QGraphicsWidget *>(item), &event); + if (d->activePanel) { + // Deactivate the active panel (but keep it so we can + // reactivate it later). + QGraphicsItem *lastActivePanel = d->activePanel; + setActivePanel(0); + d->lastActivePanel = lastActivePanel; + } else { + // Activate all toplevel items. + QEvent event(QEvent::WindowDeactivate); + foreach (QGraphicsItem *item, items()) { + if (item->isVisible() && !item->isPanel() && !item->parentItem()) + sendEvent(item, &event); } } } break; - } case QEvent::ApplicationFontChange: { // Resolve the existing scene font. d->resolveFont(); @@ -3526,8 +3524,8 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.last()) : 0; while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem)) commonAncestorItem = commonAncestorItem->parentItem(); - if (commonAncestorItem && commonAncestorItem->window() != item->window()) { - // The common ancestor isn't in the same window as the two hovered + if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) { + // The common ancestor isn't in the same panel as the two hovered // items. commonAncestorItem = 0; } @@ -3548,8 +3546,8 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv QGraphicsItem *parent = item; while (parent && parent != commonAncestorItem) { parents.prepend(parent); - if (parent->isWindow()) { - // Stop at the window - we don't deliver beyond this point. + if (parent->isPanel()) { + // Stop at the panel - we don't deliver beyond this point. break; } parent = parent->parentItem(); @@ -3626,7 +3624,7 @@ void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent) // is filtered out, stop propagating it. if (!d->sendEvent(p, keyEvent)) break; - } while (!keyEvent->isAccepted() && !p->isWindow() && (p = p->parentItem())); + } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); } else { keyEvent->ignore(); } @@ -3656,7 +3654,7 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) // is filtered out, stop propagating it. if (!d->sendEvent(p, keyEvent)) break; - } while (!keyEvent->isAccepted() && !p->isWindow() && (p = p->parentItem())); + } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); } else { keyEvent->ignore(); } @@ -3818,9 +3816,9 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) wheelEvent->setPos(item->d_ptr->genericMapFromScene(wheelEvent->scenePos(), wheelEvent->widget())); wheelEvent->accept(); - bool isWindow = item->isWindow(); + bool isPanel = item->isPanel(); d->sendEvent(item, wheelEvent); - if (isWindow || wheelEvent->isAccepted()) + if (isPanel || wheelEvent->isAccepted()) break; } } @@ -4879,7 +4877,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) if (widget->flags() & QGraphicsItem::ItemIsFocusable && widget->isEnabled() && widget->isVisibleTo(0) && (widget->focusPolicy() & Qt::TabFocus) - && (!item || !item->isWindow() || item->isAncestorOf(widget)) + && (!item || !item->isPanel() || item->isAncestorOf(widget)) ) { setFocusItem(widget, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); return true; @@ -5066,84 +5064,150 @@ void QGraphicsScene::setPalette(const QPalette &palette) } /*! - \since 4.4 + \since 4.6 - Returns the current active window, or 0 if there is no window is currently - active. + Returns true if the scene is active (e.g., it's viewed by + at least one QGraphicsView that is active); otherwise returns false. - \sa QGraphicsScene::setActiveWindow() + \sa QGraphicsItem::isActive(), QWidget::isActiveWindow() */ -QGraphicsWidget *QGraphicsScene::activeWindow() const +bool QGraphicsScene::isActive() const { Q_D(const QGraphicsScene); - return d->activeWindow; + return d->activationRefCount > 0; } /*! - \since 4.4 - Activates \a widget, which must be a widget in this scene. You can also - pass 0 for \a widget, in which case QGraphicsScene will deactivate any - currently active window. + \since 4.6 + Returns the current active panel, or 0 if no panel is currently active. - \sa activeWindow(), QGraphicsWidget::isActiveWindow() + \sa QGraphicsScene::setActivePanel() */ -void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) +QGraphicsItem *QGraphicsScene::activePanel() const +{ + Q_D(const QGraphicsScene); + return d->activePanel; +} + +/*! + \since 4.6 + Activates \a item, which must be an item in this scene. You + can also pass 0 for \a item, in which case QGraphicsScene will + deactivate any currently active panel. + + \sa activePanel(), isActive(), QGraphicsItem::isActive() +*/ +void QGraphicsScene::setActivePanel(QGraphicsItem *item) { Q_D(QGraphicsScene); - if (widget && widget->scene() != this) { - qWarning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", - widget); + if (item && item->scene() != this) { + qWarning("QGraphicsScene::setActivePanel: item %p must be part of this scene", + item); return; } - // Activate the widget's window. - QGraphicsWidget *window = widget ? widget->window() : 0; - if (window == d->activeWindow) + // Find the item's panel. + QGraphicsItem *panel = item ? item->panel() : 0; + d->lastActivePanel = panel ? d->activePanel : 0; + if (panel == d->activePanel) return; - // Deactivate the last active window. - if (d->activeWindow) { - if (QGraphicsWidget *fw = d->activeWindow->focusWidget()) { + // Deactivate the last active panel. + if (d->activePanel) { + if (QGraphicsItem *fi = d->activePanel->focusItem()) { // Remove focus from the current focus item. - if (fw == focusItem()) + if (fi == focusItem()) setFocusItem(0, Qt::ActiveWindowFocusReason); } QEvent event(QEvent::WindowDeactivate); - QApplication::sendEvent(d->activeWindow, &event); + sendEvent(d->activePanel, &event); + } else if (panel) { + // Deactivate the scene if changing activation to a panel. + QEvent event(QEvent::WindowDeactivate); + foreach (QGraphicsItem *item, items()) { + if (item->isVisible() && !item->isPanel() && !item->parentItem()) + sendEvent(item, &event); + } } // Update activate state. - d->activeWindow = window; + d->activePanel = panel; QEvent event(QEvent::ActivationChange); QApplication::sendEvent(this, &event); // Activate - if (window) { + if (panel) { QEvent event(QEvent::WindowActivate); - QApplication::sendEvent(window, &event); + sendEvent(panel, &event); + // Set focus on the panel's focus item. + if (QGraphicsItem *focusItem = panel->focusItem()) + focusItem->setFocus(Qt::ActiveWindowFocusReason); + } else if (isActive()) { + // Activate the scene + QEvent event(QEvent::WindowActivate); + foreach (QGraphicsItem *item, items()) { + if (item->isVisible() && !item->isPanel() && !item->parentItem()) + sendEvent(item, &event); + } + } +} + +/*! + \since 4.4 + + Returns the current active window, or 0 if there is no window is currently + active. + + \sa QGraphicsScene::setActiveWindow() +*/ +QGraphicsWidget *QGraphicsScene::activeWindow() const +{ + Q_D(const QGraphicsScene); + if (d->activePanel && d->activePanel->isWindow()) + return static_cast<QGraphicsWidget *>(d->activePanel); + return 0; +} + +/*! + \since 4.4 + Activates \a widget, which must be a widget in this scene. You can also + pass 0 for \a widget, in which case QGraphicsScene will deactivate any + currently active window. + + \sa activeWindow(), QGraphicsWidget::isActiveWindow() +*/ +void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) +{ + if (widget && widget->scene() != this) { + qWarning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", + widget); + return; + } + + // Activate the widget's panel (all windows are panels). + QGraphicsItem *panel = widget ? widget->panel() : 0; + setActivePanel(panel); + + // Raise + if (panel) { QList<QGraphicsItem *> siblingWindows; - QGraphicsItem *parent = window->parentItem(); + QGraphicsItem *parent = panel->parentItem(); // Raise ### inefficient for toplevels foreach (QGraphicsItem *sibling, parent ? parent->children() : items()) { - if (sibling != window && sibling->isWidget() - && static_cast<QGraphicsWidget *>(sibling)->isWindow()) { + if (sibling != panel && sibling->isWindow()) siblingWindows << sibling; - } } // Find the highest z value. - qreal z = window->zValue(); + qreal z = panel->zValue(); for (int i = 0; i < siblingWindows.size(); ++i) z = qMax(z, siblingWindows.at(i)->zValue()); // This will probably never overflow. const qreal litt = qreal(0.001); - window->setZValue(z + litt); - - if (QGraphicsWidget *focusChild = window->focusWidget()) - focusChild->setFocus(Qt::ActiveWindowFocusReason); + panel->setZValue(z + litt); } } diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 26cb1c2..9478879 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -243,6 +243,9 @@ public: QPalette palette() const; void setPalette(const QPalette &palette); + bool isActive() const; + QGraphicsItem *activePanel() const; + void setActivePanel(QGraphicsItem *item); QGraphicsWidget *activeWindow() const; void setActiveWindow(QGraphicsWidget *widget); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 4b8791e..c46c906 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // @@ -129,7 +129,8 @@ public: QGraphicsItem *focusItem; QGraphicsItem *lastFocusItem; QGraphicsWidget *tabFocusFirst; - QGraphicsWidget *activeWindow; + QGraphicsItem *activePanel; + QGraphicsItem *lastActivePanel; int activationRefCount; void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 27c499d..5cc8449 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -44,8 +44,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 3ec14c3..afcc4e1 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -87,9 +87,11 @@ \since 4.2 \ingroup graphicsview-api - When a QGraphicsView receives a QMouseEvent, it translates it to - a QGraphicsSceneMouseEvent. The event is then forwarded to the - QGraphicsScene associated with the view. + When a QGraphicsView receives a QMouseEvent, it translates it to a + QGraphicsSceneMouseEvent. The event is then forwarded to the + QGraphicsScene associated with the view. If the event is not + handled by the scene, the view may use it, e.g., for the + \l{QGraphicsView::}{DragMode}. In addition to containing the item, scene, and screen coordinates of the event (as pos(), scenePos(), and screenPos()), mouse diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index d922036..00e5f89 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h index 2c563e4..c9b95fd 100644 --- a/src/gui/graphicsview/qgraphicstransform_p.h +++ b/src/gui/graphicsview/qgraphicstransform_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index bdf5ddd..a40dfdc 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 157fbe5..40addf6 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -168,6 +168,8 @@ QT_BEGIN_NAMESPACE \sa QGraphicsProxyWidget, QGraphicsItem, {Widgets and Layouts} */ +bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); + /*! Constructs a QGraphicsWidget instance. The optional \a parent argument is passed to QGraphicsItem's constructor. The optional \a wFlags argument @@ -379,6 +381,8 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); + wd->invalidateCachedClipPathRecursively(); + // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { @@ -1097,7 +1101,11 @@ QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVar */ bool QGraphicsWidget::sceneEvent(QEvent *event) { - return QCoreApplication::sendEvent(this, event) || QGraphicsItem::sceneEvent(event); + bool spont = event->spontaneous(); + if (spont ? qt_sendSpontaneousEvent(this, event) : QApplication::sendEvent(this, event)) + return true; + event->spont = spont; + return QGraphicsItem::sceneEvent(event); } /*! @@ -1277,10 +1285,6 @@ bool QGraphicsWidget::event(QEvent *event) case QEvent::WindowActivate: case QEvent::WindowDeactivate: update(); - foreach (QGraphicsItem *child, childItems()) { - if (child->isWidget()) - QApplication::sendEvent(static_cast<QGraphicsWidget *>(child), event); - } break; // Taken from QWidget::event case QEvent::ActivationChange: @@ -1590,6 +1594,8 @@ void QGraphicsWidget::ungrabKeyboardEvent(QEvent *event) /*! Returns the widgets window type. + + \sa windowFlags(), isWindow(), isPanel() */ Qt::WindowType QGraphicsWidget::windowType() const { @@ -1605,6 +1611,13 @@ Qt::WindowType QGraphicsWidget::windowType() const is platform-dependent. By default, this property contains no window flags. + + Windows are panels. If you set the Qt::Window flag, the ItemIsPanel flag + will be set automatically. If you clear the Qt::Window flag, the + ItemIsPanel flag is also cleared. Note that the ItemIsPanel flag can be + set independently of Qt::Window. + + \sa isWindow(), isPanel() */ Qt::WindowFlags QGraphicsWidget::windowFlags() const { @@ -1623,6 +1636,8 @@ void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags) if (!d->setWindowFrameMargins) unsetWindowFrameMargins(); + setFlag(ItemIsPanel, d->windowFlags & Qt::Window); + bool isPopup = (d->windowFlags & Qt::WindowType_Mask) == Qt::Popup; if (d->scene && isVisible() && wasPopup != isPopup) { // Popup state changed; update implicit mouse grab. @@ -1646,7 +1661,7 @@ void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags) The active window is the window that either contains a child widget that currently has input focus, or that itself has input focus. - \sa QGraphicsScene::activeWindow(), QGraphicsScene::setActiveWindow() + \sa QGraphicsScene::activeWindow(), QGraphicsScene::setActiveWindow(), isActive() */ bool QGraphicsWidget::isActiveWindow() const { @@ -1654,7 +1669,7 @@ bool QGraphicsWidget::isActiveWindow() const if (!d->scene) return false; const QGraphicsWidget *w = window(); - return (!w && d->scene->d_func()->activationRefCount) || (w && d->scene->activeWindow() == w); + return (!w && d->scene->isActive()) || (w && d->scene->activeWindow() == w); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 0e1fe46..1ee79e1 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 5ad6ac9..beb9cb0 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -461,7 +461,7 @@ void QGridLayoutRowData::dump(int indent) const QGridLayoutItem::QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem *layoutItem, int row, int column, int rowSpan, int columnSpan, - Qt::Alignment alignment) + Qt::Alignment alignment, int itemAtIndex) : q_engine(engine), q_layoutItem(layoutItem), q_alignment(alignment) { q_firstRows[Hor] = column; @@ -471,7 +471,7 @@ QGridLayoutItem::QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem q_stretches[Hor] = -1; q_stretches[Ver] = -1; - q_engine->addItem(this); + q_engine->insertItem(this, itemAtIndex); } int QGridLayoutItem::firstRow(Qt::Orientation orientation) const @@ -937,11 +937,20 @@ Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layou return align; } -void QGridLayoutEngine::addItem(QGridLayoutItem *item) +/*! + \internal + The \a index is only used by QGraphicsLinearLayout to ensure that itemAt() reflects the order + of visual arrangement. Strictly speaking it does not have to, but most people expect it to. + (And if it didn't we would have to add itemArrangedAt(int index) or something..) + */ +void QGridLayoutEngine::insertItem(QGridLayoutItem *item, int index) { maybeExpandGrid(item->lastRow(), item->lastColumn()); - q_items.append(item); + if (index == -1) + q_items.append(item); + else + q_items.insert(index, item); for (int i = item->firstRow(); i <= item->lastRow(); ++i) { for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) { @@ -952,6 +961,11 @@ void QGridLayoutEngine::addItem(QGridLayoutItem *item) } } +void QGridLayoutEngine::addItem(QGridLayoutItem *item) +{ + insertItem(item, -1); +} + void QGridLayoutEngine::removeItem(QGridLayoutItem *item) { Q_ASSERT(q_items.contains(item)); diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 8f3eb13..aab695a 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -267,7 +267,8 @@ class QGridLayoutItem { public: QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem *layoutItem, int row, int column, - int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0); + int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0, + int itemAtIndex = -1); inline int firstRow() const { return q_firstRows[Ver]; } inline int firstColumn() const { return q_firstRows[Hor]; } @@ -378,6 +379,7 @@ public: Qt::Alignment effectiveAlignment(const QGridLayoutItem *layoutItem) const; + void insertItem(QGridLayoutItem *item, int index); void addItem(QGridLayoutItem *item); void removeItem(QGridLayoutItem *item); QGridLayoutItem *findLayoutItem(QGraphicsLayoutItem *layoutItem) const; diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 7fa5ab0..30a7d5d 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qsimplex_p.h" #include <QtCore/qset.h> @@ -252,7 +293,7 @@ int QSimplex::findPivotColumn() int QSimplex::pivotRowForColumn(int column) { - qreal min = 999999999999.0; // ### + qreal min = qreal(999999999999.0); // ### int minIndex = -1; for (int i = 1; i < rows; ++i) { diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index e3629df..5d32dd3 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -1,19 +1,58 @@ /**************************************************************************** ** -** Copyright (C) 1992-$THISYEAR$ $TROLLTECH$. All rights reserved. +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QSIMPLEX_P_H #define QSIMPLEX_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qhash.h> #include <QtCore/qpair.h> diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 1e1c7fd..f273c3c 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -148,11 +148,15 @@ QImage::Format QNativeImage::systemFormat() #elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM) QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget) + : xshmimg(0), xshmpm(0) { if (!X11->use_mitshm) { - xshmimg = 0; - xshmpm = 0; image = QImage(width, height, format); + // follow good coding practice and set xshminfo attributes, though values not used in this case + xshminfo.readOnly = true; + xshminfo.shmaddr = 0; + xshminfo.shmid = 0; + xshminfo.shmseg = 0; return; } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 00e78ad..658b8e0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -832,20 +832,11 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers if (QPixmapCache::find(key, *this)) return true; - QImage image = QImageReader(fileName, format).read(); - if (image.isNull()) - return false; - - QPixmap pm; - if (data->pixelType() == QPixmapData::BitmapType) - pm = QBitmap::fromImage(image, flags); - else - pm = fromImage(image, flags); - if (!pm.isNull()) { - *this = pm; + if (data->fromFile(fileName, format, flags)) { QPixmapCache::insert(key, *this); return true; } + return false; } @@ -870,21 +861,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) { - QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - - QImage image = QImageReader(&b, format).read(); - QPixmap pm; - if (data->pixelType() == QPixmapData::BitmapType) - pm = QBitmap::fromImage(image, flags); - else - pm = fromImage(image, flags); - if (!pm.isNull()) { - *this = pm; - return true; - } - return false; + return data->fromData(buf, len, format, flags); } /*! diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index e549900..a6c70a7 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -48,6 +48,9 @@ #include <private/qdrawhelper_p.h> #include <private/qpixmap_raster_p.h> + +QT_BEGIN_NAMESPACE + QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { QWidget *widget = QWidget::find(window); @@ -148,3 +151,5 @@ int QPixmap::qwsBytesPerLine() const return 0; } + +QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index b8d6ac1..81071ee 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -82,6 +82,11 @@ QT_BEGIN_NAMESPACE A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of memory. + The \e{Qt Quarterly} article + \l{http://qt.nokia.com/doc/qq/qq12-qpixmapcache.html}{Optimizing + with QPixmapCache} explains how to use QPixmapCache to speed up + applications by caching the results of painting. + \sa QCache, QPixmap */ diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 001a930..c8b91db 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qpixmapdata_p.h" +#include <QtCore/qbuffer.h> #include <QtGui/qbitmap.h> #include <QtGui/qimagereader.h> @@ -66,14 +67,44 @@ QPixmapData::~QPixmapData() { } -void QPixmapData::fromFile(const QString &fileName, const char *format, +static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags) +{ + if (d->pixelType() == QPixmapData::BitmapType) { + QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); + + // make sure image.color(0) == Qt::color0 (white) + // and image.color(1) == Qt::color1 (black) + const QRgb c0 = QColor(Qt::black).rgb(); + const QRgb c1 = QColor(Qt::white).rgb(); + if (img.color(0) == c0 && img.color(1) == c1) { + img.invertPixels(); + img.setColor(0, c1); + img.setColor(1, c0); + } + return img; + } + + return image; +} + +bool QPixmapData::fromFile(const QString &fileName, const char *format, Qt::ImageConversionFlags flags) { - const QImage image = QImageReader(fileName, format).read(); + QImage image = QImageReader(fileName, format).read(); if (image.isNull()) - return; + return false; + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); +} - fromImage(image, flags); +bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) +{ + QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); } void QPixmapData::copy(const QPixmapData *data, const QRect &rect) diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 70890c0..9040641 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -75,8 +75,12 @@ public: virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags) = 0; - virtual void fromFile(const QString &filename, const char *format, + + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + virtual bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); + virtual void copy(const QPixmapData *data, const QRect &rect); virtual bool scroll(int dx, int dy, const QRect &rect); diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index bc14b5e..4b2f365 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -580,8 +580,6 @@ Qt::TransformationMode QPixmapBlurFilter::quality() const } /*! - \reimp - \internal */ QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const @@ -657,8 +655,6 @@ static QImage blurred(const QImage& image, const QRect& rect, int radius) } /*! - \reimp - \internal */ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &srcRect) const diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 7c7bce3..09eda67 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -44,6 +44,7 @@ #include "qcoefepinputcontext_p.h" #include <qapplication.h> #include <qtextformat.h> +#include <private/qcore_symbian_p.h> #include <fepitfr.h> @@ -139,100 +140,14 @@ void QCoeFepInputContext::widgetDestroyed(QWidget *w) } } -/*! - Definition of struct for mapping Symbian to ISO locale - ### REMOVE - See below. -*/ -struct symbianToISO { - int symbian_language; - char iso_name[8]; -}; - -/*! - Mapping from Symbian to ISO locale - ### REMOVE - This was taken from the preliminary QLocale port to S60, and should be - removed once that is finished. -*/ -static const symbianToISO symbian_to_iso_list[] = { - { ELangEnglish, "en_GB" }, - { ELangFrench, "fr_FR" }, - { ELangGerman, "de_DE" }, - { ELangSpanish, "es_ES" }, - { ELangItalian, "it_IT" }, - { ELangSwedish, "sv_SE" }, - { ELangDanish, "da_DK" }, - { ELangNorwegian, "no_NO" }, - { ELangFinnish, "fi_FI" }, - { ELangAmerican, "en_US" }, - { ELangPortuguese, "pt_PT" }, - { ELangTurkish, "tr_TR" }, - { ELangIcelandic, "is_IS" }, - { ELangRussian, "ru_RU" }, - { ELangHungarian, "hu_HU" }, - { ELangDutch, "nl_NL" }, - { ELangBelgianFlemish, "nl_BE" }, - { ELangCzech, "cs_CZ" }, - { ELangSlovak, "sk_SK" }, - { ELangPolish, "pl_PL" }, - { ELangSlovenian, "sl_SI" }, - { ELangTaiwanChinese, "zh_TW" }, - { ELangHongKongChinese, "zh_HK" }, - { ELangPrcChinese, "zh_CN" }, - { ELangJapanese, "ja_JP" }, - { ELangThai, "th_TH" }, - { ELangArabic, "ar_AE" }, - { ELangTagalog, "tl_PH" }, - { ELangBulgarian, "bg_BG" }, - { ELangCatalan, "ca_ES" }, - { ELangCroatian, "hr_HR" }, - { ELangEstonian, "et_EE" }, - { ELangFarsi, "fa_IR" }, - { ELangCanadianFrench, "fr_CA" }, - { ELangGreek, "el_GR" }, - { ELangHebrew, "he_IL" }, - { ELangHindi, "hi_IN" }, - { ELangIndonesian, "id_ID" }, - { ELangLatvian, "lv_LV" }, - { ELangLithuanian, "lt_LT" }, - { ELangMalay, "ms_MY" }, - { ELangBrazilianPortuguese, "pt_BR" }, - { ELangRomanian, "ro_RO" }, - { ELangSerbian, "sr_YU" }, - { ELangLatinAmericanSpanish, "es" }, - { ELangUkrainian, "uk_UA" }, - { ELangUrdu, "ur_PK" }, // India/Pakistan - { ELangVietnamese, "vi_VN" }, -#ifdef __E32LANG_H__ -// 5.0 - { ELangBasque, "eu_ES" }, - { ELangGalician, "gl_ES" }, -#endif - //{ ELangEnglish_Apac, "en" }, - //{ ELangEnglish_Taiwan, "en_TW" }, - //{ ELangEnglish_HongKong, "en_HK" }, - //{ ELangEnglish_Prc, "en_CN" }, - //{ ELangEnglish_Japan, "en_JP"}, - //{ ELangEnglish_Thailand, "en_TH" }, - //{ ELangMalay_Apac, "ms" } -}; - -/*! - Number of Symbian to ISO locale mappings - ### Remove. - See comment for array above. -*/ -static const int symbian_to_iso_count - = sizeof(symbian_to_iso_list)/sizeof(symbianToISO); - QString QCoeFepInputContext::language() { TLanguage lang = m_fepState->LocalLanguage(); - if (lang < symbian_to_iso_count) { - return QLatin1String(symbian_to_iso_list[lang].iso_name); + const QByteArray localeName = qt_symbianLocaleName(lang); + if (!localeName.isEmpty()) { + return QString::fromLatin1(localeName); } else { - return QLatin1String("C"); + return QString::fromLatin1("C"); } } diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp index 35f1b65..992bc78 100644 --- a/src/gui/inputmethod/qinputcontext.cpp +++ b/src/gui/inputmethod/qinputcontext.cpp @@ -105,25 +105,27 @@ QT_BEGIN_NAMESPACE \header \o Context \o Functions \row \o Receiving information \o - x11FilterEvent(), - filterEvent(), - mouseHandler() + x11FilterEvent(), + filterEvent(), + mouseHandler() \row \o Sending back composed text \o - sendEvent() + sendEvent() \row \o State change notification \o - setFocusWidget(), - reset() + setFocusWidget(), + reset() \row \o Context information \o - identifierName(), - language(), - font(), - isComposing() + identifierName(), + language(), + font(), + isComposing() \endtable + \section1 Licensing Information + \legalese Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. @@ -154,16 +156,17 @@ QInputContext::~QInputContext() } /*! - \internal Returns the widget that has an input focus for this input - context. Ordinary input methods should not call this function - directly to keep platform independence and flexible configuration - possibility. + context. The return value may differ from holderWidget() if the input context is shared between several text widgets. - \sa setFocusWidget(), holderWidget() + \warning To ensure platform independence and support flexible + configuration of widgets, ordinary input methods should not call + this function directly. + + \sa setFocusWidget() */ QWidget *QInputContext::focusWidget() const { @@ -173,9 +176,9 @@ QWidget *QInputContext::focusWidget() const /*! - \internal - Sets the widget that has an input focus for this input - context. Ordinary input methods must not call this function + Sets the widget that has an input focus for this input context. + + \warning Ordinary input methods must not call this function directly. \sa focusWidget() diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index eff223b..767fc33 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -79,6 +79,7 @@ public: bool startComposition(); bool endComposition(); bool composition(LPARAM lparam); + int reconvertString(RECONVERTSTRING *reconv); static void TranslateMessage(const MSG *msg); static LRESULT DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 684f325..d917cb3 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -47,6 +47,7 @@ #include "qapplication.h" #include "qevent.h" #include "qtextformat.h" +#include "qtextboundaryfinder.h" //#define Q_IME_DEBUG @@ -810,4 +811,52 @@ QString QWinInputContext::language() return QString(); } +int QWinInputContext::reconvertString(RECONVERTSTRING *reconv) +{ + QWidget *w = focusWidget(); + if(!w) + return -1; + + Q_ASSERT(w->testAttribute(Qt::WA_WState_Created)); + QString surroundingText = qvariant_cast<QString>(w->inputMethodQuery(Qt::ImSurroundingText)); + int memSize = sizeof(RECONVERTSTRING)+(surroundingText.length()+1)*sizeof(ushort); + // If memory is not allocated, return the required size. + if (!reconv) { + if (surroundingText.isEmpty()) + return -1; + else + return memSize; + } + int pos = qvariant_cast<int>(w->inputMethodQuery(Qt::ImCursorPosition)); + // find the word in the surrounding text. + QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText); + bounds.setPosition(pos); + if (bounds.isAtBoundary()) { + if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons()) + bounds.toPreviousBoundary(); + } else { + bounds.toPreviousBoundary(); + } + int startPos = bounds.position(); + bounds.toNextBoundary(); + int endPos = bounds.position(); + // select the text, this will be overwritten by following ime events. + QList<QInputMethodEvent::Attribute> attrs; + attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant()); + QInputMethodEvent e(QString(), attrs); + qt_sendSpontaneousEvent(w, &e); + + reconv->dwSize = memSize; + reconv->dwVersion = 0; + + reconv->dwStrLen = surroundingText.length(); + reconv->dwStrOffset = sizeof(RECONVERTSTRING); + reconv->dwCompStrLen = endPos-startPos; + reconv->dwCompStrOffset = startPos*sizeof(ushort); + reconv->dwTargetStrLen = reconv->dwCompStrLen; + reconv->dwTargetStrOffset = reconv->dwCompStrOffset; + memcpy((char*)(reconv+1), surroundingText.utf16(), surroundingText.length()*sizeof(ushort)); + return memSize; +} + QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qwsinputcontext_qws.cpp b/src/gui/inputmethod/qwsinputcontext_qws.cpp index 5d92e1c..371ff1d 100644 --- a/src/gui/inputmethod/qwsinputcontext_qws.cpp +++ b/src/gui/inputmethod/qwsinputcontext_qws.cpp @@ -111,8 +111,8 @@ void QWSInputContext::setFocusWidget( QWidget *w ) void QWSInputContext::widgetDestroyed(QWidget *w) { - if (w == ::activeWidget) - ::activeWidget = 0; + if (w == QT_PREPEND_NAMESPACE(activeWidget)) + QT_PREPEND_NAMESPACE(activeWidget) = 0; QInputContext::widgetDestroyed(w); } @@ -138,13 +138,13 @@ void QWSInputContext::mouseHandler( int x, QMouseEvent *event) QWidget *QWSInputContext::activeWidget() { - return ::activeWidget; + return QT_PREPEND_NAMESPACE(activeWidget); } bool QWSInputContext::isComposing() const { - return ::activeWidget != 0; + return QT_PREPEND_NAMESPACE(activeWidget) != 0; } bool QWSInputContext::translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e) @@ -182,8 +182,8 @@ bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e) stream >> preedit; stream >> commit; - if (preedit.isEmpty() && ::activeWidget) - w = ::activeWidget; + if (preedit.isEmpty() && QT_PREPEND_NAMESPACE(activeWidget)) + w = QT_PREPEND_NAMESPACE(activeWidget); QInputContext *qic = w->inputContext(); if (!qic) @@ -213,9 +213,9 @@ bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e) #endif if (preedit.isEmpty()) - ::activeWidget = 0; + QT_PREPEND_NAMESPACE(activeWidget) = 0; else - ::activeWidget = w; + QT_PREPEND_NAMESPACE(activeWidget) = w; QInputMethodEvent ime(preedit, attrs); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 0671304..ccc57d7 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -908,7 +908,9 @@ QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() cons /*! Sets the current item to be the item at \a index. - Depending on the current selection mode, the item may also be selected. + + Unless the current selection mode is + \l{QAbstractItemView::}{NoSelection}, the item is also be selected. Note that this function also updates the starting position for any new selections the user performs. @@ -1659,9 +1661,6 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers); bool edited = edit(index, trigger, event); - if (d->selectionModel) - d->selectionModel->select(index, selectionCommand(index, event)); - setState(NoState); if (click) { diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index 8414460..8eb9e21 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -734,14 +734,15 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() if (ranges.isEmpty() && currentSelection.count() == 1) { QItemSelectionRange range = currentSelection.first(); QModelIndex parent = range.parent(); - if (range.top() == 0 + tableRowCount = model->rowCount(parent); + tableColCount = model->columnCount(parent); + if (tableRowCount * tableColCount > 100 + && range.top() == 0 && range.left() == 0 - && range.bottom() == model->rowCount(parent) - 1 - && range.right() == model->columnCount(parent) - 1) { + && range.bottom() == tableRowCount - 1 + && range.right() == tableColCount - 1) { tableSelected = true; tableParent = parent; - tableColCount = model->columnCount(parent); - tableRowCount = model->rowCount(parent); return; } } diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 3e9db3b..de2f493 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1715,8 +1715,7 @@ QRect QListViewPrivate::mapToViewport(const QRect &rect, bool extend) const QRect result = extend ? commonListView->mapToViewport(rect) : rect; int dx = -q->horizontalOffset(); int dy = -q->verticalOffset(); - result.adjust(dx, dy, dx, dy); - return result; + return result.adjusted(dx, dy, dx, dy); } QModelIndex QListViewPrivate::closestIndex(const QRect &target, @@ -2287,15 +2286,14 @@ QRect QListModeViewBase::mapToViewport(const QRect &rect) const if (isWrapping()) return rect; // If the listview is in "listbox-mode", the items are as wide as the view. + // But we don't shrink the items. QRect result = rect; - QSize vsize = viewport()->size(); - QSize csize = contentsSize; if (flow() == QListView::TopToBottom) { result.setLeft(spacing()); - result.setWidth(qMax(csize.width(), vsize.width()) - 2 * spacing()); + result.setWidth(qMax(rect.width(), qMax(contentsSize.width(), viewport()->width()) - 2 * spacing())); } else { // LeftToRight result.setTop(spacing()); - result.setHeight(qMax(csize.height(), vsize.height()) - 2 * spacing()); + result.setHeight(qMax(rect.height(), qMax(contentsSize.height(), viewport()->height()) - 2 * spacing())); } return result; } diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 232b4d2..64f2883 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -1432,7 +1432,8 @@ QListWidgetItem *QListWidget::currentItem() const /*! Sets the current item to \a item. - Depending on the current selection mode, the item may also be selected. + Unless the selection mode is \l{QAbstractItemView::}{NoSelection}, + the item is also be selected. */ void QListWidget::setCurrentItem(QListWidgetItem *item) { diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index d173efe..18fbf7b 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -174,6 +174,7 @@ public: const QModelIndex &source_bottom_right); void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end); + void _q_sourceAboutToBeReset(); void _q_sourceReset(); void _q_sourceLayoutAboutToBeChanged(); @@ -1148,11 +1149,17 @@ void QSortFilterProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation or emit q->headerDataChanged(orientation, proxy_start, proxy_end); } +void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset() +{ + Q_Q(QSortFilterProxyModel); + q->beginResetModel(); +} + void QSortFilterProxyModelPrivate::_q_sourceReset() { Q_Q(QSortFilterProxyModel); // All internal structures are deleted in clear() - q->reset(); + q->endResetModel(); update_source_sort_column(); if (dynamic_sortfilter) sort(); @@ -1499,6 +1506,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) disconnect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_sourceLayoutChanged())); + disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset())); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset())); QAbstractProxyModel::setSourceModel(sourceModel); @@ -1539,6 +1547,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) connect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_sourceLayoutChanged())); + connect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset())); connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset())); d->clear_mapping(); diff --git a/src/gui/itemviews/qsortfilterproxymodel.h b/src/gui/itemviews/qsortfilterproxymodel.h index 12baa19..0314aec 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.h +++ b/src/gui/itemviews/qsortfilterproxymodel.h @@ -177,6 +177,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceAboutToBeReset()) Q_PRIVATE_SLOT(d_func(), void _q_sourceReset()) Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged()) Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged()) diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index b04aea2..b7c9703 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -226,6 +226,8 @@ QTableWidgetItem *QTableModel::takeItem(int row, int column) itm->view = 0; itm->d->id = -1; tableItems[i] = 0; + QModelIndex ind = index(itm); + emit dataChanged(ind, ind); } return itm; } @@ -2115,8 +2117,8 @@ QTableWidgetItem *QTableWidget::currentItem() const /*! Sets the current item to \a item. - Depending on the current \l{QAbstractItemView::SelectionMode}{selection mode}, - the item may also be selected. + Unless the selection mode is \l{QAbstractItemView::}{NoSelection}, + the item is also be selected. \sa currentItem(), setCurrentCell() */ diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index b636284..8cc8d6c 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2784,7 +2784,8 @@ int QTreeWidget::currentColumn() const /*! Sets the current \a item in the tree widget. - Depending on the current selection mode, the item may also be selected. + Unless the selection mode is \l{QAbstractItemView::}{NoSelection}, + the item is also be selected. \sa currentItem(), currentItemChanged() */ diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index c7d06f7..8489817 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -7,6 +7,7 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h KERNEL_P= kernel HEADERS += \ kernel/qaction.h \ + kernel/qaction_p.h \ kernel/qactiongroup.h \ kernel/qapplication.h \ kernel/qapplication_p.h \ diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 00cba04..f5e1f29 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -262,6 +262,11 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \c{Info.plist} file in the application's bundle (See \l{Deploying an Application on Mac OS X}). \value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu. \value QuitRole This action should be placed where the Quit menu item is in the application menu. + + Setting this value only has effect on items that are in the immediate menus + of the menubar, not the submenus of those menus. For example, if you have + File menu in your menubar and the File menu has a submenu, setting the + MenuRole for the actions in that submenu have no effect. They will never be moved. */ /*! diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e839617..f7f8ce9 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -264,12 +264,15 @@ typedef struct tagGESTURECONFIG class QPanGesture; class QPinchGesture; +class QSwipeGesture; + struct QStandardGestures { QPanGesture *pan; QPinchGesture *pinch; + QSwipeGesture *swipe; - QStandardGestures() : pan(0), pinch(0) { } + QStandardGestures() : pan(0), pinch(0), swipe(0) { } }; diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index f7a7ab0..5340ae9 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -72,6 +72,7 @@ //#include "qwsregionmanager_qws.h" #include "qwindowsystem_qws.h" #include "private/qwindowsystem_p.h" +#include "qdecorationfactory_qws.h" #include "qwsdisplay_qws.h" #include "private/qwsdisplay_qws_p.h" @@ -122,6 +123,8 @@ #endif #endif +QT_BEGIN_NAMESPACE + #ifndef QT_NO_DIRECTPAINTER class QDirectPainter; extern void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type); @@ -161,13 +164,9 @@ int qt_servershmid = -1; bool qws_overrideCursor = false; #ifndef QT_NO_QWS_MANAGER -#include "qdecorationfactory_qws.h" extern Q_GUI_EXPORT QWSServer *qwsServer; -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE static QDecoration *qws_decoration = 0; #endif @@ -2371,7 +2370,7 @@ void qt_cleanup() QString QApplicationPrivate::appName() const // get application name { - return ::appName; + return QT_PREPEND_NAMESPACE(appName); } /***************************************************************************** diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 12cd879..b92bf03 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -171,6 +171,10 @@ typedef struct tagTOUCHINPUT #include <mywinsock.h> #endif +#ifndef IMR_CONFIRMRECONVERTSTRING +#define IMR_CONFIRMRECONVERTSTRING 0x0005 +#endif + QT_BEGIN_NAMESPACE #ifdef Q_WS_WINCE @@ -323,6 +327,7 @@ extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int #define APPCOMMAND_BASS_UP 21 #define APPCOMMAND_TREBLE_DOWN 22 #define APPCOMMAND_TREBLE_UP 23 +#endif // FAPPCOMMAND_MOUSE // New commands from Windows XP (some even Sp1) #ifndef APPCOMMAND_MICROPHONE_VOLUME_MUTE @@ -357,8 +362,6 @@ extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int #define APPCOMMAND_MEDIA_CHANNEL_DOWN 52 #endif // APPCOMMAND_MICROPHONE_VOLUME_MUTE -#endif // FAPPCOMMAND_MOUSE - #if (_WIN32_WINNT < 0x0400) // This struct is defined in winuser.h if the _WIN32_WINNT >= 0x0400 -- in the // other cases we have to define it on our own. @@ -2264,7 +2267,26 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } break; } - + case WM_IME_REQUEST: { + QWidget *fw = QApplication::focusWidget(); + QWinInputContext *im = fw ? qobject_cast<QWinInputContext *>(fw->inputContext()) : 0; + if (fw && im) { + if(wParam == IMR_RECONVERTSTRING) { + int ret = im->reconvertString((RECONVERTSTRING *)lParam); + if (ret == -1) { + result = false; + } else { + return ret; + } + } else if (wParam == IMR_CONFIRMRECONVERTSTRING) { + RETURN(TRUE); + } else { + // in all other cases, call DefWindowProc() + result = false; + } + } + break; + } #ifndef Q_WS_WINCE case WM_CHANGECBCHAIN: case WM_DRAWCLIPBOARD: diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 0d07a02..170224d 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -1915,9 +1915,12 @@ void qt_init(QApplicationPrivate *priv, int, bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0; if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) { Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display)); - X11->use_mitshm = mitshm_pixmaps && (defaultVisual->red_mask == 0xff0000 - && defaultVisual->green_mask == 0xff00 - && defaultVisual->blue_mask == 0xff); + X11->use_mitshm = mitshm_pixmaps && ((defaultVisual->red_mask == 0xff0000 + || defaultVisual->red_mask == 0xf800) + && (defaultVisual->green_mask == 0xff00 + || defaultVisual->green_mask == 0x7e0) + && (defaultVisual->blue_mask == 0xff + || defaultVisual->blue_mask == 0x1f)); } } #endif // QT_NO_MITSHM @@ -5401,7 +5404,8 @@ class QSessionManagerPrivate : public QObjectPrivate { public: QSessionManagerPrivate(QSessionManager* mgr, QString& id, QString& key) - : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key), eventLoop(0) {} + : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key), + restartHint(QSessionManager::RestartIfRunning), eventLoop(0) {} QSessionManager* sm; QStringList restartCommand; QStringList discardCommand; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 5a0209d..0a45ce9 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -892,7 +892,7 @@ extern "C" { qNGEvent.gestureType = QNativeGestureEvent::Rotate; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); - qNGEvent.percentage = [event rotation]; + qNGEvent.percentage = -[event rotation]; qt_sendSpontaneousEvent(qwidget, &qNGEvent); } @@ -905,7 +905,14 @@ extern "C" { qNGEvent.gestureType = QNativeGestureEvent::Swipe; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); - qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]); + if ([event deltaX] == 1) + qNGEvent.angle = 180.0f; + else if ([event deltaX] == -1) + qNGEvent.angle = 0.0f; + else if ([event deltaY] == 1) + qNGEvent.angle = 90.0f; + else if ([event deltaY] == -1) + qNGEvent.angle = 270.0f; qt_sendSpontaneousEvent(qwidget, &qNGEvent); } @@ -976,6 +983,15 @@ extern "C" { return qwidget->focusPolicy() != Qt::NoFocus; } +- (BOOL)resignFirstResponder +{ + // Seems like the following test only triggers if this + // view is inside a QMacNativeWidget: + if (qwidget == QApplication::focusWidget()) + QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); + return YES; +} + - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { Q_UNUSED(isLocal); diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index d93fa2f..443a118 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -59,6 +59,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetPrivate); QT_FORWARD_DECLARE_CLASS(QWidget); QT_FORWARD_DECLARE_CLASS(QEvent); QT_FORWARD_DECLARE_CLASS(QCocoaDropData); +QT_FORWARD_DECLARE_CLASS(QString); QT_FORWARD_DECLARE_CLASS(QStringList); QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 76d52c7..9626193 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3544,7 +3544,8 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) #endif -/*! \class QTouchEvent +/*! + \class QTouchEvent \brief The QTouchEvent class contains parameters that describe a touch event. \since 4.6 \ingroup events @@ -3556,27 +3557,19 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} attribute set to true. - Note: when using QAbstractScrollArea based widgets, you should enabled the - Qt::WA_AcceptTouchEvents attribute on the scroll area's - \l{QAbstractScrollArea::viewport()}{viewport}. + When using QAbstractScrollArea based widgets, you should enabled the Qt::WA_AcceptTouchEvents + attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}. - \section1 Event Delivery and Propagation + Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a + widget, and the widget will receive all updates for the touch point until it is released. + Note that it is possible for a widget to receive events for multiple touch points, and that + multiple widgets may be receiving touch events at the same time. + + \section1 Event Handling All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd. Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for widgets and - QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events. By default, - QWidget::event() translates the first non-primary touch point in a QTouchEvent into a - QMouseEvent. This makes it possible to enable touch events on existing widgets that do not - normally handle QTouchEvent. See below for information on some special considerations needed - when doing this. - - QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event - contains a special accept flag that indicates whether the receiver wants the event. By default, - the event is accepted. You should call ignore() if the touch event is not handled by your - widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget - accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the - QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event - propagation for QGraphicsItems). + QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events. The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not @@ -3587,10 +3580,20 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) Information about each touch point can be retrieved using the QTouchEvent::TouchPoint class. The Qt::TouchPointState enum describes the different states that a touch point may have. - Similar to QMouseEvent, Qt automatically grabs each touch point on the first press inside a - widget; the widget will receive all updates for the touch point until it is released. Note that - it is possible for a widget to receive events for multiple touch points, and that multiple - widgets may be receiving touch events at the same time. + \section1 Event Delivery and Propagation + + By default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into + a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not + normally handle QTouchEvent. See below for information on some special considerations needed + when doing this. + + QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event + contains a special accept flag that indicates whether the receiver wants the event. By default, + the event is accepted. You should call ignore() if the touch event is not handled by your + widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget + accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the + QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event + propagation for QGraphicsItems). \section1 Touch Point Grouping @@ -3604,7 +3607,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) \list \i When the first touch point is detected, the destination widget is determined firstly by the - location on screen first and secondly by the propagation rules. + location on screen and secondly by the propagation rules. \i When additional touch points are detected, Qt first looks to see if there are any active touch points on any ancestor or descendent of the widget under the new touch point. If there @@ -3637,17 +3640,17 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, this gives you great flexibility in designing multi-touch user interfaces. Be aware of the implications. For example, is is possible that the user is moving a QSlider with one finger and - pressing a QPushButton with another. The signals are emitted from these widgets will be + pressing a QPushButton with another. The signals emitted by these widgets will be interleaved. - \i Recursion into the event loop using one of the exec() methods (e.g. QDialog::exec() or + \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event recipients, unexpected recursion may cause problems, including but not limited to lost events and unexpected infinite recursion. \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an - \l{QApplication::activePopupWidget()}{active popup widget}. The behavior of QTouchEvents is - undefined when opening a popup or grabbing the mouse while there are multiple active touch + \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is + undefined when opening a pop-up or grabbing the mouse while there are multiple active touch points. \endlist diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index a26f585..11d3138 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -143,7 +143,7 @@ public: Type gestureType; float percentage; QPoint position; - QSize direction; + float angle; #ifdef Q_WS_WIN ulong sequenceId; quint64 argument; diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index 9e8de67..2e9514d 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -68,6 +68,12 @@ #include "qmap.h" #include <private/qt_mac_p.h> + +#ifdef Q_WS_MAC32 +#include <QuickTime/QuickTime.h> +#include <qlibrary.h> +#endif + QT_BEGIN_NAMESPACE extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp @@ -503,9 +509,6 @@ QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim // This can be removed once 10.6 is the minimum (or we have to require 64-bit) whichever comes first. -#include <QuickTime/QuickTime.h> -#include <qlibrary.h> - typedef ComponentResult (*PtrGraphicsImportSetDataHandle)(GraphicsImportComponent, Handle); typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32); typedef ComponentResult (*PtrGraphicsExportSetInputCGImage)(GraphicsExportComponent, CGImageRef); @@ -636,7 +639,9 @@ QList<QByteArray> QMacPasteboardMimePict::convertFromMime(const QString &mime, Q DisposeHandle(pic); return ret; } -#endif + + +#endif //Q_WS_MAC32 class QMacPasteboardMimeTiff : public QMacPasteboardMime { public: diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp index fa32dcd..83e9c5e 100644 --- a/src/gui/kernel/qsound_qws.cpp +++ b/src/gui/kernel/qsound_qws.cpp @@ -53,16 +53,16 @@ #include "qhash.h" #include "qfileinfo.h" -#ifdef MEDIA_SERVER #include "qbytearray.h" #include "quuid.h" #include "qdatastream.h" #include "qcopchannel_qws.h" #include "qbuffer.h" + QT_BEGIN_NAMESPACE -QT_USE_NAMESPACE +#ifdef MEDIA_SERVER #define SERVER_CHANNEL "QPE/MediaServer" diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index d798d32..de6e7c7 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -72,6 +72,7 @@ QWidgetPrivate *qt_widget_private(QWidget *widget); QPanGesture::QPanGesture(QWidget *gestureTarget, QObject *parent) : QGesture(*new QPanGesturePrivate, gestureTarget, parent) { + setObjectName(QLatin1String("QPanGesture")); } void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget) @@ -80,16 +81,22 @@ void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget) if (gestureTarget && gestureTarget->isWidgetType()) { QWidget *w = static_cast<QWidget*>(gestureTarget.data()); QApplicationPrivate::instance()->widgetGestures[w].pan = 0; -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) qt_widget_private(w)->winSetupGestures(); +#elif defined(Q_WS_MAC) + w->setAttribute(Qt::WA_AcceptTouchEvents, false); + w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents, false); #endif } if (newGestureTarget && newGestureTarget->isWidgetType()) { QWidget *w = static_cast<QWidget*>(newGestureTarget); QApplicationPrivate::instance()->widgetGestures[w].pan = q; -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) qt_widget_private(w)->winSetupGestures(); +#elif defined(Q_WS_MAC) + w->setAttribute(Qt::WA_AcceptTouchEvents); + w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); #endif } QGesturePrivate::setupGestureTarget(newGestureTarget); @@ -98,15 +105,13 @@ void QPanGesturePrivate::setupGestureTarget(QObject *newGestureTarget) /*! \internal */ bool QPanGesture::event(QEvent *event) { -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) +#if defined(QT_MAC_USE_COCOA) Q_D(QPanGesture); if (event->type() == QEvent::Timer) { const QTimerEvent *te = static_cast<QTimerEvent *>(event); - if (te->timerId() == d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - d->lastOffset = QSize(0, 0); - updateState(Qt::GestureFinished); + if (te->timerId() == d->singleTouchPanTimer.timerId()) { + d->singleTouchPanTimer.stop(); + updateState(Qt::GestureStarted); } } #endif @@ -164,8 +169,10 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) /*! \internal */ bool QPanGesture::filterEvent(QEvent *event) { +#if defined(Q_WS_WIN) Q_D(QPanGesture); const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); + if (event->type() == QEvent::TouchBegin) { QTouchEvent::TouchPoint p = ev->touchPoints().at(0); d->lastPosition = p.pos().toPoint(); @@ -197,33 +204,55 @@ bool QPanGesture::filterEvent(QEvent *event) } } } -#ifdef Q_OS_MAC - else if (event->type() == QEvent::Wheel) { - // On Mac, there is really no native panning gesture. Instead, a two - // finger pan is delivered as mouse wheel events. Otoh, on Windows, you - // either get mouse wheel events or pan events. We have decided to make this - // the Qt behaviour as well, meaning that on Mac, wheel - // events will be masked away when listening for pan events. -#ifndef QT_MAC_USE_COCOA - // In Carbon we receive neither touch-, nor pan gesture events. - // So we create pan gestures by converting wheel events. After all, this - // is how things are supposed to work on mac in the first place. - const QWheelEvent *wev = static_cast<const QWheelEvent*>(event); - int offset = wev->delta() / -120; - d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset); +#elif defined(QT_MAC_USE_COCOA) + // The following implements single touch + // panning on Mac: + Q_D(QPanGesture); + const int panBeginDelay = 300; + const int panBeginRadius = 3; + const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); - if (state() == Qt::NoGesture) { - d->totalOffset = d->lastOffset; - } else { - d->totalOffset += d->lastOffset; + switch (event->type()) { + case QEvent::TouchBegin: { + if (ev->touchPoints().size() == 1) { + d->lastPosition = QCursor::pos(); + d->singleTouchPanTimer.start(panBeginDelay, this); } - - killTimer(d->panFinishedTimer); - d->panFinishedTimer = startTimer(200); - updateState(Qt::GestureUpdated); -#endif - return true; + break;} + case QEvent::TouchEnd: { + if (state() != Qt::NoGesture) + updateState(Qt::GestureFinished); + reset(); + break;} + case QEvent::TouchUpdate: { + if (ev->touchPoints().size() == 1) { + if (state() == Qt::NoGesture) { + // INVARIANT: The singleTouchTimer has still not fired. + // Lets check if the user moved his finger so much from + // the starting point that it makes sense to cancel: + const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint(); + const QPointF p = ev->touchPoints().at(0).pos().toPoint(); + if ((startPos - p).manhattanLength() > panBeginRadius) + reset(); + else + d->lastPosition = QCursor::pos(); + } else { + QPointF mousePos = QCursor::pos(); + QPointF dist = mousePos - d->lastPosition; + d->lastPosition = mousePos; + d->lastOffset = QSizeF(dist.x(), dist.y()); + d->totalOffset += d->lastOffset; + updateState(Qt::GestureUpdated); + } + } else if (state() == Qt::NoGesture) { + reset(); + } + break;} + default: + return false; } +#else + Q_UNUSED(event); #endif return false; } @@ -232,14 +261,14 @@ bool QPanGesture::filterEvent(QEvent *event) void QPanGesture::reset() { Q_D(QPanGesture); - d->lastOffset = d->totalOffset = QSize(); - d->lastPosition = QPoint(); -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - if (d->panFinishedTimer) { - killTimer(d->panFinishedTimer); - d->panFinishedTimer = 0; - } + d->lastOffset = d->totalOffset = QSize(0, 0); + d->lastPosition = QPoint(0, 0); + +#if defined(QT_MAC_USE_COCOA) + d->singleTouchPanTimer.stop(); + d->prevMousePos = QPointF(0, 0); #endif + QGesture::reset(); } @@ -248,7 +277,7 @@ void QPanGesture::reset() Specifies a total pan offset since the start of the gesture. */ -QSize QPanGesture::totalOffset() const +QSizeF QPanGesture::totalOffset() const { Q_D(const QPanGesture); return d->totalOffset; @@ -260,12 +289,13 @@ QSize QPanGesture::totalOffset() const Specifies a pan offset since the last time the gesture was triggered. */ -QSize QPanGesture::lastOffset() const +QSizeF QPanGesture::lastOffset() const { Q_D(const QPanGesture); return d->lastOffset; } +////////////////////////////////////////////////////////////////////////////// /*! \class QPinchGesture @@ -285,6 +315,7 @@ QSize QPanGesture::lastOffset() const QPinchGesture::QPinchGesture(QWidget *gestureTarget, QObject *parent) : QGesture(*new QPinchGesturePrivate, gestureTarget, parent) { + setObjectName(QLatin1String("QPinchGesture")); } void QPinchGesturePrivate::setupGestureTarget(QObject *newGestureTarget) @@ -338,12 +369,13 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) d->state = Qt::NoGesture; d->scaleFactor = d->lastScaleFactor = 1; d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); + d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF(); #if defined(Q_WS_WIN) d->initialDistance = 0; #endif return false; case QNativeGestureEvent::Rotate: + d->scaleFactor = 0; d->lastRotationAngle = d->rotationAngle; #if defined(Q_WS_WIN) d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument); @@ -354,6 +386,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) event->accept(); break; case QNativeGestureEvent::Zoom: + d->rotationAngle = 0; #if defined(Q_WS_WIN) if (d->initialDistance != 0) { d->lastScaleFactor = d->scaleFactor; @@ -402,7 +435,7 @@ void QPinchGesture::reset() Q_D(QPinchGesture); d->scaleFactor = d->lastScaleFactor = 0; d->rotationAngle = d->lastRotationAngle = 0; - d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint(); + d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF(); QGesture::reset(); } @@ -452,7 +485,7 @@ qreal QPinchGesture::lastRotationAngle() const Specifies a center point of the gesture. The point can be used as a center point that the object is rotated around. */ -QPoint QPinchGesture::centerPoint() const +QPointF QPinchGesture::centerPoint() const { return d_func()->centerPoint; } @@ -462,7 +495,7 @@ QPoint QPinchGesture::centerPoint() const Specifies a previous center point of the gesture. */ -QPoint QPinchGesture::lastCenterPoint() const +QPointF QPinchGesture::lastCenterPoint() const { return d_func()->lastCenterPoint; } @@ -474,11 +507,117 @@ QPoint QPinchGesture::lastCenterPoint() const startCenterPoint and the centerPoint is the distance at which pinching fingers has shifted. */ -QPoint QPinchGesture::startCenterPoint() const +QPointF QPinchGesture::startCenterPoint() const { return d_func()->startCenterPoint; } +////////////////////////////////////////////////////////////////////////////// + +/*! + \class QSwipeGesture + \since 4.6 + + \brief The QSwipeGesture class represents a swipe gesture, + providing additional information related to swiping. +*/ + +/*! + Creates a new Swipe gesture handler object and marks it as a child of \a + parent. + + On some platform like Windows it's necessary to provide a non-null widget + as \a parent to get native gesture support. +*/ +QSwipeGesture::QSwipeGesture(QWidget *gestureTarget, QObject *parent) + : QGesture(*new QSwipeGesturePrivate, gestureTarget, parent) +{ + setObjectName(QLatin1String("QSwipeGesture")); +} + +void QSwipeGesturePrivate::setupGestureTarget(QObject *newGestureTarget) +{ + Q_Q(QSwipeGesture); + if (gestureTarget && gestureTarget->isWidgetType()) { + QWidget *w = static_cast<QWidget*>(gestureTarget.data()); + QApplicationPrivate::instance()->widgetGestures[w].swipe = 0; +#if defined(Q_WS_WIN) + qt_widget_private(w)->winSetupGestures(); +#endif + } + + if (newGestureTarget && newGestureTarget->isWidgetType()) { + QWidget *w = static_cast<QWidget*>(newGestureTarget); + QApplicationPrivate::instance()->widgetGestures[w].swipe = q; +#if defined(Q_WS_WIN) + qt_widget_private(w)->winSetupGestures(); +#endif + } + QGesturePrivate::setupGestureTarget(newGestureTarget); +} + +qreal QSwipeGesture::swipeAngle() const +{ + Q_D(const QSwipeGesture); + return d->swipeAngle; +} + +QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const +{ + Q_D(const QSwipeGesture); + if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270) + return QSwipeGesture::NoDirection; + else if (d->swipeAngle < 90 || d->swipeAngle > 270) + return QSwipeGesture::Right; + else + return QSwipeGesture::Left; +} + +QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const +{ + Q_D(const QSwipeGesture); + if (d->swipeAngle <= 0 || d->swipeAngle == 180) + return QSwipeGesture::NoDirection; + else if (d->swipeAngle < 180) + return QSwipeGesture::Up; + else + return QSwipeGesture::Down; +} + +bool QSwipeGesture::eventFilter(QObject *receiver, QEvent *event) +{ + Q_D(QSwipeGesture); + if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { + QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event); + switch (ev->gestureType) { + case QNativeGestureEvent::Swipe: + d->swipeAngle = ev->angle; + updateState(Qt::GestureStarted); + updateState(Qt::GestureUpdated); + updateState(Qt::GestureFinished); + break; + default: + return false; + } + return true; + } + return QGesture::eventFilter(receiver, event); +} + +/*! \internal */ +bool QSwipeGesture::filterEvent(QEvent *) +{ + return false; +} + +/*! \internal */ +void QSwipeGesture::reset() +{ + Q_D(QSwipeGesture); + d->swipeAngle = -1; + QGesture::reset(); +} + QT_END_NAMESPACE #include "moc_qstandardgestures.cpp" diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h index 0eb9d92..029e6dc 100644 --- a/src/gui/kernel/qstandardgestures.h +++ b/src/gui/kernel/qstandardgestures.h @@ -59,16 +59,16 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) - Q_PROPERTY(QSize totalOffset READ totalOffset) - Q_PROPERTY(QSize lastOffset READ lastOffset) + Q_PROPERTY(QSizeF totalOffset READ totalOffset) + Q_PROPERTY(QSizeF lastOffset READ lastOffset) public: QPanGesture(QWidget *gestureTarget, QObject *parent = 0); bool filterEvent(QEvent *event); - QSize totalOffset() const; - QSize lastOffset() const; + QSizeF totalOffset() const; + QSizeF lastOffset() const; protected: void reset(); @@ -92,9 +92,9 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture Q_PROPERTY(qreal rotationAngle READ rotationAngle) Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle) - Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint) - Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint) - Q_PROPERTY(QPoint centerPoint READ centerPoint) + Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint) + Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint) + Q_PROPERTY(QPointF centerPoint READ centerPoint) public: QPinchGesture(QWidget *gestureTarget, QObject *parent = 0); @@ -102,9 +102,9 @@ public: bool filterEvent(QEvent *event); void reset(); - QPoint startCenterPoint() const; - QPoint lastCenterPoint() const; - QPoint centerPoint() const; + QPointF startCenterPoint() const; + QPointF lastCenterPoint() const; + QPointF centerPoint() const; qreal scaleFactor() const; qreal lastScaleFactor() const; @@ -119,6 +119,34 @@ private: friend class QWidget; }; +class QSwipeGesturePrivate; +class Q_GUI_EXPORT QSwipeGesture : public QGesture +{ + Q_OBJECT + Q_ENUMS(SwipeDirection) + + Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection) + Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection) + Q_PROPERTY(qreal swipeAngle READ swipeAngle) + + Q_DECLARE_PRIVATE(QSwipeGesture) + +public: + enum SwipeDirection { NoDirection, Left, Right, Up, Down }; + QSwipeGesture(QWidget *gestureTarget, QObject *parent = 0); + + bool filterEvent(QEvent *event); + void reset(); + + SwipeDirection horizontalDirection() const; + SwipeDirection verticalDirection() const; + qreal swipeAngle() const; + +private: + bool eventFilter(QObject *receiver, QEvent *event); + + friend class QWidget; +}; QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 5fbcc5d..9829cf0 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -61,6 +61,7 @@ #include "qgesture_p.h" #include "qstandardgestures.h" +#include "qbasictimer.h" QT_BEGIN_NAMESPACE @@ -69,21 +70,15 @@ class QPanGesturePrivate : public QGesturePrivate Q_DECLARE_PUBLIC(QPanGesture) public: - QPanGesturePrivate() - { -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - panFinishedTimer = 0; -#endif - } - void setupGestureTarget(QObject *o); - QSize totalOffset; - QSize lastOffset; - QPoint lastPosition; + QSizeF totalOffset; + QSizeF lastOffset; + QPointF lastPosition; -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - int panFinishedTimer; +#if defined(QT_MAC_USE_COCOA) + QBasicTimer singleTouchPanTimer; + QPointF prevMousePos; #endif }; @@ -107,14 +102,28 @@ public: qreal lastScaleFactor; qreal rotationAngle; qreal lastRotationAngle; - QPoint startCenterPoint; - QPoint lastCenterPoint; - QPoint centerPoint; + QPointF startCenterPoint; + QPointF lastCenterPoint; + QPointF centerPoint; #ifdef Q_WS_WIN int initialDistance; #endif }; +class QSwipeGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QSwipeGesture) + +public: + QSwipeGesturePrivate() + : swipeAngle(-1) + { + } + + void setupGestureTarget(QObject *o); + qreal swipeAngle; +}; + QT_END_NAMESPACE #endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index bbda469..38b09ee 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -187,6 +187,9 @@ QWidgetPrivate::QWidgetPrivate(int version) , extraPaintEngine(0) , polished(0) , graphicsEffect(0) +#if !defined(QT_NO_IM) + , imHints(Qt::ImhNone) +#endif , inheritedFontResolveMask(0) , inheritedPaletteResolveMask(0) , leftmargin(0) @@ -217,7 +220,6 @@ QWidgetPrivate::QWidgetPrivate(int version) , window_event(0) , qd_hd(0) #endif - ,imHints(Qt::ImhNone) { if (!qApp) { qFatal("QWidget: Must construct a QApplication before a QPaintDevice"); @@ -971,7 +973,10 @@ struct QWidgetExceptionCleaner /* this cleans up when the constructor throws an exception */ static inline void cleanup(QWidget *that, QWidgetPrivate *d) { -#ifndef QT_NO_EXCEPTIONS +#ifdef QT_NO_EXCEPTIONS + Q_UNUSED(that); + Q_UNUSED(d); +#else QWidgetPrivate::allWidgets->remove(that); if (d->focus_next != that) { if (d->focus_next) @@ -4172,6 +4177,10 @@ QPalette::ColorRole QWidget::backgroundRole() const If \a role is QPalette::NoRole, then the widget inherits its parent's background role. + Note that styles are free to choose any color from the palette. + You can modify the palette or set a style sheet if you don't + achieve the result you want with setBackgroundRole(). + \sa backgroundRole(), foregroundRole() */ @@ -4234,6 +4243,10 @@ QPalette::ColorRole QWidget::foregroundRole() const If \a role is QPalette::NoRole, the widget uses a foreground role that contrasts with the background role. + Note that styles are free to choose any color from the palette. + You can modify the palette or set a style sheet if you don't + achieve the result you want with setForegroundRole(). + \sa foregroundRole(), backgroundRole() */ void QWidget::setForegroundRole(QPalette::ColorRole role) @@ -4965,6 +4978,13 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys) } #endif // !defined(Q_OS_SYMBIAN) +/*! + Returns a pointer to this widget's effect if it has one; otherwise 0. + + \since 4.6 + + \sa setGraphicsEffect() +*/ QGraphicsEffect *QWidget::graphicsEffect() const { Q_D(const QWidget); @@ -4982,6 +5002,8 @@ QGraphicsEffect *QWidget::graphicsEffect() const \note This function will apply the effect on itself and all its children. \since 4.6 + + \sa graphicsEffect() */ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) { @@ -5964,8 +5986,6 @@ bool QWidget::hasFocus() const void QWidget::setFocus(Qt::FocusReason reason) { - Q_D(QWidget); - if (!isEnabled()) return; @@ -6233,6 +6253,10 @@ bool QWidget::isActiveWindow() const if(qt_mac_is_macdrawer(tlw) && tlw->parentWidget() && tlw->parentWidget()->isActiveWindow()) return true; + + extern bool qt_mac_insideKeyWindow(const QWidget *); //qwidget_mac.cpp + if (QApplication::testAttribute(Qt::AA_MacPluginApplication) && qt_mac_insideKeyWindow(tlw)) + return true; #endif if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) { if(tlw->windowType() == Qt::Tool && @@ -11822,10 +11846,9 @@ const QList<QAction*>& QWidget::softKeys() const \preliminary \since 4.6 - Sets the softkey \a softkey to this widget's list of softkeys, + Sets the softkey \a softKey to this widget's list of softkeys. Setting 0 as softkey will clear all the existing softkeys set - to the widget - A QWidget can have 0 or more softkeys + to the widget. A QWidget can have 0 or more softkeys. \sa softKeys(), setSoftKeys() */ @@ -11842,8 +11865,8 @@ void QWidget::setSoftKey(QAction *softKey) } /*! - Sets the list of softkeys \a softkeys to this widget's list of softkeys, - A QWidget can have 0 or more softkeys + Sets the list of softkeys \a softKeys to this widget's list of softkeys. + A QWidget can have 0 or more softkeys. \sa softKeys(), setSoftKey() */ diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ea5a53e..cdf0706 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -301,6 +301,14 @@ bool qt_mac_is_macdrawer(const QWidget *w) return (w && w->parentWidget() && w->windowType() == Qt::Drawer); } +bool qt_mac_insideKeyWindow(const QWidget *w) +{ +#ifdef QT_MAC_USE_COCOA + return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow]; +#endif + return false; +} + bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where) //users of Qt for Mac OS X can use this.. { if(!qt_mac_is_macdrawer(w)) @@ -1056,7 +1064,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, break; } qNGEvent.gestureType = QNativeGestureEvent::Rotate; - qNGEvent.percentage = float(amount); + qNGEvent.percentage = float(-amount); break; } case kEventGestureSwipe: { HIPoint swipeDirection; @@ -1066,7 +1074,14 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, break; } qNGEvent.gestureType = QNativeGestureEvent::Swipe; - qNGEvent.direction = QSize(-swipeDirection.x, -swipeDirection.y); + if (swipeDirection.x == 1) + qNGEvent.angle = 180.0f; + else if (swipeDirection.x == -1) + qNGEvent.angle = 0.0f; + else if (swipeDirection.y == 1) + qNGEvent.angle = 90.0f; + else if (swipeDirection.y == -1) + qNGEvent.angle = 270.0f; break; } case kEventGestureMagnify: { CGFloat amount; diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index bcc9cfd..fa71925 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -316,7 +316,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (desktop) { q->setAttribute(Qt::WA_WState_Visible); - } else if (topLevel) { + } else if (topLevel && !q->testAttribute(Qt::WA_DontShowOnScreen)) { RECT cr; GetClientRect(id, &cr); // one cannot trust cr.left and cr.top, use a correction POINT instead diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 36ffcbe..eb87052 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1450,7 +1450,7 @@ static const qreal inv_dist_to_plane = 1. / 1024.; value of 1024 corresponds to the projection factor used by QTransform::rotate() for the x and y axes. - If \a distToPlane is zero, then the returned QTransform + If \a distanceToPlane is zero, then the returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 0fffaef..4665b66 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -1544,7 +1544,8 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) // QGLWidget does not support partial updates if: // 1) The context is double buffered // 2) The context is single buffered and auto-fill background is enabled. - const bool noPartialUpdateSupport = (engine && engine->type() == QPaintEngine::OpenGL) + const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL + || engine->type() == QPaintEngine::OpenGL2)) && (usesDoubleBufferedGLContext || q->autoFillBackground()); QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index b005842..b7179a4 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -389,20 +389,20 @@ void QBrush::init(const QColor &color, Qt::BrushStyle style) { switch(style) { case Qt::NoBrush: - d.data_ptr() = nullBrushInstance(); + d.reset(nullBrushInstance()); d->ref.ref(); if (d->color != color) setColor(color); return; case Qt::TexturePattern: - d.data_ptr() = new QTexturedBrushData; + d.reset(new QTexturedBrushData); break; case Qt::LinearGradientPattern: case Qt::RadialGradientPattern: case Qt::ConicalGradientPattern: - d.data_ptr() = new QGradientBrushData; + d.reset(new QGradientBrushData); break; default: - d.data_ptr() = new QBrushData; + d.reset(new QBrushData); break; } d->ref = 1; @@ -460,7 +460,7 @@ QBrush::QBrush(Qt::BrushStyle style) if (qbrush_check_type(style)) init(Qt::black, style); else { - d.data_ptr() = nullBrushInstance(); + d.reset(nullBrushInstance()); d->ref.ref(); } } @@ -476,7 +476,7 @@ QBrush::QBrush(const QColor &color, Qt::BrushStyle style) if (qbrush_check_type(style)) init(color, style); else { - d.data_ptr() = nullBrushInstance(); + d.reset(nullBrushInstance()); d->ref.ref(); } } @@ -493,7 +493,7 @@ QBrush::QBrush(Qt::GlobalColor color, Qt::BrushStyle style) if (qbrush_check_type(style)) init(color, style); else { - d.data_ptr() = nullBrushInstance(); + d.reset(nullBrushInstance()); d->ref.ref(); } } @@ -625,7 +625,7 @@ void QBrush::detach(Qt::BrushStyle newStyle) QBrush &QBrush::operator=(const QBrush &b) { - if (this == &b) + if (d == b.d) return *this; b.d->ref.ref(); diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 51b108e..9f9819c 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -137,13 +137,13 @@ private: friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush); void detach(Qt::BrushStyle newStyle); void init(const QColor &color, Qt::BrushStyle bs); - QCustomScopedPointer<QBrushData, QBrushDataPointerDeleter> d; + QScopedPointer<QBrushData, QBrushDataPointerDeleter> d; void cleanUp(QBrushData *x); public: inline bool isDetached() const; - typedef QBrushData * DataPtr; - inline DataPtr &data_ptr() { return d.data_ptr(); } + typedef QScopedPointer<QBrushData, QBrushDataPointerDeleter> DataPtr; + inline DataPtr &data_ptr() { return d; } }; inline void QBrush::setColor(Qt::GlobalColor acolor) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 4e93f04..ef884bd 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -237,6 +237,15 @@ QT_BEGIN_NAMESPACE alpha-channel to feature \l {QColor#Alpha-Blended Drawing}{alpha-blended drawing}. + \section1 The HSL Color Model + + HSL is similar to HSV. Instead of value parameter from HSV, + HSL has the lightness parameter. + The lightness parameter goes from black to color and from color to white. + If you go outside at the night its black or dark gray. At day its colorful but + if you look in a really strong light a things they are going to white and + wash out. + \section1 The CMYK Color Model While the RGB and HSV color models are used for display on @@ -437,6 +446,9 @@ QColor::QColor(Spec spec) case Cmyk: setCmyk(0, 0, 0, 0); break; + case Hsl: + setHsl(0, 0, 0, 0); + break; } } @@ -678,6 +690,113 @@ void QColor::setHsv(int h, int s, int v, int a) } /*! + Sets the contents pointed to by \a h, \a s, \a l, and \a a, to the hue, + saturation, lightness, and alpha-channel (transparency) components of the + color's HSL value. + + These components can be retrieved individually using the hueHslF(), + saturationHslF(), lightnessF() and alphaF() functions. + + \sa setHsl() +*/ +void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const +{ + if (!h || !s || !l) + return; + + if (cspec != Invalid && cspec != Hsl) { + toHsl().getHslF(h, s, l, a); + return; + } + + *h = ct.ahsl.hue == USHRT_MAX ? -1.0 : ct.ahsl.hue / 36000.0; + *s = ct.ahsl.saturation / qreal(USHRT_MAX); + *l = ct.ahsl.lightness / qreal(USHRT_MAX); + + if (a) + *a = ct.ahsl.alpha / qreal(USHRT_MAX); +} + +/*! + Sets the contents pointed to by \a h, \a s, \a l, and \a a, to the hue, + saturation, lightness, and alpha-channel (transparency) components of the + color's HSL value. + + These components can be retrieved individually using the hueHsl(), + saturationHsl(), lightness() and alpha() functions. + + \sa setHsl() +*/ +void QColor::getHsl(int *h, int *s, int *l, int *a) const +{ + if (!h || !s || !l) + return; + + if (cspec != Invalid && cspec != Hsl) { + toHsl().getHsl(h, s, l, a); + return; + } + + *h = ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100; + *s = ct.ahsl.saturation >> 8; + *l = ct.ahsl.lightness >> 8; + + if (a) + *a = ct.ahsl.alpha >> 8; +} + +/*! + Sets a HSL color lightness; \a h is the hue, \a s is the saturation, \a l is + the lightness and \a a is the alpha component of the HSL color. + + All the values must be in the range 0.0-1.0. + + \sa getHslF(), setHsl() +*/ +void QColor::setHslF(qreal h, qreal s, qreal l, qreal a) +{ + if (((h < 0.0 || h > 1.0) && h != -1.0) + || (s < 0.0 || s > 1.0) + || (l < 0.0 || l > 1.0) + || (a < 0.0 || a > 1.0)) { + qWarning("QColor::setHsvF: HSV parameters out of range"); + return; + } + + cspec = Hsl; + ct.ahsl.alpha = qRound(a * USHRT_MAX); + ct.ahsl.hue = h == -1.0 ? USHRT_MAX : qRound(h * 36000); + ct.ahsl.saturation = qRound(s * USHRT_MAX); + ct.ahsl.lightness = qRound(l * USHRT_MAX); + ct.ahsl.pad = 0; +} + +/*! + Sets a HSL color value; \a h is the hue, \a s is the saturation, \a l is + the lightness and \a a is the alpha component of the HSL color. + + The saturation, value and alpha-channel values must be in the range 0-255, + and the hue value must be greater than -1. + + \sa getHsl(), setHslF() +*/ +void QColor::setHsl(int h, int s, int l, int a) +{ + if (h < -1 || (uint)s > 255 || (uint)l > 255 || (uint)a > 255) { + qWarning("QColor::setHsv: HSV parameters out of range"); + invalidate(); + return; + } + + cspec = Hsl; + ct.ahsl.alpha = a * 0x101; + ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100; + ct.ahsl.saturation = s * 0x101; + ct.ahsl.lightness = l * 0x101; + ct.ahsl.pad = 0; +} + +/*! Sets the contents pointed to by \a r, \a g, \a b, and \a a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value. @@ -1082,11 +1201,25 @@ void QColor::setBlueF(qreal blue) /*! Returns the hue color component of this color. - \sa hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color + The color is implicitly converted to HSV. + + \sa hsvHue(), hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ + int QColor::hue() const { + return hsvHue(); +} + +/*! + Returns the hue color component of this color. + + \sa hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color + Model} +*/ +int QColor::hsvHue() const +{ if (cspec != Invalid && cspec != Hsv) return toHsv().hue(); return ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100; @@ -1095,11 +1228,25 @@ int QColor::hue() const /*! Returns the saturation color component of this color. - \sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color + The color is implicitly converted to HSV. + + \sa hsvSaturation(), saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} */ + int QColor::saturation() const { + return hsvSaturation(); +} + +/*! + Returns the saturation color component of this color. + + \sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color + Model} +*/ +int QColor::hsvSaturation() const +{ if (cspec != Invalid && cspec != Hsv) return toHsv().saturation(); return ct.ahsv.saturation >> 8; @@ -1121,11 +1268,24 @@ int QColor::value() const /*! Returns the hue color component of this color. - \sa hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color + The color is implicitly converted to HSV. + + \sa hsvHueF(), hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ qreal QColor::hueF() const { + return hsvHueF(); +} + +/*! + Returns the hue color component of this color. + + \sa hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color + Model} +*/ +qreal QColor::hsvHueF() const +{ if (cspec != Invalid && cspec != Hsv) return toHsv().hueF(); return ct.ahsv.hue == USHRT_MAX ? -1.0 : ct.ahsv.hue / 36000.0; @@ -1134,11 +1294,24 @@ qreal QColor::hueF() const /*! Returns the saturation color component of this color. - \sa saturation() getHsvF(), {QColor#The HSV Color Model}{The HSV Color + The color is implicitly converted to HSV. + + \sa hsvSaturationF(), saturation() getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} */ qreal QColor::saturationF() const { + return hsvSaturationF(); +} + +/*! + Returns the saturation color component of this color. + + \sa saturation() getHsvF(), {QColor#The HSV Color Model}{The HSV Color + Model} +*/ +qreal QColor::hsvSaturationF() const +{ if (cspec != Invalid && cspec != Hsv) return toHsv().saturationF(); return ct.ahsv.saturation / qreal(USHRT_MAX); @@ -1158,6 +1331,79 @@ qreal QColor::valueF() const } /*! + Returns the hue color component of this color. + + \sa hueHslF(), getHsl() +*/ +int QColor::hslHue() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().hslHue(); + return ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100; +} + +/*! + Returns the saturation color component of this color. + + \sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color + Model} +*/ +int QColor::hslSaturation() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().hslSaturation(); + return ct.ahsl.saturation >> 8; +} + +/*! + Returns the lightness color component of this color. + + \sa lightnessF(), getHsl() +*/ +int QColor::lightness() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().lightness(); + return ct.ahsl.lightness >> 8; +} + +/*! + Returns the hue color component of this color. + + \sa hue(), getHslF() +*/ +qreal QColor::hslHueF() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().hslHueF(); + return ct.ahsl.hue == USHRT_MAX ? -1.0 : ct.ahsl.hue / 36000.0; +} + +/*! + Returns the saturation color component of this color. + + \sa saturationHsl() getHslF() +*/ +qreal QColor::hslSaturationF() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().hslSaturationF(); + return ct.ahsl.saturation / qreal(USHRT_MAX); +} + +/*! + Returns the lightness color component of this color. + + \sa value() getHslF() +*/ +qreal QColor::lightnessF() const +{ + if (cspec != Invalid && cspec != Hsl) + return toHsl().lightnessF(); + return ct.ahsl.lightness / qreal(USHRT_MAX); +} + +/*! Returns the cyan color component of this color. \sa cyanF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK @@ -1337,6 +1583,53 @@ QColor QColor::toRgb() const } break; } + case Hsl: + { + if (ct.ahsl.saturation == 0 || ct.ahsl.hue == USHRT_MAX) { + // achromatic case + color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness; + } else if (ct.ahsl.lightness == 0) { + // lightness 0 + color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; + } else { + // chromatic case + const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.; + const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX); + const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX); + + qreal temp2; + if (l < qreal(0.5)) + temp2 = l * (qreal(1.0) + s); + else + temp2 = l + s - (l * s); + + const qreal temp1 = (qreal(2.0) * l) - temp2; + qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), + h, + h - (qreal(1.0) / qreal(3.0)) }; + + for (int i = 0; i != 3; ++i) { + if (temp3[i] < qreal(0.0)) + temp3[i] += qreal(1.0); + else if (temp3[i] > qreal(1.0)) + temp3[i] -= qreal(1.0); + + const qreal sixtemp3 = temp3[i] * qreal(6.0); + if (sixtemp3 < qreal(1.0)) + color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * USHRT_MAX); + else if ((temp3[i] * qreal(2.0)) < qreal(1.0)) + color.ct.array[i+1] = qRound(temp2 * USHRT_MAX); + else if ((temp3[i] * qreal(3.0)) < qreal(2.0)) + color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * USHRT_MAX); + else + color.ct.array[i+1] = qRound(temp1 * USHRT_MAX); + } + color.ct.argb.red = color.ct.argb.red == 1 ? 0 : color.ct.argb.red; + color.ct.argb.green = color.ct.argb.green == 1 ? 0 : color.ct.argb.green; + color.ct.argb.blue = color.ct.argb.blue == 1 ? 0 : color.ct.argb.blue; + } + break; + } case Cmyk: { const qreal c = ct.acmyk.cyan / qreal(USHRT_MAX); @@ -1414,6 +1707,62 @@ QColor QColor::toHsv() const } /*! + Creates and returns an HSL QColor based on this color. + + \sa fromHsl(), convertTo(), isValid() +*/ +QColor QColor::toHsl() const +{ + if (!isValid() || cspec == Hsl) + return *this; + + if (cspec != Rgb) + return toRgb().toHsl(); + + QColor color; + color.cspec = Hsl; + color.ct.ahsl.alpha = ct.argb.alpha; + color.ct.ahsl.pad = 0; + + const qreal r = ct.argb.red / qreal(USHRT_MAX); + const qreal g = ct.argb.green / qreal(USHRT_MAX); + const qreal b = ct.argb.blue / qreal(USHRT_MAX); + const qreal max = Q_MAX_3(r, g, b); + const qreal min = Q_MIN_3(r, g, b); + const qreal delta = max - min; + const qreal delta2 = max + min; + const qreal lightness = qreal(0.5) * delta2; + color.ct.ahsl.lightness = qRound(lightness * USHRT_MAX); + if (qFuzzyIsNull(delta)) { + // achromatic case, hue is undefined + color.ct.ahsl.hue = 0; + color.ct.ahsl.saturation = 0; + } else { + // chromatic case + qreal hue = 0; + if (lightness < qreal(0.5)) + color.ct.ahsl.saturation = qRound((delta / delta2) * USHRT_MAX); + else + color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * USHRT_MAX); + if (qFuzzyCompare(r, max)) { + hue = ((g - b) /delta); + } else if (qFuzzyCompare(g, max)) { + hue = (2.0 + (b - r) / delta); + } else if (qFuzzyCompare(b, max)) { + hue = (4.0 + (r - g) / delta); + } else { + Q_ASSERT_X(false, "QColor::toHsv", "internal error"); + } + hue *= 60.0; + if (hue < 0.0) + hue += 360.0; + color.ct.ahsl.hue = qRound(hue * 100); + } + + return color; +} + +/*! Creates and returns a CMYK QColor based on this color. \sa fromCmyk(), convertTo(), isValid(), {QColor#The CMYK Color @@ -1466,6 +1815,8 @@ QColor QColor::convertTo(QColor::Spec colorSpec) const return toHsv(); case Cmyk: return toCmyk(); + case Hsl: + return toHsl(); case Invalid: break; } @@ -1627,6 +1978,70 @@ QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a) } /*! + Static convenience function that returns a QColor constructed from the HSV + color values, \a h (hue), \a s (saturation), \a l (lightness), and \a a + (alpha-channel, i.e. transparency). + + The value of \a s, \a l, and \a a must all be in the range 0-255; the value + of \a h must be in the range 0-359. + + \sa toHsl(), fromHslF(), isValid() +*/ +QColor QColor::fromHsl(int h, int s, int l, int a) +{ + if (((h < 0 || h >= 360) && h != -1) + || s < 0 || s > 255 + || l < 0 || l > 255 + || a < 0 || a > 255) { + qWarning("QColor::fromHsv: HSV parameters out of range"); + return QColor(); + } + + QColor color; + color.cspec = Hsl; + color.ct.ahsl.alpha = a * 0x101; + color.ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100; + color.ct.ahsl.saturation = s * 0x101; + color.ct.ahsl.lightness = l * 0x101; + color.ct.ahsl.pad = 0; + return color; +} + +/*! + \overload + + Static convenience function that returns a QColor constructed from the HSV + color values, \a h (hue), \a s (saturation), \a l (lightness), and \a a + (alpha-channel, i.e. transparency). + + All the values must be in the range 0.0-1.0. + + \sa toHsl(), fromHsl(), isValid() +*/ +QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) +{ + if (((h < 0.0 || h > 1.0) && h != -1.0) + || (s < 0.0 || s > 1.0) + || (l < 0.0 || l > 1.0) + || (a < 0.0 || a > 1.0)) { + qWarning("QColor::fromHsvF: HSV parameters out of range"); + return QColor(); + } + + QColor color; + color.cspec = Hsl; + color.ct.ahsl.alpha = qRound(a * USHRT_MAX); + color.ct.ahsl.hue = (h == -1.0) ? USHRT_MAX : qRound(h * 36000); + if (color.ct.ahsl.hue == 36000) + color.ct.ahsl.hue = 0; + color.ct.ahsl.saturation = qRound(s * USHRT_MAX); + color.ct.ahsl.lightness = qRound(l * USHRT_MAX); + color.ct.ahsl.pad = 0; + return color; +} + + +/*! Sets the contents pointed to by \a c, \a m, \a y, \a k, and \a a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value. @@ -1917,14 +2332,26 @@ QColor &QColor::operator=(Qt::GlobalColor color) */ bool QColor::operator==(const QColor &color) const { - return (cspec == color.cspec - && ct.argb.alpha == color.ct.argb.alpha - && ((cspec == QColor::Hsv - && ((ct.argb.red % 36000) == (color.ct.argb.red % 36000))) - || (ct.argb.red == color.ct.argb.red)) - && ct.argb.green == color.ct.argb.green - && ct.argb.blue == color.ct.argb.blue - && ct.argb.pad == color.ct.argb.pad); + if (cspec == Hsl && cspec == color.cspec) { + return (ct.argb.alpha == color.ct.argb.alpha + && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) + || (ct.ahsl.hue == color.ct.ahsl.hue)) + && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 + || ct.ahsl.lightness == 0 + || color.ct.ahsl.lightness == 0 + || ct.ahsl.lightness == USHRT_MAX + || color.ct.ahsl.lightness == USHRT_MAX) + && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); + } else { + return (cspec == color.cspec + && ct.argb.alpha == color.ct.argb.alpha + && (((cspec == QColor::Hsv) + && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) + || (ct.ahsv.hue == color.ct.ahsv.hue)) + && ct.argb.green == color.ct.argb.green + && ct.argb.blue == color.ct.argb.blue + && ct.argb.pad == color.ct.argb.pad); + } } /*! @@ -2028,6 +2455,8 @@ QDebug operator<<(QDebug dbg, const QColor &c) else if (c.spec() == QColor::Cmyk) dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')'; + else if (c.spec() == QColor::Hsl) + dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')'; return dbg.space(); #else diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 1a59029..a5e5210 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -67,7 +67,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &); class Q_GUI_EXPORT QColor { public: - enum Spec { Invalid, Rgb, Hsv, Cmyk }; + enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl }; QColor(); QColor(Qt::GlobalColor color); @@ -122,10 +122,14 @@ public: int hue() const; // 0 <= hue < 360 int saturation() const; + int hsvHue() const; // 0 <= hue < 360 + int hsvSaturation() const; int value() const; qreal hueF() const; // 0.0 <= hueF < 360.0 qreal saturationF() const; + qreal hsvHueF() const; // 0.0 <= hueF < 360.0 + qreal hsvSaturationF() const; qreal valueF() const; void getHsv(int *h, int *s, int *v, int *a = 0) const; @@ -150,9 +154,24 @@ public: void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = 0); void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); + int hslHue() const; // 0 <= hue < 360 + int hslSaturation() const; + int lightness() const; + + qreal hslHueF() const; // 0.0 <= hueF < 360.0 + qreal hslSaturationF() const; + qreal lightnessF() const; + + void getHsl(int *h, int *s, int *l, int *a = 0) const; + void setHsl(int h, int s, int l, int a = 255); + + void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = 0) const; + void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0); + QColor toRgb() const; QColor toHsv() const; QColor toCmyk() const; + QColor toHsl() const; QColor convertTo(Spec colorSpec) const; @@ -168,6 +187,9 @@ public: static QColor fromCmyk(int c, int m, int y, int k, int a = 255); static QColor fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); + static QColor fromHsl(int h, int s, int l, int a = 255); + static QColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0); + QColor light(int f = 150) const; QColor lighter(int f = 150) const; QColor dark(int f = 200) const; @@ -234,6 +256,14 @@ private: ushort yellow; ushort black; } acmyk; + struct { + ushort alpha; + ushort hue; + ushort saturation; + ushort lightness; + ushort pad; + } ahsl; + ushort array[5]; } ct; friend class QColormap; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 72bb164..5f6e1d6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -791,7 +791,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) if(pen_style == Qt::SolidLine) { s->stroker = &d->basicStroker; } else if (pen_style != Qt::NoPen) { - if (!d->dashStroker.data()) + if (!d->dashStroker) d->dashStroker.reset(new QDashStroker(&d->basicStroker)); if (pen.isCosmetic()) { d->dashStroker->setClipRect(d->deviceRect); diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 4353dd9..828b32b 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -62,6 +62,7 @@ #include "private/qstroker_p.h" #include "private/qpainter_p.h" #include "private/qtextureglyphcache_p.h" +#include "private/qoutlinemapper_p.h" #include <stdlib.h> @@ -372,7 +373,7 @@ public: }; -class QClipData { +class Q_GUI_EXPORT QClipData { public: QClipData(int height); ~QClipData(); @@ -479,7 +480,7 @@ private: /******************************************************************************* * QRasterBuffer */ -class QRasterBuffer +class Q_GUI_EXPORT QRasterBuffer { public: QRasterBuffer() : m_width(0), m_height(0), m_buffer(0) { init(); } diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index cf3aad7..1ba2153 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -204,6 +204,9 @@ public: virtual void sync() {} + virtual void beginNativePainting() {} + virtual void endNativePainting() {} + virtual QPixmapFilter *createPixmapFilter(int /*type*/) const { return 0; } protected: diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index e1a6e80..699de4d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1889,6 +1889,45 @@ QPaintEngine *QPainter::paintEngine() const return d->engine; } +/*! + Flushes the painting pipeline and prepares for the user issuing + native painting commands. Must be followed by a call to + endNativePainting(). + + \sa endNativePainting() +*/ +void QPainter::beginNativePainting() +{ + Q_D(QPainter); + if (!d->engine) { + qWarning("QPainter::beginNativePainting: Painter not active"); + return; + } + + if (d->extended) + d->extended->beginNativePainting(); +} + +/*! + Restores the painter after manually issuing native painting commands. + Lets the painter restore any native state that it relies on before + calling any other painter commands. + + \sa beginNativePainting() +*/ +void QPainter::endNativePainting() +{ + Q_D(const QPainter); + if (!d->engine) { + qWarning("QPainter::beginNativePainting: Painter not active"); + return; + } + + if (d->extended) + d->extended->endNativePainting(); + else + d->engine->syncState(); +} /*! Returns the font metrics for the painter if the painter is @@ -7169,7 +7208,8 @@ QPoint QPainter::xFormDev(const QPoint &p) const QRect transformed = painter.xFormDev(rectangle); \newcode QPainter painter(this); - QRect transformed = painter.combinedTransform().inverted(rectangle); + QRegion region = QRegion(rectangle) * painter.combinedTransform().inverted(); + QRect transformed = region.boundingRect(); \endcode */ diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 14d1cf8..1bb97c6 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -423,6 +423,9 @@ public: static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0); static void restoreRedirected(const QPaintDevice *device); + void beginNativePainting(); + void endNativePainting(); + #ifdef QT3_SUPPORT inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); } diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index eb8b964..a10c4cd 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1520,12 +1520,6 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const return toSubpathPolygons(QTransform(matrix)); } -static inline bool rect_intersects(const QRectF &r1, const QRectF &r2) -{ - return qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) - && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()); -} - /*! Converts the path into a list of polygons using the QTransform \a matrix, and returns the list. @@ -1578,7 +1572,7 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const continue; QRectF cbounds = bounds.at(j); for (int i=0; i<count; ++i) { - if (rect_intersects(cbounds, bounds.at(i))) { + if (cbounds.intersects(bounds.at(i))) { isects[j] << i; } } diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h index 487c029..d3d60f1 100644 --- a/src/gui/painting/qrasterizer_p.h +++ b/src/gui/painting/qrasterizer_p.h @@ -65,7 +65,7 @@ struct QSpanData; class QRasterBuffer; class QRasterizerPrivate; -class QRasterizer +class Q_GUI_EXPORT QRasterizer { public: QRasterizer(); diff --git a/src/gui/painting/qregion_win.cpp b/src/gui/painting/qregion_win.cpp index 29ae65f..ecabd6e 100644 --- a/src/gui/painting/qregion_win.cpp +++ b/src/gui/painting/qregion_win.cpp @@ -47,7 +47,6 @@ #include "qregion.h" #include "qt_windows.h" #include "qpainterpath.h" -#include "qguifunctions_wince.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 7cb65c7..7b52b05 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -147,7 +147,10 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi QRect br = rgn.boundingRect(); #ifndef Q_WS_WINCE - if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) { + if (!qt_widget_private(window())->isOpaque + && window()->testAttribute(Qt::WA_TranslucentBackground) + && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint)) + { QRect r = window()->frameGeometry(); QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft(); QRect dirtyRect = br.translated(offset + frameOffset); diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 0a82c9c..426ebfd 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -1499,7 +1499,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o default: break; } - if (QApplication::layoutDirection() == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end + if (toolbar->direction == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -4323,7 +4323,7 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c if (verticalTitleBar) { r.adjust(0, 0, 0, -4); } else { - if (QApplication::layoutDirection() == Qt::LeftToRight) + if (opt->direction == Qt::LeftToRight) r.adjust(4, 0, 0, 0); else r.adjust(0, 0, -4, 0); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index d1bed3e..ee9827e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -564,7 +564,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->translate(opt->rect.x(), opt->rect.y()); if (opt->state & State_Horizontal) { int x = opt->rect.width() / 3; - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (opt->direction == Qt::RightToLeft) x -= 2; if (opt->rect.height() > 4) { qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, @@ -870,7 +870,6 @@ int QCommonStylePrivate::lookupToolButtonStyle() const #ifndef QT_NO_ITEMVIEWS - QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const { Q_Q(const QCommonStyle); @@ -918,7 +917,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in widthUsed = qMax(widthUsed, line.naturalTextWidth()); } textLayout.endLayout(); - const QSize size = QSizeF(widthUsed, height).toSize(); + const QSize size(qCeil(widthUsed), qCeil(height)); return QSize(size.width() + 2 * textMargin, size.height()); } break; @@ -1158,6 +1157,75 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe } #endif // QT_NO_ITEMVIEWS + +#ifndef QT_NO_TABBAR +/*! \internal + Compute the textRect and the pixmapRect from the opt rect + + Uses the same computation than in QTabBar::tabSizeHint + */ +void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const +{ + Q_ASSERT(textRect); + Q_ASSERT(iconRect); + QRect tr = opt->rect; + bool verticalTabs = opt->shape == QTabBar::RoundedEast + || opt->shape == QTabBar::RoundedWest + || opt->shape == QTabBar::TriangularEast + || opt->shape == QTabBar::TriangularWest; + if (verticalTabs) + tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform + + int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget); + int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget); + int hpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; + if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth) + verticalShift = -verticalShift; + tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding); + bool selected = opt->state & QStyle::State_Selected; + if (selected) { + tr.setBottom(tr.bottom() - verticalShift); + tr.setRight(tr.right() - horizontalShift); + } + + // left widget + if (!opt->leftButtonSize.isEmpty()) { + tr.setLeft(tr.left() + 4 + + (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width())); + } + // right widget + if (!opt->rightButtonSize.isEmpty()) { + tr.setRight(tr.right() - 4 - + (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); + } + + // icon + if (!opt->icon.isNull()) { + QSize iconSize = opt->iconSize; + if (!iconSize.isValid()) { + int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize); + iconSize = QSize(iconExtent, iconExtent); + } + QSize tabIconSize = opt->icon.actualSize(iconSize, + (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled, + (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off ); + + *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2, + tabIconSize.width(), tabIconSize .height()); + if (!verticalTabs) + *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); + tr.setLeft(tr.left() + tabIconSize.width() + 4); + } + + if (!verticalTabs) + tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); + + *textRect = tr; +} +#endif //QT_NO_TABBAR + + /*! \reimp */ @@ -1840,38 +1908,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, newY = tr.y() + tr.height(); newRot = -90; } - tr.setRect(0, 0, tr.height(), tr.width()); QTransform m = QTransform::fromTranslate(newX, newY); m.rotate(newRot); p->setTransform(m, true); } - tr = subElementRect(SE_TabBarTabText, opt, widget); + QRect iconRect; + d->tabLayout(&tabV2, widget, &tr, &iconRect); + tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect if (!tabV2.icon.isNull()) { - QSize iconSize = tabV2.iconSize; - if (!iconSize.isValid()) { - int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); - iconSize = QSize(iconExtent, iconExtent); - } - QSize tabIconSize = tabV2.icon.actualSize(iconSize, - (tabV2.state & State_Enabled) ? QIcon::Normal - : QIcon::Disabled); - QPixmap tabIcon = tabV2.icon.pixmap(iconSize, + QPixmap tabIcon = tabV2.icon.pixmap(tabV2.iconSize, (tabV2.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled, (tabV2.state & State_Selected) ? QIcon::On : QIcon::Off); - - int offset = 4; - int left = opt->rect.left(); - if (tabV2.leftButtonSize.isEmpty()) - offset += 2; - else - left += tabV2.leftButtonSize.width() + (6 + 2) + 2; - QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2, - tabIconSize.width(), tabIconSize.height()); - if (!verticalTabs) - iconRect = visualRect(opt->direction, opt->rect, iconRect); p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon); } @@ -2718,65 +2768,10 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; case SE_TabBarTabText: - // ### consider merging this with CE_TabBarTabLabel if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { - QStyleOptionTabV3 tabV2(*tab); - QRect tr = tabV2.rect; - bool verticalTabs = tabV2.shape == QTabBar::RoundedEast - || tabV2.shape == QTabBar::RoundedWest - || tabV2.shape == QTabBar::TriangularEast - || tabV2.shape == QTabBar::TriangularWest; - if (verticalTabs) - tr.setRect(0, 0, tr.height(), tr.width()); - int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); - int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); - int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; - int vpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; - if (tabV2.shape == QTabBar::RoundedSouth || tabV2.shape == QTabBar::TriangularSouth) - verticalShift = -verticalShift; - tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding); - bool selected = tabV2.state & State_Selected; - if (selected) { - tr.setBottom(tr.bottom() - verticalShift); - tr.setRight(tr.right() - horizontalShift); - } - - // left widget - if (!tabV2.leftButtonSize.isEmpty()) { - tr.setLeft(tr.left() + 6 + 2 + - (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width())); - } - - // icon - if (!tabV2.icon.isNull()) { - QSize iconSize = tabV2.iconSize; - if (!iconSize.isValid()) { - int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); - iconSize = QSize(iconExtent, iconExtent); - } - QSize tabIconSize = tabV2.icon.actualSize(iconSize, - (tabV2.state & State_Enabled) ? QIcon::Normal - : QIcon::Disabled); - int offset = 4; - if (tabV2.leftButtonSize.isEmpty()) - offset += 2; - - QRect iconRect = QRect(tr.left() + offset, tr.center().y() - tabIconSize.height() / 2, - tabIconSize.width(), tabIconSize .height()); - if (!verticalTabs) - iconRect = visualRect(opt->direction, opt->rect, iconRect); - tr.setLeft(tr.left() + tabIconSize.width() + offset + 2); - } - - // right widget - if (!tabV2.rightButtonSize.isEmpty()) { - tr.setRight(tr.right() - 6 - 2 - - (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width())); - } - - if (!verticalTabs) - tr = visualRect(opt->direction, opt->rect, tr); - r = tr; + QStyleOptionTabV3 tabV3(*tab); + QRect dummyIconRect; + d->tabLayout(&tabV3, widget, &r, &dummyIconRect); } break; case SE_TabBarTabLeftButton: @@ -2785,6 +2780,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, bool selected = tab->state & State_Selected; int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); + int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt bool verticalTabs = tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedWest @@ -2827,16 +2824,16 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; default: if (sr == SE_TabBarTabLeftButton) - r = QRect(6 + tab->rect.x(), midHeight, w, h); + r = QRect(tab->rect.x() + hpadding, midHeight, w, h); else - r = QRect(tab->rect.right() - 6 - w, midHeight, w, h); + r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); r = visualRect(tab->direction, tab->rect, r); } if (verticalTabs) { if (atTheTop) - r = QRect(midWidth, tr.y() + tab->rect.height() - 6 - h, w, h); + r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h); else - r = QRect(midWidth, tr.y() + 6, w, h); + r = QRect(midWidth, tr.y() + hpadding, w, h); } } @@ -5224,6 +5221,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti Q_UNUSED(sp); #else QPixmap pixmap; + const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft(); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { @@ -5382,7 +5380,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti switch (sp) { #ifndef QT_NO_IMAGEFORMAT_XPM case SP_ToolBarHorizontalExtensionButton: - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (rtl) { QImage im(tb_extension_arrow_h_xpm); im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false); return QPixmap::fromImage(im); @@ -5398,11 +5396,11 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti #ifndef QT_NO_IMAGEFORMAT_PNG case SP_CommandLink: case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return proxy()->standardPixmap(SP_ArrowLeft, option, widget); return proxy()->standardPixmap(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return proxy()->standardPixmap(SP_ArrowRight, option, widget); return proxy()->standardPixmap(SP_ArrowLeft, option, widget); case SP_ArrowLeft: @@ -5513,6 +5511,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons const QWidget *widget) const { QIcon icon; + const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft(); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (standardIcon) { case SP_DirHomeIcon: @@ -5637,11 +5636,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons icon = QIcon::fromTheme(QLatin1String("edit-clear")); break; case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); return standardIconImplementation(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowRight, option, widget); return standardIconImplementation(SP_ArrowLeft, option, widget); case SP_FileLinkIcon: @@ -5865,11 +5864,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png")); break; case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); return standardIconImplementation(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowRight, option, widget); return standardIconImplementation(SP_ArrowLeft, option, widget); case SP_ArrowLeft: diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h index 7e58b37..14f5558 100644 --- a/src/gui/styles/qcommonstyle_p.h +++ b/src/gui/styles/qcommonstyle_p.h @@ -123,6 +123,9 @@ public: #endif mutable QIcon tabBarcloseButtonIcon; int lookupToolButtonStyle() const; +#ifndef QT_NO_TABBAR + void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 08b6ad8..905044c 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -5318,16 +5318,23 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op case SC_ComboBoxArrow:{ ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); ret.setX(ret.x() + ret.width()); - ret.setWidth(combo->rect.width() - ret.width() - ret.x()); + ret.setWidth(combo->rect.right() - ret.right()); break; } case SC_ComboBoxListBoxPopup:{ if (combo->editable) { HIRect inner = QMacStylePrivate::comboboxInnerBounds(qt_hirectForQRect(combo->rect), bdi.kind); QRect editRect = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); - ret.adjust(qRound(inner.origin.x), 0, qRound(inner.origin.x + inner.size.width), editRect.y() + editRect.height() + 2); + const int comboTop = combo->rect.top(); + ret = QRect(qRound(inner.origin.x), + comboTop, + qRound(inner.origin.x - combo->rect.left() + inner.size.width), + editRect.bottom() - comboTop + 2); } else { QRect editRect = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); - ret.adjust(4 - 11, 1, editRect.width() + 10 + 11, 1); + ret = QRect(combo->rect.x() + 4 - 11, + combo->rect.y() + 1, + editRect.width() + 10 + 11, + 1); } break; } default: diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 04559dc..0c3c2a3 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -3749,7 +3749,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(comboBox->iconSize.width() + 5); - iconRect = alignedRect(QApplication::layoutDirection(), + iconRect = alignedRect(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2a88c9a..b05a1e9 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -426,13 +426,12 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const Q_ASSERT(2*frameCornerHeight<32); const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32,32)).toImage(); + Q_ASSERT(frameImage.bytesPerLine() > 0); if (frameImage.isNull()) return Qt::black; const QRgb *pixelRgb = (const QRgb*)frameImage.bits(); const int pixels = frameImage.numBytes()/sizeof(QRgb); - const int bytesPerLine = frameImage.bytesPerLine(); - Q_ASSERT(bytesPerLine); int estimatedRed = 0; int estimatedGreen = 0; diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 8ac811c..7acb3a6 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3196,7 +3196,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (subRule.hasDrawable()) { QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin); subRule.drawRule(p, rect); - QIcon icon = standardIcon(subControlIcon(layoutButton)); + QIcon icon = standardIcon(subControlIcon(layoutButton), opt); icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter); } else { optCopy.subControls |= control; @@ -3643,9 +3643,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(cb->iconSize.width()); - iconRect = alignedRect(QApplication::layoutDirection(), - Qt::AlignLeft | Qt::AlignVCenter, - iconRect.size(), editRect); + iconRect = alignedRect(cb->direction, + Qt::AlignLeft | Qt::AlignVCenter, + iconRect.size(), editRect); drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index e558844..8097a3d 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1261,7 +1261,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->translate(opt->rect.x(), opt->rect.y()); if (opt->state & State_Horizontal) { int x = opt->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (opt->direction == Qt::RightToLeft) x -= 2; if (opt->rect.height() > 4) { qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, @@ -2312,7 +2312,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai default: break; } - if(QApplication::layoutDirection() == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end + if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -2564,7 +2564,7 @@ QRect QWindowsStyle::subElementRect(SubElement sr, const QStyleOption *opt, cons if (verticalTitleBar) { r.adjust(0, 0, 0, -m); } else { - if (QApplication::layoutDirection() == Qt::LeftToRight) + if (opt->direction == Qt::LeftToRight) r.adjust(m, 0, 0, 0); else r.adjust(0, 0, -m, 0); diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 191b71e..e365873 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2331,7 +2331,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey()); if (hasIcon) { QPixmap pxIco = ico.pixmap(titleHeight); - if (!verticalTitleBar && QApplication::layoutDirection() == Qt::RightToLeft) + if (!verticalTitleBar && dwOpt->direction == Qt::RightToLeft) p->drawPixmap(rect.width() - titleHeight - pxIco.width(), rect.bottom() - titleHeight - 2, pxIco); else p->drawPixmap(fw, rect.bottom() - titleHeight - 2, pxIco); @@ -2672,11 +2672,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo // Draw gripper if there is enough space if (!gripperBounds.isEmpty()) { p->save(); - XPThemeData grippBackground = theme; - grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; theme.rect = gripperBounds; p->setClipRegion(d->region(theme));// Only change inside the region of the gripper - d->drawBackground(grippBackground);// The gutter is the grippers background d->drawBackground(theme); // Transparent gripper ontop of background p->restore(); } diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index e05a502..05dea6e 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -66,9 +66,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_QWS_QPF2 -QT_BEGIN_INCLUDE_NAMESPACE #include "qpfutil.cpp" +QT_BEGIN_INCLUDE_NAMESPACE + #if defined(Q_WS_QWS) # include "private/qwscommand_qws_p.h" # include "qwsdisplay_qws.h" diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 25cc4da..7a9d958 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -327,8 +327,10 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont BOOL res = GetTextMetrics(hdc, &tm); fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); - if (!res) + if (!res) { qErrnoWarning("QFontEngineWin: GetTextMetrics failed"); + ZeroMemory(&tm, sizeof(TEXTMETRIC)); + } cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000; getCMap(); @@ -1098,6 +1100,7 @@ extern bool qt_cleartype_enabled; QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin, const QTransform &t, QImage::Format mask_format) { + Q_UNUSED(mask_format) glyph_metrics_t gm = boundingBox(glyph); // printf(" -> for glyph %4x\n", glyph); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index a795c1f..7b36b9d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1994,9 +1994,12 @@ void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *cur } } - if (y + layoutStruct->frameY + fd->size.height > layoutStruct->pageBottom) { + bool frameSpansIntoNextPage = (y + layoutStruct->frameY + fd->size.height > layoutStruct->pageBottom); + if (frameSpansIntoNextPage && fd->size.height <= layoutStruct->pageHeight) { layoutStruct->newPage(); y = layoutStruct->y; + + frameSpansIntoNextPage = false; } y = findY(y, layoutStruct, fd->size.width); @@ -2017,6 +2020,11 @@ void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *cur // qDebug()<< "float positioned at " << fd->position.x << fd->position.y; fd->layoutDirty = false; + + // If the frame is a table, then positioning it will affect the size if it covers more than + // one page, because of page breaks and repeating the header. + if (qobject_cast<QTextTable *>(frame) != 0) + fd->sizeDirty = frameSpansIntoNextPage; } QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY) @@ -2349,6 +2357,10 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QLayoutStru positionFloat(c); + // If the size was made dirty when the position was set, layout again + if (cd->sizeDirty) + updateRect = layoutFrame(c, layoutFrom, layoutTo); + QRectF frameRect(cd->position.toPointF(), cd->size.toSizeF()); if (frameRect == oldFrameRect && updateRect.isValid()) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 533a56b..d1adfee 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -51,7 +51,10 @@ #include "qdebug.h" #include "qboxlayout.h" #include "qpainter.h" + +#ifdef Q_WS_WIN #include "qstandardgestures.h" +#endif #include "qabstractscrollarea_p.h" #include <qwidget.h> @@ -159,9 +162,9 @@ QT_BEGIN_NAMESPACE QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), - xoffset(0), yoffset(0), viewportFilter(0), panGesture(0) + xoffset(0), yoffset(0), viewportFilter(0) #ifdef Q_WS_WIN - , singleFingerPanEnabled(false) + , panGesture(0), singleFingerPanEnabled(false) #endif { } @@ -295,8 +298,10 @@ void QAbstractScrollAreaPrivate::init() q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); - panGesture = new QPanGesture(q); +#ifdef Q_WS_WIN + panGesture = new QPanGesture(viewport); QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); +#endif // Q_WS_WIN } #ifdef Q_WS_WIN @@ -547,6 +552,9 @@ void QAbstractScrollArea::setViewport(QWidget *widget) if (isVisible()) d->viewport->show(); QMetaObject::invokeMethod(this, "setupViewport", Q_ARG(QWidget *, widget)); +#ifdef Q_WS_WIN + d->panGesture->setGestureTarget(widget); +#endif delete oldViewport; } } @@ -1339,6 +1347,7 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } +#ifdef Q_WS_WIN void QAbstractScrollAreaPrivate::_q_gestureTriggered() { Q_Q(QAbstractScrollArea); @@ -1347,7 +1356,7 @@ void QAbstractScrollAreaPrivate::_q_gestureTriggered() return; QScrollBar *hBar = q->horizontalScrollBar(); QScrollBar *vBar = q->verticalScrollBar(); - QSize delta = g->lastOffset(); + QSizeF delta = g->lastOffset(); if (!delta.isNull()) { if (QApplication::isRightToLeft()) delta.rwidth() *= -1; @@ -1357,6 +1366,7 @@ void QAbstractScrollAreaPrivate::_q_gestureTriggered() vbar->setValue(newY); } } +#endif QT_END_NAMESPACE diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 0a3e9c5..0625458 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -128,7 +128,10 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars()) + +#ifdef Q_WS_WIN Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) +#endif friend class QStyleSheetStyle; friend class QWidgetPrivate; diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 211b7a7..4362ce9 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -101,9 +101,9 @@ public: { return q_func()->viewportEvent(event); } QScopedPointer<QObject> viewportFilter; - virtual void _q_gestureTriggered(); - QPanGesture *panGesture; #ifdef Q_WS_WIN + QPanGesture *panGesture; + virtual void _q_gestureTriggered(); bool singleFingerPanEnabled; void setSingleFingerPanEnabled(bool on = true); #endif diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 58edfde..52538e0 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -687,9 +687,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) Q_D(QAbstractSlider); e->ignore(); if (e->orientation() != d->orientation && !rect().contains(e->pos())) - { return; - } static qreal offset = 0; static QAbstractSlider *offset_owner = 0; if (offset_owner != this){ diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm index 3b58a4e..2ef0ead 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm +++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm @@ -100,7 +100,8 @@ QT_FORWARD_DECLARE_CLASS(QCFString); { Q_UNUSED(flag); Q_UNUSED(nstoolbar); - QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString(itemIdentifier)); + QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value( + QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(itemIdentifier)); NSToolbarItem *item = nil; if (tb) { item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; @@ -112,7 +113,8 @@ QT_FORWARD_DECLARE_CLASS(QCFString); - (void)toolbarWillAddItem:(NSNotification *)notification { NSToolbarItem *item = [[notification userInfo] valueForKey:@"item"]; - QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString([item itemIdentifier])); + QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value( + QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)([item itemIdentifier])); if (!tb) return; // I can't really do anything about this. [item retain]; diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index bf0d52b..b1e9c79 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2449,7 +2449,16 @@ void QComboBox::showPopup() && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150); #endif + +// Don't disable updates on Mac OS X. Windows are displayed immediately on this platform, +// which means that the window will be visible before the call to container->show() returns. +// If updates are disabled at this point we'll miss our chance at painting the popup +// menu before it's shown, causing flicker since the window then displays the standard gray +// background. +#ifndef Q_WS_MAC container->setUpdatesEnabled(false); +#endif + container->raise(); container->show(); container->updateScrollers(); @@ -2460,7 +2469,10 @@ void QComboBox::showPopup() ? QAbstractItemView::PositionAtCenter : QAbstractItemView::EnsureVisible); +#ifndef Q_WS_MAC container->setUpdatesEnabled(updatesEnabled); +#endif + container->update(); #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index 206221f..fd69f55 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -205,7 +205,9 @@ void QCommandLinkButtonPrivate::init() q->setSizePolicy(policy); q->setIconSize(QSize(20, 20)); - q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink)); + QStyleOptionButton opt; + q->initStyleOption(&opt); + q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink, &opt)); } // Calculates the height of the description text based on widget width diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 5a9c7e1..d1ebdf4 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -1643,7 +1643,6 @@ QDateTimeEditPrivate::QDateTimeEditPrivate() cachedDay = -1; currentSectionIndex = FirstSectionIndex; - layoutDirection = QApplication::layoutDirection(); first.type = FirstSection; last.type = LastSection; none.type = NoSection; diff --git a/src/gui/widgets/qdatetimeedit_p.h b/src/gui/widgets/qdatetimeedit_p.h index 7b29e51..33c09c0 100644 --- a/src/gui/widgets/qdatetimeedit_p.h +++ b/src/gui/widgets/qdatetimeedit_p.h @@ -132,7 +132,6 @@ public: mutable bool cacheGuard; QString defaultDateFormat, defaultTimeFormat, defaultDateTimeFormat, unreversedFormat; - Qt::LayoutDirection layoutDirection; mutable QVariant conflictGuard; bool hasHadFocus, formatExplicitlySet, calendarPopup; QStyle::StateFlag arrowState; diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 721d990..0db6279 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -78,10 +78,10 @@ class Q_GUI_EXPORT QLineControl : public QObject public: QLineControl(const QString &txt = QString()) - : m_cursor(0), m_preeditCursor(0), m_layoutDirection(Qt::LeftToRight), + : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LeftToRight), m_hideCursor(false), m_separator(0), m_readOnly(0), m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), - m_validInput(1), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), + m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1), m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0), m_selstart(0), m_selend(0), m_passwordEchoEditing(false) @@ -262,10 +262,10 @@ private: uint m_textDirty : 1; uint m_selDirty : 1; uint m_validInput : 1; + uint m_blinkStatus : 1; int m_blinkPeriod; // 0 for non-blinking cursor int m_blinkTimer; int m_deleteAllTimer; - int m_blinkStatus; int m_ascent; int m_maxLength; int m_lastCursorPos; @@ -349,7 +349,7 @@ Q_SIGNALS: protected: virtual void timerEvent(QTimerEvent *event); -private slots: +private Q_SLOTS: void _q_clipboardChanged(); void _q_deleteSelected(); diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 6b73e21..059aaf1 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1395,8 +1395,7 @@ bool QLineEdit::event(QEvent * e) if (e->type() == QEvent::EnterEditFocus) { end(false); d->setCursorVisible(true); - int cft = QApplication::cursorFlashTime(); - d->control->setCursorBlinkPeriod(cft/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); } else if (e->type() == QEvent::LeaveEditFocus) { d->setCursorVisible(false); d->control->setCursorBlinkPeriod(0); @@ -1691,8 +1690,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ #endif - int cft = QApplication::cursorFlashTime(); - d->control->setCursorBlinkPeriod(cft/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); QStyleOptionFrameV2 opt; initStyleOption(&opt); if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) @@ -2004,7 +2002,7 @@ QMenu *QLineEdit::createStandardContextMenu() action = popup->addAction(QLineEdit::tr("Delete")); action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText()); - connect(action, SIGNAL(triggered()), SLOT(_q_deleteSelected())); + connect(action, SIGNAL(triggered()), d->control, SLOT(_q_deleteSelected())); popup->addSeparator(); diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index 03d4376..cd37ad0 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -267,7 +267,6 @@ private: Q_DISABLE_COPY(QLineEdit) Q_DECLARE_PRIVATE(QLineEdit) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) - Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) #ifndef QT_NO_COMPLETER diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index cec34da..4218630 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -93,10 +93,6 @@ void QLineEditPrivate::_q_completionHighlighted(QString newText) #endif // QT_NO_COMPLETER -void QLineEditPrivate::_q_clipboardChanged() -{ -} - void QLineEditPrivate::_q_handleWindowActivate() { Q_Q(QLineEdit); @@ -104,10 +100,6 @@ void QLineEditPrivate::_q_handleWindowActivate() control->deselect(); } -void QLineEditPrivate::_q_deleteSelected() -{ -} - void QLineEditPrivate::_q_textEdited(const QString &text) { Q_Q(QLineEdit); diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 3ab10fc..260bc19 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -84,6 +84,7 @@ public: ~QLineEditPrivate() { + delete control; } QLineControl *control; @@ -121,9 +122,7 @@ public: QRect adjustedContentsRect() const; - void _q_clipboardChanged(); void _q_handleWindowActivate(); - void _q_deleteSelected(); void _q_textEdited(const QString &); void _q_cursorPositionChanged(int, int); #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 529a225..0ea9b56 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1463,7 +1463,7 @@ void QMainWindowLayout::setGeometry(const QRect &_r) QSize(r.width(), statusbar->heightForWidth(r.width())) .expandedTo(statusbar->minimumSize())); sbr.moveBottom(r.bottom()); - QRect vr = QStyle::visualRect(QApplication::layoutDirection(), _r, sbr); + QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr); statusbar->setGeometry(vr); r.setBottom(sbr.top() - 1); } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 69ccae5..4734d22 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -368,7 +368,9 @@ QRect QMenuPrivate::actionRect(QAction *act) const return actionRects.at(index); } +#if defined(Q_WS_MAC) static const qreal MenuFadeTimeInSec = 0.150; +#endif void QMenuPrivate::hideUpToMenuBar() { @@ -1832,7 +1834,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (adjustToDesktop) { //handle popup falling "off screen" - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (isRightToLeft()) { if(snapToMouse) //position flowing left from the mouse pos.setX(mouse.x()-size.width()); @@ -1870,9 +1872,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } setGeometry(QRect(pos, size)); #ifndef QT_NO_EFFECTS - int hGuess = QApplication::layoutDirection() == Qt::RightToLeft ? QEffects::LeftScroll : QEffects::RightScroll; + int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (isRightToLeft()) { if ((snapToMouse && (pos.x() + size.width()/2 > mouse.x())) || (qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width()/2 > d->causedPopup.widget->x())) hGuess = QEffects::RightScroll; @@ -2779,6 +2781,8 @@ void QMenu::leaveEvent(QEvent *) d->sloppyAction = 0; if (!d->sloppyRegion.isEmpty()) d->sloppyRegion = QRegion(); + if (!d->activeMenu && d->currentAction) + setActiveAction(0); } /*! diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 8089473..8e28abe 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -607,6 +607,13 @@ static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisi [menuItem setHidden:!actionVisibility]; } +static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled) +{ + [menuItem setEnabled:NO]; + [menuItem setEnabled:YES]; + [menuItem setEnabled:enabled]; +} + static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarPrivate *mac_menubar) { const QList<QMacMenuAction *> &menubarActions = mac_menubar->actionItems; @@ -659,12 +666,12 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo // The item should follow what the QAction has. if ([item tag]) { QAction *action = reinterpret_cast<QAction *>([item tag]); - [item setEnabled:action->isEnabled()]; + syncNSMenuItemEnabled(item, action->isEnabled()); } else { - [item setEnabled:YES]; + syncNSMenuItemEnabled(item, YES); } } else { - [item setEnabled:NO]; + syncNSMenuItemEnabled(item, NO); } } } @@ -728,6 +735,9 @@ bool qt_mac_menubar_is_open() void qt_mac_clear_menubar() { + if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + #ifndef QT_MAC_USE_COCOA MenuRef clear_menu = 0; if (CreateNewMenu(0, 0, &clear_menu) == noErr) { @@ -1361,7 +1371,7 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) if (!action->action->icon().isNull() && action->action->isIconVisibleInMenu()) { data.iconType = kMenuIconRefType; - data.iconHandle = (Handle)qt_mac_create_iconref(action->action->icon().pixmap(22, QIcon::Normal)); + data.iconHandle = (Handle)qt_mac_create_iconref(action->action->icon().pixmap(16, QIcon::Normal)); } else { data.iconType = kMenuNoIcon; } @@ -1400,7 +1410,7 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) // Cocoa icon NSImage *nsimage = 0; if (!action->action->icon().isNull() && action->action->isIconVisibleInMenu()) { - nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(action->action->icon().pixmap(22, QIcon::Normal))); + nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(action->action->icon().pixmap(16, QIcon::Normal))); } [item setImage:nsimage]; [nsimage release]; @@ -1754,14 +1764,16 @@ void QMenuBarPrivate::macCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); - static int checkEnv = -1; + static int dontUseNativeMenuBar = -1; // We call the isNativeMenuBar function here - // becasue that will make sure that local overrides + // because that will make sure that local overrides // are dealt with correctly. bool qt_mac_no_native_menubar = !q->isNativeMenuBar(); - if (qt_mac_no_native_menubar == false && checkEnv < 0) { - checkEnv = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); - QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, checkEnv); + if (qt_mac_no_native_menubar == false && dontUseNativeMenuBar < 0) { + bool isPlugin = QApplication::testAttribute(Qt::AA_MacPluginApplication); + bool environmentSaysNo = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); + dontUseNativeMenuBar = isPlugin || environmentSaysNo; + QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar); qt_mac_no_native_menubar = !q->isNativeMenuBar(); } if (!qt_mac_no_native_menubar) { diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 82b3769..6633f2a 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -132,7 +132,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const result.adjust(hmargin, 0, -hmargin, 0); if (extVisible) { - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setLeft(result.left() + extension->sizeHint().width()); else result.setWidth(result.width() - extension->sizeHint().width()); @@ -140,7 +140,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const if (leftWidget && leftWidget->isVisible()) { QSize sz = leftWidget->sizeHint(); - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setRight(result.right() - sz.width()); else result.setLeft(result.left() + sz.width()); @@ -148,7 +148,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const if (rightWidget && rightWidget->isVisible()) { QSize sz = rightWidget->sizeHint(); - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setLeft(result.left() + sz.width()); else result.setRight(result.right() - sz.width()); @@ -245,7 +245,7 @@ void QMenuBarPrivate::updateGeometries() pop->addActions(hiddenActions); int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q); - int x = q->layoutDirection() == Qt::RightToLeft + int x = q->isRightToLeft() ? menuRect.left() - extension->sizeHint().width() + 1 : menuRect.right(); extension->setGeometry(x, vmargin, extension->sizeHint().width(), menuRect.height() - vmargin*2); @@ -1695,6 +1695,7 @@ QSize QMenuBar::sizeHint() const ensurePolished(); QSize ret(0, 0); + const_cast<QMenuBarPrivate*>(d)->updateGeometries(); const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this); const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); @@ -1750,6 +1751,7 @@ int QMenuBar::heightForWidth(int) const const bool as_gui_menubar = true; #endif + const_cast<QMenuBarPrivate*>(d)->updateGeometries(); int height = 0; const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 20de404..6ac521b 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -66,7 +66,9 @@ #include <qtexttable.h> #include <qvariant.h> +#ifdef Q_WS_WIN #include <qstandardgestures.h> +#endif #include <qinputcontext.h> @@ -377,7 +379,7 @@ void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block) tl->beginLayout(); qreal availableWidth = d->width; if (availableWidth <= 0) { - availableWidth = INT_MAX; // similar to text edit with pageSize.width == 0 + availableWidth = qreal(INT_MAX); // similar to text edit with pageSize.width == 0 } availableWidth -= 2*margin + extraMargin; while (1) { @@ -573,7 +575,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { if (!block.isValid()) return QRectF(); QRectF r = documentLayout->blockBoundingRect(currentBlock); - while (currentBlockNumber < blockNumber && offset.y() <= 2* textEdit->viewport()->height()) { + int maxVerticalOffset = r.height(); + while (currentBlockNumber < blockNumber && offset.y() - maxVerticalOffset <= 2* textEdit->viewport()->height()) { offset.ry() += r.height(); currentBlock = currentBlock.next(); ++currentBlockNumber; @@ -583,7 +586,7 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { } r = documentLayout->blockBoundingRect(currentBlock); } - while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) { + while (currentBlockNumber > blockNumber && offset.y() + maxVerticalOffset >= -textEdit->viewport()->height()) { currentBlock = currentBlock.previous(); --currentBlockNumber; while (!currentBlock.isVisible()) { @@ -791,8 +794,10 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; +#ifdef Q_WS_WIN panGesture = new QPanGesture(q); QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); +#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2917,6 +2922,8 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ +#ifdef Q_WS_WIN + void QPlainTextEditPrivate::_q_gestureTriggered() { Q_Q(QPlainTextEdit); @@ -2927,7 +2934,7 @@ void QPlainTextEditPrivate::_q_gestureTriggered() QScrollBar *vBar = q->verticalScrollBar(); if (g->state() == Qt::GestureStarted) originalOffsetY = vBar->value(); - QSize totalOffset = g->totalOffset(); + QSizeF totalOffset = g->totalOffset(); if (!totalOffset.isNull()) { if (QApplication::isRightToLeft()) totalOffset.rwidth() *= -1; @@ -2941,6 +2948,8 @@ void QPlainTextEditPrivate::_q_gestureTriggered() } } +#endif + QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index c9652ae..5ec3ed8 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -269,7 +269,11 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) + +#ifdef Q_WS_WIN Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) +#endif + friend class QPlainTextEditControl; }; diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 608f3cf..e93302c 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -176,12 +176,14 @@ public: #endif void _q_cursorPositionChanged(); - void _q_modificationChanged(bool); - void _q_gestureTriggered(); int originalOffsetY; + +#ifdef Q_WS_WIN + void _q_gestureTriggered(); QPanGesture *panGesture; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 5166390..531c429 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1293,6 +1293,7 @@ QSize QTabBarPrivate::minimumTabSizeHint(int index) */ QSize QTabBar::tabSizeHint(int index) const { + //Note: this must match with the computations in QCommonStylePrivate::tabLayout Q_D(const QTabBar); if (const QTabBarPrivate::Tab *tab = d->at(index)) { QStyleOptionTabV3 opt; @@ -1309,18 +1310,18 @@ QSize QTabBar::tabSizeHint(int index) const int widgetWidth = 0; int widgetHeight = 0; int padding = 0; - if (opt.leftButtonSize.isValid()) { - padding += 6 + 2; + if (!opt.leftButtonSize.isEmpty()) { + padding += 4; widgetWidth += opt.leftButtonSize.width(); widgetHeight += opt.leftButtonSize.height(); } - if (opt.rightButtonSize.isValid()) { - padding += 6 + 2; + if (!opt.rightButtonSize.isEmpty()) { + padding += 4; widgetWidth += opt.rightButtonSize.width(); widgetHeight += opt.rightButtonSize.height(); } - if (opt.iconSize.isValid()) - padding += 2; + if (!opt.icon.isNull()) + padding += 4; QSize csz; if (verticalTabs(d->shape)) { @@ -1836,7 +1837,8 @@ void QTabBarPrivate::moveTabFinished(int index) } #endif //QT_NO_ANIMATION if (allAnimationsFinished && cleanup) { - movingTab->setVisible(false); // We might not get a mouse release + if(movingTab) + movingTab->setVisible(false); // We might not get a mouse release for (int i = 0; i < tabList.count(); ++i) { tabList[i].dragOffset = 0; } diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index ef0847b..89e6d7a 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -205,7 +205,7 @@ void QToolBarPrivate::initDrag(const QPoint &pos) state->moving = false; state->widgetItem = 0; - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) state->pressPos = QPoint(q->width() - state->pressPos.x(), state->pressPos.y()); } @@ -359,7 +359,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) QPoint pos = event->globalPos(); // if we are right-to-left, we move so as to keep the right edge the same distance // from the mouse - if (q->layoutDirection() == Qt::LeftToRight) + if (q->isLeftToRight()) pos -= state->pressPos; else pos += QPoint(state->pressPos.x() - q->width(), -state->pressPos.y()); @@ -369,14 +369,14 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) } else if (state->moving) { const QPoint rtl(q->width() - state->pressPos.x(), state->pressPos.y()); //for RTL - const QPoint globalPressPos = q->mapToGlobal(q->layoutDirection() == Qt::RightToLeft ? rtl : state->pressPos); + const QPoint globalPressPos = q->mapToGlobal(q->isRightToLeft() ? rtl : state->pressPos); int pos = 0; QPoint delta = event->globalPos() - globalPressPos; if (orientation == Qt::Vertical) { pos = q->y() + delta.y(); } else { - if (q->layoutDirection() == Qt::RightToLeft) { + if (q->isRightToLeft()) { pos = win->width() - q->width() - q->x() - delta.x(); } else { pos = q->x() + delta.x(); @@ -391,7 +391,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) void QToolBarPrivate::unplug(const QRect &_r) { Q_Q(QToolBar); - + layout->setExpanded(false, false); QRect r = _r; r.moveTopLeft(q->mapToGlobal(QPoint(0, 0))); setWindowState(true, true, r); diff --git a/src/gui/widgets/qtoolbarextension.cpp b/src/gui/widgets/qtoolbarextension.cpp index 1f1186c..6a70326 100644 --- a/src/gui/widgets/qtoolbarextension.cpp +++ b/src/gui/widgets/qtoolbarextension.cpp @@ -61,10 +61,12 @@ QToolBarExtension::QToolBarExtension(QWidget *parent) void QToolBarExtension::setOrientation(Qt::Orientation o) { + QStyleOption opt; + opt.init(this); if (o == Qt::Horizontal) { - setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton)); + setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, &opt)); } else { - setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton)); + setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton, &opt)); } } diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index d3c5b4b..1f2ca60 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const return result; } -void QToolBarLayout::setExpanded(bool exp) +void QToolBarLayout::setExpanded(bool exp, bool animated) { if (exp == expanded) return; @@ -665,7 +665,7 @@ void QToolBarLayout::setExpanded(bool exp) layoutActions(rect.size()); } } - layout->layoutState.toolBarAreaLayout.apply(true); + layout->layoutState.toolBarAreaLayout.apply(animated); } } diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h index fe81d2f..bb40e215 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/gui/widgets/qtoolbarlayout_p.h @@ -111,8 +111,8 @@ public: void updateMarginAndSpacing(); bool hasExpandFlag() const; -public slots: - void setExpanded(bool b); +public Q_SLOTS: + void setExpanded(bool b, bool animated = true); private: QList<QToolBarItem*> items; diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index beb6be2..972e07b 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -93,7 +93,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) return; - QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry"); + QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget); anim->setDuration(animate ? 200 : 0); anim->setEasingCurve(QEasingCurve::InOutQuad); anim->setEndValue(final_geometry); diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index f155770..d903f81 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -52,6 +52,8 @@ #include "qaudiodeviceinfo_alsa_p.h" +QT_BEGIN_NAMESPACE + QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) { handle = 0; @@ -391,4 +393,4 @@ QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() return QByteArray("default"); } - +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index ca8179f..5f17b71 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -65,6 +65,8 @@ #include <QtMultimedia/qaudiodeviceinfo.h> #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -109,5 +111,7 @@ private: snd_pcm_hw_params_t *params; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 58e7f8b..21b0e9c 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -55,6 +55,8 @@ #include <mmsystem.h> #include "qaudiodeviceinfo_win32_p.h" +QT_BEGIN_NAMESPACE + // For mingw toolchain mmsystem.h only defines half the defines, so add if needed. #ifndef WAVE_FORMAT_44M08 #define WAVE_FORMAT_44M08 0x00000100 @@ -376,3 +378,4 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return QByteArray("default"); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index 9e0d1ea..f5f575b 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -63,6 +63,8 @@ #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -105,4 +107,6 @@ private: QList<QAudioFormat::SampleType> typez; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 595c9df..0b3d337 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -53,6 +53,8 @@ #include <QtCore/qcoreapplication.h> #include "qaudioinput_alsa_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -686,3 +688,4 @@ void InputPrivate::trigger() emit readyRead(); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 3f7c85e..400157e 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -67,6 +67,8 @@ #include <QtMultimedia/qaudiodeviceinfo.h> #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + class InputPrivate; class QAudioInputPrivate : public QAbstractAudioInput @@ -148,4 +150,6 @@ private: QAudioInputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 6da80ee..fd6984f 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -53,6 +53,8 @@ #include "qaudioinput_win32_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 static CRITICAL_SECTION waveInCriticalSection; @@ -539,3 +541,4 @@ void InputPrivate::trigger() emit readyRead(); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 7f7b823..f14ce96 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -68,6 +68,8 @@ #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + class QAudioInputPrivate : public QAbstractAudioInput { Q_OBJECT @@ -149,4 +151,6 @@ private: QAudioInputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 5997d31..a5ac177 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -53,6 +53,8 @@ #include <QtCore/qcoreapplication.h> #include "qaudiooutput_alsa_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -704,3 +706,5 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) return written; } + +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 295927b..068428d 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -66,6 +66,8 @@ #include <QtMultimedia/qaudiodeviceinfo.h> #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + class OutputPrivate; class QAudioOutputPrivate : public QAbstractAudioOutput @@ -156,4 +158,6 @@ private: QAudioOutputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index bace4a6..99229df 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -54,6 +54,8 @@ //#define DEBUG_AUDIO 1 +QT_BEGIN_NAMESPACE + static CRITICAL_SECTION waveOutCriticalSection; QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -502,3 +504,5 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) } return written; } + +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index c6c025f..3906d9d 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -67,6 +67,8 @@ #include <QtMultimedia/qaudioengine.h> +QT_BEGIN_NAMESPACE + class QAudioOutputPrivate : public QAbstractAudioOutput { Q_OBJECT @@ -149,4 +151,6 @@ private: QAudioOutputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index 7d38afa..53fcb49 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -1,11 +1,12 @@ -TARGET = QtMultimedia -QPRO_PWD = $$PWD -QT = core -DEFINES += QT_BUILD_MULTIMEDIA_LIB +TARGET = QtMultimedia +QPRO_PWD = $$PWD +QT = core gui -win32-msvc*:QMAKE_LIBS += $$QMAKE_LIBS_CORE +DEFINES += QT_BUILD_MULTIMEDIA_LIB QT_NO_USING_NAMESPACE -unix:QMAKE_PKGCONFIG_REQUIRES = QtCore +unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui include(../qbase.pri) + include(audio/audio.pri) +include(video/video.pri) diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp new file mode 100644 index 0000000..702b9a0 --- /dev/null +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qabstractvideobuffer_p.h" + +#include <qvariant.h> + +QT_BEGIN_NAMESPACE + +/*! + \class QAbstractVideoBuffer + \brief The QAbstractVideoBuffer class is an abstraction for video data. + \preliminary + \since 4.6 + + The QVideoFrame class makes use of a QAbstractVideoBuffer internally to reference a buffer of + video data. Creating a subclass of QAbstractVideoBuffer will allow you to construct video + frames from preallocated or static buffers. + + The contents of a buffer can be accessed by mapping the buffer to memory using the map() + function which returns a pointer to memory containing the contents of the the video buffer. + The memory returned by map() is released by calling the unmap() function. + + The handle() of a buffer may also be used to manipulate it's contents using type specific APIs. + The type of a buffer's handle is given by the handleType() function. + + \sa QVideoFrame +*/ + +/*! + \enum QAbstractVideoBuffer::HandleType + + Identifies the type of a video buffers handle. + + \value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer. + \value GLTextureHandle The handle of the buffer is an OpenGL texture ID. + \value UserHandle Start value for user defined handle types. + + \sa handleType() +*/ + +/*! + \enum QAbstractVideoBuffer::MapMode + + Enumerates how a video buffer's data is mapped to memory. + + \value NotMapped The video buffer has is not mapped to memory. + \value ReadOnly The mapped memory is populated with data from the video buffer when mapped, but + the content of the mapped memory may be discarded when unmapped. + \value WriteOnly The mapped memory in unitialized when mapped, and the content will be used to + populate the video buffer when unmapped. + \value ReadWrite The mapped memory is populated with data from the video buffer, and the + video buffer is repopulated with the content of the mapped memory. + + \sa mapMode(), map() +*/ + +/*! + Constructs an abstract video buffer of the given \a type. +*/ + +QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type) + : d_ptr(new QAbstractVideoBufferPrivate) +{ + Q_D(QAbstractVideoBuffer); + + d->handleType = type; +} + +/*! + \internal +*/ + +QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type) + : d_ptr(&dd) +{ + Q_D(QAbstractVideoBuffer); + + d->handleType = type; +} + +/*! + Destroys an abstract video buffer. +*/ + +QAbstractVideoBuffer::~QAbstractVideoBuffer() +{ + delete d_ptr; +} + +/*! + Returns the type of a video buffer's handle. + + \sa handle() +*/ + +QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const +{ + return d_func()->handleType; +} + +/*! + \fn QAbstractVideoBuffer::mapMode() const + + Returns the mode a video buffer is mapped in. + + \sa map() +*/ + +/*! + \fn QAbstractVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) + + Maps the contents of a video buffer to memory. + + The map \a mode indicates whether the contents of the mapped memory should be read from and/or + written to the buffer. If the map mode includes the QAbstractVideoBuffer::ReadOnly flag the + mapped memory will be populated with the content of the video buffer when mapped. If the map + mode includes the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be + persisted in the buffer when unmapped. + + When access to the data is no longer needed be sure to call the unmap() function to release the + mapped memory. + + Returns a pointer to the mapped memory region, or a null pointer if the mapping failed. The + size in bytes of the mapped memory region is returned in \a numBytes, and the line stride in \a + bytesPerLine. + + When access to the data is no longer needed be sure to unmap() the buffer. + + \note Writing to memory that is mapped as read-only is undefined, and may result in changes + to shared data. + + \sa unmap(), mapMode() +*/ + +/*! + \fn QAbstractVideoBuffer::unmap() + + Releases the memory mapped by the map() function + + If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the QAbstractVideoBuffer::WriteOnly + flag this will persist the current content of the mapped memory to the video frame. + + \sa map() +*/ + +/*! + Returns a type specific handle to the data buffer. + + The type of the handle is given by handleType() function. + + \sa handleType() +*/ + +QVariant QAbstractVideoBuffer::handle() const +{ + return QVariant(); +} + + +QT_END_NAMESPACE diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h new file mode 100644 index 0000000..3ffb87a --- /dev/null +++ b/src/multimedia/video/qabstractvideobuffer.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOBUFFER_H +#define QABSTRACTVIDEOBUFFER_H + +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QVariant; + +class QAbstractVideoBufferPrivate; + +class Q_MULTIMEDIA_EXPORT QAbstractVideoBuffer +{ +public: + enum HandleType + { + NoHandle, + GLTextureHandle, + UserHandle = 1000 + }; + + enum MapMode + { + NotMapped = 0x00, + ReadOnly = 0x01, + WriteOnly = 0x02, + ReadWrite = ReadOnly | WriteOnly + }; + + QAbstractVideoBuffer(HandleType type); + virtual ~QAbstractVideoBuffer(); + + HandleType handleType() const; + + virtual MapMode mapMode() const = 0; + + virtual uchar *map(MapMode mode, int *numBytes, int *bytesPerLine) = 0; + virtual void unmap() = 0; + + virtual QVariant handle() const; + +protected: + QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type); + + QAbstractVideoBufferPrivate *d_ptr; + +private: + Q_DECLARE_PRIVATE(QAbstractVideoBuffer) + Q_DISABLE_COPY(QAbstractVideoBuffer) +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QAbstractVideoBuffer::HandleType) +Q_DECLARE_METATYPE(QAbstractVideoBuffer::MapMode) + +QT_END_HEADER + +#endif diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h new file mode 100644 index 0000000..afe22b3 --- /dev/null +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOBUFFER_P_H +#define QABSTRACTVIDEOBUFFER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qshareddata.h> +#include <QtMultimedia/qabstractvideobuffer.h> + +QT_BEGIN_NAMESPACE + +class QAbstractVideoBufferPrivate +{ +public: + QAbstractVideoBufferPrivate() + : handleType(QAbstractVideoBuffer::NoHandle) + {} + + QAbstractVideoBuffer::HandleType handleType; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp new file mode 100644 index 0000000..5309e57 --- /dev/null +++ b/src/multimedia/video/qabstractvideosurface.cpp @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qabstractvideosurface_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QAbstractVideoSurface + \brief The QAbstractVideoSurface class is a base class for video presentation surfaces. + \preliminary + \since 4.6 + + The QAbstractVideoSurface class defines the standard interface that video producers use to + inter-operate with video presentation surfaces. It is not supposed to be instantiated directly. + Instead, you should subclass it to create new video surfaces. + + A video surface presents a continuous stream of identically formatted frames, where the format + of each frame is compatible with a stream format supplied when starting a presentation. + + A list of pixel formats a surface can present is given by the supportedPixelFormats() function, + and the isFormatSupported() function will test if a complete video format is supported. In + some cases when a format is not supported; isFormatSupported() may suggest a similar format. + For example if a surface supports fixed set of resolutions it may suggest the smallest + supported resolution that contains the proposed resolution. + + The start() function takes a supported format and enables a video surface. Once started a + surface will begin displaying the frames it receives in the present() function. Surfaces may + hold a reference to the buffer of a presented video frame until a new frame is presented or + streaming is stopped. The stop() function will disable a surface and a release any video + buffers it holds references to. +*/ + +/*! + \enum QAbstractVideoSurface::Error + This enum describes the errors that may be returned by the error() function. + + \value NoError No error occurred. + \value UnsupportedFormatError A video format was not supported. + \value IncorrectFormatError A video frame was not compatible with the format of the surface. + \value StoppedError The surface has not been started. + \value ResourceError The surface could not allocate some resource. +*/ + +/*! + Constructs a video surface with the given \a parent. +*/ + +QAbstractVideoSurface::QAbstractVideoSurface(QObject *parent) + : QObject(*new QAbstractVideoSurfacePrivate, parent) +{ +} + +/*! + \internal +*/ + +QAbstractVideoSurface::QAbstractVideoSurface(QAbstractVideoSurfacePrivate &dd, QObject *parent) + : QObject(dd, parent) +{ +} + +/*! + Destroys a video surface. +*/ + +QAbstractVideoSurface::~QAbstractVideoSurface() +{ +} + +/*! + \fn QAbstractVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const + + Returns a list of pixel formats a video surface can present for a given handle \a type. + + The pixel formats returned for the QAbstractVideoBuffer::NoHandle type are valid for any buffer + that can be mapped in read-only mode. + + Types that are first in the list can be assumed to be faster to render. +*/ + +/*! + Tests a video \a format to determine if a surface can accept it. If the format isn't supported + the surface may suggest a \a similar format that is supported. + + Returns true if the format is supported by the surface, and false otherwise. +*/ + +bool QAbstractVideoSurface::isFormatSupported( + const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const +{ + Q_UNUSED(similar); + + return supportedPixelFormats(format.handleType()).contains(format.pixelFormat()); +} + +/*! + \fn QAbstractVideoSurface::supportedFormatsChanged() + + Signals that the set of formats supported by a video surface has changed. + + \sa supportedPixelFormats(), isFormatSupported() +*/ + +/*! + Returns the format of a video surface. +*/ + +QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat() const +{ + return d_func()->format; +} + +/*! + \fn QAbstractVideoSurface::surfaceFormatChanged(const QVideoSurfaceFormat &format) + + Signals that the configured \a format of a video surface has changed. + + \sa surfaceFormat(), start() +*/ + +/*! + Starts a video surface presenting \a format frames. + + Returns true if the surface was started, and false if an error occurred. + + \sa isStarted(), stop() +*/ + +bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) +{ + Q_D(QAbstractVideoSurface); + + bool wasStarted = d->started; + + d->started = true; + d->format = format; + d->error = NoError; + + emit surfaceFormatChanged(d->format); + + if (!wasStarted) + emit startedChanged(true); + + return true; +} + +/*! + Stops a video surface presenting frames and releases any resources acquired in start(). + + \sa isStarted(), start() +*/ + +void QAbstractVideoSurface::stop() +{ + Q_D(QAbstractVideoSurface); + + if (d->started) { + d->format = QVideoSurfaceFormat(); + d->started = false; + + emit startedChanged(false); + emit surfaceFormatChanged(d->format); + } +} + +/*! + Indicates whether a video surface has been started. + + Returns true if the surface has been started, and false otherwise. +*/ + +bool QAbstractVideoSurface::isStarted() const +{ + return d_func()->started; +} + +/*! + \fn QAbstractVideoSurface::startedChanged(bool started) + + Signals that the \a started state of a video surface has changed. + + \sa isStarted(), start(), stop() +*/ + +/*! + \fn QAbstractVideoSurface::present(const QVideoFrame &frame) + + Presents a video \a frame. + + Returns true if the frame was presented, and false if an error occurred. + + Not all surfaces will block until the presentation of a frame has completed. Calling present() + on a non-blocking surface may fail if called before the presentation of a previous frame has + completed. In such cases the surface may not return to a ready state until it's had an + opportunity to process events. + + If present() fails for any other reason the surface will immediately enter the stopped state + and an error() value will be set. + + A video surface must be in the started state for present() to succeed, and the format of the + video frame must be compatible with the current video surface format. + + \sa error() +*/ + +/*! + Returns the last error that occurred. + + If a surface fails to start(), or stops unexpectedly this function can be called to discover + what error occurred. +*/ + +QAbstractVideoSurface::Error QAbstractVideoSurface::error() const +{ + return d_func()->error; +} + +/*! + Sets the value of error() to \a error. +*/ + +void QAbstractVideoSurface::setError(Error error) +{ + Q_D(QAbstractVideoSurface); + + d->error = error; +} + +QT_END_NAMESPACE diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h new file mode 100644 index 0000000..78831f0 --- /dev/null +++ b/src/multimedia/video/qabstractvideosurface.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOSURFACE_H +#define QABSTRACTVIDEOSURFACE_H + +#include <QtCore/qobject.h> +#include <QtMultimedia/qvideoframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QRectF; +class QVideoSurfaceFormat; + +class QAbstractVideoSurfacePrivate; + +class Q_MULTIMEDIA_EXPORT QAbstractVideoSurface : public QObject +{ + Q_OBJECT + +public: + enum Error + { + NoError, + UnsupportedFormatError, + IncorrectFormatError, + StoppedError, + ResourceError + }; + + explicit QAbstractVideoSurface(QObject *parent = 0); + ~QAbstractVideoSurface(); + + virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const = 0; + virtual bool isFormatSupported( + const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar = 0) const; + + QVideoSurfaceFormat surfaceFormat() const; + + virtual bool start(const QVideoSurfaceFormat &format); + virtual void stop(); + + bool isStarted() const; + + virtual bool present(const QVideoFrame &frame) = 0; + + Error error() const; + +Q_SIGNALS: + void startedChanged(bool started); + void surfaceFormatChanged(const QVideoSurfaceFormat &format); + void supportedFormatsChanged(); + +protected: + QAbstractVideoSurface(QAbstractVideoSurfacePrivate &dd, QObject *parent); + + void setError(Error error); + +private: + Q_DECLARE_PRIVATE(QAbstractVideoSurface) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/multimedia/video/qabstractvideosurface_p.h b/src/multimedia/video/qabstractvideosurface_p.h new file mode 100644 index 0000000..e401102 --- /dev/null +++ b/src/multimedia/video/qabstractvideosurface_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOSURFACE_P_H +#define QABSTRACTVIDEOSURFACE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtMultimedia/qabstractvideosurface.h> +#include <QtMultimedia/qvideosurfaceformat.h> +#include <QtCore/private/qobject_p.h> + +QT_BEGIN_NAMESPACE + +class QAbstractVideoSurfacePrivate : public QObjectPrivate +{ +public: + QAbstractVideoSurfacePrivate() + : error(QAbstractVideoSurface::NoError) + , started(false) + { + } + + mutable QAbstractVideoSurface::Error error; + QVideoSurfaceFormat format; + bool started; + +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp new file mode 100644 index 0000000..6af0c41 --- /dev/null +++ b/src/multimedia/video/qimagevideobuffer.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qimagevideobuffer_p.h" + +#include <private/qabstractvideobuffer_p.h> + +#include <qimage.h> +#include <qvariant.h> + +QT_BEGIN_NAMESPACE + +class QImageVideoBufferPrivate : public QAbstractVideoBufferPrivate +{ +public: + QImageVideoBufferPrivate() + : mapMode(QAbstractVideoBuffer::NotMapped) + { + } + + QAbstractVideoBuffer::MapMode mapMode; + QImage image; +}; + +QImageVideoBuffer::QImageVideoBuffer(const QImage &image) + : QAbstractVideoBuffer(*new QImageVideoBufferPrivate, NoHandle) +{ + Q_D(QImageVideoBuffer); + + d->image = image; +} + +QImageVideoBuffer::~QImageVideoBuffer() +{ +} + +QAbstractVideoBuffer::MapMode QImageVideoBuffer::mapMode() const +{ + return d_func()->mapMode; +} + +uchar *QImageVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) +{ + Q_D(QImageVideoBuffer); + + if (d->mapMode == NotMapped && d->image.bits() && mode != NotMapped) { + d->mapMode = mode; + + if (numBytes) + *numBytes = d->image.numBytes(); + + if (bytesPerLine) + *bytesPerLine = d->image.bytesPerLine(); + + return d->image.bits(); + } else { + return 0; + } +} + +void QImageVideoBuffer::unmap() +{ + Q_D(QImageVideoBuffer); + + d->mapMode = NotMapped; +} + +QT_END_NAMESPACE diff --git a/src/multimedia/video/qimagevideobuffer_p.h b/src/multimedia/video/qimagevideobuffer_p.h new file mode 100644 index 0000000..dcbc0b3 --- /dev/null +++ b/src/multimedia/video/qimagevideobuffer_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGEVIDEOBUFFER_P_H +#define QIMAGEVIDEOBUFFER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtMultimedia/qabstractvideobuffer.h> + +QT_BEGIN_NAMESPACE + +class QImage; + +class QImageVideoBufferPrivate; + +class Q_MULTIMEDIA_EXPORT QImageVideoBuffer : public QAbstractVideoBuffer +{ + Q_DECLARE_PRIVATE(QImageVideoBuffer) +public: + QImageVideoBuffer(const QImage &image); + ~QImageVideoBuffer(); + + MapMode mapMode() const; + + uchar *map(MapMode mode, int *numBytes, int *bytesPerLine); + void unmap(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/multimedia/video/qmemoryvideobuffer.cpp b/src/multimedia/video/qmemoryvideobuffer.cpp new file mode 100644 index 0000000..f457820 --- /dev/null +++ b/src/multimedia/video/qmemoryvideobuffer.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmemoryvideobuffer_p.h" + +#include <private/qabstractvideobuffer_p.h> +#include <qbytearray.h> + +QT_BEGIN_NAMESPACE + +class QMemoryVideoBufferPrivate : public QAbstractVideoBufferPrivate +{ +public: + QMemoryVideoBufferPrivate() + : bytesPerLine(0) + , mapMode(QAbstractVideoBuffer::NotMapped) + { + } + + int bytesPerLine; + QAbstractVideoBuffer::MapMode mapMode; + QByteArray data; +}; + +/*! + \class QMemoryVideoBuffer + \brief The QMemoryVideoBuffer class provides a system memory allocated video data buffer. + \internal + + QMemoryVideoBuffer is the default video buffer for allocating system memory. It may be used to + allocate memory for a QVideoFrame without implementing your own QAbstractVideoBuffer. +*/ + +/*! + Constructs a video buffer with an image stride of \a bytesPerLine from a byte \a array. +*/ +QMemoryVideoBuffer::QMemoryVideoBuffer(const QByteArray &array, int bytesPerLine) + : QAbstractVideoBuffer(*new QMemoryVideoBufferPrivate, NoHandle) +{ + Q_D(QMemoryVideoBuffer); + + d->data = array; + d->bytesPerLine = bytesPerLine; +} + +/*! + Destroys a system memory allocated video buffer. +*/ +QMemoryVideoBuffer::~QMemoryVideoBuffer() +{ +} + +/*! + \reimp +*/ +QAbstractVideoBuffer::MapMode QMemoryVideoBuffer::mapMode() const +{ + return d_func()->mapMode; +} + +/*! + \reimp +*/ +uchar *QMemoryVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) +{ + Q_D(QMemoryVideoBuffer); + + if (d->mapMode == NotMapped && d->data.data() && mode != NotMapped) { + d->mapMode = mode; + + if (numBytes) + *numBytes = d->data.size(); + + if (bytesPerLine) + *bytesPerLine = d->bytesPerLine; + + return reinterpret_cast<uchar *>(d->data.data()); + } else { + return 0; + } +} + +/*! + \reimp +*/ +void QMemoryVideoBuffer::unmap() +{ + d_func()->mapMode = NotMapped; +} + +QT_END_NAMESPACE diff --git a/src/multimedia/video/qmemoryvideobuffer_p.h b/src/multimedia/video/qmemoryvideobuffer_p.h new file mode 100644 index 0000000..e84c4a1 --- /dev/null +++ b/src/multimedia/video/qmemoryvideobuffer_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMEMORYVIDEOBUFFER_P_H +#define QMEMORYVIDEOBUFFER_P_H + +#include <QtMultimedia/qabstractvideobuffer.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QMemoryVideoBufferPrivate; + +class Q_MULTIMEDIA_EXPORT QMemoryVideoBuffer : public QAbstractVideoBuffer +{ + Q_DECLARE_PRIVATE(QMemoryVideoBuffer) +public: + QMemoryVideoBuffer(const QByteArray &data, int bytesPerLine); + ~QMemoryVideoBuffer(); + + MapMode mapMode() const; + + uchar *map(MapMode mode, int *numBytes, int *bytesPerLine); + void unmap(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp new file mode 100644 index 0000000..c3584b7 --- /dev/null +++ b/src/multimedia/video/qvideoframe.cpp @@ -0,0 +1,742 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvideoframe.h" + +#include <private/qimagevideobuffer_p.h> +#include <private/qmemoryvideobuffer_p.h> + +#include <qimage.h> +#include <qpair.h> +#include <qsize.h> +#include <qvariant.h> +#include <qvector.h> + +QT_BEGIN_NAMESPACE + +class QVideoFramePrivate : public QSharedData +{ +public: + QVideoFramePrivate() + : startTime(-1) + , endTime(-1) + , data(0) + , numBytes(0) + , bytesPerLine(0) + , pixelFormat(QVideoFrame::Format_Invalid) + , fieldType(QVideoFrame::ProgressiveFrame) + , buffer(0) + { + } + + QVideoFramePrivate(const QSize &size, QVideoFrame::PixelFormat format) + : size(size) + , startTime(-1) + , endTime(-1) + , data(0) + , numBytes(0) + , bytesPerLine(0) + , pixelFormat(format) + , fieldType(QVideoFrame::ProgressiveFrame) + , buffer(0) + { + } + + ~QVideoFramePrivate() + { + delete buffer; + } + + QSize size; + qint64 startTime; + qint64 endTime; + uchar *data; + int numBytes; + int bytesPerLine; + QVideoFrame::PixelFormat pixelFormat; + QVideoFrame::FieldType fieldType; + QAbstractVideoBuffer *buffer; + +private: + Q_DISABLE_COPY(QVideoFramePrivate) +}; + +/*! + \class QVideoFrame + \brief The QVideoFrame class provides a representation of a frame of video data. + \preliminary + \since 4.6 + + A QVideoFrame encapsulates the data of a video frame, and information about the frame. + + The contents of a video frame can be mapped to memory using the map() function. While + mapped the video data can accessed using the bits() function which returns a pointer to a + buffer, the total size of which is given by the numBytes(), and the size of each line is given + by bytesPerLine(). The return value of the handle() function may be used to access frame data + using the internal buffer's native APIs. + + The video data in a QVideoFrame is encapsulated in a QAbstractVideoBuffer. A QVideoFrame + may be constructed from any buffer type by subclassing the QAbstractVideoBuffer class. + + \note QVideoFrame is explicitly shared, any change made to video frame will also apply to any + copies. +*/ + +/*! + \enum QVideoFrame::PixelFormat + + Enumerates video data types. + + \value Format_Invalid + The frame is invalid. + + \value Format_ARGB32 + The frame is stored using a 32-bit ARGB format (0xAARRGGBB). This is equivalent to + QImage::Format_ARGB32. + + \value Format_ARGB32_Premultiplied + The frame stored using a premultiplied 32-bit ARGB format (0xAARRGGBB). This is equivalent + to QImage::Format_ARGB32_Premultiplied. + + \value Format_RGB32 + The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to + QImage::Format_RGB32 + + \value Format_RGB24 + The frame is stored using a 24-bit RGB format (8-8-8). This is equivalent to + QImage::Format_RGB888 + + \value Format_RGB565 + The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to + QImage::Format_RGB16. + + \value Format_RGB555 + The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to + QImage::Format_RGB555. + + \value Format_ARGB8565_Premultiplied + The frame is stored using a 24-bit premultiplied ARGB format (8-6-6-5). + + \value Format_BGRA32 + The frame is stored using a 32-bit ARGB format (0xBBGGRRAA). + + \value Format_BGRA32_Premultiplied + The frame is stored using a premultiplied 32bit BGRA format. + + \value Format_BGR32 + The frame is stored using a 32-bit BGR format (0xBBGGRRff). + + \value Format_BGR24 + The frame is stored using a 24-bit BGR format (0xBBGGRR). + + \value Format_BGR565 + The frame is stored using a 16-bit BGR format (5-6-5). + + \value Format_BGR555 + The frame is stored using a 16-bit BGR format (5-5-5). + + \value Format_BGRA5658_Premultiplied + The frame is stored using a 24-bit premultiplied BGRA format (5-6-5-8). + + \value Format_AYUV444 + The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV). + + \value Format_AYUV444_Premultiplied + The frame is stored using a packed premultiplied 32-bit AYUV format (0xAAYYUUVV). + + \value Format_YUV444 + The frame is stored using a 24-bit packed YUV format (8-8-8). + + \value Format_YUV420P + The frame is stored using an 8-bit per component planar YUV format with the U and V planes + horizontally and vertically sub-sampled, i.e. the height and width of the U and V planes are + half that of the Y plane. + + \value Format_YV12 + The frame is stored using an 8-bit per component planar YVU format with the V and U planes + horizontally and vertically sub-sampled, i.e. the height and width of the V and U planes are + half that of the Y plane. + + \value Format_UYVY + The frame is stored using an 8-bit per component packed YUV format with the U and V planes + horizontally sub-sampled (U-Y-V-Y), i.e. two horizontally adjacent pixels are stored as a 32-bit + macropixel which has a Y value for each pixel and common U and V values. + + \value Format_YUYV + The frame is stored using an 8-bit per component packed YUV format with the U and V planes + horizontally sub-sampled (Y-U-Y-V), i.e. two horizontally adjacent pixels are stored as a 32-bit + macropixel which has a Y value for each pixel and common U and V values. + + \value Format_NV12 + The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) + followed by a horizontally and vertically sub-sampled, packed UV plane (U-V). + + \value Format_NV21 + The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y) + followed by a horizontally and vertically sub-sampled, packed VU plane (V-U). + + \value Format_IMC1 + The frame is stored using an 8-bit per component planar YUV format with the U and V planes + horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except + that the bytes per line of the U and V planes are padded out to the same stride as the Y plane. + + \value Format_IMC2 + The frame is stored using an 8-bit per component planar YUV format with the U and V planes + horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except + that the lines of the U and V planes are interleaved, i.e. each line of U data is followed by a + line of V data creating a single line of the same stride as the Y data. + + \value Format_IMC3 + The frame is stored using an 8-bit per component planar YVU format with the V and U planes + horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that + the bytes per line of the V and U planes are padded out to the same stride as the Y plane. + + \value Format_IMC4 + The frame is stored using an 8-bit per component planar YVU format with the V and U planes + horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that + the lines of the V and U planes are interleaved, i.e. each line of V data is followed by a line + of U data creating a single line of the same stride as the Y data. + + \value Format_Y8 + The frame is stored using an 8-bit greyscale format. + + \value Format_Y16 + The frame is stored using a 16-bit linear greyscale format. Little endian. + + \value Format_User + Start value for user defined pixel formats. +*/ + +/*! + \enum QVideoFrame::FieldType + + Specifies the field an interlaced video frame belongs to. + + \value ProgressiveFrame The frame is not interlaced. + \value TopField The frame contains a top field. + \value BottomField The frame contains a bottom field. + \value InterlacedFrame The frame contains a merged top and bottom field. +*/ + +/*! + Constructs a null video frame. +*/ + +QVideoFrame::QVideoFrame() + : d(new QVideoFramePrivate) +{ +} + +/*! + Constructs a video frame from a \a buffer of the given pixel \a format and \a size in pixels. + + \note This doesn't increment the reference count of the video buffer. +*/ + +QVideoFrame::QVideoFrame( + QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format) + : d(new QVideoFramePrivate(size, format)) +{ + d->buffer = buffer; +} + +/*! + Constructs a video frame of the given pixel \a format and \a size in pixels. + + The \a bytesPerLine (stride) is the length of each scan line in bytes, and \a bytes is the total + number of bytes that must be allocated for the frame. +*/ + +QVideoFrame::QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format) + : d(new QVideoFramePrivate(size, format)) +{ + if (bytes > 0) { + QByteArray data; + data.resize(bytes); + + // Check the memory was successfully allocated. + if (!data.isEmpty()) + d->buffer = new QMemoryVideoBuffer(data, bytesPerLine); + } +} + +/*! + Constructs a video frame from an \a image. + + \note This will construct an invalid video frame if there is no frame type equivalent to the + image format. + + \sa equivalentPixelFormat() +*/ + +QVideoFrame::QVideoFrame(const QImage &image) + : d(new QVideoFramePrivate( + image.size(), equivalentPixelFormat(image.format()))) +{ + if (d->pixelFormat != Format_Invalid) + d->buffer = new QImageVideoBuffer(image); +} + +/*! + Constructs a copy of \a other. +*/ + +QVideoFrame::QVideoFrame(const QVideoFrame &other) + : d(other.d) +{ +} + +/*! + Assigns the contents of \a other to a video frame. +*/ + +QVideoFrame &QVideoFrame::operator =(const QVideoFrame &other) +{ + d = other.d; + + return *this; +} + +/*! + Destroys a video frame. +*/ + +QVideoFrame::~QVideoFrame() +{ +} + +/*! + Identifies whether a video frame is valid. + + An invalid frame has no video buffer associated with it. + + Returns true if the frame is valid, and false if it is not. +*/ + +bool QVideoFrame::isValid() const +{ + return d->buffer != 0; +} + +/*! + Returns the color format of a video frame. +*/ + +QVideoFrame::PixelFormat QVideoFrame::pixelFormat() const +{ + return d->pixelFormat; +} + +/*! + Returns the type of a video frame's handle. +*/ + +QAbstractVideoBuffer::HandleType QVideoFrame::handleType() const +{ + return d->buffer ? d->buffer->handleType() : QAbstractVideoBuffer::NoHandle; +} + +/*! + Returns the size of a video frame. +*/ + +QSize QVideoFrame::size() const +{ + return d->size; +} + +/*! + Returns the width of a video frame. +*/ + +int QVideoFrame::width() const +{ + return d->size.width(); +} + +/*! + Returns the height of a video frame. +*/ + +int QVideoFrame::height() const +{ + return d->size.height(); +} + +/*! + Returns the field an interlaced video frame belongs to. + + If the video is not interlaced this will return WholeFrame. +*/ + +QVideoFrame::FieldType QVideoFrame::fieldType() const +{ + return d->fieldType; +} + +/*! + Sets the \a field an interlaced video frame belongs to. +*/ + +void QVideoFrame::setFieldType(QVideoFrame::FieldType field) +{ + d->fieldType = field; +} + +/*! + Identifies if a video frame's contents are currently mapped to system memory. + + This is a convenience function which checks that the \l {QAbstractVideoBuffer::MapMode}{MapMode} + of the frame is not equal to QAbstractVideoBuffer::NotMapped. + + Returns true if the contents of the video frame are mapped to system memory, and false + otherwise. + + \sa mapMode() QAbstractVideoBuffer::MapMode +*/ + +bool QVideoFrame::isMapped() const +{ + return d->buffer != 0 && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped; +} + +/*! + Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped. + + This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode} + contains the QAbstractVideoBuffer::WriteOnly flag. + + Returns true if the video frame will be updated when unmapped, and false otherwise. + + \note The result of altering the data of a frame that is mapped in read-only mode is undefined. + Depending on the buffer implementation the changes may be persisted, or worse alter a shared + buffer. + + \sa mapMode(), QAbstractVideoBuffer::MapMode +*/ + +bool QVideoFrame::isWritable() const +{ + return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly); +} + +/*! + Identifies if the mapped contents of a video frame were read from the frame when it was mapped. + + This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode} + contains the QAbstractVideoBuffer::WriteOnly flag. + + Returns true if the contents of the mapped memory were read from the video frame, and false + otherwise. + + \sa mapMode(), QAbstractVideoBuffer::MapMode +*/ + +bool QVideoFrame::isReadable() const +{ + return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly); +} + +/*! + Returns the mode a video frame was mapped to system memory in. + + \sa map(), QAbstractVideoBuffer::MapMode +*/ + +QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const +{ + return d->buffer != 0 ? d->buffer->mapMode() : QAbstractVideoBuffer::NotMapped; +} + +/*! + Maps the contents of a video frame to memory. + + The map \a mode indicates whether the contents of the mapped memory should be read from and/or + written to the frame. If the map mode includes the QAbstractVideoBuffer::ReadOnly flag the + mapped memory will be populated with the content of the video frame when mapped. If the map + mode inclues the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be + persisted in the frame when unmapped. + + While mapped the contents of a video frame can be accessed directly through the pointer returned + by the bits() function. + + When access to the data is no longer needed be sure to call the unmap() function to release the + mapped memory. + + Returns true if the buffer was mapped to memory in the given \a mode and false otherwise. + + \sa unmap(), mapMode(), bits() +*/ + +bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) +{ + if (d->buffer != 0 && d->data == 0) { + Q_ASSERT(d->bytesPerLine == 0); + Q_ASSERT(d->numBytes == 0); + + d->data = d->buffer->map(mode, &d->numBytes, &d->bytesPerLine); + + return d->data != 0; + } + + return false; +} + +/*! + Releases the memory mapped by the map() function. + + If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the QAbstractVideoBuffer::WriteOnly + flag this will persist the current content of the mapped memory to the video frame. + + \sa map() +*/ + +void QVideoFrame::unmap() +{ + if (d->data != 0) { + d->numBytes = 0; + d->bytesPerLine = 0; + d->data = 0; + + d->buffer->unmap(); + } +} + +/*! + Returns the number of bytes in a scan line. + + \note This is the bytes per line of the first plane only. The bytes per line of subsequent + planes should be calculated as per the frame type. + + This value is only valid while the frame data is \l {map()}{mapped}. + + \sa bits(), map(), numBytes() +*/ + +int QVideoFrame::bytesPerLine() const +{ + return d->bytesPerLine; +} + +/*! + Returns a pointer to the start of the frame data buffer. + + This value is only valid while the frame data is \l {map()}{mapped}. + + \sa map(), numBytes(), bytesPerLine() +*/ + +uchar *QVideoFrame::bits() +{ + return d->data; +} + +/*! + Returns a pointer to the start of the frame data buffer. + + This value is only valid while the frame data is \l {map()}{mapped}. + + \sa map(), numBytes(), bytesPerLine() +*/ + +const uchar *QVideoFrame::bits() const +{ + return d->data; +} + +/*! + Returns the number of bytes occupied by the frame data. + + This value is only valid while the frame data is \l {map()}{mapped}. + + \sa map() +*/ + +int QVideoFrame::numBytes() const +{ + return d->numBytes; +} + +/*! + Returns a type specific handle to a video frame's buffer. + + For an OpenGL texture this would be the texture ID. + + \sa QAbstractVideoBuffer::handle() +*/ + +QVariant QVideoFrame::handle() const +{ + return d->buffer != 0 ? d->buffer->handle() : QVariant(); +} + +/*! + Returns the presentation time when the frame should be displayed. +*/ + +qint64 QVideoFrame::startTime() const +{ + return d->startTime; +} + +/*! + Sets the presentation \a time when the frame should be displayed. +*/ + +void QVideoFrame::setStartTime(qint64 time) +{ + d->startTime = time; +} + +/*! + Returns the presentation time when a frame should stop being displayed. +*/ + +qint64 QVideoFrame::endTime() const +{ + return d->endTime; +} + +/*! + Sets the presentation \a time when a frame should stop being displayed. +*/ + +void QVideoFrame::setEndTime(qint64 time) +{ + d->endTime = time; +} + +/*! + Returns an video pixel format equivalent to an image \a format. If there is no equivalent + format QVideoFrame::InvalidType is returned instead. +*/ + +QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format format) +{ + switch (format) { + case QImage::Format_Invalid: + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + case QImage::Format_Indexed8: + return Format_Invalid; + case QImage::Format_RGB32: + return Format_RGB32; + case QImage::Format_ARGB32: + return Format_ARGB32; + case QImage::Format_ARGB32_Premultiplied: + return Format_ARGB32_Premultiplied; + case QImage::Format_RGB16: + return Format_RGB565; + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_RGB666: + case QImage::Format_ARGB6666_Premultiplied: + return Format_Invalid; + case QImage::Format_RGB555: + return Format_RGB555; + case QImage::Format_ARGB8555_Premultiplied: + return Format_Invalid; + case QImage::Format_RGB888: + return Format_RGB24; + case QImage::Format_RGB444: + case QImage::Format_ARGB4444_Premultiplied: + return Format_Invalid; + case QImage::NImageFormats: + return Format_Invalid; + } + return Format_Invalid; +} + +/*! + Returns an image format equivalent to a video frame pixel \a format. If there is no equivalent + format QImage::Format_Invalid is returned instead. +*/ + +QImage::Format QVideoFrame::equivalentImageFormat(PixelFormat format) +{ + switch (format) { + case Format_Invalid: + return QImage::Format_Invalid; + case Format_ARGB32: + return QImage::Format_ARGB32; + case Format_ARGB32_Premultiplied: + return QImage::Format_ARGB32_Premultiplied; + case Format_RGB32: + return QImage::Format_RGB32; + case Format_RGB24: + return QImage::Format_RGB888; + case Format_RGB565: + return QImage::Format_RGB16; + case Format_RGB555: + return QImage::Format_RGB555; + case Format_ARGB8565_Premultiplied: + return QImage::Format_ARGB8565_Premultiplied; + case Format_BGRA32: + case Format_BGRA32_Premultiplied: + case Format_BGR32: + case Format_BGR24: + return QImage::Format_Invalid; + case Format_BGR565: + case Format_BGR555: + case Format_BGRA5658_Premultiplied: + case Format_AYUV444: + case Format_AYUV444_Premultiplied: + case Format_YUV444: + case Format_YUV420P: + case Format_YV12: + case Format_UYVY: + case Format_YUYV: + case Format_NV12: + case Format_NV21: + case Format_IMC1: + case Format_IMC2: + case Format_IMC3: + case Format_IMC4: + case Format_Y8: + case Format_Y16: + return QImage::Format_Invalid; + case Format_User: + return QImage::Format_Invalid; + } + return QImage::Format_Invalid; +} + +QT_END_NAMESPACE + diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h new file mode 100644 index 0000000..5bd9ac3 --- /dev/null +++ b/src/multimedia/video/qvideoframe.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVIDEOFRAME_H +#define QVIDEOFRAME_H + +#include <QtCore/qmetatype.h> +#include <QtCore/qshareddata.h> +#include <QtGui/qimage.h> +#include <QtMultimedia/qabstractvideobuffer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QSize; +class QVariant; + +class QVideoFramePrivate; + +class Q_MULTIMEDIA_EXPORT QVideoFrame +{ +public: + enum FieldType + { + ProgressiveFrame, + TopField, + BottomField, + InterlacedFrame + }; + + enum PixelFormat + { + Format_Invalid, + Format_ARGB32, + Format_ARGB32_Premultiplied, + Format_RGB32, + Format_RGB24, + Format_RGB565, + Format_RGB555, + Format_ARGB8565_Premultiplied, + Format_BGRA32, + Format_BGRA32_Premultiplied, + Format_BGR32, + Format_BGR24, + Format_BGR565, + Format_BGR555, + Format_BGRA5658_Premultiplied, + + Format_AYUV444, + Format_AYUV444_Premultiplied, + Format_YUV444, + Format_YUV420P, + Format_YV12, + Format_UYVY, + Format_YUYV, + Format_NV12, + Format_NV21, + Format_IMC1, + Format_IMC2, + Format_IMC3, + Format_IMC4, + Format_Y8, + Format_Y16, + + Format_User = 1000 + }; + + QVideoFrame(); + QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format); + QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format); + QVideoFrame(const QImage &image); + QVideoFrame(const QVideoFrame &other); + ~QVideoFrame(); + + QVideoFrame &operator =(const QVideoFrame &other); + + bool isValid() const; + + PixelFormat pixelFormat() const; + + QAbstractVideoBuffer::HandleType handleType() const; + + QSize size() const; + int width() const; + int height() const; + + FieldType fieldType() const; + void setFieldType(FieldType); + + bool isMapped() const; + bool isReadable() const; + bool isWritable() const; + + QAbstractVideoBuffer::MapMode mapMode() const; + + bool map(QAbstractVideoBuffer::MapMode mode); + void unmap(); + + int bytesPerLine() const; + + uchar *bits(); + const uchar *bits() const; + int numBytes() const; + + QVariant handle() const; + + qint64 startTime() const; + void setStartTime(qint64 time); + + qint64 endTime() const; + void setEndTime(qint64 time); + + static PixelFormat equivalentPixelFormat(QImage::Format format); + static QImage::Format equivalentImageFormat(PixelFormat format); + +private: + QExplicitlySharedDataPointer<QVideoFramePrivate> d; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QVideoFrame::FieldType) +Q_DECLARE_METATYPE(QVideoFrame::PixelFormat) + +QT_END_HEADER + +#endif + diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp new file mode 100644 index 0000000..7e18dda --- /dev/null +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -0,0 +1,742 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvideosurfaceformat.h" + +#include <qdebug.h> +#include <qmetatype.h> +#include <qpair.h> +#include <qvariant.h> +#include <qvector.h> + +QT_BEGIN_NAMESPACE + +class QVideoSurfaceFormatPrivate : public QSharedData +{ +public: + QVideoSurfaceFormatPrivate() + : pixelFormat(QVideoFrame::Format_Invalid) + , handleType(QAbstractVideoBuffer::NoHandle) + , scanLineDirection(QVideoSurfaceFormat::TopToBottom) + , pixelAspectRatio(1, 1) + , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , frameRate(0, 0) + { + } + + QVideoSurfaceFormatPrivate( + const QSize &size, + QVideoFrame::PixelFormat format, + QAbstractVideoBuffer::HandleType type) + : pixelFormat(format) + , handleType(type) + , scanLineDirection(QVideoSurfaceFormat::TopToBottom) + , frameSize(size) + , pixelAspectRatio(1, 1) + , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , viewport(QPoint(0, 0), size) + , frameRate(0, 0) + { + } + + QVideoSurfaceFormatPrivate(const QVideoSurfaceFormatPrivate &other) + : QSharedData(other) + , pixelFormat(other.pixelFormat) + , handleType(other.handleType) + , scanLineDirection(other.scanLineDirection) + , frameSize(other.frameSize) + , pixelAspectRatio(other.pixelAspectRatio) + , yuvColorSpace(other.yuvColorSpace) + , viewport(other.viewport) + , frameRate(other.frameRate) + , propertyNames(other.propertyNames) + , propertyValues(other.propertyValues) + { + } + + bool operator ==(const QVideoSurfaceFormatPrivate &other) const + { + if (pixelFormat == other.pixelFormat + && handleType == other.handleType + && scanLineDirection == other.scanLineDirection + && frameSize == other.frameSize + && pixelAspectRatio == other.pixelAspectRatio + && viewport == other.viewport + && frameRate == other.frameRate + && yuvColorSpace == other.yuvColorSpace + && propertyNames.count() == other.propertyNames.count()) { + for (int i = 0; i < propertyNames.count(); ++i) { + int j = other.propertyNames.indexOf(propertyNames.at(i)); + + if (j == -1 || propertyValues.at(i) != other.propertyValues.at(j)) + return false; + } + return true; + } else { + return false; + } + } + + QVideoFrame::PixelFormat pixelFormat; + QAbstractVideoBuffer::HandleType handleType; + QVideoSurfaceFormat::Direction scanLineDirection; + QSize frameSize; + QSize pixelAspectRatio; + QVideoSurfaceFormat::YuvColorSpace yuvColorSpace; + QRect viewport; + QVideoSurfaceFormat::FrameRate frameRate; + QList<QByteArray> propertyNames; + QList<QVariant> propertyValues; +}; + +/*! + \class QVideoSurfaceFormat + \brief The QVideoSurfaceFormat class specifies the stream format of a video presentation + surface. + \preliminary + \since 4.6 + + A video surface presents a stream of video frames. The surface's format describes the type of + the frames and determines how they should be presented. + + The core properties of a video stream required to setup a video surface are the pixel format + given by pixelFormat(), and the frame dimensions given by frameSize(). + + If the surface is to present frames using a frame's handle a surface format will also include + a handle type which is given by the handleType() function. + + The region of a frame that is actually displayed on a video surface is given by the viewport(). + A stream may have a viewport less than the entire region of a frame to allow for videos smaller + than the nearest optimal size of a video frame. For example the width of a frame may be + extended so that the start of each scan line is eight byte aligned. + + Other common properties are the pixelAspectRatio(), scanLineDirection(), and frameRate(). + Additionally a stream may have some additional type specific properties which are listed by the + dynamicPropertyNames() function and can be accessed using the property(), and setProperty() + functions. +*/ + +/*! + \enum QVideoSurfaceFormat::Direction + + Enumerates the layout direction of video scan lines. + + \value TopToBottom Scan lines are arranged from the top of the frame to the bottom. + \value BottomToTop Scan lines are arranged from the bottom of the frame to the top. +*/ + +/*! + \enum QVideoSurfaceFormat::ViewportMode + + Enumerates the methods for updating the stream viewport when the frame size is changed. + + \value ResetViewport The viewport is reset to cover an entire frame. + \value KeepViewport The viewport is kept within the bounds the frame. +*/ + +/*! + \enum QVideoSurfaceFormat::YuvColorSpace + + Enumerates the YUV color space of video frames. + + \value YCbCr_Undefined + No color space is specified. + + \value YCbCr_BT601 + A Y'CbCr color space defined by ITU-R recommendation BT.601 + with Y value range from 16 to 235, and Cb/Cr range from 16 to 240. + Used in standard definition video. + + \value YCbCr_BT709 + A Y'CbCr color space defined by ITU-R BT.709 with the same values range as YCbCr_BT601. Used + for HDTV. + + \value YCbCr_xvYCC601 + The BT.601 color space with the value range extended to 0 to 255. + It is backward compatibile with BT.601 and uses values outside BT.601 range to represent + wider colors range. + + \value YCbCr_xvYCC709 + The BT.709 color space with the value range extended to 0 to 255. + + \value YCbCr_JPEG + The full range Y'CbCr color space used in JPEG files. +*/ + + +/*! + \typedef QVideoSurfaceFormat::FrameRate + + A pair of integers representing the frame rate of a video stream. + + The first number is the numerator and the second the denominator. +*/ + +/*! + Constructs a null video stream format. +*/ + +QVideoSurfaceFormat::QVideoSurfaceFormat() + : d(new QVideoSurfaceFormatPrivate) +{ +} + +/*! + Contructs a description of stream which receives stream of \a type buffers with given frame + \a size and pixel \a format. +*/ + +QVideoSurfaceFormat::QVideoSurfaceFormat( + const QSize& size, QVideoFrame::PixelFormat format, QAbstractVideoBuffer::HandleType type) + : d(new QVideoSurfaceFormatPrivate(size, format, type)) +{ +} + +/*! + Constructs a copy of \a other. +*/ + +QVideoSurfaceFormat::QVideoSurfaceFormat(const QVideoSurfaceFormat &other) + : d(other.d) +{ +} + +/*! + Assigns the values of \a other to a video stream description. +*/ + +QVideoSurfaceFormat &QVideoSurfaceFormat::operator =(const QVideoSurfaceFormat &other) +{ + d = other.d; + + return *this; +} + +/*! + Destroys a video stream description. +*/ + +QVideoSurfaceFormat::~QVideoSurfaceFormat() +{ +} + +/*! + Identifies if a video surface format has a valid pixel format and frame size. + + Returns true if the format is valid, and false otherwise. +*/ + +bool QVideoSurfaceFormat::isValid() const +{ + return d->pixelFormat == QVideoFrame::Format_Invalid && d->frameSize.isValid(); +} + +/*! + Returns true if \a other is the same as a video format, and false if they are the different. +*/ + +bool QVideoSurfaceFormat::operator ==(const QVideoSurfaceFormat &other) const +{ + return d == other.d || *d == *other.d; +} + +/*! + Returns true if \a other is different to a video format, and false if they are the same. +*/ + +bool QVideoSurfaceFormat::operator !=(const QVideoSurfaceFormat &other) const +{ + return d != other.d && !(*d == *other.d); +} + +/*! + Returns the pixel format of frames in a video stream. +*/ + +QVideoFrame::PixelFormat QVideoSurfaceFormat::pixelFormat() const +{ + return d->pixelFormat; +} + +/*! + Returns the type of handle the surface uses to present the frame data. + + If the handle type is QAbstractVideoBuffer::NoHandle buffers with any handle type are valid + provided they can be \l {QAbstractVideoBuffer::map()}{mapped} with the + QAbstractVideoBuffer::ReadOnly flag. If the handleType() is not QAbstractVideoBuffer::NoHandle + then the handle type of the buffer be the same as that of the surface format. +*/ + +QAbstractVideoBuffer::HandleType QVideoSurfaceFormat::handleType() const +{ + return d->handleType; +} + +/*! + Returns the size of frames in a video stream. + + \sa frameWidth(), frameHeight() +*/ + +QSize QVideoSurfaceFormat::frameSize() const +{ + return d->frameSize; +} + +/*! + Returns the width of frames in a video stream. + + \sa frameSize(), frameHeight() +*/ + +int QVideoSurfaceFormat::frameWidth() const +{ + return d->frameSize.width(); +} + +/*! + Returns the height of frame in a video stream. +*/ + +int QVideoSurfaceFormat::frameHeight() const +{ + return d->frameSize.height(); +} + +/*! + Sets the size of frames in a video stream to \a size. + + The viewport \a mode indicates how the view port should be updated. +*/ + +void QVideoSurfaceFormat::setFrameSize(const QSize &size, ViewportMode mode) +{ + d->frameSize = size; + + switch (mode) { + case ResetViewport: + d->viewport = QRect(QPoint(0, 0), size); + break; + case KeepViewport: + d->viewport = QRect(QPoint(0, 0), size).intersected(d->viewport); + break; + } +} + +/*! + \overload + + Sets the \a width and \a height of frames in a video stream. + + The viewport \a mode indicates how the view port should be updated. +*/ + +void QVideoSurfaceFormat::setFrameSize(int width, int height, ViewportMode mode) +{ + setFrameSize(QSize(width, height), mode); +} + +/*! + Returns the viewport of a video stream. + + The viewport is the region of a video frame that is actually displayed. + + By default the viewport covers an entire frame. +*/ + +QRect QVideoSurfaceFormat::viewport() const +{ + return d->viewport; +} + +/*! + Sets the viewport of a video stream to \a viewport. +*/ + +void QVideoSurfaceFormat::setViewport(const QRect &viewport) +{ + d->viewport = viewport; +} + +/*! + Returns the direction of scan lines. +*/ + +QVideoSurfaceFormat::Direction QVideoSurfaceFormat::scanLineDirection() const +{ + return d->scanLineDirection; +} + +/*! + Sets the \a direction of scan lines. +*/ + +void QVideoSurfaceFormat::setScanLineDirection(Direction direction) +{ + d->scanLineDirection = direction; +} + +/*! + Returns the frame rate of a video stream. + + The frame rate is a rational number represented by a pair of integers. + The first integer is the numerator and the second the denominator. +*/ + +QVideoSurfaceFormat::FrameRate QVideoSurfaceFormat::frameRate() const +{ + return d->frameRate; +} + +/*! + Sets the frame \a rate of a video stream. + + The frame rate is a rational number represented by a pair of integers. + The first integer is the numerator and the second the denominator. +*/ + +void QVideoSurfaceFormat::setFrameRate(const FrameRate &rate) +{ + d->frameRate = rate; +} + +/*! + \overload + + Sets the \a numerator and \a denominator of the frame rate of a video stream. +*/ + +void QVideoSurfaceFormat::setFrameRate(int numerator, int denominator) +{ + d->frameRate = qMakePair(numerator, denominator); +} + +/*! + Returns a video stream's pixel aspect ratio. +*/ + +QSize QVideoSurfaceFormat::pixelAspectRatio() const +{ + return d->pixelAspectRatio; +} + +/*! + Sets a video stream's pixel aspect \a ratio. +*/ + +void QVideoSurfaceFormat::setPixelAspectRatio(const QSize &ratio) +{ + d->pixelAspectRatio = ratio; +} + +/*! + \overload + + Sets the \a horizontal and \a vertical elements of a video stream's pixel aspect ratio. +*/ + +void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical) +{ + d->pixelAspectRatio = QSize(horizontal, vertical); +} + +/*! + Returns a YUV color space of a video stream. +*/ + +QVideoSurfaceFormat::YuvColorSpace QVideoSurfaceFormat::yuvColorSpace() const +{ + return d->yuvColorSpace; +} + +/*! + Sets a YUV color \a space of a video stream. + It is only used with raw YUV frame types. +*/ + +void QVideoSurfaceFormat::setYuvColorSpace(QVideoSurfaceFormat::YuvColorSpace space) +{ + d->yuvColorSpace = space; +} + +/*! + Returns a suggested size in pixels for the video stream. + + This is the size of the viewport scaled according to the pixel aspect ratio. +*/ + +QSize QVideoSurfaceFormat::sizeHint() const +{ + QSize size = d->viewport.size(); + + if (d->pixelAspectRatio.height() != 0) + size.setWidth(size.width() * d->pixelAspectRatio.width() / d->pixelAspectRatio.height()); + + return size; +} + +/*! + Returns a list of video format dynamic property names. +*/ + +QList<QByteArray> QVideoSurfaceFormat::propertyNames() const +{ + return (QList<QByteArray>() + << "handleType" + << "pixelFormat" + << "frameSize" + << "frameWidth" + << "viewport" + << "scanLineDirection" + << "frameRate" + << "pixelAspectRatio" + << "sizeHint" + << "yuvColorSpace") + + d->propertyNames; +} + +/*! + Returns the value of the video format's \a name property. +*/ + +QVariant QVideoSurfaceFormat::property(const char *name) const +{ + if (qstrcmp(name, "handleType") == 0) { + return qVariantFromValue(d->handleType); + } else if (qstrcmp(name, "pixelFormat") == 0) { + return qVariantFromValue(d->pixelFormat); + } else if (qstrcmp(name, "handleType") == 0) { + return qVariantFromValue(d->handleType); + } else if (qstrcmp(name, "frameSize") == 0) { + return d->frameSize; + } else if (qstrcmp(name, "frameWidth") == 0) { + return d->frameSize.width(); + } else if (qstrcmp(name, "frameHeight") == 0) { + return d->frameSize.height(); + } else if (qstrcmp(name, "viewport") == 0) { + return d->viewport; + } else if (qstrcmp(name, "scanLineDirection") == 0) { + return qVariantFromValue(d->scanLineDirection); + } else if (qstrcmp(name, "frameRate") == 0) { + return qVariantFromValue(d->frameRate); + } else if (qstrcmp(name, "pixelAspectRatio") == 0) { + return qVariantFromValue(d->pixelAspectRatio); + } else if (qstrcmp(name, "sizeHint") == 0) { + return sizeHint(); + } else if (qstrcmp(name, "yuvColorSpace") == 0) { + return qVariantFromValue(d->yuvColorSpace); + } else { + int id = 0; + for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} + + return id < d->propertyValues.count() + ? d->propertyValues.at(id) + : QVariant(); + } +} + +/*! + Sets the video format's \a name property to \a value. +*/ + +void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) +{ + if (qstrcmp(name, "handleType") == 0) { + // read only. + } else if (qstrcmp(name, "pixelFormat") == 0) { + // read only. + } else if (qstrcmp(name, "frameSize") == 0) { + if (qVariantCanConvert<QSize>(value)) { + d->frameSize = qvariant_cast<QSize>(value); + d->viewport = QRect(QPoint(0, 0), d->frameSize); + } + } else if (qstrcmp(name, "frameWidth") == 0) { + // read only. + } else if (qstrcmp(name, "frameHeight") == 0) { + // read only. + } else if (qstrcmp(name, "viewport") == 0) { + if (qVariantCanConvert<QRect>(value)) + d->viewport = qvariant_cast<QRect>(value); + } else if (qstrcmp(name, "scanLineDirection") == 0) { + if (qVariantCanConvert<Direction>(value)) + d->scanLineDirection = qvariant_cast<Direction>(value); + } else if (qstrcmp(name, "frameRate") == 0) { + if (qVariantCanConvert<FrameRate>(value)) + d->frameRate = qvariant_cast<FrameRate>(value); + } else if (qstrcmp(name, "pixelAspectRatio") == 0) { + if (qVariantCanConvert<QSize>(value)) + d->pixelAspectRatio = qvariant_cast<QSize>(value); + } else if (qstrcmp(name, "sizeHint") == 0) { + // read only. + } else if (qstrcmp(name, "yuvColorSpace") == 0) { + if (qVariantCanConvert<YuvColorSpace>(value)) + d->yuvColorSpace = qvariant_cast<YuvColorSpace>(value); + } else { + int id = 0; + for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} + + if (id < d->propertyValues.count()) { + if (value.isNull()) { + d->propertyNames.removeAt(id); + d->propertyValues.removeAt(id); + } else { + d->propertyValues[id] = value; + } + } else if (!value.isNull()) { + d->propertyNames.append(QByteArray(name)); + d->propertyValues.append(value); + } + } +} + + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f) +{ + QString typeName; + switch (f.pixelFormat()) { + case QVideoFrame::Format_Invalid: + typeName = QLatin1String("Format_Invalid"); + break; + case QVideoFrame::Format_ARGB32: + typeName = QLatin1String("Format_ARGB32"); + break; + case QVideoFrame::Format_ARGB32_Premultiplied: + typeName = QLatin1String("Format_ARGB32_Premultiplied"); + break; + case QVideoFrame::Format_RGB32: + typeName = QLatin1String("Format_RGB32"); + break; + case QVideoFrame::Format_RGB24: + typeName = QLatin1String("Format_RGB24"); + break; + case QVideoFrame::Format_RGB565: + typeName = QLatin1String("Format_RGB565"); + break; + case QVideoFrame::Format_RGB555: + typeName = QLatin1String("Format_RGB555"); + break; + case QVideoFrame::Format_ARGB8565_Premultiplied: + typeName = QLatin1String("Format_ARGB8565_Premultiplied"); + break; + case QVideoFrame::Format_BGRA32: + typeName = QLatin1String("Format_BGRA32"); + break; + case QVideoFrame::Format_BGRA32_Premultiplied: + typeName = QLatin1String("Format_BGRA32_Premultiplied"); + break; + case QVideoFrame::Format_BGR32: + typeName = QLatin1String("Format_BGR32"); + break; + case QVideoFrame::Format_BGR24: + typeName = QLatin1String("Format_BGR24"); + break; + case QVideoFrame::Format_BGR565: + typeName = QLatin1String("Format_BGR565"); + break; + case QVideoFrame::Format_BGR555: + typeName = QLatin1String("Format_BGR555"); + break; + case QVideoFrame::Format_BGRA5658_Premultiplied: + typeName = QLatin1String("Format_BGRA5658_Premultiplied"); + break; + case QVideoFrame::Format_AYUV444: + typeName = QLatin1String("Format_AYUV444"); + break; + case QVideoFrame::Format_AYUV444_Premultiplied: + typeName = QLatin1String("Format_AYUV444_Premultiplied"); + break; + case QVideoFrame::Format_YUV444: + typeName = QLatin1String("Format_YUV444"); + break; + case QVideoFrame::Format_YUV420P: + typeName = QLatin1String("Format_YUV420P"); + break; + case QVideoFrame::Format_YV12: + typeName = QLatin1String("Format_YV12"); + break; + case QVideoFrame::Format_UYVY: + typeName = QLatin1String("Format_UYVY"); + break; + case QVideoFrame::Format_YUYV: + typeName = QLatin1String("Format_YUYV"); + break; + case QVideoFrame::Format_NV12: + typeName = QLatin1String("Format_NV12"); + break; + case QVideoFrame::Format_NV21: + typeName = QLatin1String("Format_NV21"); + break; + case QVideoFrame::Format_IMC1: + typeName = QLatin1String("Format_IMC1"); + break; + case QVideoFrame::Format_IMC2: + typeName = QLatin1String("Format_IMC2"); + break; + case QVideoFrame::Format_IMC3: + typeName = QLatin1String("Format_IMC3"); + break; + case QVideoFrame::Format_IMC4: + typeName = QLatin1String("Format_IMC4"); + break; + case QVideoFrame::Format_Y8: + typeName = QLatin1String("Format_Y8"); + break; + case QVideoFrame::Format_Y16: + typeName = QLatin1String("Format_Y16"); + default: + typeName = QString(QLatin1String("UserType(%1)" )).arg(int(f.pixelFormat())); + } + + dbg.nospace() << "QVideoSurfaceFormat(" << typeName; + dbg.nospace() << ", " << f.frameSize(); + dbg.nospace() << ", viewport=" << f.viewport(); + dbg.nospace() << ", pixelAspectRatio=" << f.pixelAspectRatio(); + dbg.nospace() << ")"; + + foreach(const QByteArray& propertyName, f.propertyNames()) + dbg << "\n " << propertyName.data() << " = " << f.property(propertyName.data()); + + return dbg.space(); +} +#endif + +QT_END_NAMESPACE diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h new file mode 100644 index 0000000..72a2452 --- /dev/null +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVIDEOSURFACEFORMAT_H +#define QVIDEOSURFACEFORMAT_H + +#include <QtCore/qlist.h> +#include <QtCore/qpair.h> +#include <QtCore/qshareddata.h> +#include <QtCore/qsize.h> +#include <QtGui/qimage.h> +#include <QtMultimedia/qvideoframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QDebug; + +class QVideoSurfaceFormatPrivate; + +class Q_MULTIMEDIA_EXPORT QVideoSurfaceFormat +{ +public: + enum Direction + { + TopToBottom, + BottomToTop + }; + + enum ViewportMode + { + ResetViewport, + KeepViewport + }; + + enum YuvColorSpace + { + YCbCr_Undefined, + YCbCr_BT601, + YCbCr_BT709, + YCbCr_xvYCC601, + YCbCr_xvYCC709, + YCbCr_JPEG, +#ifndef qdoc + YCbCr_CustomMatrix +#endif + }; + + typedef QPair<int, int> FrameRate; + + QVideoSurfaceFormat(); + QVideoSurfaceFormat( + const QSize &size, + QVideoFrame::PixelFormat pixelFormat, + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); + QVideoSurfaceFormat(const QVideoSurfaceFormat &format); + ~QVideoSurfaceFormat(); + + QVideoSurfaceFormat &operator =(const QVideoSurfaceFormat &format); + + bool operator ==(const QVideoSurfaceFormat &format) const; + bool operator !=(const QVideoSurfaceFormat &format) const; + + bool isValid() const; + + QVideoFrame::PixelFormat pixelFormat() const; + QAbstractVideoBuffer::HandleType handleType() const; + + QSize frameSize() const; + void setFrameSize(const QSize &size, ViewportMode mode = ResetViewport); + void setFrameSize(int width, int height, ViewportMode mode = ResetViewport); + + int frameWidth() const; + int frameHeight() const; + + QRect viewport() const; + void setViewport(const QRect &viewport); + + Direction scanLineDirection() const; + void setScanLineDirection(Direction direction); + + FrameRate frameRate() const; + void setFrameRate(const FrameRate &rate); + void setFrameRate(int numerator, int denominator = 1); + + QSize pixelAspectRatio() const; + void setPixelAspectRatio(const QSize &ratio); + void setPixelAspectRatio(int width, int height); + + YuvColorSpace yuvColorSpace() const; + void setYuvColorSpace(YuvColorSpace colorSpace); + + QSize sizeHint() const; + + QList<QByteArray> propertyNames() const; + QVariant property(const char *name) const; + void setProperty(const char *name, const QVariant &value); + +private: + QSharedDataPointer<QVideoSurfaceFormatPrivate> d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); +#endif + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QVideoSurfaceFormat::FrameRate); +Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) +Q_DECLARE_METATYPE(QVideoSurfaceFormat::YuvColorSpace) + +QT_END_HEADER + +#endif + diff --git a/src/multimedia/video/video.pri b/src/multimedia/video/video.pri new file mode 100644 index 0000000..0547a4c --- /dev/null +++ b/src/multimedia/video/video.pri @@ -0,0 +1,21 @@ + +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/qabstractvideobuffer.h \ + $$PWD/qabstractvideobuffer_p.h \ + $$PWD/qabstractvideosurface.h \ + $$PWD/qabstractvideosurface_p.h \ + $$PWD/qimagevideobuffer_p.h \ + $$PWD/qmemoryvideobuffer_p.h \ + $$PWD/qvideoframe.h \ + $$PWD/qvideosurfaceformat.h + +SOURCES += \ + $$PWD/qabstractvideobuffer.cpp \ + $$PWD/qabstractvideosurface.cpp \ + $$PWD/qimagevideobuffer.cpp \ + $$PWD/qmemoryvideobuffer.cpp \ + $$PWD/qvideoframe.cpp \ + $$PWD/qvideosurfaceformat.cpp + diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 7b5a6e2..b111bec 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -65,7 +65,11 @@ QT_BEGIN_NAMESPACE +#ifdef Q_OS_SYMBIAN +const int QHttpNetworkConnectionPrivate::defaultChannelCount = 3; +#else const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6; +#endif // the maximum amount of requests that might be pipelined into a socket // from what was suggested, 3 seems to be OK @@ -125,30 +129,6 @@ int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const return 0; } -bool QHttpNetworkConnectionPrivate::isSocketBusy(QAbstractSocket *socket) const -{ - int i = indexOf(socket); - return (channels[i].state & QHttpNetworkConnectionChannel::BusyState); -} - -bool QHttpNetworkConnectionPrivate::isSocketWriting(QAbstractSocket *socket) const -{ - int i = indexOf(socket); - return (i != -1 && (channels[i].state & QHttpNetworkConnectionChannel::WritingState)); -} - -bool QHttpNetworkConnectionPrivate::isSocketWaiting(QAbstractSocket *socket) const -{ - int i = indexOf(socket); - return (i != -1 && (channels[i].state & QHttpNetworkConnectionChannel::WaitingState)); -} - -bool QHttpNetworkConnectionPrivate::isSocketReading(QAbstractSocket *socket) const -{ - int i = indexOf(socket); - return (i != -1 && (channels[i].state & QHttpNetworkConnectionChannel::ReadingState)); -} - qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const { return reply.d_func()->responseData.byteAmount(); @@ -623,7 +603,7 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < channelCount; ++i) { if (channels[i].reply == reply) { channels[i].reply = 0; - if (reply->d_func()->connectionCloseEnabled()) + if (reply->d_func()->isConnectionCloseEnabled()) channels[i].close(); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); return; @@ -670,7 +650,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() for (int i = 0; i < channelCount; ++i) { QAbstractSocket *chSocket = channels[i].socket; // send the request using the idle socket - if (!isSocketBusy(chSocket)) { + if (!channels[i].isSocketBusy()) { socket = chSocket; break; } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 9d2c13f..92b758e 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -165,10 +165,6 @@ public: enum { ChunkSize = 4096 }; int indexOf(QAbstractSocket *socket) const; - bool isSocketBusy(QAbstractSocket *socket) const; - bool isSocketWriting(QAbstractSocket *socket) const; - bool isSocketWaiting(QAbstractSocket *socket) const; - bool isSocketReading(QAbstractSocket *socket) const; QHttpNetworkReply *queueRequest(const QHttpNetworkRequest &request); void requeueRequest(const HttpMessagePair &pair); // e.g. after pipeline broke diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 9d78c55..d880f60 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -524,7 +524,7 @@ void QHttpNetworkConnectionChannel::allDone() handleStatus(); // ### at this point there should be no more data on the socket // close if server requested - if (reply->d_func()->connectionCloseEnabled()) + if (reply->d_func()->isConnectionCloseEnabled()) close(); // queue the finished signal, this is required since we might send new requests from // slot connected to it. The socket will not fire readyRead signal, if we are already @@ -539,7 +539,7 @@ void QHttpNetworkConnectionChannel::allDone() // move next from pipeline to current request if (!alreadyPipelinedRequests.isEmpty()) { - if (resendCurrent || reply->d_func()->connectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) { + if (resendCurrent || reply->d_func()->isConnectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) { // move the pipelined ones back to the main queue requeueCurrentlyPipelinedRequests(); } else { @@ -584,7 +584,7 @@ void QHttpNetworkConnectionChannel::detectPipeliningSupport() // check for HTTP/1.1 && (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1) // check for not having connection close - && (!reply->d_func()->connectionCloseEnabled()) + && (!reply->d_func()->isConnectionCloseEnabled()) // check if it is still connected && (socket->state() == QAbstractSocket::ConnectedState) ) { @@ -705,10 +705,30 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } +bool QHttpNetworkConnectionChannel::isSocketBusy() const +{ + return (state & QHttpNetworkConnectionChannel::BusyState); +} + +bool QHttpNetworkConnectionChannel::isSocketWriting() const +{ + return (state & QHttpNetworkConnectionChannel::WritingState); +} + +bool QHttpNetworkConnectionChannel::isSocketWaiting() const +{ + return (state & QHttpNetworkConnectionChannel::WaitingState); +} + +bool QHttpNetworkConnectionChannel::isSocketReading() const +{ + return (state & QHttpNetworkConnectionChannel::ReadingState); +} + //private slots void QHttpNetworkConnectionChannel::_q_readyRead() { - if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) { + if (isSocketWaiting() || isSocketReading()) { state = QHttpNetworkConnectionChannel::ReadingState; if (reply) receiveReply(); @@ -719,7 +739,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) { Q_UNUSED(bytes); // bytes have been written to the socket. write even more of them :) - if (connection->d_func()->isSocketWriting(socket)) + if (isSocketWriting()) sendRequest(); // otherwise we do nothing } @@ -727,7 +747,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) void QHttpNetworkConnectionChannel::_q_disconnected() { // read the available data before closing - if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) { + if (isSocketWaiting() || isSocketReading()) { state = QHttpNetworkConnectionChannel::ReadingState; if (reply) receiveReply(); diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 220b72c..687ba47 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -160,6 +160,11 @@ public: void eatWhitespace(); + bool isSocketBusy() const; + bool isSocketWriting() const; + bool isSocketWaiting() const; + bool isSocketReading() const; + protected slots: void _q_bytesWritten(qint64 bytes); // proceed sending void _q_readyRead(); // pending data to read diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index ba429fd..ea2018d 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -196,7 +196,8 @@ bool QHttpNetworkReply::isPipeliningUsed() const QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), - chunkedTransferEncoding(0), + chunkedTransferEncoding(false), + connectionCloseEnabled(true), currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), autoDecompress(false), responseData(), requestIsPrepared(false) ,pipeliningUsed(false) @@ -216,6 +217,7 @@ void QHttpNetworkReplyPrivate::clear() totalProgress = 0; currentChunkSize = 0; currentChunkRead = 0; + connectionCloseEnabled = true; connection = 0; #ifndef QT_NO_COMPRESS if (initInflate) @@ -510,6 +512,13 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) // cache isChunked() since it is called often chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked"); + + // cache isConnectionCloseEnabled since it is called often + QByteArray connectionHeaderField = headerField("connection"); + // check for explicit indication of close or the implicit connection close of HTTP/1.0 + connectionCloseEnabled = (connectionHeaderField.toLower().contains("close") || + headerField("proxy-connection").toLower().contains("close")) || + (majorVersion == 1 && minorVersion == 0 && connectionHeaderField.isEmpty()); } return bytes; } @@ -553,10 +562,9 @@ bool QHttpNetworkReplyPrivate::isChunked() return chunkedTransferEncoding; } -bool QHttpNetworkReplyPrivate::connectionCloseEnabled() +bool QHttpNetworkReplyPrivate::isConnectionCloseEnabled() { - return (headerField("connection").toLower().contains("close") || - headerField("proxy-connection").toLower().contains("close")); + return connectionCloseEnabled; } // note this function can only be used for non-chunked, non-compressed with diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 8d4d724..cfc1523 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -185,7 +185,7 @@ public: qint64 bytesAvailable() const; bool isChunked(); - bool connectionCloseEnabled(); + bool isConnectionCloseEnabled(); bool isGzipped(); #ifndef QT_NO_COMPRESS bool gzipCheckHeader(QByteArray &content, int &pos); @@ -212,6 +212,7 @@ public: qint64 totalProgress; QByteArray fragment; // used for header, status, chunk header etc, not for reply data bool chunkedTransferEncoding; + bool connectionCloseEnabled; qint64 currentChunkSize; qint64 currentChunkRead; QPointer<QHttpNetworkConnection> connection; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 30f16da..faf04da 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -951,6 +951,12 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo if (hop_by_hop) continue; + // Do not copy over the Date header because it will be + // different for every request and therefore cause a re-write to + // the disk when a 304 is received inside replyHeaderChanged() + if (header == "date") + continue; + // Don't store Warning 1xx headers if (header == "warning") { QByteArray v = rawHeader(header); diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 347fb72..4fcf740 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1282,8 +1282,9 @@ void QAbstractSocket::connectToHostImplementation(const QString &hostName, quint (int) openMode); #endif - if (d->state == ConnectedState || d->state == ConnectingState || d->state == ClosingState) { - qWarning("QAbstractSocket::connectToHost() called when already connecting/connected to \"%s\"", qPrintable(hostName)); + if (d->state == ConnectedState || d->state == ConnectingState + || d->state == ClosingState || d->state == HostLookupState) { + qWarning("QAbstractSocket::connectToHost() called when already looking up or connecting/connected to \"%s\"", qPrintable(hostName)); return; } diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index a09b8c43..8d855b1 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -381,7 +381,7 @@ QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubje } const char *altNameStr = reinterpret_cast<const char *>(q_ASN1_STRING_data(genName->d.ia5)); - const QString altName = QLatin1String(QByteArray(altNameStr, len)); + const QString altName = QString::fromLatin1(altNameStr, len); if (genName->type == GEN_DNS) result.insert(QSsl::DnsEntry, altName); else if (genName->type == GEN_EMAIL) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index cdbcb86..94f1006 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -683,7 +683,16 @@ void QSslSocket::close() #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocket::close()"; #endif + Q_D(QSslSocket); QTcpSocket::close(); + + // must be cleared, reading/writing not possible on closed socket: + d->readBuffer.clear(); + d->writeBuffer.clear(); + // for QTcpSocket this is already done because it uses the readBuffer/writeBuffer + // if the QIODevice it is based on + // ### FIXME QSslSocket should probably do similar instead of having + // its own readBuffer/writeBuffer } /*! @@ -1288,10 +1297,8 @@ QList<QSslCertificate> QSslSocket::defaultCaCertificates() } /*! - Returns the system default CA certificate database for your - system. This database is normally found in a standard place for - your system. If it is not found there, Qt will provide its own - default CA certificate database. The CA certificate database + This function provides a default CA certificate database + shipped together with Qt. The CA certificate database returned by this function is used to initialize the database returned by defaultCaCertificates(). You can replace that database with your own with setDefaultCaCertificates(). diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp index 8f9a6a9..425b877 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp @@ -98,7 +98,7 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc case QPainterPath::MoveToElement: // qDebug("element[%d] is a MoveToElement", i); vertexArrayStops.append(vertexArray.size()); - vertexArray.add(points[i]); // Add the moveTo as a new vertex + lineToArray(points[i].x(), points[i].y()); // Add the moveTo as a new vertex break; case QPainterPath::LineToElement: // qDebug("element[%d] is a LineToElement", i); diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp index a82caa0..9a729f9 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -44,6 +44,8 @@ #include "qpaintengineex_opengl2_p.h" #include <private/qpainter_p.h> +QT_BEGIN_NAMESPACE + class QGLCustomShaderStagePrivate { public: @@ -121,3 +123,5 @@ void QGLCustomShaderStage::setSource(const QByteArray& s) Q_D(QGLCustomShaderStage); d->m_source = s; } + +QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index 70e9ff0..5392643 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -34,11 +34,14 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef QGL_CUSTOM_SHADER_STAGE_H +#define QGL_CUSTOM_SHADER_STAGE_H + // // W A R N I N G // ------------- @@ -50,9 +53,6 @@ // We mean it. // -#ifndef QGL_CUSTOM_SHADER_STAGE_H -#define QGL_CUSTOM_SHADER_STAGE_H - #include <QGLShaderProgram> QT_BEGIN_HEADER diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 795c8b0..e6b1994 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -161,7 +161,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) #if defined(QT_DEBUG) // Check that all the elements have been filled: for (int i = 0; i < TotalShaderCount; ++i) { - if (i != CustomImageSrcFragmentShader && qglEngineShaderSourceCode[i] == 0) { + if (qglEngineShaderSourceCode[i] == 0) { int enumIndex = staticMetaObject.indexOfEnumerator("ShaderName"); QMetaEnum m = staticMetaObject.enumerator(enumIndex); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 1ee75df..ace6b63 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -209,7 +209,7 @@ (QGLCustomShaderStage). The shader will implement a pre-defined method name which Qt's fragment pipeline will call: - lowp vec4 customShader(sampler2d src, vec2 srcCoords) + lowp vec4 customShader(lowp sampler2d imageTexture, highp vec2 textureCoords) The provided src and srcCoords parameters can be used to sample from the source image. @@ -361,7 +361,6 @@ public: MainFragmentShader, ImageSrcFragmentShader, - CustomSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, CustomImageSrcFragmentShader, diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index cf930f3..c8e85ab 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -73,8 +73,8 @@ static const char* const qglslMainVertexShader = "\ }"; static const char* const qglslMainWithTexCoordsVertexShader = "\ - attribute mediump vec2 textureCoordArray; \ - varying mediump vec2 textureCoords; \ + attribute highp vec2 textureCoordArray; \ + varying highp vec2 textureCoords; \ uniform highp float depth;\ void setPosition();\ void main(void) \ @@ -105,9 +105,9 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\ attribute highp vec4 vertexCoordsArray; \ uniform highp mat4 pmvMatrix; \ uniform mediump vec2 halfViewportSize; \ - uniform mediump vec2 invertedTextureSize; \ - uniform mediump mat3 brushTransform; \ - varying mediump vec2 patternTexCoords; \ + uniform highp vec2 invertedTextureSize; \ + uniform highp mat3 brushTransform; \ + varying highp vec2 patternTexCoords; \ void setPosition(void) { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -124,9 +124,9 @@ static const char* const qglslAffinePositionWithPatternBrushVertexShader = qglslPositionWithPatternBrushVertexShader; static const char* const qglslPatternBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture;\ + uniform lowp sampler2D brushTexture;\ uniform lowp vec4 patternColor; \ - varying mediump vec2 patternTexCoords;\ + varying highp vec2 patternTexCoords;\ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \ }\n"; @@ -139,7 +139,7 @@ static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\ uniform mediump vec2 halfViewportSize; \ uniform highp vec3 linearData; \ uniform highp mat3 brushTransform; \ - varying mediump float index ; \ + varying mediump float index; \ void setPosition() { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -155,7 +155,7 @@ static const char* const qglslAffinePositionWithLinearGradientBrushVertexShader = qglslPositionWithLinearGradientBrushVertexShader; static const char* const qglslLinearGradientBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ varying mediump float index; \ lowp vec4 srcPixel() { \ mediump vec2 val = vec2(index, 0.5); \ @@ -187,7 +187,7 @@ static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\ #define INVERSE_2PI 0.1591549430918953358 \n\ - uniform sampler2D brushTexture; \n\ + uniform lowp sampler2D brushTexture; \n\ uniform mediump float angle; \ varying highp vec2 A; \ lowp vec4 srcPixel() { \ @@ -226,7 +226,7 @@ static const char* const qglslAffinePositionWithRadialGradientBrushVertexShader = qglslPositionWithRadialGradientBrushVertexShader; static const char* const qglslRadialGradientBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ uniform highp float fmp2_m_radius2; \ uniform highp float inverse_2_fmp2_m_radius2; \ varying highp float b; \ @@ -243,9 +243,9 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\ attribute highp vec4 vertexCoordsArray; \ uniform highp mat4 pmvMatrix; \ uniform mediump vec2 halfViewportSize; \ - uniform mediump vec2 invertedTextureSize; \ - uniform mediump mat3 brushTransform; \ - varying mediump vec2 brushTextureCoords; \ + uniform highp vec2 invertedTextureSize; \ + uniform highp mat3 brushTransform; \ + varying highp vec2 brushTextureCoords; \ void setPosition(void) { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -255,23 +255,22 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\ gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \ gl_Position.w = invertedHTexCoordsZ; \ brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \ - brushTextureCoords.y = -brushTextureCoords.y; \ }"; static const char* const qglslAffinePositionWithTextureBrushVertexShader = qglslPositionWithTextureBrushVertexShader; static const char* const qglslTextureBrushSrcFragmentShader = "\ - varying mediump vec2 brushTextureCoords; \ - uniform sampler2D brushTexture; \ + varying highp vec2 brushTextureCoords; \ + uniform lowp sampler2D brushTexture; \ lowp vec4 srcPixel() { \ return texture2D(brushTexture, brushTextureCoords); \ }"; static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\ - varying mediump vec2 brushTextureCoords; \ + varying highp vec2 brushTextureCoords; \ uniform lowp vec4 patternColor; \ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \ }"; @@ -284,16 +283,16 @@ static const char* const qglslSolidBrushSrcFragmentShader = "\ }"; static const char* const qglslImageSrcFragmentShader = "\ - varying mediump vec2 textureCoords; \ - uniform sampler2D imageTexture; \ + varying highp vec2 textureCoords; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ return texture2D(imageTexture, textureCoords); \ }"; static const char* const qglslCustomSrcFragmentShader = "\ varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ - lowp vec4 customShader(sampler2D texture, vec2 coords); \ + uniform lowp sampler2D imageTexture; \ + lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \ lowp vec4 srcPixel() { \ return customShader(imageTexture, textureCoords); \ }"; @@ -301,14 +300,14 @@ static const char* const qglslCustomSrcFragmentShader = "\ static const char* const qglslImageSrcWithPatternFragmentShader = "\ varying highp vec2 textureCoords; \ uniform lowp vec4 patternColor; \ - uniform sampler2D imageTexture; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \ }\n"; static const char* const qglslNonPremultipliedImageSrcFragmentShader = "\ varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ lowp vec4 sample = texture2D(imageTexture, textureCoords); \ sample.rgb = sample.rgb * sample.a; \ @@ -383,7 +382,7 @@ static const char* const qglslMainFragmentShader = "\ static const char* const qglslMaskFragmentShader = "\ varying highp vec2 textureCoords;\ - uniform sampler2D maskTexture;\ + uniform lowp sampler2D maskTexture;\ lowp vec4 applyMask(lowp vec4 src) \ {\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \ diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 7a3fa56..cc9b014 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -376,6 +376,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader() void QGL2PaintEngineExPrivate::updateBrushTexture() { + Q_Q(QGL2PaintEngineEx); // qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()"); Qt::BrushStyle style = currentBrush->style(); @@ -384,8 +385,8 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() QImage texImage = qt_imageForBrush(style, false); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { // Gradiant brush: All the gradiants use the same texture @@ -400,18 +401,18 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() glBindTexture(GL_TEXTURE_2D, texId); if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient) - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); else if (g->spread() == QGradient::ReflectSpread) - updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, true); + updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, q->state()->renderHints & QPainter::SmoothPixmapTransform); else - updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, true); + updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style == Qt::TexturePattern) { const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, true); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } brushTextureDirty = false; } @@ -666,7 +667,7 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s GLfloat dx = 1.0 / textureSize.width(); GLfloat dy = 1.0 / textureSize.height(); - QGLRect srcTextureRect(src.left*dx, 1.0 - src.top*dy, src.right*dx, 1.0 - src.bottom*dy); + QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); setCoords(staticVertexCoordinateArray, dest); setCoords(staticTextureCoordinateArray, srcTextureRect); @@ -674,7 +675,7 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } -void QGL2PaintEngineEx::sync() +void QGL2PaintEngineEx::beginNativePainting() { Q_D(QGL2PaintEngineEx); ensureActive(); @@ -708,15 +709,25 @@ void QGL2PaintEngineEx::sync() #endif d->lastTexture = GLuint(-1); + d->resetGLState(); + + d->needsSync = true; +} +void QGL2PaintEngineExPrivate::resetGLState() +{ glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); - glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); glDepthFunc(GL_LESS); glDepthMask(true); glClearDepth(1); +} +void QGL2PaintEngineEx::endNativePainting() +{ + Q_D(QGL2PaintEngineEx); d->needsSync = true; } @@ -1073,6 +1084,7 @@ void QGL2PaintEngineEx::renderHintsChanged() Q_D(QGL2PaintEngineEx); d->lastTexture = GLuint(-1); + d->brushTextureDirty = true; // qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!"); } @@ -1091,16 +1103,17 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true, true); + QGLTexture *texture = + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); - GLfloat top = texture->yInverted ? (pixmap.height() - src.top()) : src.top(); - GLfloat bottom = texture->yInverted ? (pixmap.height() - src.bottom()) : src.bottom(); + GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); + GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); QGLRect srcRect(src.left(), top, src.right(), bottom); bool isBitmap = pixmap.isQBitmap(); bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel(); - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); } @@ -1114,10 +1127,10 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true); + QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); GLuint id = texture->id; - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id); d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); } @@ -1132,7 +1145,7 @@ void QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); glBindTexture(GL_TEXTURE_2D, textureId); - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, textureId); d->drawTexture(dest, src, size, false); } @@ -1355,6 +1368,8 @@ bool QGL2PaintEngineEx::end() d->drawable.doneCurrent(); d->ctx->d_ptr->active_engine = 0; + d->resetGLState(); + return false; } @@ -1498,7 +1513,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) if (op == Qt::ReplaceClip && !d->hasClipOperations()) op = Qt::IntersectClip; - if (!path.isEmpty() && op == Qt::IntersectClip && (path.hints() & QVectorPath::RectangleHint)) { + if (!path.isEmpty() && op == Qt::IntersectClip && (path.shape() == QVectorPath::RectangleHint)) { const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); QRectF rect(points[0], points[2]); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 7b734e3..66e7a51 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -133,7 +133,9 @@ public: inline const QOpenGL2PaintEngineState *state() const { return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state()); } - virtual void sync(); + + void beginNativePainting(); + void endNativePainting(); const QGLContext* context(); @@ -168,6 +170,7 @@ public: void setBrush(const QBrush* brush); void transferMode(EngineMode newMode); + void resetGLState(); // fill, drawOutline, drawTexture & drawCachedGlyphs are the rendering entry points: void fill(const QVectorPath &path); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 57ef70c..8cf3b45 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1443,7 +1443,7 @@ bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId) for (int i = 0; i < keys.size(); ++i) { QGLTexture *tex = m_cache.object(keys.at(i)); if (tex->id == textureId && tex->context == ctx) { - tex->clean = true; // forces a glDeleteTextures() call + tex->options |= QGLContext::MemoryManagedBindOption; // forces a glDeleteTextures() call m_cache.remove(keys.at(i)); return true; } @@ -1479,7 +1479,7 @@ void QGLTextureCache::imageCleanupHook(qint64 cacheKey) if (qApp->thread() != QThread::currentThread()) return; QGLTexture *texture = instance()->getTexture(cacheKey); - if (texture && texture->clean) + if (texture && texture->options & QGLContext::MemoryManagedBindOption) instance()->remove(cacheKey); } @@ -1490,7 +1490,7 @@ void QGLTextureCache::pixmapCleanupHook(QPixmap* pixmap) if (qApp->thread() == QThread::currentThread()) { const qint64 cacheKey = pixmap->cacheKey(); QGLTexture *texture = instance()->getTexture(cacheKey); - if (texture && texture->clean) + if (texture && texture->options & QGLContext::MemoryManagedBindOption) instance()->remove(cacheKey); } #if defined(Q_WS_X11) @@ -1578,6 +1578,39 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() Please note that QGLContext is not thread safe. */ +/*! + \enum QGLContext::BindOption + A set of options to decide how to bind a texture using bindTexture(). + + \value NoBindOption Don't do anything, pass the texture straight + thru. + + \value InvertedYBindOption Specifies that the texture should be flipped + over the X axis so that the texture coordinate 0,0 corresponds to + the top left corner. Inverting the texture implies a deep copy + prior to upload. + + \value MipmapBindOption Specifies that bindTexture should try + to generate mipmaps. If the GL implementation supports the \c + GL_SGIS_generate_mipmap extension, mipmaps will be automatically + generated for the texture. Mipmap generation is only supported for + the \c GL_TEXTURE_2D target. + + \value PremultipliedAlphaBindOption Specifies that the image should be + uploaded with premultiplied alpha and does a conversion accordingly. + + \value LinearFilteringBindOption Specifies that the texture filtering + should be set to GL_LINEAR. Default is GL_NEAREST. If mipmap is + also enabled, filtering will be set to GL_LINEAR_MIPMAP_LINEAR. + + \value DefaultBindOption In Qt 4.5 and earlier, bindTexture() + would mirror the image and automatically generate mipmaps. This + option helps preserve this default behavior. + + \omitvalue MemoryManagedBindOption + + \omitvalue InternalBindOption +*/ /*! \obsolete @@ -1880,7 +1913,8 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem } /*! \internal */ -QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, bool clean) +QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options) { const qint64 key = image.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); @@ -1890,7 +1924,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G } if (!texture) - texture = bindTexture(image, target, format, key, clean); + texture = bindTexture(image, target, format, key, options); // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); @@ -1900,68 +1934,128 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G return texture; } +// #define QGL_BIND_TEXTURE_DEBUG + QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, - const qint64 key, bool clean) + const qint64 key, QGLContext::BindOptions options) { Q_Q(QGLContext); - QGLContext *ctx = q; - - // the GL_BGRA format is only present in GL version >= 1.2 - GLenum texture_format = (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) - ? GL_BGRA : GL_RGBA; +#ifdef QGL_BIND_TEXTURE_DEBUG + printf("QGLContextPrivate::bindTexture(), imageSize=(%d,%d), format=%x, options=%x\n", + image.width(), image.height(), format, int(options)); +#endif // Scale the pixmap if needed. GL textures needs to have the // dimensions 2^n+2(border) x 2^m+2(border), unless we're using GL // 2.0 or use the GL_TEXTURE_RECTANGLE texture target int tx_w = qt_next_power_of_two(image.width()); int tx_h = qt_next_power_of_two(image.height()); - bool scale = false; QImage img = image; if (( !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0) ) && (target == GL_TEXTURE_2D && (tx_w != image.width() || tx_h != image.height()))) { - scale = true; + img = img.scaled(tx_w, tx_h); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - upscaled to %dx%d\n", tx_w, tx_h); +#endif } + GLuint filtering = options & QGLContext::LinearFilteringBindOption ? GL_LINEAR : GL_NEAREST; + GLuint tx_id; glGenTextures(1, &tx_id); glBindTexture(target, tx_id); - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, filtering); + if (glFormat.directRendering() && QGLExtensions::glExtensions & QGLExtensions::GenerateMipmap - && target == GL_TEXTURE_2D && !clean) + && target == GL_TEXTURE_2D + && options & QGLContext::MipmapBindOption) { +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - generating mipmaps\n"); +#endif glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); #ifndef QT_OPENGL_ES glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); #else glTexParameterf(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); #endif - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, options & QGLContext::LinearFilteringBindOption + ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST); } else { - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, filtering); } QImage::Format target_format = img.format(); - // Note: the clean param is only true when a texture is bound - // from the QOpenGLPaintEngine - in that case we have to force - // a premultiplied texture format - if (clean || img.format() != QImage::Format_ARGB32) - target_format = QImage::Format_ARGB32_Premultiplied; - if (img.format() != target_format) - img = img.convertToFormat(target_format); + bool premul = options & QGLContext::PremultipliedAlphaBindOption; + GLenum texture_format = QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2 + ? GL_BGRA : GL_RGBA; + GLuint pixel_type = GL_UNSIGNED_BYTE; + + switch (target_format) { + case QImage::Format_ARGB32: + if (premul) { + img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting ARGB32 -> ARGB32_Premultiplied \n"); +#endif + } + break; + case QImage::Format_ARGB32_Premultiplied: + if (!premul) { + img = img.convertToFormat(target_format = QImage::Format_ARGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting ARGB32_Premultiplied -> ARGB32\n"); +#endif + } + break; + case QImage::Format_RGB16: + pixel_type = GL_UNSIGNED_SHORT_5_6_5; + texture_format = GL_RGB; + break; + case QImage::Format_RGB32: + if (format == GL_RGBA) + format = GL_RGB; + break; - QImage tx(scale ? QSize(tx_w, tx_h) : img.size(), target_format); - convertToGLFormatHelper(tx, img, texture_format); - glTexImage2D(target, 0, format, tx.width(), tx.height(), 0, texture_format, - GL_UNSIGNED_BYTE, tx.bits()); + default: + if (img.hasAlphaChannel()) { + img = img.convertToFormat(premul + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_ARGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting to 32-bit alpha format\n"); +#endif + } else { + img = img.convertToFormat(QImage::Format_RGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting to 32-bit\n"); +#endif + } + } + + if (options & QGLContext::InvertedYBindOption) { + int ipl = img.bytesPerLine() / 4; + int h = img.height(); + for (int y=0; y<h/2; ++y) { + int *a = (int *) img.scanLine(y); + int *b = (int *) img.scanLine(h - y - 1); + for (int x=0; x<ipl; ++x) + qSwap(a[x], b[x]); + } + } + + const QImage &constRef = img; // to avoid detach in bits()... + glTexImage2D(target, 0, format, img.width(), img.height(), 0, texture_format, + pixel_type, constRef.bits()); // this assumes the size of a texture is always smaller than the max cache size int cost = img.width()*img.height()*4/1024; - QGLTexture *texture = new QGLTexture(q, tx_id, target, clean, false); + QGLTexture *texture = new QGLTexture(q, tx_id, target, options); QGLTextureCache::instance()->insert(q, key, texture, cost); return texture; } @@ -1980,7 +2074,7 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe /*! \internal */ -QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert) +QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { Q_Q(QGLContext); QPixmapData *pd = pixmap.pixmapData(); @@ -2005,9 +2099,9 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap if (pd->classId() == QPixmapData::X11Class) { - texture = bindTextureFromNativePixmap(pd, key, canInvert); + texture = bindTextureFromNativePixmap(pd, key, options); if (texture) { - texture->clean = clean; + texture->options |= QGLContext::MemoryManagedBindOption; texture->boundPixmap = pd; boundPixmaps.insert(pd, QPixmap(pixmap)); } @@ -2015,7 +2109,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #endif if (!texture) - texture = bindTexture(pixmap.toImage(), target, format, key, clean); + texture = bindTexture(pixmap.toImage(), target, format, key, options); // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); @@ -2061,6 +2155,20 @@ int QGLContextPrivate::maxTextureSize() } /*! + Generates and binds a 2D GL texture to the current context, based + on \a image. The generated texture id is returned and can be used in + later \c glBindTexture() calls. + + \overload +*/ +GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption); + return texture->id; +} + +/*! Generates and binds a 2D GL texture to the current context, based on \a image. The generated texture id is returned and can be used in later \c glBindTexture() calls. @@ -2069,12 +2177,10 @@ int QGLContextPrivate::maxTextureSize() target is \c GL_TEXTURE_2D. The \a format parameter sets the internal format for the - texture. The default format is \c GL_RGBA8. + texture. The default format is \c GL_RGBA. - If the GL implementation supports the \c GL_SGIS_generate_mipmap - extension, mipmaps will be automatically generated for the - texture. Mipmap generation is only supported for the \c - GL_TEXTURE_2D target. + The binding \a options are a set of options used to decide how to + bind the texture to the context. The texture that is generated is cached, so multiple calls to bindTexture() with the same QImage will return the same texture @@ -2085,10 +2191,10 @@ int QGLContextPrivate::maxTextureSize() \sa deleteTexture() */ -GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) +GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, target, format, false); + QGLTexture *texture = d->bindTexture(image, target, format, false, options); return texture->id; } @@ -2097,7 +2203,16 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false); + QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption); + return texture->id; +} + +/*! \internal */ +GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, + BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options); return texture->id; } #endif @@ -2109,7 +2224,20 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, target, format, false, false); + QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption); + return texture->id; +} + +/*! + \overload + + Generates and binds a 2D GL texture to the current context, based + on \a pixmap. +*/ +GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(pixmap, target, format, options); return texture->id; } @@ -2118,7 +2246,15 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), false, false); + QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); + return texture->id; +} +/*! \internal */ +GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, + BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); return texture->id; } #endif @@ -4118,15 +4254,35 @@ bool QGLWidget::autoBufferSwap() const GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(image, target, format); + return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } +/*! + \overload + + The binding \a options are a set of options used to decide how to + bind the texture to the context. + */ +GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(image, target, format, options); +} + + #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(image, GLenum(target), GLint(format)); + return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); +} + +GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); } #endif @@ -4139,7 +4295,23 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format); + return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); +} + +/*! + \overload + + Generates and binds a 2D GL texture to the current context, based + on \a pixmap. The generated texture id is returned and can be used in + + The binding \a options are a set of options used to decide how to + bind the texture to the context. + */ +GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(pixmap, target, format, options); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS @@ -4147,7 +4319,14 @@ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format); + return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); +} + +GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(pixmap, target, format, options); } #endif @@ -4568,34 +4747,37 @@ QGLFormat QGLDrawable::format() const return QGLFormat(); } -GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format) +GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options) { QGLTexture *texture = 0; + options |= QGLContext::MemoryManagedBindOption; if (widget) - texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, true); + texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, options); else if (buffer) - texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, true); + texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, options); else if (fbo && QGLContext::currentContext()) - texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, true); + texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, options); #if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)) else if (wsurf) - texture = wsurf->context()->d_func()->bindTexture(image, target, format, true); + texture = wsurf->context()->d_func()->bindTexture(image, target, format, options); #endif return texture->id; } -GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) +GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options) { QGLTexture *texture = 0; if (widget) - texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, true, true); + texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, options); else if (buffer) - texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, true, true); + texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, options); else if (fbo && QGLContext::currentContext()) - texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, true, true); + texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, options); #if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)) else if (wsurf) - texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, true, true); + texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, options); #endif return texture->id; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 678bbb7..13ad668 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -288,6 +288,25 @@ public: virtual void swapBuffers() const; + enum BindOption { + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x1000, // internal flag + + DefaultBindOption = LinearFilteringBindOption | InvertedYBindOption | MipmapBindOption, + InternalBindOption = MemoryManagedBindOption | PremultipliedAlphaBindOption + }; + Q_DECLARE_FLAGS(BindOptions, BindOption) + + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, @@ -304,6 +323,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); void deleteTexture(QMacCompatGLuint tx_id); @@ -446,10 +469,16 @@ public: const QFont & fnt = QFont(), int listBase = 2000); QPaintEngine *paintEngine() const; + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); + GLuint bindTexture(const QString &fileName); void deleteTexture(GLuint tx_id); @@ -462,6 +491,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); void deleteTexture(QMacCompatGLuint tx_id); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index ab040ed..6905199 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -208,10 +208,12 @@ class QGLContextPrivate public: explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {groupResources = new QGLContextGroupResources;} ~QGLContextPrivate() {if (!groupResources->refs.deref()) delete groupResources;} - QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, bool clean); + QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, const qint64 key, - bool clean = false); - QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert = false); + QGLContext::BindOptions options); + QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); QGLTexture *textureCacheLookup(const qint64 key, GLenum target); void init(QPaintDevice *dev, const QGLFormat &format); QImage convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format); @@ -241,7 +243,8 @@ public: quint32 gpm; int screen; QHash<QPixmapData*, QPixmap> boundPixmaps; - QGLTexture *bindTextureFromNativePixmap(QPixmapData*, const qint64 key, bool canInvert); + QGLTexture *bindTextureFromNativePixmap(QPixmapData*, const qint64 key, + QGLContext::BindOptions options); static void destroyGlSurfaceForPixmap(QPixmapData*); static void unbindPixmapFromTexture(QPixmapData*); #endif @@ -319,8 +322,10 @@ public: void doneCurrent(); QSize size() const; QGLFormat format() const; - GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); - GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); + GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); QColor backgroundColor() const; QGLContext *context() const; bool autoFillBackground() const; @@ -404,15 +409,18 @@ extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg(); class QGLTexture { public: QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D, - bool _clean = false, bool _yInverted = false) - : context(ctx), id(tx_id), target(tx_target), clean(_clean), yInverted(_yInverted) + QGLContext::BindOptions opt = QGLContext::DefaultBindOption) + : context(ctx), + id(tx_id), + target(tx_target), + options(opt) #if defined(Q_WS_X11) - , boundPixmap(0) + , boundPixmap(0) #endif {} ~QGLTexture() { - if (clean) { + if (options & QGLContext::MemoryManagedBindOption) { QGLContext *current = const_cast<QGLContext *>(QGLContext::currentContext()); QGLContext *ctx = const_cast<QGLContext *>(context); Q_ASSERT(ctx); @@ -436,8 +444,9 @@ public: QGLContext *context; GLuint id; GLenum target; - bool clean; - bool yInverted; // NOTE: Y-Inverted textures are for internal use only! + + QGLContext::BindOptions options; + #if defined(Q_WS_X11) QPixmapData* boundPixmap; #endif diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index dccdf63..aca60bc 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1599,7 +1599,8 @@ bool qt_resolveTextureFromPixmap() #endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key, bool canInvert) +QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key, + QGLContext::BindOptions options) { #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX) return 0; @@ -1632,7 +1633,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, // QGLContext::bindTexture() can't return an inverted texture, but QPainter::drawPixmap() can: - GLX_Y_INVERTED_EXT, canInvert ? GLX_DONT_CARE : False, + GLX_Y_INVERTED_EXT, options & QGLContext::InvertedYBindOption ? GLX_DONT_CARE : False, XNone }; configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); @@ -1693,9 +1694,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); - QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, canInvert, false); - texture->yInverted = (hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted); - if (texture->yInverted) + if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); + options &= ~QGLContext::InvertedYBindOption; + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); + if (texture->options & QGLContext::InvertedYBindOption) pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 7452c92..b982a19 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -494,6 +494,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons { Q_Q(QGLContext); + // The EGL texture_from_pixmap has no facility to invert the y coordinate + if (!canInvert) + return 0; + Q_ASSERT(pd->classId() == QPixmapData::X11Class); static bool checkedForTFP = false; diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index b03fdfa..a5f83a5 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -410,6 +410,14 @@ struct QGLExtensionFuncs #define GL_BGRA 0x80E1 #endif +#ifndef GL_RGB16 +#define GL_RGB16 32852 +#endif + +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 33635 +#endif + #ifndef GL_MULTISAMPLE #define GL_MULTISAMPLE 0x809D #endif diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 29f6440..0913606 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const { - const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, true, false); + const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption)); } void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF& source) const @@ -338,7 +338,6 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine()); - engine->syncState(); painter->save(); // ensure GL_LINEAR filtering is used @@ -418,7 +417,7 @@ QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur source.append("uniform highp vec4 clip;\n"); } - source.append("mediump vec4 customShader(sampler2D src, vec2 srcCoords) {\n"); + source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); QVector<qreal> sampleOffsets; QVector<qreal> weights; diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index f8bffd3..b07fb3b 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - + \section1 Simple shader example \code @@ -199,8 +199,11 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). + \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. + + \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -251,8 +254,7 @@ public: , shader(0) , shaderType(type) , compiled(false) - , isPartial(type == QGLShader::PartialVertexShader || - type == QGLShader::PartialFragmentShader) + , isPartial((type & QGLShader::PartialShader) != 0) , hasPartialSource(false) { } @@ -348,31 +350,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) } /*! - Constructs a new QGLShader object from the source code in \a fileName - and attaches it to \a parent. If the filename ends in \c{.fsh}, - it is assumed to be a fragment shader, otherwise it is assumed to - be a vertex shader (normally the extension is \c{.vsh} for vertex shaders). - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with the current QGLContext. - - \sa isCompiled() -*/ -QGLShader::QGLShader(const QString& fileName, QObject *parent) - : QObject(parent) -{ - if (fileName.endsWith(QLatin1String(".fsh"), Qt::CaseInsensitive)) - d = new QGLShaderPrivate(QGLShader::FragmentShader, QGLContext::currentContext()); - else - d = new QGLShaderPrivate(QGLShader::VertexShader, QGLContext::currentContext()); - if (d->create() && !compileFile(fileName)) { - if (d->shader) - glDeleteShader(d->shader); - d->shader = 0; - } -} - -/*! Constructs a new QGLShader object of the specified \a type from the source code in \a fileName and attaches it to \a parent. If the shader could not be loaded, then isCompiled() will return false. @@ -413,31 +390,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObj } /*! - Constructs a new QGLShader object from the source code in \a fileName - and attaches it to \a parent. If the filename ends in \c{.fsh}, - it is assumed to be a fragment shader, otherwise it is assumed to - be a vertex shader (normally the extension is \c{.vsh} for vertex shaders). - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with \a context. - - \sa isCompiled() -*/ -QGLShader::QGLShader(const QString& fileName, const QGLContext *context, QObject *parent) - : QObject(parent) -{ - if (fileName.endsWith(QLatin1String(".fsh"), Qt::CaseInsensitive)) - d = new QGLShaderPrivate(QGLShader::FragmentShader, context); - else - d = new QGLShaderPrivate(QGLShader::VertexShader, context); - if (d->create() && !compileFile(fileName)) { - if (d->shader) - glDeleteShader(d->shader); - d->shader = 0; - } -} - -/*! Constructs a new QGLShader object of the specified \a type from the source code in \a fileName and attaches it to \a parent. If the shader could not be loaded, then isCompiled() will return false. @@ -489,6 +441,16 @@ static const char qualifierDefines[] = "#define highp\n"; #endif +// The "highp" qualifier doesn't exist in fragment shaders +// on all ES platforms. When it doesn't exist, use "mediump". +#ifdef QT_OPENGL_ES +#define QGL_REDEFINE_HIGHP 1 +static const char redefineHighp[] = + "#ifndef GL_FRAGMENT_PRECISION_HIGH\n" + "#define highp mediump\n" + "#endif\n"; +#endif + /*! Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. @@ -511,6 +473,11 @@ bool QGLShader::compile(const char *source) #ifdef QGL_DEFINE_QUALIFIERS src.append(qualifierDefines); #endif +#ifdef QGL_REDEFINE_HIGHP + if (d->shaderType == FragmentShader || + d->shaderType == PartialFragmentShader) + src.append(redefineHighp); +#endif src.append(source); glShaderSource(d->shader, src.size(), src.data(), 0); return d->compile(this); @@ -917,6 +884,33 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& sour } /*! + Compiles the contents of \a fileName as a shader of the specified + \a type and adds it to this shader program. Returns true if + compilation was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QGLShader first. + + \sa addShader() +*/ +bool QGLShaderProgram::addShaderFromFile + (QGLShader::ShaderType type, const QString& fileName) +{ + if (!init()) + return false; + QGLShader *shader = new QGLShader(type, this); + if (!shader->compileFile(fileName)) { + d->log = shader->log(); + delete shader; + return false; + } + d->anonShaders.append(shader); + return addShader(shader); +} + +/*! Removes \a shader from this shader program. The object is not deleted. \sa addShader(), link(), removeAllShaders() @@ -2983,6 +2977,7 @@ bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) #endif } + #endif QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index c5295eb..d747679 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -63,19 +63,21 @@ class Q_OPENGL_EXPORT QGLShader : public QObject { Q_OBJECT public: - enum ShaderType + enum ShaderTypeBits { - VertexShader, - FragmentShader, - PartialVertexShader, - PartialFragmentShader + VertexShader = 0x0001, + FragmentShader = 0x0002, + + PartialShader = 0x1000, + + PartialVertexShader = PartialShader | VertexShader, + PartialFragmentShader = PartialShader | FragmentShader }; + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); - explicit QGLShader(const QString& fileName, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); - QGLShader(const QString& fileName, const QGLContext *context, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); virtual ~QGLShader(); @@ -106,6 +108,9 @@ private: Q_DISABLE_COPY(QGLShader) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) + + class QGLShaderProgramPrivate; class Q_OPENGL_EXPORT QGLShaderProgram : public QObject @@ -123,6 +128,7 @@ public: bool addShader(QGLShader::ShaderType type, const char *source); bool addShader(QGLShader::ShaderType type, const QByteArray& source); bool addShader(QGLShader::ShaderType type, const QString& source); + bool addShaderFromFile(QGLShader::ShaderType type, const QString& fileName); void removeAllShaders(); diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index e8741b5..293413c 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,8 +51,6 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - /*! \class QGraphicsShaderEffect \brief The QGraphicsShaderEffect class is the base class for creating @@ -63,7 +61,9 @@ QT_BEGIN_NAMESPACE The specific effect is defined by a fragment of GLSL source code supplied to setPixelShaderFragment(). This source code must define a - function called \c{srcPixel()} that returns the source pixel value + function with the signature + \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)} + that returns the source pixel value to use in the paint engine's shader program. The shader fragment is linked with the regular shader code used by the GL2 paint engine to construct a complete QGLShaderProgram. @@ -74,10 +74,8 @@ QT_BEGIN_NAMESPACE \code static char const colorizeShaderCode[] = - "varying highp vec2 textureCoords;\n" - "uniform sampler2D imageTexture;\n" "uniform lowp vec4 effectColor;\n" - "lowp vec4 srcPixel() {\n" + "lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {\n" " vec4 src = texture2D(imageTexture, textureCoords);\n" " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n" " vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n" @@ -126,13 +124,11 @@ QT_BEGIN_NAMESPACE the drawItem() method will draw its item argument directly with no effect applied. - \sa QGrapicsEffect + \sa QGraphicsEffect */ static const char qglslDefaultImageFragmentShader[] = "\ - varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ - lowp vec4 srcPixel() { \ + lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { \ return texture2D(imageTexture, textureCoords); \ }\n"; @@ -216,15 +212,14 @@ QByteArray QGraphicsShaderEffect::pixelShaderFragment() const Sets the source code for the pixel shader fragment for this shader effect to \a code. - The \a code must define a GLSL function called \c{srcPixel()} + The \a code must define a GLSL function with the signature + \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)} that returns the source pixel value to use in the paint engine's shader program. The following is the default pixel shader fragment, which draws a pixmap with no effect applied: \code - varying highp vec2 textureCoords; - uniform sampler2D imageTexture; - lowp vec4 srcPixel() { + lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { return texture2D(imageTexture, textureCoords); } \endcode @@ -316,6 +311,4 @@ void QGraphicsShaderEffect::setUniforms(QGLShaderProgram *program) Q_UNUSED(program); } -#endif // QT_NO_GRAPHICSVIEW - QT_END_NAMESPACE diff --git a/src/opengl/qgraphicsshadereffect.h b/src/opengl/qgraphicsshadereffect.h index 1612431..672973b 100644 --- a/src/opengl/qgraphicsshadereffect.h +++ b/src/opengl/qgraphicsshadereffect.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - class QGLShaderProgram; class QGLCustomShaderEffectStage; class QGraphicsShaderEffectPrivate; @@ -78,8 +76,6 @@ private: friend class QGLCustomShaderEffectStage; }; -#endif // QT_NO_GRAPHICSVIEW - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 9434adf..ac41ab0 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4351,13 +4351,6 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con GLdouble tc_w = r.width()/pm.width(); GLdouble tc_h = r.height()/pm.height(); - // Rotate the texture so that it is aligned correctly and the - // wrapping is done correctly - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glRotatef(180.0, 0.0, 1.0, 0.0); - glRotatef(180.0, 0.0, 0.0, 1.0); - q_vertexType vertexArray[4*2]; q_vertexType texCoordArray[4*2]; @@ -4376,7 +4369,6 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); - glPopMatrix(); glDisable(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES @@ -4433,13 +4425,13 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec if (target == GL_TEXTURE_2D) { x1 = sr.x() / tx_width; x2 = x1 + sr.width() / tx_width; - y1 = 1.0 - (sr.bottom() / tx_height); - y2 = 1.0 - (sr.y() / tx_height); + y1 = 1 - (sr.bottom() / tx_height); + y2 = 1 - (sr.y() / tx_height); } else { x1 = sr.x(); x2 = sr.right(); - y1 = tx_height - sr.bottom(); - y2 = tx_height - sr.y(); + y1 = sr.bottom(); + y2 = sr.y(); } q_vertexType vertexArray[4*2]; diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index a441a23..c193f12 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -108,7 +108,6 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize if (sz != fboSize) { delete candidate; - qDebug() << "Resizing fbo in pool:" << sz; candidate = new QGLFramebufferObject(sz, requestFormat); } @@ -117,7 +116,6 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize } if (!chosen) { - qDebug() << "Creating new fbo in pool:" << requestSize; chosen = new QGLFramebufferObject(requestSize, requestFormat); } @@ -273,7 +271,7 @@ void QGLPixmapData::ensureCreated() const m_source = QImage(); } - m_texture.clean = false; + m_texture.options &= ~QGLContext::MemoryManagedBindOption; } QGLFramebufferObject *QGLPixmapData::fbo() const diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 9451eda..6decaca 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -1,57 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ #ifndef FRAGMENTPROGRAMS_H #define FRAGMENTPROGRAMS_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - enum FragmentVariable { VAR_BRUSH_TEXTURE, VAR_LINEAR, @@ -71,7 +20,7 @@ enum FragmentVariable { VAR_FMP2_M_RADIUS2, VAR_FMP, VAR_INV_MATRIX_M0, - VAR_ANGLE + VAR_ANGLE, }; enum FragmentBrushType { @@ -80,7 +29,7 @@ enum FragmentBrushType { FRAGMENT_PROGRAM_BRUSH_CONICAL, FRAGMENT_PROGRAM_BRUSH_LINEAR, FRAGMENT_PROGRAM_BRUSH_TEXTURE, - FRAGMENT_PROGRAM_BRUSH_PATTERN + FRAGMENT_PROGRAM_BRUSH_PATTERN, }; enum FragmentCompositionModeType { @@ -109,12 +58,12 @@ enum FragmentCompositionModeType { COMPOSITION_MODES_DIFFERENCE_NOMASK, COMPOSITION_MODES_EXCLUSION_NOMASK, COMPOSITION_MODE_BLEND_MODE_MASK, - COMPOSITION_MODE_BLEND_MODE_NOMASK + COMPOSITION_MODE_BLEND_MODE_NOMASK, }; enum FragmentMaskType { FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, - FRAGMENT_PROGRAM_MASK_ELLIPSE_AA + FRAGMENT_PROGRAM_MASK_ELLIPSE_AA, }; static const unsigned int num_fragment_variables = 19; @@ -133,55 +82,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA = "TEMP R4;\n" "ADD R4.x, fragment.position, c[0];\n" "ADD R0.y, fragment.position, -c[0].x;\n" - "MAX R2.x, R0.y, fragment.texcoord[0].y;\n" + "MAX R3.w, fragment.texcoord[0].y, R0.y;\n" "ADD R0.x, fragment.position.y, c[0];\n" - "MIN R2.y, R0.x, fragment.texcoord[0].x;\n" - "ADD R3.x, fragment.position, -c[0];\n" + "MIN R3.z, R0.x, fragment.texcoord[0].x;\n" + "ADD R2.z, fragment.position.x, -c[0].x;\n" + "MOV R0.yw, R3.w;\n" + "MOV R0.xz, R3.z;\n" + "MAD R1, fragment.texcoord[1].xxzz, R0, fragment.texcoord[1].yyww;\n" + "MAD R1.zw, fragment.position.x, c[0].y, -R1;\n" + "MOV R0.z, R1.x;\n" + "MOV R0.w, R1.z;\n" + "MOV R0.y, R1.w;\n" + "MOV R0.x, R1.y;\n" + "MIN R2.xy, R0.zwzw, R0;\n" + "SGE R1.xy, R0, R0.zwzw;\n" "ADD R1.zw, -fragment.texcoord[0], -fragment.texcoord[0];\n" - "MOV R3.y, R4.x;\n" - "MOV R0.yw, R2.x;\n" - "MOV R0.xz, R2.y;\n" - "MAD R0, fragment.texcoord[1].xxzz, R0, fragment.texcoord[1].yyww;\n" - "MAD R1.xy, fragment.position.x, c[0].y, -R0.zwzw;\n" - "MOV R0.w, R1.x;\n" - "MOV R1.x, R0.y;\n" - "MOV R0.z, R0.x;\n" - "SGE R2.zw, R1.xyxy, R0;\n" - "MAX R0.xy, R0.zwzw, R1;\n" - "MIN R0.zw, R0, R1.xyxy;\n" - "MAD R2.zw, R2, R1, fragment.texcoord[0];\n" - "ADD R1, R3.xyxy, -R0.zzww;\n" - "MAD R1, R1, R2.zzww, R2.x;\n" - "ADD R3.zw, R0.xyxy, R0;\n" - "ADD R3.y, R2, -R2.x;\n" - "ADD R2.zw, R1.xyyw, -R2.x;\n" - "ADD R4.zw, R4.x, -R0;\n" - "MUL R2.zw, R4, R2;\n" - "ADD R4.zw, R1.xyyw, R1.xyxz;\n" - "ADD R1.xz, R2.y, -R1;\n" - "MAD R2.zw, -R2, c[0].x, R3.y;\n" - "MAD R3.zw, R3, c[0].x, -R3.x;\n" - "MAD R3.zw, R3, R3.y, -R2;\n" - "ADD R1.y, R4.x, -R3.x;\n" - "MAD R4.zw, -R4, c[0].x, R2.y;\n" - "MUL R4.zw, R4, R1.y;\n" - "ADD R1.yw, R0.xxzy, -R3.x;\n" - "MUL R1.xy, R1.xzzw, R1.ywzw;\n" - "MAD R1.zw, R1.xyxy, c[0].x, -R4;\n" - "SGE R1.xy, R4.x, R0;\n" - "MUL R1.zw, R1.xyxy, R1;\n" - "MAD R1.xy, R1, R3.zwzw, R2.zwzw;\n" - "SGE R2.zw, R3.x, R0;\n" - "ADD R1.zw, R4, R1;\n" - "ADD R1.zw, R1, -R1.xyxy;\n" - "MAD R1.xy, R2.zwzw, R1.zwzw, R1;\n" - "ADD R1.xy, R1, -R3.y;\n" - "SGE R0.zw, R4.x, R0;\n" - "MAD R0.zw, R0, R1.xyxy, R3.y;\n" - "SGE R0.xy, R0, R3.x;\n" + "MAX R0.xy, R0.zwzw, R0;\n" + "MAD R3.xy, R1, R1.zwzw, fragment.texcoord[0].zwzw;\n" + "MOV R2.w, R4.x;\n" + "ADD R1, -R2.xxyy, R2.zwzw;\n" + "MAD R1, R1, R3.xxyy, R3.w;\n" + "ADD R3.xy, R1.ywzw, R1.xzzw;\n" + "ADD R4.zw, R3.z, -R1.xyxz;\n" + "ADD R1.zw, -R3.w, R1.xyyw;\n" + "ADD R1.xy, R4.x, -R2;\n" + "MUL R1.xy, R1, R1.zwzw;\n" + "MAD R3.xy, -R3, c[0].x, R3.z;\n" + "ADD R2.w, R4.x, -R2.z;\n" + "MUL R0.zw, R3.xyxy, R2.w;\n" + "ADD R2.w, R3.z, -R3;\n" + "ADD R3.xy, -R2.z, R0;\n" + "MUL R3.xy, R4.zwzw, R3;\n" + "ADD R4.zw, R2.xyxy, R0.xyxy;\n" + "MAD R1.zw, R4, c[0].x, -R2.z;\n" + "MAD R1.xy, -R1, c[0].x, R2.w;\n" + "MAD R4.zw, R2.w, R1, -R1.xyxy;\n" + "SGE R1.zw, R4.x, R0.xyxy;\n" + "MAD R3.xy, R3, c[0].x, -R0.zwzw;\n" + "MAD R1.xy, R1.zwzw, R4.zwzw, R1;\n" + "MAD R0.zw, R1, R3.xyxy, R0;\n" + "ADD R1.zw, R0, -R1.xyxy;\n" + "SGE R0.zw, R2.z, R2.xyxy;\n" + "MAD R0.zw, R0, R1, R1.xyxy;\n" + "ADD R0.zw, -R2.w, R0;\n" + "SGE R1.xy, R4.x, R2;\n" + "MAD R0.zw, R1.xyxy, R0, R2.w;\n" + "SGE R0.xy, R0, R2.z;\n" "MUL R0.xy, R0.zwzw, R0;\n" - "ADD R0.x, R3.y, -R0;\n" - "SGE R0.z, R2.y, R2.x;\n" + "ADD R0.x, R2.w, -R0;\n" + "SGE R0.z, R3, R3.w;\n" "ADD R0.x, R0, -R0.y;\n" "MUL result.color, R0.x, R0.z;\n" "END\n" @@ -195,20 +144,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_ELLIPSE_AA = "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R1.xyz, R0.y, c[2];\n" - "MAD R0.xyz, R0.x, c[1], R1;\n" - "ADD R0.xyz, R0, c[3];\n" + "ADD R0.xy, fragment.position, c[3];\n" + "MUL R1.xyz, R0.y, c[1];\n" + "MAD R0.xyz, R0.x, c[0], R1;\n" + "ADD R0.xyz, R0, c[2];\n" "RCP R2.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R2.z;\n" - "MUL R2.xy, R0.zwzw, fragment.texcoord[0];\n" - "MOV R1.xy, c[1];\n" - "MOV R1.zw, c[2].xyxy;\n" - "MOV R0.x, c[1].z;\n" - "MOV R0.y, c[2].z;\n" - "MAD R0, -R0.xyxy, R0.zzww, R1.xzyw;\n" + "MUL R1.zw, R0.xyxy, R2.z;\n" + "MUL R2.xy, R1.zwzw, fragment.texcoord[0];\n" + "MOV R1.x, c[0].z;\n" + "MOV R1.y, c[1].z;\n" + "MOV R0.xy, c[0];\n" + "MOV R0.zw, c[1].xyxy;\n" + "MAD R0, R1.zzww, -R1.xyxy, R0.xzyw;\n" "MUL R1.xy, R2, fragment.texcoord[0];\n" - "MUL R0, R0, R2.z;\n" + "MUL R0, R2.z, R0;\n" "MUL R1.xy, R1, c[4].x;\n" "MUL R1.zw, R1.xyxy, R0.xyxz;\n" "MUL R0.xy, R1, R0.ywzw;\n" @@ -230,36 +179,34 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_ELLIPSE_AA = static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MUL R0.xyz, R1, c[6].y;\n" - "MUL R2.xyz, R0, fragment.color.primary.w;\n" - "MUL R0.xyz, fragment.color.primary, c[6].x;\n" - "MAD R2.xyz, R0, R1.w, R2;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "ADD R0.w, -R1, c[4].x;\n" - "MUL R0.xyz, fragment.color.primary, c[5].y;\n" - "MAD R2.xyz, R0, R0.w, R2;\n" - "MUL R0.xyz, R1, c[5].z;\n" - "ADD R0.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R0, R0.w, R2;\n" - "ADD R0.y, -R1.w, c[4].x;\n" - "MUL R0.x, fragment.color.primary.w, R1.w;\n" - "MUL R0.y, fragment.color.primary.w, R0;\n" - "MUL R0.z, R1.w, R0.w;\n" - "DP3 R2.w, R0, c[5];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.xyz, R0, c[0].y;\n" + "MUL R2.xyz, fragment.color.primary.w, R1;\n" + "MUL R1.xyz, fragment.color.primary, c[0].x;\n" + "MAD R2.xyz, R0.w, R1, R2;\n" + "ADD R3.xy, fragment.position, c[4];\n" + "ADD R1.w, -R0, c[6].x;\n" + "MUL R1.xyz, fragment.color.primary, c[1].y;\n" + "MAD R2.xyz, R1.w, R1, R2;\n" + "MUL R1.xyz, R0, c[1].z;\n" + "ADD R2.w, -fragment.color.primary, c[6].x;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.z, R0.w, R2.w;\n" + "MUL R1.x, fragment.color.primary.w, R0.w;\n" + "MUL R1.y, fragment.color.primary.w, R1.w;\n" + "DP3 R2.w, R1, c[1];\n" + "MUL R3.xy, R3, c[2];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[5];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -270,21 +217,21 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "ADD R0.x, -R1.w, c[4];\n" - "MUL R0.xyz, fragment.color.primary, R0.x;\n" - "MAD R0.xyz, fragment.color.primary, R1, R0;\n" - "ADD R0.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R1, R0.w, R0;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R0.w, c[4];\n" + "MUL R1.xyz, fragment.color.primary, R1.x;\n" + "MAD R1.xyz, fragment.color.primary, R0, R1;\n" + "ADD R1.w, -fragment.color.primary, c[4].x;\n" + "MAD R2.xyz, R0, R1.w, R1;\n" + "ADD R1.z, fragment.color.primary.w, R0.w;\n" + "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -294,16 +241,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "ADD R2, fragment.color.primary, R1;\n" - "MUL R0.xy, R0, c[1];\n" - "MAD R2, -fragment.color.primary, R1, R2;\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "ADD R2, fragment.color.primary, R0;\n" + "MUL R1.xy, R1, c[0];\n" + "MAD R2, -fragment.color.primary, R0, R2;\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -315,7 +262,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[3];\n" + "MUL R0.xy, fragment.position, c[1];\n" "TEX R1, R0, texture[0], 2D;\n" "ADD R0.w, -R1, c[4].y;\n" "MUL R3.xyz, fragment.color.primary, R0.w;\n" @@ -336,11 +283,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAD R2.xyz, R0, R3, R2;\n" "ADD R0.z, fragment.color.primary.w, R1.w;\n" "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[2];\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[3];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -352,23 +299,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MUL R2.xyz, R1, fragment.color.primary.w;\n" - "MUL R0.xyz, fragment.color.primary, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "ADD R0.w, -R1, c[4].x;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "ADD R0.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R1, R0.w, R0;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" + "MUL R1.xyz, fragment.color.primary, R0.w;\n" + "MIN R1.xyz, R1, R2;\n" + "ADD R1.w, -R0, c[4].x;\n" + "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" + "ADD R1.w, -fragment.color.primary, c[4].x;\n" + "MAD R2.xyz, R0, R1.w, R1;\n" + "ADD R1.z, fragment.color.primary.w, R0.w;\n" + "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -379,35 +326,35 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MUL R2.xyz, R1, fragment.color.primary.w;\n" - "MUL R0.xyz, fragment.color.primary, R1.w;\n" - "MAX R0.xyz, R0, R2;\n" - "ADD R0.w, -R1, c[4].x;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "ADD R0.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R1, R0.w, R0;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" + "MUL R1.xyz, fragment.color.primary, R0.w;\n" + "MAX R1.xyz, R1, R2;\n" + "ADD R1.w, -R0, c[4].x;\n" + "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" + "ADD R1.w, -fragment.color.primary, c[4].x;\n" + "MAD R2.xyz, R0, R1.w, R1;\n" + "ADD R1.z, fragment.color.primary.w, R0.w;\n" + "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" "PARAM c[5] = { program.local[0..3],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[3];\n" + "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R1.y, -fragment.color.primary.w, c[4].x;\n" "MAX R1.x, fragment.color.primary.w, c[4].y;\n" @@ -417,7 +364,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "RCP R1.x, R1.x;\n" "MAD R1.xyz, -fragment.color.primary, R1.x, c[4].x;\n" "MAX R1.xyz, R1, c[4].y;\n" - "MUL R2.xyz, R0, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" "MUL R1.w, fragment.color.primary, R0;\n" "RCP R1.x, R1.x;\n" "RCP R1.y, R1.y;\n" @@ -430,11 +377,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAD R2.xyz, R2, R3, R1;\n" "ADD R1.z, fragment.color.primary.w, R0.w;\n" "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[3];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -442,29 +389,28 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" "PARAM c[5] = { program.local[0..3],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xy, fragment.position, c[3];\n" + "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R1.w, -R0, c[4].x;\n" - "MUL R1.xyz, R0, fragment.color.primary.w;\n" + "MUL R1.xyz, fragment.color.primary.w, R0;\n" "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" "MAD R1.xyz, -fragment.color.primary.w, R0.w, R2;\n" "MUL R3.xyz, fragment.color.primary.w, R1;\n" "MAX R1.xyz, fragment.color.primary, c[4].y;\n" + "ADD R2.w, -fragment.color.primary, c[4].x;\n" "MUL R4.xyz, fragment.color.primary, R1.w;\n" "RCP R1.x, R1.x;\n" "RCP R1.y, R1.y;\n" "RCP R1.z, R1.z;\n" "MAD R3.xyz, R3, R1, R4;\n" - "ADD R2.w, -fragment.color.primary, c[4].x;\n" "MUL R1.xyz, R0, R2.w;\n" "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R2.w, -fragment.color.primary, c[4].x;\n" "MAD R3.xyz, R0, R2.w, R3;\n" "MUL R1.w, fragment.color.primary, R0;\n" "ADD R3.xyz, R3, -R1;\n" @@ -472,11 +418,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAD R2.xyz, R2, R3, R1;\n" "ADD R1.z, fragment.color.primary.w, R0.w;\n" "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[3];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -489,7 +435,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[3];\n" + "MUL R0.xy, fragment.position, c[1];\n" "TEX R1, R0, texture[0], 2D;\n" "ADD R0.w, -R1, c[4].y;\n" "MUL R3.xyz, fragment.color.primary, R0.w;\n" @@ -510,11 +456,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAD R2.xyz, R0, R3, R2;\n" "ADD R0.z, fragment.color.primary.w, R1.w;\n" "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[2];\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[3];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -522,58 +468,56 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..3],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xy, fragment.position, c[3];\n" + "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.x, R0.w, c[4].y;\n" "RCP R1.w, R1.x;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R1.xyz, -R2, c[4].w;\n" + "MUL R1.xyz, -R2, c[5].x;\n" "RSQ R2.w, R2.x;\n" - "ADD R4.xyz, R1, c[5].x;\n" + "ADD R4.xyz, R1, c[4].w;\n" "MAD R1.xyz, -R0, R1.w, c[4].x;\n" "RSQ R2.z, R2.z;\n" "RSQ R2.y, R2.y;\n" "RCP R2.x, R2.w;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R5.xyz, R2, R0.w, -R0;\n" + "MAD R5.xyz, R0.w, R2, -R0;\n" "MAD R2.xyz, fragment.color.primary, c[4].z, -fragment.color.primary.w;\n" "MUL R3.xyz, R1, R2;\n" "MAD R3.xyz, -R3, R4, fragment.color.primary.w;\n" "MUL R4.xyz, R5, R2;\n" "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MAD R5.xyz, R0, fragment.color.primary.w, R4;\n" "MUL R3.xyz, R0, R3;\n" - "MUL R4.xyz, R0, c[4].w;\n" - "ADD R5.xyz, R5, -R3;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MUL R4.xyz, R4, R5;\n" - "ADD R2.xyz, R3, R4;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R4;\n" + "ADD R5.xyz, R4, -R3;\n" + "MUL R4.xyz, R0, c[5].x;\n" + "SGE R2.xyz, R4, R0.w;\n" + "MAD R2.xyz, R2, R5, R3;\n" "MUL R1.xyz, R0, R1;\n" "MUL R3.xyz, fragment.color.primary, c[4].z;\n" "ADD R2.xyz, R2, -R1;\n" "SGE R3.xyz, R3, fragment.color.primary.w;\n" - "MUL R2.xyz, R3, R2;\n" - "ADD R1.xyz, R1, R2;\n" + "MAD R1.xyz, R3, R2, R1;\n" "ADD R1.w, -R0, c[4].x;\n" "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" "ADD R1.w, -fragment.color.primary, c[4].x;\n" "MAD R2.xyz, R0, R1.w, R1;\n" "ADD R1.z, fragment.color.primary.w, R0.w;\n" "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[3];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -586,77 +530,75 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MUL R2.xyz, R1, fragment.color.primary.w;\n" - "MUL R0.xyz, fragment.color.primary, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "ADD R3.xyz, fragment.color.primary, R1;\n" - "MAD R2.xyz, -R0, c[4].x, R3;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.xyz, fragment.color.primary, R0;\n" + "MUL R3.xyz, fragment.color.primary.w, R0;\n" + "MUL R2.xyz, fragment.color.primary, R0.w;\n" + "MIN R2.xyz, R2, R3;\n" + "MAD R2.xyz, -R2, c[4].x, R1;\n" + "ADD R1.z, fragment.color.primary.w, R0.w;\n" + "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[5] = { program.local[0..3],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MUL R0.xyz, R1, fragment.color.primary.w;\n" - "MAD R2.xyz, fragment.color.primary, R1.w, R0;\n" - "MUL R0.xyz, fragment.color.primary, R1;\n" - "MAD R0.xyz, -R0, c[4].y, R2;\n" - "ADD R0.w, -R1, c[4].x;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "ADD R0.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R1, R0.w, R0;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, fragment.position, c[1];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.xyz, fragment.color.primary.w, R0;\n" + "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" + "MUL R1.xyz, fragment.color.primary, R0;\n" + "MAD R1.xyz, -R1, c[4].x, R2;\n" + "ADD R1.w, -R0, c[4].y;\n" + "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" + "ADD R1.w, -fragment.color.primary, c[4].y;\n" + "MAD R2.xyz, R0, R1.w, R1;\n" + "ADD R1.z, fragment.color.primary.w, R0.w;\n" + "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[2];\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[3];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0],\n" - " { 1 },\n" - " program.local[2..3] };\n" + "PARAM c[4] = { program.local[0..2],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" + "MUL R0.xy, fragment.position, c[2];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, R0, c[3].y;\n" - "MUL R2.xyz, R1, fragment.color.primary.w;\n" - "MUL R1.xyz, fragment.color.primary, c[3].x;\n" - "MAD R2.xyz, R1, R0.w, R2;\n" - "MUL R0.xyz, R0, c[2].z;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MUL R1.xyz, fragment.color.primary, c[2].y;\n" - "MAD R1.xyz, R1, R1.w, R2;\n" - "ADD R1.w, -fragment.color.primary, c[1].x;\n" - "MAD result.color.xyz, R0, R1.w, R1;\n" - "ADD R0.y, -R0.w, c[1].x;\n" + "MUL R1.xyz, R0, c[0].y;\n" + "MUL R2.xyz, fragment.color.primary.w, R1;\n" + "MUL R1.xyz, fragment.color.primary, c[0].x;\n" + "MAD R2.xyz, R0.w, R1, R2;\n" + "MUL R0.xyz, R0, c[1].z;\n" + "ADD R1.w, -R0, c[3].x;\n" + "MUL R1.xyz, fragment.color.primary, c[1].y;\n" + "MAD R1.xyz, R1.w, R1, R2;\n" + "ADD R2.x, -fragment.color.primary.w, c[3];\n" + "MAD result.color.xyz, R2.x, R0, R1;\n" "MUL R0.x, fragment.color.primary.w, R0.w;\n" - "MUL R0.z, R0.w, R1.w;\n" - "MUL R0.y, fragment.color.primary.w, R0;\n" - "DP3 result.color.w, R0, c[2];\n" + "MUL R0.z, R0.w, R2.x;\n" + "MUL R0.y, fragment.color.primary.w, R1.w;\n" + "DP3 result.color.w, R0, c[1];\n" "END\n" ; @@ -732,7 +674,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R2;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" "MUL R1.xyz, fragment.color.primary, R0.w;\n" "MIN R1.xyz, R1, R2;\n" "ADD R1.w, -R0, c[1].x;\n" @@ -753,7 +695,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R2;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" "MUL R1.xyz, fragment.color.primary, R0.w;\n" "MAX R1.xyz, R1, R2;\n" "ADD R1.w, -R0, c[1].x;\n" @@ -768,7 +710,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" "PARAM c[2] = { program.local[0],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -782,7 +724,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" "MAD R2.xyz, -fragment.color.primary, R2.x, c[1].x;\n" "MAX R2.xyz, R2, c[1].y;\n" - "MUL R0.xyz, R0, fragment.color.primary.w;\n" + "MUL R0.xyz, fragment.color.primary.w, R0;\n" "MUL R1.w, fragment.color.primary, R0;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" @@ -801,7 +743,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" "PARAM c[2] = { program.local[0],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -809,7 +751,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R4;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, R0, fragment.color.primary.w;\n" + "MUL R1.xyz, fragment.color.primary.w, R0;\n" "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" "MAD R1.xyz, -fragment.color.primary.w, R0.w, R2;\n" "MUL R3.xyz, fragment.color.primary.w, R1;\n" @@ -822,7 +764,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "RCP R1.z, R1.z;\n" "MAD R1.xyz, R3, R1, R4;\n" "MUL R3.xyz, R0, R2.w;\n" - "ADD R2.w, -fragment.color.primary, c[1].x;\n" "MAD R0.xyz, R0, R2.w, R1;\n" "MAD R1.xyz, fragment.color.primary, R1.w, R3;\n" "MUL R1.w, fragment.color.primary, R0;\n" @@ -869,8 +810,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[3] = { program.local[0],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -882,8 +823,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MAX R1.x, R0.w, c[1].y;\n" "RCP R1.w, R1.x;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R1.xyz, -R2, c[1].w;\n" - "ADD R4.xyz, R1, c[2].x;\n" + "MUL R1.xyz, -R2, c[2].x;\n" + "ADD R4.xyz, R1, c[1].w;\n" "MAD R1.xyz, -R0, R1.w, c[1].x;\n" "RSQ R2.w, R2.x;\n" "RSQ R2.z, R2.z;\n" @@ -891,25 +832,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "RCP R2.x, R2.w;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R5.xyz, R2, R0.w, -R0;\n" + "MAD R5.xyz, R0.w, R2, -R0;\n" "MAD R2.xyz, fragment.color.primary, c[1].z, -fragment.color.primary.w;\n" "MUL R3.xyz, R1, R2;\n" "MAD R3.xyz, -R3, R4, fragment.color.primary.w;\n" "MUL R4.xyz, R5, R2;\n" "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MAD R5.xyz, R0, fragment.color.primary.w, R4;\n" "MUL R3.xyz, R0, R3;\n" - "MUL R4.xyz, R0, c[1].w;\n" - "ADD R5.xyz, R5, -R3;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MUL R4.xyz, R4, R5;\n" - "ADD R2.xyz, R3, R4;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R4;\n" + "ADD R5.xyz, R4, -R3;\n" + "MUL R4.xyz, R0, c[2].x;\n" + "SGE R2.xyz, R4, R0.w;\n" + "MAD R2.xyz, R2, R5, R3;\n" "MUL R1.xyz, R0, R1;\n" "MUL R3.xyz, fragment.color.primary, c[1].z;\n" "ADD R2.xyz, R2, -R1;\n" "SGE R3.xyz, R3, fragment.color.primary.w;\n" - "MUL R2.xyz, R3, R2;\n" - "ADD R1.xyz, R1, R2;\n" + "MAD R1.xyz, R3, R2, R1;\n" "ADD R1.w, -R0, c[1].x;\n" "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" "ADD R1.w, fragment.color.primary, R0;\n" @@ -928,7 +867,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "TEMP R2;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary.w, R0;\n" "MUL R1.xyz, fragment.color.primary, R0.w;\n" "ADD R1.w, fragment.color.primary, R0;\n" "MIN R1.xyz, R1, R2;\n" @@ -941,20 +880,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[2] = { program.local[0],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, R0, fragment.color.primary.w;\n" + "MUL R1.xyz, fragment.color.primary.w, R0;\n" "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" "MUL R1.xyz, fragment.color.primary, R0;\n" - "MAD R1.xyz, -R1, c[1].y, R2;\n" - "ADD R1.w, -R0, c[1].x;\n" + "MAD R1.xyz, -R1, c[1].x, R2;\n" + "ADD R1.w, -R0, c[1].y;\n" "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R2.x, -fragment.color.primary.w, c[1];\n" + "ADD R2.x, -fragment.color.primary.w, c[1].y;\n" "MAD result.color.xyz, R0, R2.x, R1;\n" "MAD result.color.w, -fragment.color.primary, R0, R1;\n" "END\n" @@ -964,8 +903,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "!!ARBfp1.0\n" "PARAM c[3] = { program.local[0..2] };\n" "TEMP R0;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[1];\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" "DP4 R0.x, R0, c[2];\n" "MUL result.color, fragment.color.primary, R0.x;\n" @@ -974,359 +913,351 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[1] = { program.local[0] };\n" "MOV result.color, fragment.color.primary;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[12] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..11] };\n" + "PARAM c[12] = { program.local[0..10],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[9].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[7].x;\n" - "MUL R0.y, c[8].x, R0;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, c[11].y;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[11].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "ADD R2.w, -R1, c[7].z;\n" - "MUL R0.xyz, R0, c[10].y;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R1, c[10].z;\n" - "ADD R3.z, -R0.w, c[7];\n" - "MAD R2.xyz, R0, R3.z, R2;\n" - "MUL R0.y, R0.w, R2.w;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R3;\n" - "DP3 R2.w, R0, c[10];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[11].x;\n" + "MUL R0.z, R0, c[11].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.x, R0.x;\n" + "RCP R0.z, R0.x;\n" + "ADD R1.x, -R0.y, R0.z;\n" + "MOV R0.x, c[11];\n" + "MUL R0.z, R0.x, c[1].x;\n" + "RCP R1.y, R0.z;\n" + "MUL R0.xy, fragment.position, c[8];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.x, R1, R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R0, c[5].y;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[5].x;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R3.xy, fragment.position, c[9];\n" + "ADD R2.w, -R0, c[11].z;\n" + "MUL R1.xyz, R1, c[6].y;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.xyz, R0, c[6].z;\n" + "ADD R3.z, -R1.w, c[11];\n" + "MAD R2.xyz, R3.z, R1, R2;\n" + "MUL R1.y, R1.w, R2.w;\n" + "MUL R1.x, R1.w, R0.w;\n" + "MUL R1.z, R0.w, R3;\n" + "DP3 R2.w, R1, c[6];\n" + "MUL R3.xy, R3, c[7];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[10];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.z, R0.y;\n" - "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[9].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[7].x;\n" - "MUL R0.y, c[8].x, R0;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2.x, -R1.w, c[7].z;\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.x, R0.x;\n" + "RCP R0.z, R0.x;\n" + "ADD R1.x, -R0.y, R0.z;\n" + "MOV R0.x, c[9];\n" + "MUL R0.z, R0.x, c[1].x;\n" + "RCP R1.y, R0.z;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.x, R1, R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "ADD R2.x, -R0.w, c[9].z;\n" + "MUL R2.xyz, R1, R2.x;\n" + "MAD R1.xyz, R1, R0, R2;\n" + "ADD R2.x, -R1.w, c[9].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" - "ADD R3.xy, fragment.position, c[0];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.z, -R0, c[1].x;\n" + "ADD R3.xy, fragment.position, c[7];\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[9].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD R2, -R0, R1, R2;\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.z, R0.x, R0.y;\n" + "TEX R1, R0.z, texture[2], 1D;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R2, R1, R0;\n" + "MAD R2, -R1, R0, R2;\n" + "MUL R3.xy, R3, c[5];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R1.xy, fragment.position, c[6];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[9].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "ADD R2.w, -R1, c[7].z;\n" + "ADD R2.w, -R1, c[9].z;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[7].x;\n" + "MUL R2.xyz, R2, c[9].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MUL R3.xyz, R0, R1;\n" "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R3.xyz, R3, c[7].x, R4;\n" + "ADD R2.x, -R0.w, c[9].z;\n" + "MAD R3.xyz, R3, c[9].x, R4;\n" "MAD R3.xyz, R1, R2.x, R3;\n" "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[7].x;\n" + "MUL R2.xyz, R1, c[9].x;\n" "ADD R0.xyz, R0, -R3;\n" "SGE R2.xyz, R2, R1.w;\n" "MAD R2.xyz, R2, R0, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, R0, c[5];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[8];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.z, R0.z;\n" + "ADD R0.z, -R0.y, R0;\n" + "RCP R0.w, R0.x;\n" + "MUL R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[9].z;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[9].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.z, R0.z;\n" + "ADD R0.z, -R0.y, R0;\n" + "RCP R0.w, R0.x;\n" + "MUL R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[9].z;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[9].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1, 1e-06 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[9].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAX R1.x, R0.w, c[7].w;\n" + "MAX R1.x, R0.w, c[9].w;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[7].z;\n" - "MAX R2.xyz, R1, c[7].w;\n" - "MUL R1.xy, fragment.position, c[9];\n" + "MAD R1.xyz, -R0, R1.x, c[9].z;\n" + "MAX R2.xyz, R1, c[9].w;\n" + "MUL R1.xy, fragment.position, c[6];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[7].z;\n" + "ADD R2.w, -R0, c[9].z;\n" "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[7].z;\n" + "ADD R2.w, -R1, c[9].z;\n" "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MUL R2.w, R0, R1;\n" "MAD R0.xyz, R0, R1.w, R3;\n" "SGE R0.xyz, R0, R2.w;\n" @@ -1339,57 +1270,56 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R2.xyz, R0, R4, R2;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, R0, c[5];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[8];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1, 9.9999997e-06 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MOV R0.y, c[9].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[7].w;\n" - "ADD R2.w, -R1, c[7].z;\n" + "MAX R2.xyz, R0, c[9].w;\n" + "ADD R2.w, -R1, c[9].z;\n" "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[7].z;\n" + "ADD R3.w, -R0, c[9].z;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" "RCP R2.z, R2.z;\n" @@ -1403,60 +1333,59 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R2.xyz, R3, R2, R0;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, R0, c[5];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[8];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R1.xy, fragment.position, c[6];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[9].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "ADD R2.w, -R1, c[7].z;\n" + "ADD R2.w, -R1, c[9].z;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[7].x;\n" + "MUL R2.xyz, R2, c[9].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[7].z;\n" - "MAD R3.xyz, R3, c[7].x, R4;\n" - "MUL R0.xyz, R0, c[7].x;\n" + "ADD R2.w, -R0, c[9].z;\n" + "MAD R3.xyz, R3, c[9].x, R4;\n" + "MUL R0.xyz, R0, c[9].x;\n" "SGE R0.xyz, R0, R0.w;\n" "MAD R3.xyz, R1, R2.w, R3;\n" "MAD R2.xyz, R1, R2.w, R2;\n" @@ -1464,21 +1393,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R2.xyz, R0, R2, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, R0, c[5];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[8];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..6],\n" - " { 2, 4, 1, 9.9999997e-06 },\n" - " program.local[8..9],\n" - " { 8, 3 } };\n" + "PARAM c[11] = { program.local[0..8],\n" + " { 2, 4, 1, 9.9999997e-006 },\n" + " { 3, 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -1486,259 +1414,252 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.zw, fragment.position.xyxy, c[9].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[7];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MAX R0.z, R1.w, c[7].w;\n" - "RCP R2.w, R0.z;\n" - "MUL R2.xyz, R1, R2.w;\n" - "MUL R6.xyz, -R2, c[10].x;\n" - "MAD R3.xyz, -R1, R2.w, c[7].z;\n" + "MOV R0.z, c[9].x;\n" + "MUL R1.y, R0.z, c[1].x;\n" "RSQ R0.y, R0.y;\n" "RCP R0.y, R0.y;\n" - "ADD R0.x, -R0, R0.y;\n" - "MOV R0.y, c[7].x;\n" - "MUL R0.y, c[8].x, R0;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAD R4.xyz, R0, c[7].x, -R0.w;\n" + "ADD R1.x, -R0, R0.y;\n" + "RCP R1.y, R1.y;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.z, R0.w, c[9].w;\n" + "RCP R2.w, R1.z;\n" + "MUL R2.xyz, R0, R2.w;\n" + "MAD R6.xyz, -R2, c[10].y, c[10].x;\n" + "MAD R3.xyz, -R0, R2.w, c[9].z;\n" + "RSQ R2.w, R2.x;\n" + "RCP R2.x, R2.w;\n" + "MUL R1.x, R1, R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MAD R4.xyz, R1, c[9].x, -R1.w;\n" "MUL R5.xyz, R3, R4;\n" - "MAD R3.xyz, -R3, R4, R0.w;\n" - "ADD R6.xyz, R6, c[10].y;\n" - "RSQ R2.x, R2.x;\n" + "MAD R5.xyz, -R5, R6, R1.w;\n" + "MAD R3.xyz, -R3, R4, R1.w;\n" "RSQ R2.z, R2.z;\n" "RSQ R2.y, R2.y;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" - "MUL R3.xyz, R1, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "RCP R2.x, R2.x;\n" + "MUL R5.xyz, R0, R5;\n" + "MUL R3.xyz, R0, R3;\n" + "ADD R2.w, -R0, c[9].z;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R1.w, -R1;\n" - "MUL R6.xyz, R2, R4;\n" - "MUL R2.xyz, R1, R5;\n" - "MAD R6.xyz, R1, R0.w, R6;\n" - "MUL R4.xyz, R0, c[7].x;\n" - "MUL R5.xyz, R1, c[10].x;\n" - "ADD R6.xyz, R6, -R2;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R2.xyz, R2, R5;\n" - "SGE R4.xyz, R4, R0.w;\n" + "MAD R2.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R1.w, R0, R2;\n" + "ADD R6.xyz, R2, -R5;\n" + "MUL R4.xyz, R1, c[9].x;\n" + "MUL R2.xyz, R0, c[10].y;\n" + "SGE R2.xyz, R2, R0.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" + "SGE R4.xyz, R4, R1.w;\n" "ADD R2.xyz, R2, -R3;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MAD R2.xyz, R4, R2, R3;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[9].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[9].xyxy;\n" - "MOV R0.y, c[7].x;\n" - "MUL R0.y, c[8].x, R0;\n" - "RCP R0.y, R0.y;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R3.xyz, R0, R1;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R0.xyz, R0, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "MAD R2.xyz, -R0, c[7].x, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.z, R0.z;\n" + "ADD R0.z, -R0.y, R0;\n" + "RCP R0.w, R0.x;\n" + "MUL R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "ADD R2.xyz, R1, R0;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R1.xyz, R1, R0.w;\n" + "MIN R1.xyz, R1, R3;\n" + "MAD R2.xyz, -R1, c[9].x, R2;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 2, 4, 1 },\n" - " program.local[8..9] };\n" + "PARAM c[10] = { program.local[0..8],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[6];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[8].x, -R0;\n" - "MUL R0.y, R0.z, c[7];\n" - "MUL R0.x, R0, c[7];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[7].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[8].x, R0;\n" - "MUL R1.xy, fragment.position, c[9];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" - "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[7].x, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].z;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.x, c[9].x;\n" + "MUL R0.z, R0, c[9].y;\n" + "MAD R0.x, R0.y, R0.y, -R0.z;\n" + "RSQ R0.z, R0.x;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "RCP R0.z, R0.z;\n" + "ADD R0.z, -R0.y, R0;\n" + "RCP R0.w, R0.x;\n" + "MUL R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[6];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R1.w, R0;\n" + "MAD R3.xyz, R1, R0.w, R2;\n" + "MUL R2.xyz, R1, R0;\n" + "MAD R2.xyz, -R2, c[9].x, R3;\n" + "ADD R2.w, -R0, c[9].z;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[9].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, R1, c[5];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[8];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..8] };\n" + "PARAM c[9] = { program.local[0..7],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[8];\n" + "MUL R0.x, R0, c[8];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.z, R0.y;\n" - "RCP R0.z, R0.z;\n" + "RSQ R0.y, R0.y;\n" + "RCP R0.z, R0.y;\n" "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[8].y;\n" - "MOV R0.y, c[4].x;\n" - "MUL R0.y, c[5].x, R0;\n" + "MUL R2.xyz, R1, c[5].y;\n" + "MOV R0.y, c[8].x;\n" + "MUL R0.y, R0, c[1].x;\n" "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[8].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R2.w, -R1, c[4].z;\n" - "MUL R0.xyz, R0, c[7].y;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[4].z;\n" - "MUL R1.xyz, R1, c[7].z;\n" - "MAD result.color.xyz, R1, R2.x, R0;\n" + "MUL R3.xyz, R0.w, R2;\n" + "MUL R2.xyz, R0, c[5].x;\n" + "MAD R2.xyz, R1.w, R2, R3;\n" + "ADD R2.w, -R1, c[8].z;\n" + "MUL R0.xyz, R0, c[6].y;\n" + "MAD R0.xyz, R2.w, R0, R2;\n" + "ADD R2.x, -R0.w, c[8].z;\n" + "MUL R1.xyz, R1, c[6].z;\n" + "MAD result.color.xyz, R2.x, R1, R0;\n" "MUL R0.x, R0.w, R1.w;\n" "MUL R0.z, R1.w, R2.x;\n" "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[7];\n" + "DP3 result.color.w, R0, c[6];\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" "RSQ R0.y, R0.y;\n" "RCP R0.z, R0.y;\n" "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, c[4].x;\n" - "MUL R0.y, c[5].x, R0;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.x, -R1.w, c[4].z;\n" + "ADD R2.x, -R1.w, c[6].z;\n" "MUL R2.xyz, R0, R2.x;\n" "MAD R0.xyz, R0, R1, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].z;\n" + "ADD R2.y, -R0.w, c[6].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -1746,31 +1667,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" "ADD R0.x, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "MOV R0.y, c[4].x;\n" - "MUL R0.y, c[5].x, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" "RCP R0.y, R0.y;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" "MUL R0.x, R0, R0.y;\n" @@ -1782,50 +1702,49 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[6].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4].z;\n" - "MUL R2.xyz, R2, c[4].x;\n" + "ADD R2.w, -R1, c[6].z;\n" + "MUL R2.xyz, R2, c[6].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "MUL R3.xyz, R0, R2.w;\n" "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[4].z;\n" - "MAD R0.xyz, R0, c[4].x, R3;\n" + "ADD R2.w, -R0, c[6].z;\n" + "MAD R0.xyz, R0, c[6].x, R3;\n" "MAD R0.xyz, R1, R2.w, R0;\n" "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[4].x;\n" + "MUL R1.xyz, R1, c[6].x;\n" "ADD R2.w, R0, R1;\n" "ADD R2.xyz, R2, -R0;\n" "SGE R1.xyz, R1, R1.w;\n" @@ -1836,43 +1755,42 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4].z;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].z;\n" + "ADD R2.y, -R0.w, c[6].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -1880,43 +1798,42 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4].z;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].z;\n" + "ADD R2.y, -R0.w, c[6].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -1924,45 +1841,44 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1, 1e-06 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[6].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAX R1.x, R0.w, c[4].w;\n" + "MAX R1.x, R0.w, c[6].w;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[4].z;\n" - "MAX R2.xyz, R1, c[4].w;\n" - "MUL R1.xy, fragment.position, c[6];\n" + "MAD R1.xyz, -R0, R1.x, c[6].z;\n" + "MAX R2.xyz, R1, c[6].w;\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[4].z;\n" + "ADD R2.w, -R0, c[6].z;\n" "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[4].z;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.xyz, R1, R0.w;\n" + "MUL R1.xyz, R0.w, R1;\n" "MAD R0.xyz, R0, R1.w, R1;\n" "MUL R2.w, R0, R1;\n" "RCP R2.x, R2.x;\n" @@ -1980,46 +1896,45 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1, 9.9999997e-06 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" - "ADD R2.w, -R1, c[4].z;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[4].w;\n" + "MAX R2.xyz, R0, c[6].w;\n" "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[4].z;\n" + "ADD R3.w, -R0, c[6].z;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" "RCP R2.z, R2.z;\n" @@ -2038,50 +1953,49 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[6].x;\n" + "RSQ R0.z, R0.z;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" + "ADD R0.x, -R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.w, -R1, c[4].z;\n" + "ADD R2.w, -R1, c[6].z;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[4].x;\n" + "MUL R2.xyz, R2, c[6].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MUL R3.xyz, R0, R1;\n" "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[4].z;\n" - "MUL R0.xyz, R0, c[4].x;\n" + "ADD R2.w, -R0, c[6].z;\n" + "MUL R0.xyz, R0, c[6].x;\n" "MAD R2.xyz, R1, R2.w, R2;\n" - "MAD R3.xyz, R3, c[4].x, R4;\n" + "MAD R3.xyz, R3, c[6].x, R4;\n" "MAD R1.xyz, R1, R2.w, R3;\n" "ADD R2.w, R0, R1;\n" "ADD R2.xyz, R2, -R1;\n" @@ -2093,10 +2007,9 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..3],\n" - " { 2, 4, 1, 9.9999997e-06 },\n" - " program.local[5..6],\n" - " { 8, 3 } };\n" + "PARAM c[8] = { program.local[0..5],\n" + " { 2, 4, 1, 9.9999997e-006 },\n" + " { 3, 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2104,64 +2017,61 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MAX R0.z, R1.w, c[4].w;\n" + "MAX R0.z, R1.w, c[6].w;\n" "RCP R2.w, R0.z;\n" "MUL R2.xyz, R1, R2.w;\n" - "MUL R6.xyz, -R2, c[7].x;\n" - "MAD R3.xyz, -R1, R2.w, c[4].z;\n" + "MAD R6.xyz, -R2, c[7].y, c[7].x;\n" + "MAD R3.xyz, -R1, R2.w, c[6].z;\n" + "RSQ R2.w, R2.x;\n" + "RCP R2.x, R2.w;\n" "RSQ R0.y, R0.y;\n" "RCP R0.y, R0.y;\n" "ADD R0.x, -R0, R0.y;\n" - "MOV R0.y, c[4].x;\n" - "MUL R0.y, c[5].x, R0;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" "RCP R0.y, R0.y;\n" "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R0, c[4].x, -R0.w;\n" + "MAD R4.xyz, R0, c[6].x, -R0.w;\n" "MUL R5.xyz, R3, R4;\n" + "MAD R5.xyz, -R5, R6, R0.w;\n" "MAD R3.xyz, -R3, R4, R0.w;\n" - "ADD R6.xyz, R6, c[7].y;\n" - "RSQ R2.x, R2.x;\n" "RSQ R2.z, R2.z;\n" "RSQ R2.y, R2.y;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" + "MUL R5.xyz, R1, R5;\n" "MUL R3.xyz, R1, R3;\n" - "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R1.w, -R1;\n" - "MUL R6.xyz, R2, R4;\n" - "MUL R2.xyz, R1, R5;\n" - "MUL R4.xyz, R0, c[4].x;\n" - "MAD R6.xyz, R1, R0.w, R6;\n" - "MUL R5.xyz, R1, c[7].x;\n" - "ADD R6.xyz, R6, -R2;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R2.xyz, R2, R5;\n" + "MAD R2.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R0.w, R1, R2;\n" + "ADD R6.xyz, R2, -R5;\n" + "MUL R4.xyz, R0, c[6].x;\n" + "MUL R2.xyz, R1, c[7].y;\n" + "SGE R2.xyz, R2, R1.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" "ADD R2.xyz, R2, -R3;\n" "SGE R4.xyz, R4, R0.w;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" - "ADD R2.w, -R1, c[4].z;\n" + "MAD R2.xyz, R4, R2, R3;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].z;\n" + "ADD R2.y, -R0.w, c[6].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -2169,86 +2079,84 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "ADD R0.xyz, R0, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[4].x, R0;\n" + "MAD result.color.xyz, -R2, c[6].x, R0;\n" "MAD result.color.w, -R0, R1, R1.x;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 2, 4, 1 },\n" - " program.local[5..6] };\n" + "PARAM c[7] = { program.local[0..5],\n" + " { 2, 4, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" "ADD R0.z, R0, R0.w;\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R0.x, -R0, R0.y;\n" + "RSQ R0.z, R0.y;\n" "RCP R0.z, R0.z;\n" - "MUL R0.x, R0, R0.z;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MOV R0.y, c[6].x;\n" + "MUL R0.y, R0, c[1].x;\n" + "RCP R0.y, R0.y;\n" + "MUL R0.x, R0, R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[4].x, R3;\n" - "ADD R2.w, -R1, c[4].z;\n" + "MAD R2.xyz, -R2, c[6].x, R3;\n" + "ADD R2.w, -R1, c[6].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].z;\n" + "ADD R2.y, -R0.w, c[6].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -2256,35 +2164,34 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_MASK = "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..3],\n" - " { 2, 4 },\n" - " program.local[5..8] };\n" + "PARAM c[9] = { program.local[0..7],\n" + " { 2, 4 } };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.z, R0, R0.w;\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[8];\n" + "MUL R0.x, R0, c[8];\n" "MAD R0.y, R0.x, R0.x, -R0;\n" "RSQ R0.y, R0.y;\n" "RCP R0.y, R0.y;\n" "ADD R1.x, -R0, R0.y;\n" - "MOV R0.z, c[4].x;\n" - "MUL R0.z, c[5].x, R0;\n" + "MOV R0.z, c[8].x;\n" + "MUL R0.z, R0, c[1].x;\n" "RCP R1.y, R0.z;\n" "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[7];\n" + "MUL R0.xy, R0, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1.x, R1, R1.y;\n" - "DP4 R1.y, R0, c[8];\n" + "DP4 R1.y, R0, c[7];\n" "TEX R0, R1, texture[1], 1D;\n" "MUL result.color, R0, R1.y;\n" "END\n" @@ -2292,480 +2199,479 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..3],\n" - " { 2, 4 },\n" - " program.local[5] };\n" + "PARAM c[6] = { program.local[0..4],\n" + " { 2, 4 } };\n" "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[3];\n" + "MAD R0.xyz, fragment.position.x, c[2], R0;\n" + "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "ADD R0.z, R0, R0.w;\n" - "MUL R0.z, c[5].x, -R0;\n" - "MUL R0.y, R0.z, c[4];\n" - "MUL R0.x, R0, c[4];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "MOV R0.z, c[4].x;\n" - "RSQ R0.y, R0.y;\n" - "MUL R0.z, c[5].x, R0;\n" - "RCP R0.y, R0.y;\n" + "MUL R0.z, -R0, c[1].x;\n" + "MUL R0.y, R0.z, c[5];\n" + "MUL R0.x, R0, c[5];\n" + "MAD R0.z, R0.x, R0.x, -R0.y;\n" + "MOV R0.y, c[5].x;\n" + "RSQ R0.z, R0.z;\n" + "MUL R0.y, R0, c[1].x;\n" "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0, R0.y;\n" - "MUL R0.x, R0, R0.z;\n" + "RCP R0.y, R0.y;\n" + "ADD R0.x, -R0, R0.z;\n" + "MUL R0.x, R0, R0.y;\n" "TEX result.color, R0, texture[0], 1D;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[13] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494 },\n" - " program.local[10..12] };\n" + "PARAM c[13] = { program.local[0..9],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[10].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, c[12].y;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[12].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "ADD R2.w, -R1, c[7];\n" - "MUL R0.xyz, R0, c[11].y;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R1, c[11].z;\n" - "ADD R3.z, -R0.w, c[7].w;\n" - "MAD R2.xyz, R0, R3.z, R2;\n" - "MUL R0.y, R0.w, R2.w;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R3;\n" - "DP3 R2.w, R0, c[11];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[10].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[11].x, c[11].y;\n" + "MAD R1.z, R1, R1.y, -c[11];\n" + "MAD R1.z, R1, R1.y, c[11].w;\n" + "MAD R1.z, R1, R1.y, -c[12].x;\n" + "MAD R1.y, R1.z, R1, c[12];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[10].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[10].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R1.x, R0, c[10];\n" + "FLR R1.y, R1.x;\n" + "MUL R0.xy, fragment.position, c[7];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, R1, -R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R0, c[4].y;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[4].x;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R3.xy, fragment.position, c[8];\n" + "ADD R2.w, -R0, c[12].z;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.xyz, R0, c[5].z;\n" + "ADD R3.z, -R1.w, c[12];\n" + "MAD R2.xyz, R3.z, R1, R2;\n" + "MUL R1.y, R1.w, R2.w;\n" + "MUL R1.x, R1.w, R0.w;\n" + "MUL R1.z, R0.w, R3;\n" + "DP3 R2.w, R1, c[5];\n" + "MUL R3.xy, R3, c[6];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[9];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[10].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2.x, -R1.w, c[7].w;\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R1.x, R0, c[8];\n" + "FLR R1.y, R1.x;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, R1, -R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "ADD R2.x, -R0.w, c[10].z;\n" + "MUL R2.xyz, R1, R2.x;\n" + "MAD R1.xyz, R1, R0, R2;\n" + "ADD R2.x, -R1.w, c[10].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" + "ADD R3.xy, fragment.position, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[8];\n" "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD R2, -R0, R1, R2;\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R0.z, R0.x, -R0.y;\n" + "TEX R1, R0.z, texture[2], 1D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R2, R1, R0;\n" + "MAD R2, -R1, R0, R2;\n" + "MUL R3.xy, R3, c[4];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 2 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[7];\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].y, c[8];\n" + "MAD R1.z, R1, R1.y, -c[8].w;\n" + "MAD R1.z, R1, R1.y, c[9].x;\n" + "MAD R1.z, R1, R1.y, -c[9].y;\n" + "MAD R1.y, R1.z, R1, c[9].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[9].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[10].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" + "ADD R2.w, -R1, c[10];\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[9].y;\n" + "MUL R2.xyz, R2, c[10].z;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MUL R3.xyz, R0, R1;\n" "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R3.xyz, R3, c[9].y, R4;\n" + "ADD R2.x, -R0.w, c[10].w;\n" + "MAD R3.xyz, R3, c[10].z, R4;\n" "MAD R3.xyz, R1, R2.x, R3;\n" "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[9].y;\n" + "MUL R2.xyz, R1, c[10].z;\n" "ADD R0.xyz, R0, -R3;\n" "SGE R2.xyz, R2, R1.w;\n" "MAD R2.xyz, R2, R0, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.z, R0.x, c[8].x;\n" + "FLR R0.w, R0.z;\n" + "ADD R1.x, R0.z, -R0.w;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[10].z;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[10].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.z, R0.x, c[8].x;\n" + "FLR R0.w, R0.z;\n" + "ADD R1.x, R0.z, -R0.w;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[10].z;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[10].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 1e-06 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].y, c[8];\n" + "MAD R1.z, R1, R1.y, -c[8].w;\n" + "MAD R1.z, R1, R1.y, c[9].x;\n" + "MAD R1.z, R1, R1.y, -c[9].y;\n" + "MAD R1.y, R1.z, R1, c[9].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[9].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[10].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAX R1.x, R0.w, c[9].y;\n" + "MAX R1.x, R0.w, c[10].w;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[7].w;\n" - "MAX R2.xyz, R1, c[9].y;\n" - "MUL R1.xy, fragment.position, c[10];\n" + "MAD R1.xyz, -R0, R1.x, c[10].z;\n" + "MAX R2.xyz, R1, c[10].w;\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[7];\n" + "ADD R2.w, -R0, c[10].z;\n" "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[7];\n" + "ADD R2.w, -R1, c[10].z;\n" "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MUL R2.w, R0, R1;\n" "MAD R0.xyz, R0, R1.w, R3;\n" "SGE R0.xyz, R0, R2.w;\n" @@ -2778,70 +2684,70 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "MAD R2.xyz, R0, R4, R2;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 9.9999997e-06 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[7];\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].y, c[8];\n" + "MAD R1.z, R1, R1.y, -c[8].w;\n" + "MAD R1.z, R1, R1.y, c[9].x;\n" + "MAD R1.z, R1, R1.y, -c[9].y;\n" + "MAD R1.y, R1.z, R1, c[9].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[9].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[10].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[9].y;\n" - "ADD R3.w, -R0, c[7];\n" + "MAX R2.xyz, R0, c[10].w;\n" + "ADD R2.w, -R1, c[10].z;\n" + "ADD R3.w, -R0, c[10].z;\n" "MUL R5.xyz, R0, R2.w;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" @@ -2856,74 +2762,74 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "MAD R2.xyz, R3, R2, R0;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 2 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[7];\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].y, c[8];\n" + "MAD R1.z, R1, R1.y, -c[8].w;\n" + "MAD R1.z, R1, R1.y, c[9].x;\n" + "MAD R1.z, R1, R1.y, -c[9].y;\n" + "MAD R1.y, R1.z, R1, c[9].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[9].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[10].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" + "ADD R2.w, -R1, c[10];\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[9].y;\n" + "MUL R2.xyz, R2, c[10].z;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[7];\n" - "MAD R3.xyz, R3, c[9].y, R4;\n" - "MUL R0.xyz, R0, c[9].y;\n" + "ADD R2.w, -R0, c[10];\n" + "MAD R3.xyz, R3, c[10].z, R4;\n" + "MUL R0.xyz, R0, c[10].z;\n" "SGE R0.xyz, R0, R0.w;\n" "MAD R3.xyz, R1, R2.w, R3;\n" "MAD R2.xyz, R1, R2.w, R2;\n" @@ -2931,24 +2837,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "MAD R2.xyz, R0, R2, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" - "PARAM c[12] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 9.9999997e-06, 2, 8 },\n" - " program.local[10],\n" - " { 3 } };\n" + "PARAM c[12] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1, 9.9999997e-006 },\n" + " { 2, 3, 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2956,326 +2860,325 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MOV R1.x, c[7].y;\n" - "MUL R0.w, R0.z, R0.z;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[10].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "MAX R0.z, R1.w, c[9].y;\n" - "RCP R2.w, R0.z;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R3.w, R2.x;\n" - "RSQ R4.y, R2.z;\n" - "RCP R4.x, R3.w;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[9].z, -R0.w;\n" - "RSQ R3.w, R2.y;\n" - "RCP R4.z, R4.y;\n" - "RCP R4.y, R3.w;\n" - "MAD R4.xyz, R4, R1.w, -R1;\n" - "MUL R6.xyz, R4, R3;\n" - "MUL R4.xyz, -R2, c[9].w;\n" - "MAD R2.xyz, -R1, R2.w, c[7].w;\n" - "ADD R5.xyz, R4, c[11].x;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R0.w;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R5.xyz, R1, R0.w, R6;\n" - "MUL R4.xyz, R1, R4;\n" - "MUL R6.xyz, R1, c[9].w;\n" - "ADD R5.xyz, R5, -R4;\n" - "SGE R6.xyz, R6, R1.w;\n" - "MUL R5.xyz, R6, R5;\n" - "ADD R3.xyz, R4, R5;\n" - "MUL R2.xyz, R1, R2;\n" - "MUL R4.xyz, R0, c[9].z;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R1.x, R0, c[8];\n" + "FLR R1.y, R1.x;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R2.x, R0.w, c[10].w;\n" + "RCP R2.w, R2.x;\n" + "MUL R2.xyz, R0, R2.w;\n" + "MAD R6.xyz, -R2, c[11].z, c[11].y;\n" + "MAD R3.xyz, -R0, R2.w, c[10].z;\n" + "RSQ R2.w, R2.x;\n" + "RCP R2.x, R2.w;\n" + "ADD R1.x, R1, -R1.y;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MAD R4.xyz, R1, c[11].x, -R1.w;\n" + "MUL R5.xyz, R3, R4;\n" + "MAD R5.xyz, -R5, R6, R1.w;\n" + "MAD R3.xyz, -R3, R4, R1.w;\n" + "RSQ R2.z, R2.z;\n" + "RSQ R2.y, R2.y;\n" + "MUL R5.xyz, R0, R5;\n" + "MUL R3.xyz, R0, R3;\n" + "ADD R2.w, -R0, c[10].z;\n" + "RCP R2.z, R2.z;\n" + "RCP R2.y, R2.y;\n" + "MAD R2.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R1.w, R0, R2;\n" + "ADD R6.xyz, R2, -R5;\n" + "MUL R4.xyz, R1, c[11].x;\n" + "MUL R2.xyz, R0, c[11].z;\n" + "SGE R2.xyz, R2, R0.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" + "SGE R4.xyz, R4, R1.w;\n" + "ADD R2.xyz, R2, -R3;\n" + "MAD R2.xyz, R4, R2, R3;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[10].z;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 2 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[10].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R3.xyz, R0, R1;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R0.xyz, R0, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "MAD R2.xyz, -R0, c[9].y, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.z, R0.x, c[8].x;\n" + "FLR R0.w, R0.z;\n" + "ADD R1.x, R0.z, -R0.w;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "ADD R2.xyz, R1, R0;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R1.xyz, R1, R0.w;\n" + "MIN R1.xyz, R1, R3;\n" + "MAD R2.xyz, -R1, c[10].z, R2;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..5],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[8],\n" - " { 0.15915494, 2 },\n" - " program.local[10] };\n" + "PARAM c[11] = { program.local[0..7],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[6].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[6].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[7].y;\n" - "CMP R0.x, R0, c[7], R1;\n" - "MAD R0.w, R0, c[6].z, -c[6];\n" - "MUL R1.xy, fragment.position, c[10];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[7].z, c[7].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[8];\n" - "MUL R0.x, R0, c[9];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[9].y, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[7].w;\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[8].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[9].x, c[9].y;\n" + "MAD R1.z, R1, R1.y, -c[9];\n" + "MAD R1.z, R1, R1.y, c[9].w;\n" + "MAD R1.z, R1, R1.y, -c[10].x;\n" + "MAD R1.y, R1.z, R1, c[10];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[8].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[8].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.z, R0.x, c[8].x;\n" + "FLR R0.w, R0.z;\n" + "ADD R1.x, R0.z, -R0.w;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R1.w, R0;\n" + "MAD R3.xyz, R1, R0.w, R2;\n" + "MUL R2.xyz, R1, R0;\n" + "MAD R2.xyz, -R2, c[10].z, R3;\n" + "ADD R2.w, -R0, c[10];\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[10].w;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7..9] };\n" + "PARAM c[10] = { program.local[0..6],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" - "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[7].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].x, c[8].y;\n" + "MAD R1.z, R1, R1.y, -c[8];\n" + "MAD R1.z, R1, R1.y, c[8].w;\n" + "MAD R1.z, R1, R1.y, -c[9].x;\n" + "MAD R1.y, R1.z, R1, c[9];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[7].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[9].y;\n" + "MUL R2.xyz, R1, c[4].y;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[7];\n" + "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[9].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R2.w, -R1, c[4];\n" - "MUL R0.xyz, R0, c[8].y;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[4].w;\n" - "MUL R1.xyz, R1, c[8].z;\n" - "MAD result.color.xyz, R1, R2.x, R0;\n" + "MUL R3.xyz, R0.w, R2;\n" + "MUL R2.xyz, R0, c[4].x;\n" + "MAD R2.xyz, R1.w, R2, R3;\n" + "ADD R2.w, -R1, c[9].z;\n" + "MUL R0.xyz, R0, c[5].y;\n" + "MAD R0.xyz, R2.w, R0, R2;\n" + "ADD R2.x, -R0.w, c[9].z;\n" + "MUL R1.xyz, R1, c[5].z;\n" + "MAD result.color.xyz, R2.x, R1, R0;\n" "MUL R0.x, R0.w, R1.w;\n" "MUL R0.z, R1.w, R2.x;\n" "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[8];\n" + "DP3 result.color.w, R0, c[5];\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" - "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" + "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.x, -R1.w, c[4].w;\n" + "ADD R2.x, -R1.w, c[7].z;\n" "MUL R2.xyz, R0, R2.x;\n" "MAD R0.xyz, R0, R1, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].w;\n" + "ADD R2.y, -R0.w, c[7].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -3283,46 +3186,46 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" "FLR R0.y, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" @@ -3333,64 +3236,64 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 2 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[4];\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[5].y, c[5];\n" + "MAD R1.z, R1, R1.y, -c[5].w;\n" + "MAD R1.z, R1, R1.y, c[6].x;\n" + "MAD R1.z, R1, R1.y, -c[6].y;\n" + "MAD R1.y, R1.z, R1, c[6].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[6].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[6].y;\n" + "ADD R2.w, -R1, c[7];\n" + "MUL R2.xyz, R2, c[7].z;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "MUL R3.xyz, R0, R2.w;\n" "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[4];\n" - "MAD R0.xyz, R0, c[6].y, R3;\n" + "ADD R2.w, -R0, c[7];\n" + "MAD R0.xyz, R0, c[7].z, R3;\n" "MAD R0.xyz, R1, R2.w, R0;\n" "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[6].y;\n" + "MUL R1.xyz, R1, c[7].z;\n" "ADD R2.w, R0, R1;\n" "ADD R2.xyz, R2, -R0;\n" "SGE R1.xyz, R1, R1.w;\n" @@ -3401,57 +3304,57 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4];\n" + "ADD R2.w, -R1, c[7].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].w;\n" + "ADD R2.y, -R0.w, c[7].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -3459,57 +3362,57 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4];\n" + "ADD R2.w, -R1, c[7].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].w;\n" + "ADD R2.y, -R0.w, c[7].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -3517,59 +3420,59 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 1e-06 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[5].y, c[5];\n" + "MAD R1.z, R1, R1.y, -c[5].w;\n" + "MAD R1.z, R1, R1.y, c[6].x;\n" + "MAD R1.z, R1, R1.y, -c[6].y;\n" + "MAD R1.y, R1.z, R1, c[6].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[6].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAX R1.x, R0.w, c[6].y;\n" + "MAX R1.x, R0.w, c[7].w;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[4].w;\n" - "MAX R2.xyz, R1, c[6].y;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MAD R1.xyz, -R0, R1.x, c[7].z;\n" + "MAX R2.xyz, R1, c[7].w;\n" + "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[4];\n" + "ADD R2.w, -R0, c[7].z;\n" "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[4];\n" + "ADD R2.w, -R1, c[7].z;\n" "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.xyz, R1, R0.w;\n" + "MUL R1.xyz, R0.w, R1;\n" "MAD R0.xyz, R0, R1.w, R1;\n" "MUL R2.w, R0, R1;\n" "RCP R2.x, R2.x;\n" @@ -3587,60 +3490,60 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 9.9999997e-06 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[4];\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[5].y, c[5];\n" + "MAD R1.z, R1, R1.y, -c[5].w;\n" + "MAD R1.z, R1, R1.y, c[6].x;\n" + "MAD R1.z, R1, R1.y, -c[6].y;\n" + "MAD R1.y, R1.z, R1, c[6].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[6].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" + "ADD R2.w, -R1, c[7].z;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[6].y;\n" + "MAX R2.xyz, R0, c[7].w;\n" "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[4];\n" + "ADD R3.w, -R0, c[7].z;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" "RCP R2.z, R2.z;\n" @@ -3659,64 +3562,64 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 2 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.0020000001, -0.01348047, 0.057477314, 0.12123907 },\n" + " { 0.19563593, 0.33299461, 0.99999565, 1.5707964 },\n" + " { 3.1415927, 0.15915494, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[4];\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5];\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[5].y, c[5];\n" + "MAD R1.z, R1, R1.y, -c[5].w;\n" + "MAD R1.z, R1, R1.y, c[6].x;\n" + "MAD R1.z, R1, R1.y, -c[6].y;\n" + "MAD R1.y, R1.z, R1, c[6].z;\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[6].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].x;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" + "ADD R2.w, -R1, c[7];\n" "ADD R3.xyz, R0.w, -R0;\n" "ADD R2.xyz, R1.w, -R1;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[6].y;\n" + "MUL R2.xyz, R2, c[7].z;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MUL R3.xyz, R0, R1;\n" "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[4];\n" - "MUL R0.xyz, R0, c[6].y;\n" + "ADD R2.w, -R0, c[7];\n" + "MUL R0.xyz, R0, c[7].z;\n" "MAD R2.xyz, R1, R2.w, R2;\n" - "MAD R3.xyz, R3, c[6].y, R4;\n" + "MAD R3.xyz, R3, c[7].z, R4;\n" "MAD R1.xyz, R1, R2.w, R3;\n" "ADD R2.w, R0, R1;\n" "ADD R2.xyz, R2, -R1;\n" @@ -3728,13 +3631,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 9.9999997e-06, 2, 8 },\n" - " program.local[7],\n" - " { 3 } };\n" + "PARAM c[9] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 1, 9.9999997e-006 },\n" + " { 2, 3, 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3742,75 +3643,74 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MOV R1.x, c[4].y;\n" - "MUL R0.w, R0.z, R0.z;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" - "FLR R0.y, R0.x;\n" - "MAX R0.z, R1.w, c[6].y;\n" - "RCP R2.w, R0.z;\n" + "MAX R2.x, R1.w, c[7].w;\n" + "RCP R2.w, R2.x;\n" "MUL R2.xyz, R1, R2.w;\n" - "RSQ R3.w, R2.x;\n" - "RSQ R4.y, R2.z;\n" - "RCP R4.x, R3.w;\n" + "MAD R6.xyz, -R2, c[8].z, c[8].y;\n" + "MAD R3.xyz, -R1, R2.w, c[7].z;\n" + "RSQ R2.w, R2.x;\n" + "RCP R2.x, R2.w;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" + "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[6].z, -R0.w;\n" - "RSQ R3.w, R2.y;\n" - "RCP R4.z, R4.y;\n" - "RCP R4.y, R3.w;\n" - "MAD R4.xyz, R4, R1.w, -R1;\n" - "MUL R6.xyz, R4, R3;\n" - "MUL R4.xyz, -R2, c[6].w;\n" - "MAD R2.xyz, -R1, R2.w, c[4].w;\n" - "ADD R5.xyz, R4, c[8].x;\n" - "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R0.w;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R5.xyz, R1, R0.w, R6;\n" - "MUL R4.xyz, R1, R4;\n" - "MUL R6.xyz, R1, c[6].w;\n" - "ADD R5.xyz, R5, -R4;\n" - "SGE R6.xyz, R6, R1.w;\n" - "MUL R5.xyz, R6, R5;\n" - "ADD R3.xyz, R4, R5;\n" - "MUL R2.xyz, R1, R2;\n" - "MUL R4.xyz, R0, c[6].z;\n" - "ADD R3.xyz, R3, -R2;\n" + "MAD R4.xyz, R0, c[8].x, -R0.w;\n" + "MUL R5.xyz, R3, R4;\n" + "MAD R5.xyz, -R5, R6, R0.w;\n" + "MAD R3.xyz, -R3, R4, R0.w;\n" + "RSQ R2.z, R2.z;\n" + "RSQ R2.y, R2.y;\n" + "MUL R5.xyz, R1, R5;\n" + "MUL R3.xyz, R1, R3;\n" + "RCP R2.z, R2.z;\n" + "RCP R2.y, R2.y;\n" + "MAD R2.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R0.w, R1, R2;\n" + "ADD R6.xyz, R2, -R5;\n" + "MUL R4.xyz, R0, c[8].x;\n" + "MUL R2.xyz, R1, c[8].z;\n" + "SGE R2.xyz, R2, R1.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" + "ADD R2.xyz, R2, -R3;\n" "SGE R4.xyz, R4, R0.w;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[4];\n" + "MAD R2.xyz, R4, R2, R3;\n" + "ADD R2.w, -R1, c[7].z;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].w;\n" + "ADD R2.y, -R0.w, c[7].z;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -3818,114 +3718,114 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 2 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" "FLR R0.y, R0.x;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "ADD R0.xyz, R0, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[6].y, R0;\n" + "MAD result.color.xyz, -R2, c[7].z, R0;\n" "MAD result.color.w, -R0, R1, R1.x;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494, 2 },\n" - " program.local[7] };\n" + "PARAM c[8] = { program.local[0..4],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565, 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[5].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[6].x, c[6].y;\n" + "MAD R1.z, R1, R1.y, -c[6];\n" + "MAD R1.z, R1, R1.y, c[6].w;\n" + "MAD R1.z, R1, R1.y, -c[7].x;\n" + "MAD R1.y, R1.z, R1, c[7];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[5].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[5].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[5];\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[6].y, R3;\n" - "ADD R2.w, -R1, c[4];\n" + "MAD R2.xyz, -R2, c[7].z, R3;\n" + "ADD R2.w, -R1, c[7];\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[4].w;\n" + "ADD R2.y, -R0.w, c[7].w;\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -3933,49 +3833,49 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_MASK = "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 },\n" - " program.local[7..9] };\n" + "PARAM c[10] = { program.local[0..6],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565 } };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.y, R0.w;\n" - "RCP R1.x, R1.x;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.z, R0.x, R0.y, c[5].x;\n" - "MUL R1.x, R0.z, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[7].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[8].x, c[8].y;\n" + "MAD R1.z, R1, R1.y, -c[8];\n" + "MAD R1.z, R1, R1.y, c[8].w;\n" + "MAD R1.z, R1, R1.y, -c[9].x;\n" + "MAD R1.y, R1.z, R1, c[9];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R1.y, -R1.x, c[7].w;\n" + "ADD R0.z, -R0, R0.w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[7].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.z, R0.x, c[0].x;\n" + "MUL R1.x, R0.z, c[7];\n" "FLR R1.y, R1.x;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[8];\n" + "ADD R0.xy, fragment.position, c[5];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R1.x, R1, -R1.y;\n" - "DP4 R1.y, R0, c[9];\n" + "DP4 R1.y, R0, c[6];\n" "TEX R0, R1, texture[1], 1D;\n" "MUL result.color, R0, R1.y;\n" "END\n" @@ -3983,42 +3883,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..2],\n" - " { 0.0020000001, 9.9999997e-10, 0.1963, 0.9817 },\n" - " { 2.3561945, 0.78539819, -1, 1 },\n" - " program.local[5],\n" - " { 0.15915494 } };\n" + "PARAM c[7] = { program.local[0..3],\n" + " { 0.15915494, 0.0020000001, 3.1415927, 1.5707964 },\n" + " { -0.01348047, 0.057477314, 0.12123907, 0.19563593 },\n" + " { 0.33299461, 0.99999565 } };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R0.w, R0.y, c[3].x;\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R0.w;\n" - "ABS R0.z, -R0.y;\n" - "ADD R0.z, R0, c[3].y;\n" - "ADD R0.w, R0.x, R0.z;\n" - "ADD R1.x, R0.z, -R0;\n" - "RCP R1.x, R1.x;\n" - "RCP R1.y, R0.w;\n" - "MUL R0.w, R0, R1.x;\n" - "ADD R0.z, R0.x, -R0;\n" - "MUL R0.z, R0, R1.y;\n" - "CMP R0.z, R0.x, R0.w, R0;\n" - "MUL R0.w, R0.z, R0.z;\n" - "MOV R1.x, c[4].y;\n" - "CMP R0.y, -R0, c[4].z, c[4].w;\n" - "MAD R0.w, R0, c[3].z, -c[3];\n" - "CMP R0.x, R0, c[4], R1;\n" - "MAD R0.x, R0.w, R0.z, R0;\n" - "MAD R0.x, R0, R0.y, c[5];\n" - "MUL R0.x, R0, c[6];\n" + "ABS R0.z, R0.x;\n" + "ABS R0.w, R0.y;\n" + "ADD R0.w, R0, -R0.z;\n" + "ADD R1.x, R0.y, c[4].y;\n" + "ABS R0.w, R0;\n" + "CMP R0.y, -R0.w, R0, R1.x;\n" + "ABS R0.w, -R0.y;\n" + "MAX R1.x, R0.z, R0.w;\n" + "RCP R1.y, R1.x;\n" + "MIN R1.x, R0.z, R0.w;\n" + "MUL R1.x, R1, R1.y;\n" + "MUL R1.y, R1.x, R1.x;\n" + "MAD R1.z, R1.y, c[5].x, c[5].y;\n" + "MAD R1.z, R1, R1.y, -c[5];\n" + "MAD R1.z, R1, R1.y, c[5].w;\n" + "MAD R1.z, R1, R1.y, -c[6].x;\n" + "MAD R1.y, R1.z, R1, c[6];\n" + "MUL R1.x, R1.y, R1;\n" + "ADD R0.z, -R0, R0.w;\n" + "ADD R1.y, -R1.x, c[4].w;\n" + "CMP R0.z, -R0, R1.y, R1.x;\n" + "ADD R0.w, -R0.z, c[4].z;\n" + "CMP R0.x, R0, R0.w, R0.z;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "ADD R0.x, R0, c[0];\n" + "MUL R0.x, R0, c[4];\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX result.color, R0, texture[0], 1D;\n" @@ -4027,45 +3928,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 1 },\n" - " program.local[9..10] };\n" + "PARAM c[11] = { program.local[0..9],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[6].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, c[10].y;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[10].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "MUL R0.xyz, R0, c[9].y;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R1, c[9].z;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.y, -R1.w, c[8].x;\n" - "MUL R0.z, R1.w, R2.w;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.y, R0.w, R0;\n" - "DP3 R2.w, R0, c[9];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "ADD R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[7];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.x, R1, c[0].z;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R0, c[4].y;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[4].x;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R3.xy, fragment.position, c[8];\n" + "ADD R2.w, -R0, c[10].x;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.xyz, R0, c[5].z;\n" + "ADD R3.z, -R1.w, c[10].x;\n" + "MAD R2.xyz, R3.z, R1, R2;\n" + "MUL R1.y, R1.w, R2.w;\n" + "MUL R1.x, R1.w, R0.w;\n" + "MUL R1.z, R0.w, R3;\n" + "DP3 R2.w, R1, c[5];\n" + "MUL R3.xy, R3, c[6];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[9];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -4076,30 +3975,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[6].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "ADD R1.x, R0.z, R0.w;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.x, R1, c[0].z;\n" + "TEX R1, R1, texture[2], 1D;\n" "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R2.xyz, R1, R2.x;\n" + "MAD R1.xyz, R1, R0, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -4110,25 +4009,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "ADD R3.xy, fragment.position, c[0];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD R2, -R0, R1, R2;\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.z, R0.x, c[0];\n" + "ADD R3.xy, fragment.position, c[6];\n" + "TEX R1, R0.z, texture[2], 1D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R2, R1, R0;\n" + "MAD R2, -R1, R0, R2;\n" + "MUL R3.xy, R3, c[4];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -4141,16 +4040,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].y;\n" "ADD R3.xyz, R0.w, -R0;\n" @@ -4171,11 +4070,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MAD R2.xyz, R2, R0, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -4188,32 +4087,32 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.z, R0.x, R0.y;\n" + "MUL R1.x, R0.z, c[0].z;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -4225,64 +4124,64 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.z, R0.x, R0.y;\n" + "MUL R1.x, R0.z, c[0].z;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" "MAX R1.x, R0.w, c[8].y;\n" "RCP R1.x, R1.x;\n" "MAD R2.xyz, -R0, R1.x, c[8].x;\n" "MAX R2.xyz, R2, c[8].y;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].x;\n" "MUL R3.xyz, R1, R2.w;\n" "ADD R2.w, -R1, c[8].x;\n" "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MUL R2.w, R0, R1;\n" "MAD R0.xyz, R0, R1.w, R3;\n" "SGE R0.xyz, R0, R2.w;\n" @@ -4295,11 +4194,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MAD R2.xyz, R0, R4, R2;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -4307,25 +4206,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" @@ -4340,18 +4239,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R4.xyz, R1, R3.w;\n" "MAD R0.xyz, R0, R2.w, R4;\n" "MUL R2.w, R0, R1;\n" - "ADD R3.w, -R0, c[8].x;\n" "MAD R2.xyz, R1, R3.w, R2;\n" "ADD R2.xyz, R2, -R0;\n" "SGE R3.xyz, R3, R2.w;\n" "MAD R2.xyz, R3, R2, R0;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -4365,16 +4263,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].y;\n" "ADD R3.xyz, R0.w, -R0;\n" @@ -4395,11 +4293,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MAD R2.xyz, R0, R2, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -4407,8 +4305,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4416,60 +4314,58 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R2.xyz, fragment.position.y, c[4];\n" - "MAD R3.xyz, fragment.position.x, c[3], R2;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[8].y;\n" - "RCP R2.w, R0.x;\n" - "MUL R0.xyz, R1, R2.w;\n" - "RSQ R0.w, R0.x;\n" - "RSQ R2.y, R0.y;\n" - "ADD R3.xyz, R3, c[5];\n" - "RCP R2.x, R0.w;\n" - "RCP R0.w, R3.z;\n" - "MUL R3.xy, R3, R0.w;\n" - "RSQ R0.w, R0.z;\n" - "RCP R2.z, R0.w;\n" + "MUL R2.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R2;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.x, R0.w, c[8].y;\n" + "RCP R2.w, R1.x;\n" + "MUL R1.xyz, R0, R2.w;\n" + "RSQ R1.w, R1.x;\n" + "RSQ R2.y, R1.y;\n" + "ADD R3.xyz, R3, c[3];\n" + "RCP R2.x, R1.w;\n" + "RCP R1.w, R3.z;\n" + "MUL R3.xy, R3, R1.w;\n" + "RSQ R1.w, R1.z;\n" + "RCP R2.z, R1.w;\n" "RCP R2.y, R2.y;\n" - "MAD R6.xyz, R2, R1.w, -R1;\n" - "MUL R2.xyz, -R0, c[8].w;\n" - "ADD R5.xyz, R2, c[9].x;\n" - "MAD R2.xyz, -R1, R2.w, c[8].x;\n" - "MUL R3.xy, R3, c[6];\n" - "ADD R0.w, R3.x, R3.y;\n" - "MUL R0.w, R0, c[6].z;\n" - "TEX R0, R0.w, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[8].z, -R0.w;\n" + "MAD R6.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, -R1, c[9].x;\n" + "ADD R5.xyz, R2, c[8].w;\n" + "MAD R2.xyz, -R0, R2.w, c[8].x;\n" + "MUL R3.xy, R3, c[0];\n" + "ADD R1.w, R3.x, R3.y;\n" + "MUL R1.w, R1, c[0].z;\n" + "TEX R1, R1.w, texture[2], 1D;\n" + "MAD R3.xyz, R1, c[8].z, -R1.w;\n" "MUL R4.xyz, R2, R3;\n" - "MAD R4.xyz, -R4, R5, R0.w;\n" + "MAD R4.xyz, -R4, R5, R1.w;\n" + "MAD R2.xyz, -R2, R3, R1.w;\n" "MUL R5.xyz, R6, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, R1, R0.w, R5;\n" - "MUL R4.xyz, R1, R4;\n" - "MUL R5.xyz, R1, c[8].w;\n" - "ADD R6.xyz, R6, -R4;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R3.xyz, R4, R5;\n" - "MUL R2.xyz, R1, R2;\n" - "MUL R4.xyz, R0, c[8].z;\n" + "MUL R4.xyz, R0, R4;\n" + "MAD R5.xyz, R1.w, R0, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R0, c[9].x;\n" + "SGE R3.xyz, R5, R0.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" + "MUL R2.xyz, R0, R2;\n" + "MUL R4.xyz, R1, c[8].z;\n" + "SGE R4.xyz, R4, R1.w;\n" "ADD R3.xyz, R3, -R2;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MAD R2.xyz, R4, R3, R2;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -4481,106 +4377,104 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[6].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R3.xyz, R0, R1;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R0.xyz, R0, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "MAD R2.xyz, -R0, c[8].x, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.z, R0.x, R0.y;\n" + "MUL R1.x, R0.z, c[0].z;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "ADD R2.xyz, R1, R0;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R1.xyz, R1, R0.w;\n" + "MIN R1.xyz, R1, R3;\n" + "MAD R2.xyz, -R1, c[8].x, R2;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[6].z;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[8].y, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, R0, c[0];\n" + "ADD R0.z, R0.x, R0.y;\n" + "MUL R1.x, R0.z, c[0].z;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 1D;\n" + "MUL R2.xyz, R1.w, R0;\n" + "MAD R3.xyz, R1, R0.w, R2;\n" + "MUL R2.xyz, R1, R0;\n" + "MAD R2.xyz, -R2, c[8].x, R3;\n" + "ADD R2.w, -R0, c[8].y;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8].y;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 1 },\n" - " program.local[6..7] };\n" + "PARAM c[8] = { program.local[0..6],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[7].y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R2.xyz, R1, c[4].y;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[7].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "MUL R0.xyz, R0, c[6].y;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[5];\n" - "MUL R1.xyz, R1, c[6].z;\n" - "MAD result.color.xyz, R1, R2.x, R0;\n" - "ADD R0.y, -R1.w, c[5].x;\n" + "MUL R3.xyz, R0.w, R2;\n" + "MUL R2.xyz, R0, c[4].x;\n" + "MAD R2.xyz, R1.w, R2, R3;\n" + "ADD R2.w, -R1, c[7].x;\n" + "MUL R0.xyz, R0, c[5].y;\n" + "MAD R0.xyz, R2.w, R0, R2;\n" + "ADD R2.x, -R0.w, c[7];\n" + "MUL R1.xyz, R1, c[5].z;\n" + "MAD result.color.xyz, R2.x, R1, R0;\n" "MUL R0.x, R0.w, R1.w;\n" "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R0;\n" - "DP3 result.color.w, R0, c[6];\n" + "MUL R0.y, R0.w, R2.w;\n" + "DP3 result.color.w, R0, c[5];\n" "END\n" ; @@ -4591,16 +4485,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "ADD R2.x, -R1.w, c[5];\n" "MUL R2.xyz, R0, R2.x;\n" @@ -4618,16 +4512,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "ADD R2, R0, R1;\n" "MAD result.color, -R0, R1, R2;\n" @@ -4642,14 +4536,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" @@ -4683,19 +4577,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" @@ -4714,19 +4608,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MAX R2.xyz, R2, R3;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" @@ -4740,19 +4634,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "MAX R1.x, R0.w, c[5].y;\n" "RCP R1.x, R1.x;\n" @@ -4764,7 +4658,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R2.xyz, R1, R2.x;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R1.xyz, R1, R0.w;\n" + "MUL R1.xyz, R0.w, R1;\n" "MAD R0.xyz, R0, R1.w, R1;\n" "MUL R2.w, R0, R1;\n" "RCP R3.x, R3.x;\n" @@ -4783,25 +4677,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" @@ -4814,9 +4708,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "RCP R2.z, R2.z;\n" "MAD R2.xyz, R4, R2, R5;\n" "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "ADD R3.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R3.w, R2;\n" + "MAD R0.xyz, R0, R2.w, R4;\n" "MUL R2.x, R0.w, R1.w;\n" "ADD R2.w, R0, R1;\n" "ADD R1.xyz, R1, -R0;\n" @@ -4835,14 +4728,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" @@ -4871,8 +4764,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4880,8 +4773,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R2.xyz, fragment.position.y, c[1];\n" - "MAD R3.xyz, fragment.position.x, c[0], R2;\n" + "MUL R2.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R2;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R1, R0, texture[0], 2D;\n" "MAX R0.x, R1.w, c[5].y;\n" @@ -4889,39 +4782,37 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R0.xyz, R1, R2.w;\n" "RSQ R0.w, R0.x;\n" "RSQ R2.y, R0.y;\n" - "ADD R3.xyz, R3, c[2];\n" + "ADD R3.xyz, R3, c[3];\n" "RCP R2.x, R0.w;\n" "RCP R0.w, R3.z;\n" "MUL R3.xy, R3, R0.w;\n" "RSQ R0.w, R0.z;\n" "RCP R2.z, R0.w;\n" "RCP R2.y, R2.y;\n" - "MAD R6.xyz, R2, R1.w, -R1;\n" - "MUL R2.xyz, -R0, c[5].w;\n" - "ADD R5.xyz, R2, c[6].x;\n" + "MAD R6.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, -R0, c[6].x;\n" + "ADD R5.xyz, R2, c[5].w;\n" "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "MUL R3.xy, R3, c[3];\n" + "MUL R3.xy, R3, c[0];\n" "ADD R0.w, R3.x, R3.y;\n" - "MUL R0.w, R0, c[3].z;\n" + "MUL R0.w, R0, c[0].z;\n" "TEX R0, R0.w, texture[1], 1D;\n" "MAD R3.xyz, R0, c[5].z, -R0.w;\n" "MUL R4.xyz, R2, R3;\n" "MAD R4.xyz, -R4, R5, R0.w;\n" "MUL R5.xyz, R6, R3;\n" "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, R1, R0.w, R5;\n" "MUL R4.xyz, R1, R4;\n" - "MUL R5.xyz, R1, c[5].w;\n" - "ADD R6.xyz, R6, -R4;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R3.xyz, R4, R5;\n" + "MAD R5.xyz, R0.w, R1, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R1, c[6].x;\n" + "SGE R3.xyz, R5, R1.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" "MUL R2.xyz, R1, R2;\n" "MUL R4.xyz, R0, c[5].z;\n" "ADD R3.xyz, R3, -R2;\n" "SGE R4.xyz, R4, R0.w;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, R2, R3;\n" + "MAD R2.xyz, R4, R3, R2;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" @@ -4939,19 +4830,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" - "MUL R1.xy, fragment.position, c[4];\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "TEX R1, R1, texture[0], 2D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "ADD R0.xyz, R0, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R0.w, R1.w;\n" @@ -4963,30 +4854,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[5].y, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" + "MAD R2.xyz, -R2, c[5].x, R3;\n" + "ADD R2.w, -R1, c[5].y;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" + "ADD R2.y, -R0.w, c[5];\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -4997,18 +4888,18 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "PARAM c[7] = { program.local[0..6] };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R0.zw, R0, c[3].xyxy;\n" + "MUL R0.zw, R0, c[0].xyxy;\n" "ADD R1.x, R0.z, R0.w;\n" - "ADD R0.xy, fragment.position, c[4];\n" - "MUL R0.xy, R0, c[5];\n" + "ADD R0.xy, fragment.position, c[5];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "DP4 R1.y, R0, c[6];\n" - "MUL R1.x, R1, c[3].z;\n" + "MUL R1.x, R1, c[0].z;\n" "TEX R0, R1, texture[1], 1D;\n" "MUL result.color, R0, R1.y;\n" "END\n" @@ -5018,58 +4909,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[4] = { program.local[0..3] };\n" "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[3].z;\n" + "MUL R0.x, R0, c[0].z;\n" "TEX result.color, R0, texture[0], 1D;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 1 },\n" - " program.local[9..10] };\n" + "PARAM c[11] = { program.local[0..9],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R2.xyz, R1, c[10].y;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[10].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "MUL R0.xyz, R0, c[9].y;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R0.xyz, R1, c[9].z;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.y, -R1.w, c[8].x;\n" - "MUL R0.z, R1.w, R2.w;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.y, R0.w, R0;\n" - "DP3 R2.w, R0, c[9];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" + "RCP R0.z, R1.z;\n" + "MUL R1.xy, R1, R0.z;\n" + "MUL R0.xy, fragment.position, c[7];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[2], 2D;\n" + "MUL R2.xyz, R0, c[4].y;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[4].x;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R3.xy, fragment.position, c[8];\n" + "ADD R2.w, -R0, c[10].x;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.xyz, R0, c[5].z;\n" + "ADD R3.z, -R1.w, c[10].x;\n" + "MAD R2.xyz, R3.z, R1, R2;\n" + "MUL R1.y, R1.w, R2.w;\n" + "MUL R1.x, R1.w, R0.w;\n" + "MUL R1.z, R0.w, R3;\n" + "DP3 R2.w, R1, c[5];\n" + "MUL R3.xy, R3, c[6];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[9];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -5080,29 +4968,28 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" - "RCP R1.x, R0.z;\n" - "MUL R0.xy, R0, R1.x;\n" - "MUL R0.xy, R0, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" - "TEX R0, R0, texture[2], 2D;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" + "RCP R0.z, R1.z;\n" + "MUL R1.xy, R1, R0.z;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R1, R1, texture[2], 2D;\n" "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R2.xyz, R1, R2.x;\n" + "MAD R1.xyz, R1, R0, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -5113,24 +5000,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "ADD R3.xy, fragment.position, c[0];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 2D;\n" - "ADD R2, R0, R1;\n" - "MAD R2, -R0, R1, R2;\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "ADD R3.xy, fragment.position, c[6];\n" + "TEX R1, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "ADD R2, R1, R0;\n" + "MAD R2, -R1, R0, R2;\n" + "MUL R3.xy, R3, c[4];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -5143,15 +5029,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].y;\n" "ADD R3.xyz, R0.w, -R0;\n" @@ -5172,11 +5057,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MAD R2.xyz, R2, R0, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -5189,31 +5074,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 2D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -5225,62 +5109,60 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 2D;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" "MAX R1.x, R0.w, c[8].y;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[8].x;\n" - "MAX R2.xyz, R1, c[8].y;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MAD R2.xyz, -R0, R1.x, c[8].x;\n" + "MAX R2.xyz, R2, c[8].y;\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].x;\n" "MUL R3.xyz, R1, R2.w;\n" "ADD R2.w, -R1, c[8].x;\n" "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MUL R2.w, R0, R1;\n" "MAD R0.xyz, R0, R1.w, R3;\n" "SGE R0.xyz, R0, R2.w;\n" @@ -5293,11 +5175,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MAD R2.xyz, R0, R4, R2;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -5305,24 +5187,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" "MUL R4.xyz, R0.w, R2;\n" @@ -5337,18 +5218,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MUL R4.xyz, R1, R3.w;\n" "MAD R0.xyz, R0, R2.w, R4;\n" "MUL R2.w, R0, R1;\n" - "ADD R3.w, -R0, c[8].x;\n" "MAD R2.xyz, R1, R3.w, R2;\n" "ADD R2.xyz, R2, -R0;\n" "SGE R3.xyz, R3, R2.w;\n" "MAD R2.xyz, R3, R2, R0;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -5362,15 +5242,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" + "MUL R1.xy, fragment.position, c[5];\n" "TEX R1, R1, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].y;\n" "ADD R3.xyz, R0.w, -R0;\n" @@ -5391,11 +5270,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MAD R2.xyz, R0, R2, R3;\n" "ADD R0.z, R0.w, R1.w;\n" "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" + "ADD R0.xy, fragment.position, c[6];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" + "DP4 R0.x, R0, c[7];\n" "MAD result.color, R0.x, R2, R1;\n" "END\n" ; @@ -5403,8 +5282,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5412,59 +5291,56 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.z, R1.w, c[8].y;\n" - "RCP R2.w, R0.z;\n" - "MUL R2.xyz, R1, R2.w;\n" - "MUL R6.xyz, -R2, c[8].w;\n" - "MAD R3.xyz, -R1, R2.w, c[8].x;\n" - "MOV R0.y, -R0;\n" - "TEX R0, R0, texture[2], 2D;\n" - "MAD R4.xyz, R0, c[8].z, -R0.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R3.xyz, -R3, R4, R0.w;\n" - "ADD R6.xyz, R6, c[9].x;\n" - "RSQ R2.x, R2.x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" - "MUL R3.xyz, R1, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "RCP R2.x, R2.x;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.x, R0.w, c[8].y;\n" + "RCP R2.w, R1.x;\n" + "MUL R1.xyz, R0, R2.w;\n" + "RSQ R1.w, R1.x;\n" + "RCP R2.x, R1.w;\n" + "RSQ R1.w, R1.y;\n" + "RSQ R2.z, R1.z;\n" + "MUL R3.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R3;\n" + "ADD R3.xyz, R3, c[3];\n" + "RCP R2.y, R1.w;\n" + "RCP R1.w, R3.z;\n" + "MUL R3.xy, R3, R1.w;\n" "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R1.w, -R1;\n" - "MUL R6.xyz, R2, R4;\n" - "MUL R2.xyz, R1, R5;\n" - "MAD R6.xyz, R1, R0.w, R6;\n" - "MUL R4.xyz, R0, c[8].z;\n" - "MUL R5.xyz, R1, c[8].w;\n" - "ADD R6.xyz, R6, -R2;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R2.xyz, R2, R5;\n" - "SGE R4.xyz, R4, R0.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MAD R6.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, -R1, c[9].x;\n" + "ADD R5.xyz, R2, c[8].w;\n" + "MAD R2.xyz, -R0, R2.w, c[8].x;\n" + "MUL R3.xy, R3, c[0];\n" + "TEX R1, R3, texture[2], 2D;\n" + "MAD R3.xyz, R1, c[8].z, -R1.w;\n" + "MUL R4.xyz, R2, R3;\n" + "MAD R4.xyz, -R4, R5, R1.w;\n" + "MAD R2.xyz, -R2, R3, R1.w;\n" + "MUL R5.xyz, R6, R3;\n" + "MUL R4.xyz, R0, R4;\n" + "MAD R5.xyz, R1.w, R0, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R0, c[9].x;\n" + "SGE R3.xyz, R5, R0.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" + "MUL R2.xyz, R0, R2;\n" + "MUL R4.xyz, R1, c[8].z;\n" + "SGE R4.xyz, R4, R1.w;\n" + "ADD R3.xyz, R3, -R2;\n" + "MAD R2.xyz, R4, R3, R2;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -5476,103 +5352,98 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" - "TEX R0, R0, texture[2], 2D;\n" - "ADD R3.xyz, R0, R1;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R0.xyz, R0, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "MAD R2.xyz, -R0, c[8].x, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 2D;\n" + "ADD R2.xyz, R1, R0;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R1.xyz, R1, R0.w;\n" + "MIN R1.xyz, R1, R3;\n" + "MAD R2.xyz, -R1, c[8].x, R2;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[8].y, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1, R1, texture[2], 2D;\n" + "MUL R2.xyz, R1.w, R0;\n" + "MAD R3.xyz, R1, R0.w, R2;\n" + "MUL R2.xyz, R1, R0;\n" + "MAD R2.xyz, -R2, c[8].x, R3;\n" + "ADD R2.w, -R0, c[8].y;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8].y;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 1 },\n" - " program.local[6..7] };\n" + "PARAM c[8] = { program.local[0..6],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R1.x, R0.z;\n" + "MUL R0.xy, R0, R1.x;\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[7].y;\n" - "MOV R0.y, -R0;\n" + "MUL R2.xyz, R1, c[4].y;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[7].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "MUL R0.xyz, R0, c[6].y;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[5];\n" - "MUL R1.xyz, R1, c[6].z;\n" - "MAD result.color.xyz, R1, R2.x, R0;\n" - "ADD R0.y, -R1.w, c[5].x;\n" + "MUL R3.xyz, R0.w, R2;\n" + "MUL R2.xyz, R0, c[4].x;\n" + "MAD R2.xyz, R1.w, R2, R3;\n" + "ADD R2.w, -R1, c[7].x;\n" + "MUL R0.xyz, R0, c[5].y;\n" + "MAD R0.xyz, R2.w, R0, R2;\n" + "ADD R2.x, -R0.w, c[7];\n" + "MUL R1.xyz, R1, c[5].z;\n" + "MAD result.color.xyz, R2.x, R1, R0;\n" "MUL R0.x, R0.w, R1.w;\n" "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R0;\n" - "DP3 result.color.w, R0, c[6];\n" + "MUL R0.y, R0.w, R2.w;\n" + "DP3 result.color.w, R0, c[5];\n" "END\n" ; @@ -5583,15 +5454,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R1.x, R0.z;\n" "MUL R0.xy, R0, R1.x;\n" - "MUL R0.xy, R0, c[3];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2.x, -R1.w, c[5];\n" "MUL R2.xyz, R0, R2.x;\n" @@ -5609,15 +5479,14 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "ADD R2, R0, R1;\n" "MAD result.color, -R0, R1, R2;\n" @@ -5632,13 +5501,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" @@ -5672,18 +5540,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" @@ -5702,18 +5569,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "MAX R2.xyz, R2, R3;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" @@ -5727,41 +5593,40 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "MAX R1.x, R0.w, c[5].y;\n" "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[5].x;\n" - "MAX R2.xyz, R1, c[5].y;\n" + "MAD R3.xyz, -R0, R1.x, c[5].x;\n" + "MAX R3.xyz, R3, c[5].y;\n" "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MUL R3.xyz, R1, R2.w;\n" + "ADD R2.x, -R0.w, c[5];\n" + "MUL R2.xyz, R1, R2.x;\n" "ADD R2.w, -R1, c[5].x;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.xyz, R1, R0.w;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" + "MUL R1.xyz, R0.w, R1;\n" "MAD R0.xyz, R0, R1.w, R1;\n" "MUL R2.w, R0, R1;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R1, R2, R3;\n" - "MAD R3.xyz, R0.w, R1.w, R3;\n" + "RCP R3.x, R3.x;\n" + "RCP R3.y, R3.y;\n" + "RCP R3.z, R3.z;\n" + "MAD R3.xyz, R1, R3, R2;\n" + "MAD R2.xyz, R0.w, R1.w, R2;\n" "ADD R1.x, R0.w, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" + "ADD R2.xyz, R2, -R3;\n" "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R3, R2;\n" + "MAD result.color.xyz, R0, R2, R3;\n" "MAD result.color.w, -R0, R1, R1.x;\n" "END\n" ; @@ -5769,24 +5634,23 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R2.xyz, -R0.w, R1.w, R3;\n" @@ -5799,9 +5663,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "RCP R2.z, R2.z;\n" "MAD R2.xyz, R4, R2, R5;\n" "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "ADD R3.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R3.w, R2;\n" + "MAD R0.xyz, R0, R2.w, R4;\n" "MUL R2.x, R0.w, R1.w;\n" "ADD R2.w, R0, R1;\n" "ADD R1.xyz, R1, -R0;\n" @@ -5820,13 +5683,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" "MUL R1.xy, fragment.position, c[4];\n" "TEX R1, R1, texture[0], 2D;\n" @@ -5836,27 +5698,27 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "MUL R2.xyz, R2, R3;\n" "MUL R2.xyz, R2, c[5].x;\n" "MAD R2.xyz, R0.w, R1.w, -R2;\n" + "MAD R2.xyz, R0, R2.w, R2;\n" "MUL R4.xyz, R0, R2.w;\n" "MUL R3.xyz, R0, R1;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[5].y;\n" "MUL R0.xyz, R0, c[5].x;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" + "ADD R2.w, -R0, c[5].y;\n" "MAD R3.xyz, R3, c[5].x, R4;\n" - "MAD R1.xyz, R1, R2.w, R3;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R1;\n" + "MAD R3.xyz, R1, R2.w, R3;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, R0.w, R1.w;\n" + "ADD R1.xyz, R1, -R3;\n" "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R2, R1;\n" - "MAD result.color.w, -R0, R1, R2;\n" + "MAD result.color.xyz, R0, R1, R3;\n" + "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5864,47 +5726,44 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.z, R1.w, c[5].y;\n" - "RCP R2.w, R0.z;\n" - "MUL R2.xyz, R1, R2.w;\n" - "MUL R6.xyz, -R2, c[5].w;\n" - "MAD R3.xyz, -R1, R2.w, c[5].x;\n" - "MOV R0.y, -R0;\n" - "TEX R0, R0, texture[1], 2D;\n" - "MAD R4.xyz, R0, c[5].z, -R0.w;\n" - "MUL R5.xyz, R3, R4;\n" - "MAD R3.xyz, -R3, R4, R0.w;\n" - "ADD R6.xyz, R6, c[6].x;\n" - "RSQ R2.x, R2.x;\n" - "RSQ R2.z, R2.z;\n" - "RSQ R2.y, R2.y;\n" - "MAD R5.xyz, -R5, R6, R0.w;\n" - "MUL R3.xyz, R1, R3;\n" - "RCP R2.x, R2.x;\n" + "MUL R0.xy, fragment.position, c[4];\n" + "TEX R1, R0, texture[0], 2D;\n" + "MAX R0.x, R1.w, c[5].y;\n" + "RCP R2.w, R0.x;\n" + "MUL R0.xyz, R1, R2.w;\n" + "RSQ R0.w, R0.x;\n" + "RCP R2.x, R0.w;\n" + "RSQ R0.w, R0.y;\n" + "RSQ R2.z, R0.z;\n" + "MUL R3.xyz, fragment.position.y, c[2];\n" + "MAD R3.xyz, fragment.position.x, c[1], R3;\n" + "ADD R3.xyz, R3, c[3];\n" + "RCP R2.y, R0.w;\n" + "RCP R0.w, R3.z;\n" + "MUL R3.xy, R3, R0.w;\n" "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R1.w, -R1;\n" - "MUL R6.xyz, R2, R4;\n" - "MUL R2.xyz, R1, R5;\n" + "MAD R6.xyz, R1.w, R2, -R1;\n" + "MUL R2.xyz, -R0, c[6].x;\n" + "ADD R5.xyz, R2, c[5].w;\n" + "MAD R2.xyz, -R1, R2.w, c[5].x;\n" + "MUL R3.xy, R3, c[0];\n" + "TEX R0, R3, texture[1], 2D;\n" + "MAD R3.xyz, R0, c[5].z, -R0.w;\n" + "MUL R4.xyz, R2, R3;\n" + "MAD R4.xyz, -R4, R5, R0.w;\n" + "MUL R5.xyz, R6, R3;\n" + "MAD R2.xyz, -R2, R3, R0.w;\n" + "MUL R4.xyz, R1, R4;\n" + "MAD R5.xyz, R0.w, R1, R5;\n" + "ADD R6.xyz, R5, -R4;\n" + "MUL R5.xyz, R1, c[6].x;\n" + "SGE R3.xyz, R5, R1.w;\n" + "MAD R3.xyz, R3, R6, R4;\n" + "MUL R2.xyz, R1, R2;\n" "MUL R4.xyz, R0, c[5].z;\n" - "MAD R6.xyz, R1, R0.w, R6;\n" - "MUL R5.xyz, R1, c[5].w;\n" - "ADD R6.xyz, R6, -R2;\n" - "SGE R5.xyz, R5, R1.w;\n" - "MUL R5.xyz, R5, R6;\n" - "ADD R2.xyz, R2, R5;\n" - "ADD R2.xyz, R2, -R3;\n" + "ADD R3.xyz, R3, -R2;\n" "SGE R4.xyz, R4, R0.w;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" + "MAD R2.xyz, R4, R3, R2;\n" "ADD R2.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" @@ -5922,18 +5781,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[4];\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "TEX R1, R1, texture[0], 2D;\n" "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R1, R0.w;\n" + "MUL R3.xyz, R0.w, R1;\n" "ADD R0.xyz, R0, R1;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R0.w, R1.w;\n" @@ -5945,29 +5803,28 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" + "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R1, R0.w;\n" + "MUL R2.xyz, R0.w, R1;\n" "MAD R3.xyz, R0, R1.w, R2;\n" "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[5].y, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" + "MAD R2.xyz, -R2, c[5].x, R3;\n" + "ADD R2.w, -R1, c[5].y;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" + "ADD R2.y, -R0.w, c[5];\n" "MAD result.color.xyz, R1, R2.y, R0;\n" "MAD result.color.w, -R0, R1, R2.x;\n" "END\n" @@ -5978,19 +5835,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "PARAM c[7] = { program.local[0..6] };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R1.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R0.z, R1.z;\n" "MUL R1.xy, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[4];\n" - "MUL R0.xy, R0, c[5];\n" + "ADD R0.xy, fragment.position, c[5];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "DP4 R1.z, R0, c[6];\n" - "MUL R1.xy, R1, c[3];\n" - "MOV R0.x, R1;\n" - "MOV R0.y, -R1;\n" - "TEX R0, R0, texture[1], 2D;\n" + "MUL R1.xy, R1, c[0];\n" + "TEX R0, R1, texture[1], 2D;\n" "MUL result.color, R0, R1.z;\n" "END\n" ; @@ -5999,58 +5854,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "!!ARBfp1.0\n" "PARAM c[4] = { program.local[0..3] };\n" "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" + "MUL R0.xy, R0, c[0];\n" "TEX result.color, R0, texture[0], 2D;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 1 },\n" - " program.local[9..10] };\n" + "PARAM c[11] = { program.local[0..9],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "MUL R2.xyz, R1, c[10].y;\n" - "MUL R3.xyz, R2, R0.w;\n" - "MUL R2.xyz, R0, c[10].x;\n" - "MAD R2.xyz, R2, R1.w, R3;\n" - "ADD R3.xy, fragment.position, c[0];\n" - "MUL R0.xyz, R0, c[9].y;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R0.xyz, R1, c[9].z;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.y, -R1.w, c[8].x;\n" - "MUL R0.z, R1.w, R2.w;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.y, R0.w, R0;\n" - "DP3 R2.w, R0, c[9];\n" - "MUL R3.xy, R3, c[1];\n" - "TEX R0, R3, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MOV R1.y, -R1;\n" + "MUL R0.xy, fragment.position, c[7];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1.x, R1, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MUL R2.xyz, R0, c[4].y;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[4].x;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R3.xy, fragment.position, c[8];\n" + "ADD R2.w, -R0, c[10].x;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "MAD R2.xyz, R2.w, R1, R2;\n" + "MUL R1.xyz, R0, c[5].z;\n" + "ADD R3.z, -R1.w, c[10].x;\n" + "MAD R2.xyz, R3.z, R1, R2;\n" + "MUL R1.y, R1.w, R2.w;\n" + "MUL R1.x, R1.w, R0.w;\n" + "MUL R1.z, R0.w, R3;\n" + "DP3 R2.w, R1, c[5];\n" + "MUL R3.xy, R3, c[6];\n" + "TEX R1, R3, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[9];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6061,30 +5913,30 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.y, -R0;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MOV R1.y, -R1;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "TEX R1.x, R1, texture[2], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R2.xyz, R1, R2.x;\n" + "MAD R1.xyz, R1, R0, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6095,24 +5947,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "ADD R3.xy, fragment.position, c[0];\n" + "MUL R0.xy, fragment.position, c[5];\n" + "ADD R3.xy, fragment.position, c[6];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2, R1, R0;\n" "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[1];\n" + "MUL R3.xy, R3, c[4];\n" "TEX R1, R3, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6126,16 +5978,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].y;\n" "ADD R3.xyz, R1.w, -R1;\n" @@ -6156,11 +6008,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R2.xyz, R2, R1, R3;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6173,32 +6025,33 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6210,50 +6063,51 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R2.xyz, R1, R0.w;\n" "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "ADD R2.w, -R0, c[8].x;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R0.x;\n" @@ -6261,13 +6115,13 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.x, R0.x;\n" "MAD R0.xyz, -R1, R0.x, c[8].x;\n" "MAX R2.xyz, R0, c[8].y;\n" - "MUL R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R2.w, -R1, c[8].x;\n" "MUL R3.xyz, R0, R2.w;\n" "ADD R2.w, -R0, c[8].x;\n" "MAD R4.xyz, R1, R2.w, R3;\n" - "MUL R3.xyz, R0, R1.w;\n" + "MUL R3.xyz, R1.w, R0;\n" "MUL R2.w, R1, R0;\n" "MAD R1.xyz, R1, R0.w, R3;\n" "SGE R1.xyz, R1, R2.w;\n" @@ -6280,11 +6134,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R2.xyz, R1, R4, R2;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6292,25 +6146,26 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MAD R2.xyz, -R1.w, R0.w, R3;\n" "MUL R4.xyz, R1.w, R2;\n" @@ -6325,18 +6180,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R4.xyz, R0, R3.w;\n" "MAD R1.xyz, R1, R2.w, R4;\n" "MUL R2.w, R1, R0;\n" - "ADD R3.w, -R1, c[8].x;\n" "MAD R2.xyz, R0, R3.w, R2;\n" "ADD R2.xyz, R2, -R1;\n" "SGE R3.xyz, R3, R2.w;\n" "MAD R2.xyz, R3, R2, R1;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6350,16 +6204,16 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "ADD R2.w, -R0, c[8].y;\n" "ADD R3.xyz, R1.w, -R1;\n" @@ -6380,11 +6234,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R2.xyz, R1, R2, R3;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6392,68 +6246,66 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R1.xyz, R0, c[5];\n" + "TEMP R6;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R0.z, R1.z;\n" "MUL R1.xy, R1, R0.z;\n" - "MUL R1.xy, R1, c[6];\n" + "MUL R1.xy, R1, c[0];\n" "MOV R1.y, -R1;\n" - "MUL R0.xy, fragment.position, c[7];\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.z, R0.w, c[8].y;\n" "RCP R2.w, R1.z;\n" "MUL R2.xyz, R0, R2.w;\n" - "MUL R5.xyz, -R2, c[8].w;\n" - "MAD R4.xyz, -R0, R2.w, c[8].x;\n" + "MUL R6.xyz, -R2, c[9].x;\n" + "MAD R3.xyz, -R0, R2.w, c[8].x;\n" "TEX R1.x, R1, texture[2], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R3.xyz, R1, c[8].z, -R1.w;\n" + "MAD R4.xyz, R1, c[8].z, -R1.w;\n" + "MUL R5.xyz, R3, R4;\n" + "MAD R3.xyz, -R3, R4, R1.w;\n" + "ADD R6.xyz, R6, c[8].w;\n" + "MAD R5.xyz, -R5, R6, R1.w;\n" "RSQ R2.x, R2.x;\n" "RSQ R2.z, R2.z;\n" "RSQ R2.y, R2.y;\n" - "MUL R4.xyz, R4, R3;\n" - "ADD R5.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R4, R5;\n" - "ADD R4.xyz, R1.w, -R4;\n" + "MUL R5.xyz, R0, R5;\n" + "MUL R3.xyz, R0, R3;\n" "ADD R2.w, -R0, c[8].x;\n" "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R0.w, -R0;\n" - "MUL R3.xyz, R2, R3;\n" - "ADD R2.xyz, R1.w, -R5;\n" - "MAD R5.xyz, R0, R1.w, R3;\n" - "MUL R2.xyz, R0, R2;\n" - "MUL R3.xyz, R0, c[8].w;\n" - "ADD R5.xyz, R5, -R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R3.xyz, R3, R5;\n" - "ADD R2.xyz, R2, R3;\n" - "MUL R3.xyz, R0, R4;\n" + "MAD R2.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R1.w, R0, R2;\n" + "ADD R6.xyz, R2, -R5;\n" "MUL R4.xyz, R1, c[8].z;\n" + "MUL R2.xyz, R0, c[9].x;\n" + "SGE R2.xyz, R2, R0.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" "SGE R4.xyz, R4, R1.w;\n" "ADD R2.xyz, R2, -R3;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" + "MAD R2.xyz, R4, R2, R3;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, -R1.w, c[8];\n" "MAD R2.xyz, R0, R2.x, R1;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[0];\n" - "MUL R1.xy, R1, c[1];\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" "TEX R1, R1, texture[1], 2D;\n" "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[2];\n" + "DP4 R1.x, R1, c[7];\n" "MAD result.color, R1.x, R2, R0;\n" "END\n" ; @@ -6466,107 +6318,106 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "ADD R3.xyz, R0, R1;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R0.xyz, R0, R1.w;\n" - "MIN R0.xyz, R0, R2;\n" - "MAD R2.xyz, -R0, c[8].x, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "ADD R2.xyz, R1, R0;\n" + "MUL R3.xyz, R1.w, R0;\n" + "MUL R1.xyz, R1, R0.w;\n" + "MIN R1.xyz, R1, R3;\n" + "MAD R2.xyz, -R1, c[8].x, R2;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[4];\n" - "MAD R0.xyz, fragment.position.x, c[3], R0;\n" - "ADD R0.xyz, R0, c[5];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[6];\n" - "MOV R0.y, -R0;\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[7];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0, fragment.color.primary, R0.x;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[8].y, R3;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R2.x, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[0];\n" - "MUL R0.xy, R0, c[1];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[2];\n" - "MAD result.color, R0.x, R2, R1;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MUL R2.xyz, R1.w, R0;\n" + "MAD R3.xyz, R1, R0.w, R2;\n" + "MUL R2.xyz, R1, R0;\n" + "MAD R2.xyz, -R2, c[8].x, R3;\n" + "ADD R2.w, -R0, c[8].y;\n" + "MAD R1.xyz, R1, R2.w, R2;\n" + "ADD R2.x, -R1.w, c[8].y;\n" + "MAD R2.xyz, R0, R2.x, R1;\n" + "ADD R1.z, R1.w, R0.w;\n" + "MAD R2.w, -R1, R0, R1.z;\n" + "ADD R1.xy, fragment.position, c[6];\n" + "MUL R1.xy, R1, c[4];\n" + "TEX R1, R1, texture[1], 2D;\n" + "ADD R2, R2, -R0;\n" + "DP4 R1.x, R1, c[7];\n" + "MAD result.color, R1.x, R2, R0;\n" "END\n" ; static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 1 },\n" - " program.local[6..7] };\n" + "PARAM c[8] = { program.local[0..6],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.w, -R0.y;\n" - "MOV R0.z, R0.x;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R1.xy, R0.zwzw, c[0];\n" + "MOV R1.y, -R1;\n" + "MUL R0.xy, fragment.position, c[6];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, c[7].y;\n" + "MUL R2.xyz, R0, c[4].y;\n" + "TEX R1.x, R1, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R3.xyz, R2, R1.w;\n" - "MUL R2.xyz, R1, c[7].x;\n" - "MUL R0.xyz, R0, c[6].z;\n" - "MAD R2.xyz, R2, R0.w, R3;\n" - "MUL R1.xyz, R1, c[6].y;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[5];\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "ADD R0.y, -R0.w, c[5].x;\n" + "MUL R3.xyz, R1.w, R2;\n" + "MUL R2.xyz, R1, c[4].x;\n" + "MUL R0.xyz, R0, c[5].z;\n" + "MAD R2.xyz, R0.w, R2, R3;\n" + "ADD R2.w, -R0, c[7].x;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "MAD R1.xyz, R2.w, R1, R2;\n" + "ADD R2.x, -R1.w, c[7];\n" + "MAD result.color.xyz, R2.x, R0, R1;\n" "MUL R0.x, R1.w, R0.w;\n" "MUL R0.z, R0.w, R2.x;\n" - "MUL R0.y, R1.w, R0;\n" - "DP3 result.color.w, R0, c[6];\n" + "MUL R0.y, R1.w, R2.w;\n" + "DP3 result.color.w, R0, c[5];\n" "END\n" ; @@ -6577,12 +6428,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[3];\n" + "MUL R1.xy, R0.zwzw, c[0];\n" "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" @@ -6604,12 +6455,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.w, -R0.y;\n" "MOV R0.z, R0.x;\n" "TEX R1.x, R0.zwzw, texture[1], 2D;\n" @@ -6629,12 +6480,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6670,19 +6521,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1, R0.w;\n" - "MUL R3.xyz, R0, R1.w;\n" + "MUL R3.xyz, R1.w, R0;\n" "MIN R2.xyz, R2, R3;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" @@ -6701,19 +6553,20 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1, R0.w;\n" - "MUL R3.xyz, R0, R1.w;\n" + "MUL R3.xyz, R1.w, R0;\n" "MAX R2.xyz, R2, R3;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" @@ -6727,17 +6580,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-06 } };\n" + " { 1, 1e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R0.x;\n" @@ -6751,7 +6604,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R3.xyz, R0, R2.w;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R3.xyz, R1, R2.w, R3;\n" - "MUL R0.xyz, R0, R1.w;\n" + "MUL R0.xyz, R1.w, R0;\n" "RCP R2.x, R2.x;\n" "RCP R2.y, R2.y;\n" "RCP R2.z, R2.z;\n" @@ -6770,25 +6623,26 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-06 } };\n" + " { 1, 9.9999997e-006 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R2.xyz, -R1.w, R0.w, R3;\n" @@ -6801,9 +6655,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R2.z, R2.z;\n" "MAD R2.xyz, R4, R2, R5;\n" "MUL R4.xyz, R0, R3.w;\n" - "MAD R1.xyz, R1, R2.w, R4;\n" - "ADD R3.w, -R1, c[5].x;\n" "MAD R0.xyz, R0, R3.w, R2;\n" + "MAD R1.xyz, R1, R2.w, R4;\n" "MUL R2.x, R1.w, R0.w;\n" "ADD R2.w, R1, R0;\n" "ADD R0.xyz, R0, -R1;\n" @@ -6822,12 +6675,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R1.x, R0, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6858,57 +6711,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 9.9999997e-06, 2, 8 },\n" - " { 3 } };\n" + " { 1, 9.9999997e-006, 2, 3 },\n" + " { 8 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" "TEMP R4;\n" "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R1.xyz, R0, c[2];\n" + "TEMP R6;\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R0.z, R1.z;\n" "MUL R1.xy, R1, R0.z;\n" - "MUL R1.xy, R1, c[3];\n" + "MUL R1.xy, R1, c[0];\n" "MOV R1.y, -R1;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.z, R0.w, c[5].y;\n" "RCP R2.w, R1.z;\n" "MUL R2.xyz, R0, R2.w;\n" - "MUL R5.xyz, -R2, c[5].w;\n" - "MAD R4.xyz, -R0, R2.w, c[5].x;\n" + "MUL R6.xyz, -R2, c[6].x;\n" + "MAD R3.xyz, -R0, R2.w, c[5].x;\n" "TEX R1.x, R1, texture[1], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R3.xyz, R1, c[5].z, -R1.w;\n" + "MAD R4.xyz, R1, c[5].z, -R1.w;\n" + "MUL R5.xyz, R3, R4;\n" + "MAD R3.xyz, -R3, R4, R1.w;\n" + "ADD R6.xyz, R6, c[5].w;\n" + "MAD R5.xyz, -R5, R6, R1.w;\n" "RSQ R2.x, R2.x;\n" "RSQ R2.z, R2.z;\n" "RSQ R2.y, R2.y;\n" - "MUL R4.xyz, R4, R3;\n" - "ADD R5.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R4, R5;\n" - "ADD R4.xyz, R1.w, -R4;\n" + "MUL R5.xyz, R0, R5;\n" + "MUL R3.xyz, R0, R3;\n" "RCP R2.x, R2.x;\n" "RCP R2.z, R2.z;\n" "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R2, R0.w, -R0;\n" - "MUL R3.xyz, R2, R3;\n" - "ADD R2.xyz, R1.w, -R5;\n" - "MAD R5.xyz, R0, R1.w, R3;\n" - "MUL R2.xyz, R0, R2;\n" - "MUL R3.xyz, R0, c[5].w;\n" - "ADD R5.xyz, R5, -R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R3.xyz, R3, R5;\n" - "ADD R2.xyz, R2, R3;\n" - "MUL R3.xyz, R0, R4;\n" + "MAD R2.xyz, R0.w, R2, -R0;\n" + "MUL R2.xyz, R2, R4;\n" + "MAD R2.xyz, R1.w, R0, R2;\n" + "ADD R6.xyz, R2, -R5;\n" "MUL R4.xyz, R1, c[5].z;\n" + "MUL R2.xyz, R0, c[6].x;\n" + "SGE R2.xyz, R2, R0.w;\n" + "MAD R2.xyz, R2, R6, R5;\n" "ADD R2.xyz, R2, -R3;\n" "SGE R4.xyz, R4, R1.w;\n" - "MUL R2.xyz, R4, R2;\n" - "ADD R2.xyz, R3, R2;\n" + "MAD R2.xyz, R4, R2, R3;\n" "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" @@ -6926,18 +6777,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" - "MUL R1, fragment.color.primary, R1.x;\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R3.xyz, R0, R1.w;\n" + "MUL R1, fragment.color.primary, R1.x;\n" + "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" "ADD R0.xyz, R1, R0;\n" "MIN R2.xyz, R2, R3;\n" @@ -6950,30 +6802,31 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" + " { 2, 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" - "MOV R0.y, -R0;\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "MOV R0.w, -R0.y;\n" + "MOV R0.z, R0.x;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R0, R1.w;\n" + "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[5].y, R3;\n" - "ADD R2.w, -R0, c[5].x;\n" + "MAD R2.xyz, -R2, c[5].x, R3;\n" + "ADD R2.w, -R0, c[5].y;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" + "ADD R2.y, -R1.w, c[5];\n" "MAD result.color.xyz, R0, R2.y, R1;\n" "MAD result.color.w, -R1, R0, R2.x;\n" "END\n" @@ -6984,15 +6837,15 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "PARAM c[7] = { program.local[0..6] };\n" "TEMP R0;\n" "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R1.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R0.z, R1.z;\n" "MUL R0.zw, R1.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[3];\n" + "MUL R1.xy, R0.zwzw, c[0];\n" "MOV R1.y, -R1;\n" - "ADD R0.xy, fragment.position, c[4];\n" - "MUL R0.xy, R0, c[5];\n" + "ADD R0.xy, fragment.position, c[5];\n" + "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" "TEX R1.x, R1, texture[1], 2D;\n" "DP4 R0.x, R0, c[6];\n" @@ -7005,12 +6858,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "!!ARBfp1.0\n" "PARAM c[4] = { program.local[0..3] };\n" "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[1];\n" - "MAD R0.xyz, fragment.position.x, c[0], R0;\n" - "ADD R0.xyz, R0, c[2];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[3];\n" + "MUL R0.xy, R0, c[0];\n" "MOV R0.y, -R0;\n" "TEX R0.x, R0, texture[0], 2D;\n" "MUL result.color, fragment.color.primary, R0.x;\n" @@ -7195,19 +7048,19 @@ static const char *painter_fragment_program_sources[num_fragment_brushes][num_fr static int painter_variable_locations[num_fragment_brushes][num_fragment_composition_modes][num_fragment_variables] = { { - { -1, -1, -1, 1, -1, 6, 2, -1, 5, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, 3, 1, 0, -1, 0, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, 3, -1, -1, 2, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 2, -1, 0, 5, -1, 1, 3, 1, 0, -1, 4, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, + { -1, -1, -1, -1, -1, 0, -1, -1, 1, 2, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, @@ -7219,154 +7072,154 @@ static int painter_variable_locations[num_fragment_brushes][num_fragment_composi { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 1, -1, -1, 2, -1, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, }, + { -1, -1, -1, 0, -1, -1, 2, -1, -1, -1, 0, -1, -1, 1, -1, -1, -1, -1, -1, }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, }, { - { -1, -1, 4, 1, 5, 11, 2, -1, 10, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 9, 1, 0, 2, 0, -1, 8, 6, 3, -1, }, - { -1, -1, 1, -1, 2, 8, -1, -1, 7, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 6, -1, 0, 1, -1, -1, 5, 3, 0, -1, }, - { -1, -1, 1, 7, 2, -1, 8, -1, -1, -1, 0, -1, 1, 6, -1, 5, 3, 0, -1, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 5, 3, 0, -1, }, + { -1, -1, 3, 7, 4, 5, 10, -1, 6, 8, 1, 0, 2, 9, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, + { -1, -1, 3, 5, 4, -1, 7, -1, -1, -1, 0, -1, 1, 6, -1, 1, 0, 2, -1, }, + { -1, -1, 3, -1, 4, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, 0, 2, -1, }, }, { - { -1, -1, 4, 1, 5, 12, 2, -1, 11, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 4, 1, 5, -1, 2, -1, -1, 10, 1, 0, 2, 0, -1, -1, -1, 3, 8, }, - { -1, -1, 1, -1, 2, 9, -1, -1, 8, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, 7, -1, 0, 1, -1, -1, -1, -1, 0, 5, }, - { -1, -1, 1, 8, 2, -1, 9, -1, -1, -1, 0, -1, 1, 7, -1, -1, -1, 0, 5, }, - { -1, -1, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, 5, }, + { -1, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, 2, 8, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, + { -1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, 1, 5, -1, -1, -1, 1, 0, }, + { -1, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 1, 0, }, }, { - { -1, 6, 4, 1, 5, 10, 2, -1, 9, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 6, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, 2, 0, -1, -1, -1, 3, -1, }, - { -1, 3, 1, -1, 2, 7, -1, -1, 6, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 0, -1, }, - { -1, 3, 1, 5, 2, -1, 6, -1, -1, -1, 0, -1, 1, 4, -1, -1, -1, 0, -1, }, - { -1, 3, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, }, + { -1, 0, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, 2, 8, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, + { -1, 0, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, 1, 5, -1, -1, -1, 1, -1, }, + { -1, 0, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 1, -1, }, }, { - { 2, -1, 4, 1, 5, 10, 2, -1, 9, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 1, -1, 1, -1, 2, 7, -1, -1, 6, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, 5, 2, -1, 6, -1, -1, -1, 0, -1, -1, 4, 3, -1, -1, 0, -1, }, - { 0, -1, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, -1, }, + { 2, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, -1, 8, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, -1, 5, 0, -1, -1, 1, -1, }, + { 0, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, }, }, { - { 2, -1, 4, 1, 5, 10, 2, -1, 9, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 2, -1, 4, 1, 5, -1, 2, -1, -1, 7, 1, 0, -1, 0, 6, -1, -1, 3, -1, }, - { 1, -1, 1, -1, 2, 7, -1, -1, 6, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, -1, 2, -1, -1, -1, -1, 4, -1, 0, -1, -1, 3, -1, -1, 0, -1, }, - { 1, -1, 1, 5, 2, -1, 6, -1, -1, -1, 0, -1, -1, 4, 3, -1, -1, 0, -1, }, - { 0, -1, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, -1, }, + { 2, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, -1, 8, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, + { 1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, -1, 5, 0, -1, -1, 1, -1, }, + { 0, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, }, }, }; static int mask_variable_locations[num_fragment_masks][num_fragment_variables] = { { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, 2, -1, 3, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, }, + { -1, -1, 1, -1, 2, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, }, }; #endif diff --git a/src/opengl/util/generator.pro b/src/opengl/util/generator.pro index 9425dbe..ac71934 100644 --- a/src/opengl/util/generator.pro +++ b/src/opengl/util/generator.pro @@ -9,3 +9,5 @@ INCLUDEPATH += . # Input SOURCES += generator.cpp + +CONFIG += console diff --git a/src/opengl/util/texture_brush.glsl b/src/opengl/util/texture_brush.glsl index 93865b8..9498255 100644 --- a/src/opengl/util/texture_brush.glsl +++ b/src/opengl/util/texture_brush.glsl @@ -17,7 +17,5 @@ vec4 brush() coords *= inv_brush_texture_size; - coords.y = -coords.y; - return texture2D(brush_texture, coords); } diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index b0e190f..09eb646 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1091,6 +1091,7 @@ VGPaintType QVGPaintEnginePrivate::setBrush // The brush is a texture specified by a QPixmap/QImage. QPixmapData *pd = brush.texture().pixmapData(); VGImage vgImg; + bool deref = false; if (pd->pixelType() == QPixmapData::BitmapType) { // Colorize bitmaps using the brush color and opacity. QColor color = brush.color(); @@ -1098,15 +1099,21 @@ VGPaintType QVGPaintEnginePrivate::setBrush color.setAlphaF(color.alphaF() * opacity); QImage image = colorizeBitmap(*(pd->buffer()), color); vgImg = toVGImage(image); + deref = true; } else if (opacity == 1.0) { if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); vgImg = vgpd->toVGImage(); } else { vgImg = toVGImage(*(pd->buffer())); + deref = true; } + } else if (pd->classId() == QPixmapData::OpenVGClass) { + QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); + vgImg = vgpd->toVGImage(opacity); } else { vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity); + deref = true; } if (vgImg == VG_INVALID_HANDLE) break; @@ -1114,7 +1121,8 @@ VGPaintType QVGPaintEnginePrivate::setBrush vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN); vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT); vgPaintPattern(paint, vgImg); - vgDestroyImage(vgImg); // Will stay valid until pattern is destroyed. + if (deref) + vgDestroyImage(vgImg); // Will be valid until pattern is destroyed. return VG_PAINT_TYPE_PATTERN; } @@ -3064,43 +3072,42 @@ void QVGPaintEngine::setState(QPainterState *s) } } -// Called from QPaintEngine::syncState() to force a state flush. -// This should be called before and after raw VG operations. -void QVGPaintEngine::updateState(const QPaintEngineState &state) +void QVGPaintEngine::beginNativePainting() { - Q_UNUSED(state); Q_D(QVGPaintEngine); - if (!(d->rawVG)) { - // About to enter raw VG mode: flush pending changes and make - // sure that all matrices are set to the current transformation. - QVGPainterState *s = this->state(); - d->ensurePen(s->pen); - d->ensureBrush(s->brush); - d->ensurePathTransform(); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, d->imageTransform); + // About to enter raw VG mode: flush pending changes and make + // sure that all matrices are set to the current transformation. + QVGPainterState *s = this->state(); + d->ensurePen(s->pen); + d->ensureBrush(s->brush); + d->ensurePathTransform(); + d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, d->imageTransform); #if !defined(QVG_NO_DRAW_GLYPHS) - d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform); + d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform); #endif - d->rawVG = true; - } else { - // Exiting raw VG mode: force all state values to be - // explicitly set on the VG engine to undo any changes - // that were made by the raw VG function calls. - QPaintEngine::DirtyFlags dirty = d->dirty; - d->clearModes(); - d->forcePenChange = true; - d->forceBrushChange = true; - d->penType = (VGPaintType)0; - d->brushType = (VGPaintType)0; - d->clearColor = QColor(); - d->fillPaint = d->brushPaint; - restoreState(QPaintEngine::AllDirty); - d->dirty = dirty; - d->rawVG = false; - vgSetPaint(d->penPaint, VG_STROKE_PATH); - vgSetPaint(d->brushPaint, VG_FILL_PATH); - } + d->rawVG = true; +} + +void QVGPaintEngine::endNativePainting() +{ + Q_D(QVGPaintEngine); + // Exiting raw VG mode: force all state values to be + // explicitly set on the VG engine to undo any changes + // that were made by the raw VG function calls. + QPaintEngine::DirtyFlags dirty = d->dirty; + d->clearModes(); + d->forcePenChange = true; + d->forceBrushChange = true; + d->penType = (VGPaintType)0; + d->brushType = (VGPaintType)0; + d->clearColor = QColor(); + d->fillPaint = d->brushPaint; + restoreState(QPaintEngine::AllDirty); + d->dirty = dirty; + d->rawVG = false; + vgSetPaint(d->penPaint, VG_STROKE_PATH); + vgSetPaint(d->brushPaint, VG_FILL_PATH); } QPixmapFilter *QVGPaintEngine::createPixmapFilter(int type) const @@ -3112,6 +3119,8 @@ QPixmapFilter *QVGPaintEngine::createPixmapFilter(int type) const return new QVGPixmapColorizeFilter; else if (type == QPixmapFilter::DropShadowFilter) return new QVGPixmapDropShadowFilter; + else if (type == QPixmapFilter::BlurFilter) + return new QVGPixmapBlurFilter; else #endif return QPaintEngineEx::createPixmapFilter(type); diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 469ec9e..f0a7838 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -140,7 +140,8 @@ public: QVGPainterState *state() { return static_cast<QVGPainterState *>(QPaintEngineEx::state()); } const QVGPainterState *state() const { return static_cast<const QVGPainterState *>(QPaintEngineEx::state()); } - void updateState(const QPaintEngineState &state); + void beginNativePainting(); + void endNativePainting(); QPixmapFilter *createPixmapFilter(int type) const; diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 2dbdf7e..5a263a5 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -335,6 +335,65 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con vgDestroyImage(dstImage); } +QVGPixmapBlurFilter::QVGPixmapBlurFilter(QObject *parent) + : QPixmapBlurFilter(parent) +{ +} + +QVGPixmapBlurFilter::~QVGPixmapBlurFilter() +{ +} + +void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const +{ + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { + // The pixmap data is not an instance of QVGPixmapData, so fall + // back to the default blur filter implementation. + QPixmapBlurFilter::draw(painter, dest, src, srcRect); + return; + } + + QVGPixmapData *pd = static_cast<QVGPixmapData *>(src.pixmapData()); + + VGImage srcImage = pd->toVGImage(); + if (srcImage == VG_INVALID_HANDLE) + return; + + QSize size = pd->size(); + VGImage dstImage = vgCreateImage + (VG_sARGB_8888_PRE, size.width(), size.height(), + VG_IMAGE_QUALITY_FASTER); + if (dstImage == VG_INVALID_HANDLE) + return; + + // Clamp the radius range. We divide by 2 because the OpenVG blur + // is "too blurry" compared to the default raster implementation. + VGfloat maxRadius = VGfloat(vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION)); + VGfloat radiusF = VGfloat(radius()) / 2.0f; + if (radiusF < 0.001f) + radiusF = 0.001f; + else if (radiusF > maxRadius) + radiusF = maxRadius; + + vgGaussianBlur(dstImage, srcImage, radiusF, radiusF, VG_TILE_PAD); + + VGImage child = VG_INVALID_HANDLE; + + if (srcRect.isNull() || + (srcRect.topLeft().isNull() && srcRect.size() == size)) { + child = dstImage; + } else { + QRect src = srcRect.toRect(); + child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height()); + } + + qt_vg_drawVGImage(painter, dest, child); + + if(child != dstImage) + vgDestroyImage(child); + vgDestroyImage(dstImage); +} + #endif QT_END_NAMESPACE diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index 6a3cc5f..3dc0e8f 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE class Q_OPENVG_EXPORT QVGPixmapConvolutionFilter : public QPixmapConvolutionFilter { + Q_OBJECT public: QVGPixmapConvolutionFilter(); ~QVGPixmapConvolutionFilter(); @@ -72,6 +73,7 @@ public: class Q_OPENVG_EXPORT QVGPixmapColorizeFilter : public QPixmapColorizeFilter { + Q_OBJECT public: QVGPixmapColorizeFilter(); ~QVGPixmapColorizeFilter(); @@ -86,6 +88,7 @@ private: class Q_OPENVG_EXPORT QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter { + Q_OBJECT public: QVGPixmapDropShadowFilter(); ~QVGPixmapDropShadowFilter(); @@ -101,6 +104,16 @@ private: mutable QVarLengthArray<VGshort, 16> kernel; }; +class Q_OPENVG_EXPORT QVGPixmapBlurFilter : public QPixmapBlurFilter +{ + Q_OBJECT +public: + QVGPixmapBlurFilter(QObject *parent = 0); + ~QVGPixmapBlurFilter(); + + void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; +}; + #endif QT_END_NAMESPACE diff --git a/src/plugins/codecs/jp/qjiscodec.cpp b/src/plugins/codecs/jp/qjiscodec.cpp index a495dae..3e4d5a0 100644 --- a/src/plugins/codecs/jp/qjiscodec.cpp +++ b/src/plugins/codecs/jp/qjiscodec.cpp @@ -41,7 +41,7 @@ // Most of the code here was originally written by Serika Kurusugawa, // a.k.a. Junji Takagi, and is included in Qt with the author's permission -// and the grateful thanks of the Trolltech team. +// and the grateful thanks of the Qt team. /*! \class QJisCodec \reentrant diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 5c60b2f..c5da3df 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -6,6 +6,9 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # +#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR +#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER +#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #DEFINES += QT_DIRECTFB_IMAGECACHE #DEFINES += QT_NO_DIRECTFB_WM #DEFINES += QT_NO_DIRECTFB_LAYER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 3979a8c..6abf0ff 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -47,7 +47,8 @@ QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr), - bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0) + bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), + imageFormat(QImage::Format_Invalid) {} QDirectFBPaintDevice::~QDirectFBPaintDevice() @@ -56,13 +57,11 @@ QDirectFBPaintDevice::~QDirectFBPaintDevice() delete engine; } - IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const { return dfbSurface; } - void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags) { if (!(lockFlgs & flags)) { @@ -77,7 +76,6 @@ void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags) } } - void QDirectFBPaintDevice::unlockDirectFB() { if (!lockedImage || !QDirectFBScreen::instance()) @@ -90,26 +88,23 @@ void QDirectFBPaintDevice::unlockDirectFB() lockFlgs = DFBSurfaceLockFlags(0); } - void *QDirectFBPaintDevice::memory() const { return mem; } - QImage::Format QDirectFBPaintDevice::format() const { - return QDirectFBScreen::getImageFormat(dfbSurface); + return imageFormat; } - int QDirectFBPaintDevice::bytesPerLine() const { if (bpl == -1) { // Can only get the stride when we lock the surface Q_ASSERT(!lockedImage); QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); - that->lockDirectFB(DSLF_READ); + that->lockDirectFB(DSLF_READ|DSLF_WRITE); Q_ASSERT(bpl != -1); } return bpl; @@ -143,11 +138,9 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmDpiY: return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch case QPaintDevice::PdmDepth: - DFBSurfacePixelFormat format; - dfbSurface->GetPixelFormat(dfbSurface, &format); - return QDirectFBScreen::depth(format); + return QDirectFBScreen::depth(imageFormat); case QPaintDevice::PdmNumColors: { - if (lockedImage) + if (lockedImage) return lockedImage->numColors(); DFBResult result; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index 688fd7b..48761b2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -89,6 +89,7 @@ protected: DFBSurfaceLockFlags lockFlgs; uchar *mem; QDirectFBPaintEngine *engine; + QImage::Format imageFormat; private: Q_DISABLE_COPY(QDirectFBPaintDevice); }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 956189c..e63a628 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -532,7 +532,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, d->unlock(); bool release; IDirectFBSurface *imgSurface = d->getSurface(image, &release); - d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface)); + d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface)); CLIPPED_PAINT(d->blit(r, imgSurface, sr)); if (release) { #if (Q_DIRECTFB_VERSION >= 0x010000) @@ -939,9 +939,9 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) { -#ifndef QT_DIRECTFB_IMAGECACHE +#ifdef QT_NO_DIRECTFB_IMAGECACHE *release = true; - return QDirectFBScreen::instance()->createDFBSurface(img, QDirectFBScreen::DontTrackSurface); + return QDirectFBScreen::instance()->createDFBSurface(img, img.format(), QDirectFBScreen::DontTrackSurface); #else const qint64 key = img.cacheKey(); *release = false; @@ -955,7 +955,7 @@ IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, boo const QImage::Format format = (img.format() == screen->alphaPixmapFormat() || QDirectFBPixmapData::hasAlphaChannel(img) ? screen->alphaPixmapFormat() : screen->pixelFormat()); - IDirectFBSurface *surface = screen->copyToDFBSurface(img, format, + IDirectFBSurface *surface = screen->createDFBSurface(img, format, cache ? QDirectFBScreen::TrackSurface : QDirectFBScreen::DontTrackSurface); @@ -1133,7 +1133,7 @@ IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size) clear(); const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size); - surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface); + surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface, 0); if (!surface) qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 0afb8a8..146a920 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -45,13 +45,14 @@ #include "qdirectfbpaintengine.h" #include <QtGui/qbitmap.h> +#include <QtCore/qfile.h> #include <directfb.h> static int global_ser_no = 0; QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen), - format(QImage::Format_Invalid), alpha(false) + alpha(false) { setSerialNumber(0); } @@ -70,11 +71,11 @@ void QDirectFBPixmapData::resize(int width, int height) return; } - format = screen->pixelFormat(); + imageFormat = screen->pixelFormat(); dfbSurface = screen->createDFBSurface(QSize(width, height), - format, + imageFormat, QDirectFBScreen::TrackSurface); - d = screen->depth(); + d = QDirectFBScreen::depth(imageFormat); alpha = false; if (!dfbSurface) { invalidate(); @@ -85,7 +86,6 @@ void QDirectFBPixmapData::resize(int width, int height) w = width; h = height; is_null = (w <= 0 || h <= 0); - d = metric(QPaintDevice::PdmDepth); setSerialNumber(++global_ser_no); } @@ -168,37 +168,200 @@ bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) #endif } +#ifdef QT_DIRECTFB_IMAGEPROVIDER +bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags) +{ + if (flags == Qt::AutoColor) { + if (filename.startsWith(QLatin1Char(':'))) { // resource + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) + return false; + const QByteArray data = file.readAll(); + file.close(); + return fromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), format, flags); + } else { + DFBDataBufferDescription description; + description.flags = DBDESC_FILE; + const QByteArray fileNameData = filename.toLocal8Bit(); + description.file = fileNameData.constData(); + if (fromDataBufferDescription(description)) { + return true; + } + // fall back to Qt + } + } + return QPixmapData::fromFile(filename, format, flags); +} -void QDirectFBPixmapData::fromImage(const QImage &i, - Qt::ImageConversionFlags flags) +bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags) { -#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION - Q_UNUSED(flags); + if (flags == Qt::AutoColor) { + DFBDataBufferDescription description; + description.flags = DBDESC_MEMORY; + description.memory.data = buffer; + description.memory.length = len; + if (fromDataBufferDescription(description)) + return true; + // fall back to Qt + } + return QPixmapData::fromData(buffer, len, format, flags); +} + +template <typename T> struct QDirectFBInterfaceCleanupHandler +{ + static void cleanup(T *t) { if (t) t->Release(t); } +}; + +template <typename T> +class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> > +{ +public: + QDirectFBPointer(T *t = 0) + : QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t) + {} +}; + +bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) +{ + IDirectFB *dfb = screen->dfb(); + Q_ASSERT(dfb); + DFBResult result = DFB_OK; + IDirectFBDataBuffer *dataBufferPtr; + if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result); + return false; + } + QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr); + + IDirectFBImageProvider *providerPtr; + if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't create image provider", result); + return false; + } + QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr); + + DFBSurfaceDescription surfaceDescription; + if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); + return false; + } + + QDirectFBPointer<IDirectFBSurface> surfaceFromDescription; + surfaceFromDescription.reset(screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result)); + if (!surfaceFromDescription) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't create surface", result); + return false; + } + + result = provider->RenderTo(provider.data(), surfaceFromDescription.data(), 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); + return false; + } + + DFBImageDescription imageDescription; + result = provider->GetImageDescription(provider.data(), &imageDescription); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result); + return false; + } + + alpha = imageDescription.caps & (DICAPS_ALPHACHANNEL|DICAPS_COLORKEY); + imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); + + dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height), + imageFormat, QDirectFBScreen::TrackSurface); + if (alpha) + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + if (imageDescription.caps & DICAPS_COLORKEY) { + blittingFlags |= DSBLIT_SRC_COLORKEY; + result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription.data(), + imageDescription.colorkey_r, + imageDescription.colorkey_g, + imageDescription.colorkey_b); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set src color key", result); + invalidate(); // release dfbSurface + return false; + } + } + if (imageDescription.caps & DICAPS_ALPHACHANNEL) { + blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; + } + result = dfbSurface->SetBlittingFlags(dfbSurface, blittingFlags); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set blitting flags", result); + invalidate(); // release dfbSurface + return false; + } + + result = dfbSurface->Blit(dfbSurface, surfaceFromDescription.data(), 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't blit to surface", result); + invalidate(); // release dfbSurface + return false; + } + if (blittingFlags != DSBLIT_NOFX) { + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); + } + + + w = surfaceDescription.width; + h = surfaceDescription.height; + is_null = (w <= 0 || h <= 0); + d = QDirectFBScreen::depth(imageFormat); + setSerialNumber(++global_ser_no); +#if (Q_DIRECTFB_VERSION >= 0x010000) + dfbSurface->ReleaseSource(dfbSurface); +#endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + screen->setDirectFBImageProvider(providerPtr); + provider.take(); #endif - const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i); - if (img.hasAlphaChannel() + + return true; +} + +#endif + +void QDirectFBPixmapData::fromImage(const QImage &image, + Qt::ImageConversionFlags flags) +{ + if (image.depth() == 1) { + fromImage(image.convertToFormat(screen->alphaPixmapFormat()), flags); + return; + } + + if (image.hasAlphaChannel() #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) + && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(image)) #endif ) { alpha = true; - format = screen->alphaPixmapFormat(); + imageFormat = screen->alphaPixmapFormat(); } else { alpha = false; - format = screen->pixelFormat(); + imageFormat = screen->pixelFormat(); } - dfbSurface = screen->copyToDFBSurface(img, format, - QDirectFBScreen::TrackSurface); + + dfbSurface = screen->createDFBSurface(image, imageFormat, QDirectFBScreen::TrackSurface|QDirectFBScreen::NoPreallocated); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); return; } - w = img.width(); - h = img.height(); + w = image.width(); + h = image.height(); is_null = (w <= 0 || h <= 0); - d = metric(QPaintDevice::PdmDepth); + d = QDirectFBScreen::depth(imageFormat); setSerialNumber(++global_ser_no); +#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION + Q_UNUSED(flags); +#endif } void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) @@ -212,12 +375,12 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data); IDirectFBSurface *src = otherData->directFBSurface(); alpha = data->hasAlphaChannel(); - format = (alpha - ? QDirectFBScreen::instance()->alphaPixmapFormat() - : QDirectFBScreen::instance()->pixelFormat()); + imageFormat = (alpha + ? QDirectFBScreen::instance()->alphaPixmapFormat() + : QDirectFBScreen::instance()->pixelFormat()); - dfbSurface = screen->createDFBSurface(rect.size(), format, + dfbSurface = screen->createDFBSurface(rect.size(), imageFormat, QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::copy()"); @@ -275,11 +438,12 @@ void QDirectFBPixmapData::fill(const QColor &color) alpha = (color.alpha() < 255); - if (alpha && ::isOpaqueFormat(format)) { + if (alpha && ::isOpaqueFormat(imageFormat)) { QSize size; dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); screen->releaseDFBSurface(dfbSurface); - format = screen->alphaPixmapFormat(); + imageFormat = screen->alphaPixmapFormat(); + d = QDirectFBScreen::depth(imageFormat); dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); setSerialNumber(++global_ser_no); if (!dfbSurface) { @@ -320,7 +484,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, flags = DSBLIT_BLEND_ALPHACHANNEL; } data->dfbSurface = screen->createDFBSurface(size, - format, + imageFormat, QDirectFBScreen::TrackSurface); if (flags & DSBLIT_BLEND_ALPHACHANNEL) { data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0); @@ -399,9 +563,14 @@ QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags) void QDirectFBPixmapData::invalidate() { + if (dfbSurface) { + screen->releaseDFBSurface(dfbSurface); + dfbSurface = 0; + } setSerialNumber(0); alpha = false; d = w = h = 0; - format = QImage::Format_Invalid; + is_null = true; + imageFormat = QImage::Format_Invalid; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 2300174..f0ae2f8 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -62,6 +62,12 @@ public: // Re-implemented from QPixmapData: virtual void resize(int width, int height); virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags); +#ifdef QT_DIRECTFB_IMAGEPROVIDER + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + virtual bool fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags); +#endif virtual void copy(const QPixmapData *data, const QRect &rect); virtual void fill(const QColor &color); virtual QPixmap transformed(const QTransform &matrix, @@ -74,12 +80,14 @@ public: QImage *buffer(DFBSurfaceLockFlags lockFlags); // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice - inline QImage::Format pixelFormat() const { return format; } + inline QImage::Format pixelFormat() const { return imageFormat; } static bool hasAlphaChannel(const QImage &img); inline bool hasAlphaChannel() const { return alpha; } private: +#ifdef QT_DIRECTFB_IMAGEPROVIDER + bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer); +#endif void invalidate(); - QImage::Format format; bool alpha; }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 45de07a..4542051 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -87,6 +87,9 @@ public: #ifndef QT_NO_DIRECTFB_KEYBOARD QDirectFBKeyboardHandler *keyboard; #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + IDirectFBImageProvider *imageProvider; +#endif QColor backgroundColor; QDirectFBScreen *q; }; @@ -109,6 +112,9 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) #ifndef QT_NO_DIRECTFB_KEYBOARD , keyboard(0) #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + , imageProvider(0) +#endif , q(qptr) { #ifndef QT_NO_QWS_SIGNALHANDLER @@ -128,6 +134,10 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() #ifndef QT_NO_DIRECTFB_KEYBOARD delete keyboard; #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + if (imageProvider) + imageProvider->Release(imageProvider); +#endif for (QSet<IDirectFBSurface*>::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) { (*it)->Release(*it); @@ -150,64 +160,77 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() dfb->Release(dfb); } - - -// creates a preallocated surface with the same format as the image if -// possible. - -IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *resultPtr) { - if (img.isNull()) // assert? + if (image.isNull()) // assert? return 0; - if (QDirectFBScreen::getSurfacePixelFormat(img.format()) == DSPF_UNKNOWN) { - QImage image = img.convertToFormat(img.hasAlphaChannel() - ? d_ptr->alphaPixmapFormat - : pixelFormat()); - IDirectFBSurface *tmp = createDFBSurface(image, false); - if (!tmp) { - qWarning("Couldn't create surface createDFBSurface(QImage, bool)"); - return 0; - } - IDirectFBSurface *surface = copyDFBSurface(tmp, image.format(), options); - tmp->Release(tmp); - return surface; + if (QDirectFBScreen::getSurfacePixelFormat(format) == DSPF_UNKNOWN) { + format = QDirectFBPixmapData::hasAlphaChannel(image) ? d_ptr->alphaPixmapFormat : pixelFormat(); + } + if (image.format() != format) { + return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated, resultPtr); } - IDirectFBSurface *surface = createDFBSurface(QDirectFBScreen::getSurfaceDescription(img), options); -#ifdef QT_NO_DIRECTFB_PREALLOCATED - if (surface) { - int bpl; - uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bpl); + DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); + description.width = image.width(); + description.height = image.height(); + description.flags = DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT; + initSurfaceDescriptionPixelFormat(&description, format); + bool doMemCopy = true; +#ifdef QT_DIRECTFB_PREALLOCATED + if (!(options & NoPreallocated)) { + doMemCopy = false; + description.flags |= DSDESC_PREALLOCATED; + description.preallocated[0].data = const_cast<uchar*>(image.bits()); + description.preallocated[0].pitch = image.bytesPerLine(); + description.preallocated[1].data = 0; + description.preallocated[1].pitch = 0; + } +#endif + DFBResult result; + IDirectFBSurface *surface = createDFBSurface(description, options, &result); + if (resultPtr) + *resultPtr = result; + if (!surface) { + DirectFBError("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions)", result); + return 0; + } + if (doMemCopy) { + int bplDFB; + uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB); if (mem) { - const int h = img.height(); - const int w = img.width() * img.depth() / 8; - for (int i = 0; i < h; ++i) { - memcpy(mem, img.scanLine(i), w); - mem += bpl; + const int height = image.height(); + const int bplQt = image.bytesPerLine(); + if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) { + memcpy(mem, image.bits(), image.numBytes()); + } else { + for (int i=0; i<height; ++i) { + memcpy(mem, image.scanLine(i), bplQt); + mem += bplDFB; + } } surface->Unlock(surface); } } -#endif -#ifndef QT_NO_DIRECTFB_PALETTE - if (img.numColors() != 0 && surface) - QDirectFBScreen::setSurfaceColorTable(surface, img); +#ifdef QT_DIRECTFB_PALETTE + if (image.numColors() != 0 && surface) + QDirectFBScreen::setSurfaceColorTable(surface, image); #endif return surface; } IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, QImage::Format format, - SurfaceCreationOptions options) + SurfaceCreationOptions options, + DFBResult *result) { Q_ASSERT(src); QSize size; src->GetSize(src, &size.rwidth(), &size.rheight()); - IDirectFBSurface *surface = createDFBSurface(size, format, options); - DFBSurfacePixelFormat dspf; - src->GetPixelFormat(src, &dspf); - DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlpha(dspf) + IDirectFBSurface *surface = createDFBSurface(size, format, options, result); + DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(surface) ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; if (flags & DSBLIT_BLEND_ALPHACHANNEL) @@ -223,7 +246,8 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, QImage::Format format, - SurfaceCreationOptions options) + SurfaceCreationOptions options, + DFBResult *result) { DFBSurfaceDescription desc; memset(&desc, 0, sizeof(DFBSurfaceDescription)); @@ -232,12 +256,14 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, return 0; desc.width = size.width(); desc.height = size.height(); - return createDFBSurface(desc, options); + return createDFBSurface(desc, options, result); } -IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *resultPtr) { - DFBResult result = DFB_OK; + DFBResult tmp; + DFBResult &result = (resultPtr ? *resultPtr : tmp); + result = DFB_OK; IDirectFBSurface *newSurface = 0; if (!d_ptr->dfb) { @@ -299,68 +325,6 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, return newSurface; } -IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, - QImage::Format pixmapFormat, - SurfaceCreationOptions options) -{ - QImage image = img; - if (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN -#ifdef QT_NO_DIRECTFB_PREALLOCATED - || image.format() != pixmapFormat -#endif -#ifdef QT_NO_DIRECTFB_PALETTE - || image.numColors() != 0 -#endif - ) { - image = image.convertToFormat(pixmapFormat); - } - - IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options); - if (!dfbSurface) { - qWarning("QDirectFBScreen::copyToDFBSurface() Couldn't create surface"); - return 0; - } - -#ifndef QT_NO_DIRECTFB_PREALLOCATED - IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface); - if (!imgSurface) { - qWarning("QDirectFBScreen::copyToDFBSurface()"); - QDirectFBScreen::releaseDFBSurface(dfbSurface); - return 0; - } - - Q_ASSERT(imgSurface); - DFBSurfaceBlittingFlags flags = img.hasAlphaChannel() - ? DSBLIT_BLEND_ALPHACHANNEL - : DSBLIT_NOFX; - if (flags & DSBLIT_BLEND_ALPHACHANNEL) - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - - dfbSurface->SetBlittingFlags(dfbSurface, flags); - DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0); - if (result != DFB_OK) - DirectFBError("QDirectFBScreen::copyToDFBSurface()", result); - imgSurface->Release(imgSurface); -#if (Q_DIRECTFB_VERSION >= 0x010000) - dfbSurface->ReleaseSource(dfbSurface); -#endif -#else // QT_NO_DIRECTFB_PREALLOCATED - Q_ASSERT(image.format() == pixmapFormat); - int bpl; - uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); - if (mem) { - const int h = image.height(); - const int w = image.width() * image.depth() / 8; - for (int i=0; i<h; ++i) { - memcpy(mem, image.scanLine(i), w); - mem += bpl; - } - dfbSurface->Unlock(dfbSurface); - } -#endif - return dfbSurface; -} - void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface) { Q_ASSERT(QDirectFBScreen::instance()); @@ -474,36 +438,6 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface) return QImage::Format_Invalid; } -DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image) -{ - DFBSurfaceDescription description; - memset(&description, 0, sizeof(DFBSurfaceDescription)); - - const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format()); - - if (format == DSPF_UNKNOWN || image.isNull()) { - description.flags = DSDESC_NONE; - return description; - } - - description.flags = DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT; - QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, image.format()); - description.width = image.width(); - description.height = image.height(); -#ifndef QT_NO_DIRECTFB_PREALLOCATED - description.flags |= DSDESC_PREALLOCATED; - description.preallocated[0].data = (void*)(image.bits()); - description.preallocated[0].pitch = image.bytesPerLine(); - description.preallocated[1].data = 0; - description.preallocated[1].pitch = 0; -#endif - - if (QDirectFBScreen::isPremultiplied(image.format())) - description.caps = DSCAPS_PREMULTIPLIED; - - return description; -} - DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer, int length) { @@ -519,7 +453,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer, description.preallocated[0].pitch = length * sizeof(uint); description.preallocated[1].data = 0; description.preallocated[1].pitch = 0; -return description; + return description; } #ifndef QT_NO_DIRECTFB_PALETTE @@ -560,7 +494,15 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, #endif // QT_NO_DIRECTFB_PALETTE -#if !defined(QT_NO_DIRECTFB_LAYER) && !defined(QT_NO_QWS_CURSOR) +#ifndef QT_NO_QWS_CURSOR +#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR +#define QT_DIRECTFB_CURSOR +#elif defined QT_DIRECTFB_LAYER +#define QT_DIRECTFB_CURSOR +#endif +#endif + +#if defined QT_DIRECTFB_CURSOR class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor { public: @@ -570,6 +512,11 @@ public: virtual void show(); virtual void hide(); private: +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + ~QDirectFBScreenCursor(); + bool createWindow(); + IDirectFBWindow *window; +#endif IDirectFBDisplayLayer *layer; }; @@ -585,12 +532,95 @@ QDirectFBScreenCursor::QDirectFBScreenCursor() enable = false; hwaccel = true; supportsAlpha = true; +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + window = 0; + DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } + result = layer->SetCursorOpacity(layer, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cursor opacity", result); + } + + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } +#endif +} + +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR +QDirectFBScreenCursor::~QDirectFBScreenCursor() +{ + if (window) { + window->Release(window); + window = 0; + } } +bool QDirectFBScreenCursor::createWindow() +{ + Q_ASSERT(!window); + Q_ASSERT(!cursor.isNull()); + DFBWindowDescription description; + memset(&description, 0, sizeof(DFBWindowDescription)); + description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_OPTIONS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS; + description.width = cursor.width(); + description.height = cursor.height(); + description.posx = pos.x() - hotspot.x(); + description.posy = pos.y() - hotspot.y(); + description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; + description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; + const QImage::Format format = QDirectFBScreen::instance()->alphaPixmapFormat(); + description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); + if (QDirectFBScreen::isPremultiplied(format)) + description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = layer->CreateWindow(layer, &description, &window); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to create window", result); + return false; + } + result = window->SetOpacity(window, 255); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set opacity ", result); + return false; + } + + result = window->SetStackingClass(window, DWSC_UPPER); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set stacking class ", result); + return false; + } + + result = window->RaiseToTop(window); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to raise window ", result); + return false; + } + + return true; +} +#endif + void QDirectFBScreenCursor::move(int x, int y) { pos = QPoint(x, y); +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + if (window) { + const QPoint p = pos - hotspot; + DFBResult result = window->MoveTo(window, p.x(), p.y()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::move: Unable to move window", result); + } + } +#else layer->WarpCursor(layer, x, y); +#endif } void QDirectFBScreenCursor::hide() @@ -598,6 +628,7 @@ void QDirectFBScreenCursor::hide() if (enable) { enable = false; DFBResult result; +#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::hide: " @@ -613,6 +644,15 @@ void QDirectFBScreenCursor::hide() DirectFBError("QDirectFBScreenCursor::hide: " "Unable to set cooperative level", result); } +#else + if (window) { + result = window->SetOpacity(window, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set window opacity", result); + } + } +#endif } } @@ -626,7 +666,13 @@ void QDirectFBScreenCursor::show() DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } - result = layer->SetCursorOpacity(layer, 255); + result = layer->SetCursorOpacity(layer, +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + 0 +#else + 255 +#endif + ); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cursor shape", result); @@ -636,6 +682,15 @@ void QDirectFBScreenCursor::show() DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + if (window) { + DFBResult result = window->SetOpacity(window, 255); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set window opacity", result); + } + } +#endif } } @@ -652,12 +707,15 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) cursor = image.convertToFormat(screen->alphaPixmapFormat()); size = cursor.size(); hotspot = QPoint(hotx, hoty); - IDirectFBSurface *surface = screen->createDFBSurface(cursor, QDirectFBScreen::DontTrackSurface); + DFBResult result = DFB_OK; + IDirectFBSurface *surface = screen->createDFBSurface(cursor, screen->alphaPixmapFormat(), + QDirectFBScreen::DontTrackSurface, &result); if (!surface) { - qWarning("QDirectFBScreenCursor::set: Unable to create surface"); + DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result); return; } - DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); +#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR + result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); @@ -667,17 +725,53 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cursor shape", result); } - surface->Release(surface); result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } +#else + if (window || createWindow()) { + QSize windowSize; + result = window->GetSize(window, &windowSize.rwidth(), &windowSize.rheight()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: " + "Unable to get window size", result); + } + result = window->Resize(window, size.width(), size.height()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to resize window", result); + } + + IDirectFBSurface *windowSurface; + result = window->GetSurface(window, &windowSurface); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to get window surface", result); + } else { + result = windowSurface->Clear(windowSurface, 0, 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to clear surface", result); + } + + result = windowSurface->Blit(windowSurface, surface, 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to blit to surface", result); + } + } + result = windowSurface->Flip(windowSurface, 0, DSFLIP_NONE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to flip window", result); + } + + windowSurface->Release(windowSurface); + } +#endif + surface->Release(surface); show(); } } -#endif // QT_NO_DIRECTFB_LAYER +#endif // QT_DIRECTFB_CURSOR QDirectFBScreen::QDirectFBScreen(int display_id) : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this)) @@ -732,6 +826,42 @@ int QDirectFBScreen::depth(DFBSurfacePixelFormat format) return 0; } +int QDirectFBScreen::depth(QImage::Format format) +{ + int depth = 0; + switch(format) { + case QImage::Format_Invalid: + case QImage::NImageFormats: + Q_ASSERT(false); + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + depth = 1; + break; + case QImage::Format_Indexed8: + depth = 8; + break; + case QImage::Format_RGB32: + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + depth = 32; + break; + case QImage::Format_RGB555: + case QImage::Format_RGB16: + case QImage::Format_RGB444: + case QImage::Format_ARGB4444_Premultiplied: + depth = 16; + break; + case QImage::Format_RGB666: + case QImage::Format_ARGB6666_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_ARGB8555_Premultiplied: + case QImage::Format_RGB888: + depth = 24; + break; + } + return depth; +} + void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) { QRegExp flipRegexp(QLatin1String("^flip=([\\w,]*)$")); @@ -1015,7 +1145,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) } // We don't track the primary surface as it's released in disconnect - d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface); + d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result); if (!d_ptr->primarySurface) { DirectFBError("QDirectFBScreen: error creating primary surface", result); @@ -1026,7 +1156,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #else description.flags = DSDESC_WIDTH|DSDESC_HEIGHT; description.width = description.height = 1; - surface = createDFBSurface(description, DontTrackSurface); + surface = createDFBSurface(description, DontTrackSurface, &result); + if (!surface) { + DirectFBError("QDirectFBScreen: error creating surface", result); + return false; + } #endif // Work out what format we're going to use for surfaces with an alpha channel QImage::Format pixelFormat = QDirectFBScreen::getImageFormat(surface); @@ -1131,6 +1265,10 @@ bool QDirectFBScreen::connect(const QString &displaySpec) void QDirectFBScreen::disconnect() { +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + if (d_ptr->imageProvider) + d_ptr->imageProvider->Release(d_ptr->imageProvider); +#endif #ifdef QT_NO_DIRECTFB_WM d_ptr->primarySurface->Release(d_ptr->primarySurface); d_ptr->primarySurface = 0; @@ -1295,7 +1433,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) const QRect cursorRectangle = cursor->boundingRect(); if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) { const QImage image = cursor->image(); - IDirectFBSurface *surface = createDFBSurface(image, QDirectFBScreen::DontTrackSurface); + IDirectFBSurface *surface = createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); d_ptr->primarySurface->SetBlittingFlags(d_ptr->primarySurface, DSBLIT_BLEND_ALPHACHANNEL); d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, 0, cursorRectangle.x(), cursorRectangle.y()); surface->Release(surface); @@ -1371,10 +1509,10 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d return true; } -uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, uint flags, int *bpl) +uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) { void *mem; - const DFBResult result = surface->Lock(surface, static_cast<DFBSurfaceLockFlags>(flags), static_cast<void**>(&mem), bpl); + const DFBResult result = surface->Lock(surface, flags, &mem, bpl); if (result != DFB_OK) { DirectFBError("QDirectFBScreen::lockSurface()", result); } @@ -1409,4 +1547,46 @@ void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags } } +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider) +{ + Q_ASSERT(provider); + if (d_ptr->imageProvider) + d_ptr->imageProvider->Release(d_ptr->imageProvider); + d_ptr->imageProvider = provider; +} +#endif + +IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const +{ + Q_ASSERT(widget); + if (!widget->isVisible() || widget->size().isNull()) + return 0; + + const QWSWindowSurface *surface = static_cast<const QWSWindowSurface*>(widget->windowSurface()); + if (surface && surface->key() == QLatin1String("directfb")) { + return static_cast<const QDirectFBWindowSurface*>(surface)->surfaceForWidget(widget, rect); + } + return 0; +} + +IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const +{ + Q_ASSERT(widget); + QRect rect; + IDirectFBSurface *surface = surfaceForWidget(widget, &rect); + IDirectFBSurface *subSurface = 0; + if (surface) { + if (!area.isNull()) + rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0))); + if (!rect.isNull()) { + const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() }; + const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result); + } + } + } + return subSurface; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 3f9248e..4b6c01f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -59,6 +59,15 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_IMAGECACHE && !defined QT_NO_DIRECTFB_IMAGECACHE #define QT_NO_DIRECTFB_IMAGECACHE #endif +#if !defined QT_DIRECTFB_NO_IMAGEPROVIDER && !defined QT_DIRECTFB_IMAGEPROVIDER +#define QT_DIRECTFB_IMAGEPROVIDER +#endif +#if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +#define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +#endif +#if !defined QT_DIRECTFB_WINDOW_AS_CURSOR && !defined QT_NO_DIRECTFB_WINDOW_AS_CURSOR +#define QT_NO_DIRECTFB_WINDOW_AS_CURSOR +#endif #if !defined QT_NO_DIRECTFB_PALETTE && !defined QT_DIRECTFB_PALETTE #define QT_DIRECTFB_PALETTE #endif @@ -74,6 +83,15 @@ QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION #define QT_DIRECTFB_OPAQUE_DETECTION #endif +#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM +#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM +#endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && defined QT_NO_DIRECTFB_IMAGEPROVIDER +#error QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE requires QT_DIRECTFB_IMAGEPROVIDER to be defined +#endif +#if defined QT_DIRECTFB_WINDOW_AS_CURSOR && defined QT_NO_DIRECTFB_WM +#error QT_DIRECTFB_WINDOW_AS_CURSOR requires QT_DIRECTFB_WM to be defined +#endif #define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION) @@ -86,6 +104,8 @@ QT_MODULE(Gui) DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBInputDeviceCapabilities); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowDescriptionFlags); +DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowCapabilities); +DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowOptions); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDescriptionFlags); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceCapabilities); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceLockFlags); @@ -132,6 +152,9 @@ public: return static_cast<QDirectFBScreen*>(inst); } + IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; + IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; + IDirectFB *dfb(); #ifdef QT_NO_DIRECTFB_WM IDirectFBSurface *primarySurface(); @@ -142,21 +165,27 @@ public: // Track surface creation/release so we can release all on exit enum SurfaceCreationOption { - DontTrackSurface = 0, - TrackSurface = 1 + DontTrackSurface = 0x1, + TrackSurface = 0x2, + NoPreallocated = 0x4 }; Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); IDirectFBSurface *createDFBSurface(const QImage &image, - SurfaceCreationOptions options); + QImage::Format format, + SurfaceCreationOptions options, + DFBResult *result = 0); IDirectFBSurface *createDFBSurface(const QSize &size, QImage::Format format, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result = 0); IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src, QImage::Format format, - SurfaceCreationOptions options); - IDirectFBSurface *copyToDFBSurface(const QImage &image, - QImage::Format format, - SurfaceCreationOptions options); + SurfaceCreationOptions options, + DFBResult *result = 0); + IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, + SurfaceCreationOptions options, + DFBResult *result); + void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset); void releaseDFBSurface(IDirectFBSurface *surface); @@ -164,16 +193,16 @@ public: using QScreen::depth; static int depth(DFBSurfacePixelFormat format); + static int depth(QImage::Format format); static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); - static DFBSurfaceDescription getSurfaceDescription(const QImage &image); static DFBSurfaceDescription getSurfaceDescription(const uint *buffer, int length); static QImage::Format getImageFormat(IDirectFBSurface *surface); static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); static inline bool isPremultiplied(QImage::Format format); - static inline bool hasAlpha(DFBSurfacePixelFormat format); - static inline bool hasAlpha(IDirectFBSurface *surface); + static inline bool hasAlphaChannel(DFBSurfacePixelFormat format); + static inline bool hasAlphaChannel(IDirectFBSurface *surface); QImage::Format alphaPixmapFormat() const; #ifndef QT_NO_DIRECTFB_PALETTE @@ -181,12 +210,12 @@ public: const QImage &image); #endif - static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0); + static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0); +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + void setDirectFBImageProvider(IDirectFBImageProvider *provider); +#endif private: - IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, - SurfaceCreationOptions options); QDirectFBScreenPrivate *d_ptr; - friend class SurfaceCache; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); @@ -207,7 +236,7 @@ inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) return false; } -inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) +inline bool QDirectFBScreen::hasAlphaChannel(DFBSurfacePixelFormat format) { switch (format) { case DSPF_ARGB1555: @@ -232,12 +261,12 @@ inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) } } -inline bool QDirectFBScreen::hasAlpha(IDirectFBSurface *surface) +inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface) { Q_ASSERT(surface); DFBSurfacePixelFormat format; surface->GetPixelFormat(surface, &format); - return QDirectFBScreen::hasAlpha(format); + return QDirectFBScreen::hasAlphaChannel(format); } QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 441bac9..9de1ca5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -48,8 +48,6 @@ #include <qpaintdevice.h> #include <qvarlengtharray.h> -//#define QT_DIRECTFB_DEBUG_SURFACES 1 - QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM @@ -119,15 +117,12 @@ bool QDirectFBWindowSurface::isValid() const #ifndef QT_NO_DIRECTFB_WM void QDirectFBWindowSurface::createWindow() { -#ifdef QT_NO_DIRECTFB_LAYER -#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM -#else IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); if (!layer) qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); DFBWindowDescription description; - description.caps = DWCAPS_NODECORATION; + description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; description.surface_caps = DSCAPS_NONE; @@ -147,7 +142,7 @@ void QDirectFBWindowSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); -#endif + updateFormat(); } #endif // QT_NO_DIRECTFB_WM @@ -183,6 +178,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const void QDirectFBWindowSurface::setGeometry(const QRect &rect) { + IDirectFBSurface *oldSurface = dfbSurface; #ifdef QT_NO_DIRECTFB_WM IDirectFBSurface *primarySurface = screen->primarySurface(); Q_ASSERT(primarySurface); @@ -240,27 +236,26 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); } + if (oldSurface != dfbSurface) + updateFormat(); QWSWindowSurface::setGeometry(rect); } QByteArray QDirectFBWindowSurface::permanentState() const { - QByteArray state; #ifdef QT_DIRECTFB_WM - QDataStream ds(&state, QIODevice::WriteOnly); - ds << reinterpret_cast<quintptr>(this); -#endif + QByteArray state(sizeof(this), 0); + *reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this; return state; +#endif + return QByteArray(); } void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { #ifdef QT_DIRECTFB_WM - if (state.size() == sizeof(quintptr)) { - QDataStream ds(state); - quintptr ptr; - ds >> ptr; - sibling = reinterpret_cast<QDirectFBWindowSurface*>(ptr); + if (state.size() == sizeof(this)) { + sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData()); } #else Q_UNUSED(state); @@ -392,7 +387,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, && region.intersects(cursorRectangle.translated(-(offset + windowGeometry.topLeft())))) { const QImage image = cursor->image(); - IDirectFBSurface *surface = screen->createDFBSurface(image, QDirectFBScreen::DontTrackSurface); + IDirectFBSurface *surface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); primarySurface->SetBlittingFlags(primarySurface, DSBLIT_BLEND_ALPHACHANNEL); primarySurface->Blit(primarySurface, surface, 0, cursorRectangle.x(), cursorRectangle.y()); surface->Release(surface); @@ -418,7 +413,6 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, #endif } - void QDirectFBWindowSurface::beginPaint(const QRegion &) { if (!engine) @@ -427,42 +421,31 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &) void QDirectFBWindowSurface::endPaint(const QRegion &) { -#ifdef QT_DIRECTFB_DEBUG_SURFACES - if (bufferImages.count()) { - qDebug("QDirectFBWindowSurface::endPaint() this=%p", this); - - foreach(QImage* bufferImg, bufferImages) - qDebug(" Deleting buffer image %p", bufferImg); - } -#endif - - qDeleteAll(bufferImages); - bufferImages.clear(); unlockDirectFB(); } - -QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) +IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const { - if (!lockedImage) + Q_ASSERT(widget); + if (!dfbSurface) { + if (sibling && (!sibling->sibling || sibling->dfbSurface)) + return sibling->surfaceForWidget(widget, rect); return 0; - - const QRect rect = QRect(offset(widget), widget->size()) - & lockedImage->rect(); - if (rect.isEmpty()) - return 0; - - QImage *img = new QImage(lockedImage->scanLine(rect.y()) - + rect.x() * (lockedImage->depth() / 8), - rect.width(), rect.height(), - lockedImage->bytesPerLine(), - lockedImage->format()); - bufferImages.append(img); - -#ifdef QT_DIRECTFB_DEBUG_SURFACES - qDebug("QDirectFBWindowSurface::buffer() Created & returned %p", img); -#endif - - return img; + } + QWidget *win = window(); + Q_ASSERT(win); + if (rect) { + if (win == widget) { + *rect = widget->rect(); + } else { + *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); + } + } + Q_ASSERT(win == widget || widget->isAncestorOf(win)); + return dfbSurface; } +void QDirectFBWindowSurface::updateFormat() +{ + imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 2c4bcdf..f8c0aae 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -88,22 +88,20 @@ public: void beginPaint(const QRegion &); void endPaint(const QRegion &); - QImage *buffer(const QWidget *widget); + IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; private: + void updateFormat(); #ifdef QT_DIRECTFB_WM void createWindow(); IDirectFBWindow *dfbWindow; QDirectFBWindowSurface *sibling; -#endif - -#ifdef QT_NO_DIRECTFB_WM +#else enum Mode { Primary, Offscreen } mode; #endif - QList<QImage*> bufferImages; DFBSurfaceFlipFlags flipFlags; bool boundingRectFlip; #ifdef QT_DIRECTFB_TIMING diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 395adca..910366c 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -493,7 +493,16 @@ private: in--; out[i] = qRgb(*in, *in, *in); } - } else { + } else if (cinfo->out_color_space == JCS_CMYK) { + int cols32Bit = scaledWidth() * 4; + in = (uchar*)out + cols32Bit; + for (uint i = scaledWidth(); i--; ) { + in -= 4; + int k = in[3]; + out[i] = qRgb(k * in[0] / 255, k * in[1] / 255, k * in[2] / 255); + //out[i] = qRgb(in[0], in[1], in[2]); + } + } else { in = (uchar*)out + cols24Bit; for (uint i = scaledWidth(); i--; ) { in -= 3; diff --git a/src/qbase.pri b/src/qbase.pri index b285d88..27e4992 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -101,7 +101,8 @@ symbian { "DEFFILE ../s60installs/eabi/$${TARGET}.def" \ "$${LITERAL_HASH}endif" - MMP_RULES += defBlock + #MMP_RULES += defBlock + MMP_RULES += EXPORTUNFROZEN } load(armcc_warnings) } diff --git a/src/qt3support/tools/q3garray.cpp b/src/qt3support/tools/q3garray.cpp index e4aef3d..c1360a0 100644 --- a/src/qt3support/tools/q3garray.cpp +++ b/src/qt3support/tools/q3garray.cpp @@ -114,6 +114,7 @@ Q3GArray::Q3GArray() */ Q3GArray::Q3GArray(int, int) + : shd(0) { } diff --git a/src/script/api/qscriptclass.cpp b/src/script/api/qscriptclass.cpp index f96a5bc..9ad5ad6 100644 --- a/src/script/api/qscriptclass.cpp +++ b/src/script/api/qscriptclass.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -42,8 +42,6 @@ #include "qscriptclass.h" #include "qscriptstring.h" -QT_BEGIN_NAMESPACE - /*! \since 4.4 \class QScriptClass @@ -131,6 +129,8 @@ QT_BEGIN_NAMESPACE \sa queryProperty() */ +QT_BEGIN_NAMESPACE + class QScriptClassPrivate { Q_DECLARE_PUBLIC(QScriptClass) diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index 0b1ca33..6a85ede 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -305,8 +305,8 @@ QScriptValue QScriptContext::argumentsObject() const { JSC::CallFrame *frame = const_cast<JSC::ExecState*>(QScriptEnginePrivate::frameForContext(this)); - if (frame == frame->lexicalGlobalObject()->globalExec() || frame->callerFrame()->hasHostCallFrameFlag()) { - // <global> or <eval> context doesn't have arguments. return an empty object + if (frame == frame->lexicalGlobalObject()->globalExec()) { + // <global> context doesn't have arguments. return an empty object return QScriptEnginePrivate::get(QScript::scriptEngineFromExec(frame))->newObject(); } @@ -316,6 +316,11 @@ QScriptValue QScriptContext::argumentsObject() const return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(result); } + if (frame->callerFrame()->hasHostCallFrameFlag()) { + // <eval> context doesn't have arguments. return an empty object + return QScriptEnginePrivate::get(QScript::scriptEngineFromExec(frame))->newObject(); + } + //for a native function if (!frame->optionalCalleeArguments()) { Q_ASSERT(frame->argumentCount() > 0); //we need at least 'this' otherwise we'll crash later diff --git a/src/script/api/qscriptcontext.h b/src/script/api/qscriptcontext.h index 2eb0c85..53d07cc 100644 --- a/src/script/api/qscriptcontext.h +++ b/src/script/api/qscriptcontext.h @@ -44,7 +44,6 @@ #include <QtCore/qobjectdefs.h> -#include <QtCore/qscopedpointer.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_HEADER diff --git a/src/script/api/qscriptcontext_p.h b/src/script/api/qscriptcontext_p.h index e8cc47e..c40f3de 100644 --- a/src/script/api/qscriptcontext_p.h +++ b/src/script/api/qscriptcontext_p.h @@ -55,8 +55,6 @@ #include <QtCore/qobjectdefs.h> -QT_BEGIN_NAMESPACE - namespace JSC { class JSObject; @@ -64,8 +62,7 @@ namespace JSC class ExecState; } -#include "wtf/Platform.h" -#include "JSValue.h" +QT_BEGIN_NAMESPACE class QScriptEnginePrivate; @@ -73,4 +70,7 @@ class QScriptContext; QT_END_NAMESPACE +#include "wtf/Platform.h" +#include "JSValue.h" + #endif diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index e59b773..890ed9d 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -50,6 +50,9 @@ #include <QtCore/qmetaobject.h> #include "CodeBlock.h" #include "JSFunction.h" +#if ENABLE(JIT) +#include "MacroAssemblerCodeRef.h" +#endif QT_BEGIN_NAMESPACE @@ -154,7 +157,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte lineNumber = -1; columnNumber = -1; - const JSC::ExecState *frame = QScriptEnginePrivate::frameForContext(context); + JSC::CallFrame *frame = const_cast<JSC::CallFrame *>(QScriptEnginePrivate::frameForContext(context)); // Get the line number: @@ -171,8 +174,13 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::Instruction *returnPC = aboveFrame->returnPC(); JSC::CodeBlock *codeBlock = frame->codeBlock(); if (returnPC && codeBlock) { - lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), - returnPC - codeBlock->instructions().begin() -1); +#if ENABLE(JIT) + unsigned bytecodeOffset = codeBlock->getBytecodeIndex(frame, JSC::ReturnAddressPtr(returnPC)); +#else + unsigned bytecodeOffset = returnPC - codeBlock->instructions().begin(); +#endif + bytecodeOffset--; //because returnPC is on the next instruction. We want the current one + lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), bytecodeOffset); } } } else { diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 131fe28..29044a9 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -468,7 +468,7 @@ bool isFunction(JSC::JSValue value) static JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); static JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObject */*callee*/, JSC::JSValue thisObject, const JSC::ArgList &args) +JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObject * /*callee*/, JSC::JSValue thisObject, const JSC::ArgList &args) { #ifndef QT_NO_QOBJECT if (args.size() == 0) { @@ -533,7 +533,7 @@ JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObjec #endif // QT_NO_QOBJECT } -JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject */*callee*/, JSC::JSValue thisObject, const JSC::ArgList &args) +JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject * /*callee*/, JSC::JSValue thisObject, const JSC::ArgList &args) { #ifndef QT_NO_QOBJECT if (args.size() == 0) { @@ -791,7 +791,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng) } // namespace QScript QScriptEnginePrivate::QScriptEnginePrivate() - : registeredScriptValues(0), inEval(false) + : registeredScriptValues(0), freeScriptValues(0), inEval(false) { qMetaTypeId<QScriptValue>(); @@ -844,34 +844,11 @@ QScriptEnginePrivate::~QScriptEnginePrivate() JSC::JSLock lock(false); globalData->heap.destroy(); globalData->deref(); -} - -QScriptValue QScriptEnginePrivate::scriptValueFromJSCValue(JSC::JSValue value) -{ - if (!value) - return QScriptValue(); - - QScriptValuePrivate *p_value = new QScriptValuePrivate(); - p_value->engine = this; - p_value->initFrom(value); - return QScriptValuePrivate::toPublic(p_value); -} - -JSC::JSValue QScriptEnginePrivate::scriptValueToJSCValue(const QScriptValue &value) -{ - QScriptValuePrivate *vv = QScriptValuePrivate::get(value); - if (!vv) - return JSC::JSValue(); - if (vv->type != QScriptValuePrivate::JSC) { - Q_ASSERT(!vv->engine || vv->engine == this); - vv->engine = this; - if (vv->type == QScriptValuePrivate::Number) { - vv->initFrom(JSC::jsNumber(currentFrame, vv->numberValue)); - } else { //QScriptValuePrivate::String - vv->initFrom(JSC::jsString(currentFrame, vv->stringValue)); - } + while (freeScriptValues) { + QScriptValuePrivate *p = freeScriptValues; + freeScriptValues = p->next; + qFree(p); } - return vv->jscValue; } QScriptValue QScriptEnginePrivate::scriptValueFromVariant(const QVariant &v) @@ -1203,14 +1180,14 @@ JSC::JSValue QScriptEnginePrivate::newQObject( bool preferExisting = (options & QScriptEngine::PreferExistingWrapperObject) != 0; QScriptEngine::QObjectWrapOptions opt = options & ~QScriptEngine::PreferExistingWrapperObject; QScriptObject *result = 0; - if (preferExisting) + if (preferExisting) { result = data->findWrapper(ownership, opt); - if (!result) { - result = new (exec) QScriptObject(qobjectWrapperObjectStructure); - if (preferExisting) - data->registerWrapper(result, ownership, opt); + if (result) + return result; } - Q_ASSERT(result != 0); + result = new (exec) QScriptObject(qobjectWrapperObjectStructure); + if (preferExisting) + data->registerWrapper(result, ownership, opt); result->setDelegate(new QScript::QObjectDelegate(object, ownership, options)); /*if (setDefaultPrototype)*/ { const QMetaObject *meta = object->metaObject(); @@ -1362,27 +1339,6 @@ bool QScriptEnginePrivate::scriptDisconnect(JSC::JSValue signal, JSC::JSValue re #endif -void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value) -{ - value->prev = 0; - value->next = registeredScriptValues; - if (registeredScriptValues) - registeredScriptValues->prev = value; - registeredScriptValues = value; -} - -void QScriptEnginePrivate::unregisterScriptValue(QScriptValuePrivate *value) -{ - if (value->prev) - value->prev->next = value->next; - if (value->next) - value->next->prev = value->prev; - if (value == registeredScriptValues) - registeredScriptValues = value->next; - value->prev = 0; - value->next = 0; -} - void QScriptEnginePrivate::detachAllRegisteredScriptValues() { QScriptValuePrivate *it; @@ -1679,7 +1635,6 @@ QScriptValue QScriptEngine::newVariant(const QScriptValue &object, } QScriptObject *jscScriptObject = static_cast<QScriptObject*>(jscObject); if (!object.isVariant()) { - delete jscScriptObject->delegate(); jscScriptObject->setDelegate(new QScript::QVariantDelegate(value)); } else { QScriptValuePrivate::get(object)->setVariantValue(value); @@ -1757,7 +1712,6 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, } QScriptObject *jscScriptObject = static_cast<QScriptObject*>(jscObject); if (!scriptObject.isQObject()) { - delete jscScriptObject->delegate(); jscScriptObject->setDelegate(new QScript::QObjectDelegate(qtObject, ownership, options)); } else { QScript::QObjectDelegate *delegate = static_cast<QScript::QObjectDelegate*>(jscScriptObject->delegate()); @@ -2305,8 +2259,11 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV if (calledAsConstructor) flags |= CalledAsConstructorContext; + //build a frame JSC::CallFrame *newCallFrame = exec; - if (callee == 0 || !(exec->callee() == callee && exec->returnPC() != 0)) { + if (callee == 0 //called from public QScriptEngine::pushContext + || exec->returnPC() == 0 || (contextFlags(exec) & NativeContext) //called from native-native call + || (exec->codeBlock() && exec->callee() != callee)) { //the interpreter did not build a frame for us. //We need to check if the Interpreter might have already created a frame for function called from JS. JSC::Interpreter *interp = exec->interpreter(); JSC::Register *oldEnd = interp->registerFile().end(); @@ -2324,6 +2281,9 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags, argc, callee); } else { setContextFlags(newCallFrame, flags); +#if ENABLE(JIT) + exec->registers()[JSC::RegisterFile::Callee] = JSC::JSValue(callee); //JIT let the callee set the 'callee' +#endif if (calledAsConstructor) { //update the new created this JSC::Register* thisRegister = newCallFrame->registers() - JSC::RegisterFile::CallFrameHeaderSize - newCallFrame->argumentCount(); @@ -3631,9 +3591,6 @@ void QScriptEngine::setAgent(QScriptEngineAgent *agent) QScriptEngineAgentPrivate::get(d->activeAgent)->detach(); d->activeAgent = agent; if (agent) { - int index = d->ownedAgents.indexOf(agent); - if (index == -1) - d->ownedAgents.append(agent); QScriptEngineAgentPrivate::get(agent)->attach(); } } diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 5979b9b..67b2d45 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -57,14 +57,13 @@ #include <QtCore/qhash.h> #include <QtCore/qset.h> +#include "qscriptvalue_p.h" #include "RefPtr.h" #include "Structure.h" #include "JSGlobalObject.h" #include "JSValue.h" -QT_BEGIN_NAMESPACE - namespace JSC { class ExecState; @@ -75,11 +74,12 @@ namespace JSC } +QT_BEGIN_NAMESPACE + class QString; class QStringList; class QScriptContext; class QScriptValue; -class QScriptValuePrivate; class QScriptTypeInfo; class QScriptEngineAgent; class QScriptEnginePrivate; @@ -120,8 +120,8 @@ public: QScriptValue create(int type, const void *ptr); bool hasDemarshalFunction(int type) const; - QScriptValue scriptValueFromJSCValue(JSC::JSValue value); - JSC::JSValue scriptValueToJSCValue(const QScriptValue &value); + inline QScriptValue scriptValueFromJSCValue(JSC::JSValue value); + inline JSC::JSValue scriptValueToJSCValue(const QScriptValue &value); QScriptValue scriptValueFromVariant(const QVariant &value); QVariant scriptValueToVariant(const QScriptValue &value, int targetType); @@ -210,8 +210,11 @@ public: bool scriptDisconnect(JSC::JSValue signal, JSC::JSValue receiver, JSC::JSValue function); - void registerScriptValue(QScriptValuePrivate *value); - void unregisterScriptValue(QScriptValuePrivate *value); + inline QScriptValuePrivate *allocateScriptValuePrivate(size_t); + inline void freeScriptValuePrivate(QScriptValuePrivate *p); + + inline void registerScriptValue(QScriptValuePrivate *value); + inline void unregisterScriptValue(QScriptValuePrivate *value); void detachAllRegisteredScriptValues(); // private slots @@ -237,6 +240,7 @@ public: QScriptEngineAgent *activeAgent; int agentLineNumber; QScriptValuePrivate *registeredScriptValues; + QScriptValuePrivate *freeScriptValues; QHash<int, QScriptTypeInfo*> m_typeInfos; int processEventsInterval; QScriptValue abortResult; @@ -254,6 +258,110 @@ public: #endif }; +inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size) +{ + if (freeScriptValues) { + QScriptValuePrivate *p = freeScriptValues; + freeScriptValues = p->next; + return p; + } + return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size)); +} + +inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p) +{ + p->next = freeScriptValues; + freeScriptValues = p; +} + +inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value) +{ + value->prev = 0; + value->next = registeredScriptValues; + if (registeredScriptValues) + registeredScriptValues->prev = value; + registeredScriptValues = value; +} + +inline void QScriptEnginePrivate::unregisterScriptValue(QScriptValuePrivate *value) +{ + if (value->prev) + value->prev->next = value->next; + if (value->next) + value->next->prev = value->prev; + if (value == registeredScriptValues) + registeredScriptValues = value->next; + value->prev = 0; + value->next = 0; +} + +inline QScriptValue QScriptEnginePrivate::scriptValueFromJSCValue(JSC::JSValue value) +{ + if (!value) + return QScriptValue(); + + QScriptValuePrivate *p_value = new (this)QScriptValuePrivate(this); + p_value->initFrom(value); + return QScriptValuePrivate::toPublic(p_value); +} + +inline JSC::JSValue QScriptEnginePrivate::scriptValueToJSCValue(const QScriptValue &value) +{ + QScriptValuePrivate *vv = QScriptValuePrivate::get(value); + if (!vv) + return JSC::JSValue(); + if (vv->type != QScriptValuePrivate::JSC) { + Q_ASSERT(!vv->engine || vv->engine == this); + vv->engine = this; + if (vv->type == QScriptValuePrivate::Number) { + vv->initFrom(JSC::jsNumber(currentFrame, vv->numberValue)); + } else { //QScriptValuePrivate::String + vv->initFrom(JSC::jsString(currentFrame, vv->stringValue)); + } + } + return vv->jscValue; +} + +inline QScriptValuePrivate::~QScriptValuePrivate() +{ + if (engine) + engine->unregisterScriptValue(this); +} + +inline void QScriptValuePrivate::initFrom(JSC::JSValue value) +{ + if (value.isCell()) { + Q_ASSERT(engine != 0); + value = engine->toUsableValue(value); + } + type = JSC; + jscValue = value; + if (engine) + engine->registerScriptValue(this); +} + +inline void QScriptValuePrivate::initFrom(double value) +{ + type = Number; + numberValue = value; + if (engine) + engine->registerScriptValue(this); +} + +inline void QScriptValuePrivate::initFrom(const QString &value) +{ + type = String; + stringValue = value; + if (engine) + engine->registerScriptValue(this); +} + +inline QScriptValue QScriptValuePrivate::property(const QString &name, int resolveMode) const +{ + JSC::ExecState *exec = engine->currentFrame; + return property(JSC::Identifier(exec, name), resolveMode); +} + QT_END_NAMESPACE #endif diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index b18f29d..193ee21 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -213,6 +213,7 @@ QScriptEngineAgent::QScriptEngineAgent(QScriptEngine *engine) { d_ptr->q_ptr = this; d_ptr->engine = QScriptEnginePrivate::get(engine); + d_ptr->engine->ownedAgents.append(this); } /*! diff --git a/src/script/api/qscriptengineagent_p.h b/src/script/api/qscriptengineagent_p.h index 64befc1..9ef1eaf 100644 --- a/src/script/api/qscriptengineagent_p.h +++ b/src/script/api/qscriptengineagent_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index b9c26f8..de707e9 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -72,7 +72,8 @@ QT_BEGIN_NAMESPACE /*! \internal */ -QScriptStringPrivate::QScriptStringPrivate() +QScriptStringPrivate::QScriptStringPrivate(QScriptEngine *e, const JSC::Identifier &id) + : engine(e), identifier(id) { ref = 0; } @@ -87,12 +88,11 @@ QScriptStringPrivate::~QScriptStringPrivate() /*! \internal */ -void QScriptStringPrivate::init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &value) +void QScriptStringPrivate::init(QScriptString &q, QScriptEngine *engine, + const JSC::Identifier &value) { Q_ASSERT(!q.isValid()); - q.d_ptr = new QScriptStringPrivate(); - q.d_ptr->identifier = value; - q.d_ptr->engine = engine; + q.d_ptr = new QScriptStringPrivate(engine, value); } /*! diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h index 74094bf..3413315 100644 --- a/src/script/api/qscriptstring_p.h +++ b/src/script/api/qscriptstring_p.h @@ -69,10 +69,10 @@ class QScriptEngine; class QScriptStringPrivate { public: - QScriptStringPrivate(); + QScriptStringPrivate(QScriptEngine *engine, const JSC::Identifier &id); ~QScriptStringPrivate(); - static void init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &value); + static void init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &id); QBasicAtomicInt ref; #ifndef QT_NO_QOBJECT diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index c344aed..d5aaed7 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -63,6 +63,7 @@ #include <QtCore/qdatetime.h> #include <QtCore/qregexp.h> #include <QtCore/qvariant.h> +#include <QtCore/qvarlengtharray.h> #include <QtCore/qnumeric.h> #include "utils/qscriptdate_p.h" @@ -71,8 +72,6 @@ #include "bridge/qscriptvariant_p.h" #include "bridge/qscriptqobject_p.h" -QT_BEGIN_NAMESPACE - /*! \since 4.3 \class QScriptValue @@ -202,6 +201,8 @@ QT_BEGIN_NAMESPACE #include <QtCore/qnumeric.h> #include <math.h> +QT_BEGIN_NAMESPACE + namespace QScript { @@ -275,61 +276,9 @@ qsreal ToInteger(qsreal n) } // namespace QScript -QScriptValuePrivate::QScriptValuePrivate() : engine(0), prev(0), next(0) -{ - ref = 0; -} - -QScriptValuePrivate::~QScriptValuePrivate() -{ - if (engine) - engine->unregisterScriptValue(this); -} - -void QScriptValuePrivate::initFrom(JSC::JSValue value) -{ - if (value.isCell()) { - Q_ASSERT(engine != 0); - value = engine->toUsableValue(value); - JSC::JSCell *cell = JSC::asCell(value); - Q_ASSERT(cell != engine->originalGlobalObject()); - } - type = JSC; - jscValue = value; - if (engine) - engine->registerScriptValue(this); -} - -void QScriptValuePrivate::initFrom(double value) -{ - type = Number; - numberValue = value; - if (engine) - engine->registerScriptValue(this); -} - -void QScriptValuePrivate::initFrom(const QString &value) -{ - type = String; - stringValue = value; - if (engine) - engine->registerScriptValue(this); -} - -bool QScriptValuePrivate::isJSC() const -{ - return (type == JSC); -} - -QScriptValue QScriptValuePrivate::property(const QString &name, int resolveMode) const -{ - JSC::ExecState *exec = engine->currentFrame; - return property(JSC::Identifier(exec, name), resolveMode); -} - QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolveMode) const { - Q_ASSERT(isJSC()); + Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; JSC::JSObject *object = jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -352,7 +301,7 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const { - Q_ASSERT(isJSC()); + Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; JSC::JSObject *object = jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -366,6 +315,115 @@ QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const return engine->scriptValueFromJSCValue(result); } +void QScriptValuePrivate::setProperty(const JSC::Identifier &id, const QScriptValue &value, + const QScriptValue::PropertyFlags &flags) +{ + QScriptEngine *valueEngine = value.engine(); + if (valueEngine && (QScriptEnginePrivate::get(valueEngine) != engine)) { + qWarning("QScriptValue::setProperty(%s) failed: " + "cannot set value created in a different engine", + qPrintable(QString(id.ustring()))); + return; + } + JSC::ExecState *exec = engine->currentFrame; + JSC::JSValue jsValue = engine->scriptValueToJSCValue(value); + JSC::JSObject *thisObject = JSC::asObject(jscValue); + JSC::JSValue setter = thisObject->lookupSetter(exec, id); + JSC::JSValue getter = thisObject->lookupGetter(exec, id); + if ((flags & QScriptValue::PropertyGetter) || (flags & QScriptValue::PropertySetter)) { + if (!jsValue) { + // deleting getter/setter + if ((flags & QScriptValue::PropertyGetter) && (flags & QScriptValue::PropertySetter)) { + // deleting both: just delete the property + thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); + } else if (flags & QScriptValue::PropertyGetter) { + // preserve setter, if there is one + thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); + if (setter && setter.isObject()) + thisObject->defineSetter(exec, id, JSC::asObject(setter)); + } else { // flags & QScriptValue::PropertySetter + // preserve getter, if there is one + thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); + if (getter && getter.isObject()) + thisObject->defineGetter(exec, id, JSC::asObject(getter)); + } + } else { + if (jsValue.isObject()) { // ### should check if it has callData() + // defining getter/setter + if (id == exec->propertyNames().underscoreProto) { + qWarning("QScriptValue::setProperty() failed: " + "cannot set getter or setter of native property `__proto__'"); + } else { + if (flags & QScriptValue::PropertyGetter) + thisObject->defineGetter(exec, id, JSC::asObject(jsValue)); + if (flags & QScriptValue::PropertySetter) + thisObject->defineSetter(exec, id, JSC::asObject(jsValue)); + } + } else { + qWarning("QScriptValue::setProperty(): getter/setter must be a function"); + } + } + } else { + // setting the value + if (getter && getter.isObject() && !(setter && setter.isObject())) { + qWarning("QScriptValue::setProperty() failed: " + "property '%s' has a getter but no setter", + qPrintable(QString(id.ustring()))); + return; + } + if (!jsValue) { + // ### check if it's a getter/setter property + thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); + } else if (flags != QScriptValue::KeepExistingFlags) { + if (thisObject->hasOwnProperty(exec, id)) + thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); // ### hmmm - can't we just update the attributes? + unsigned attribs = 0; + if (flags & QScriptValue::ReadOnly) + attribs |= JSC::ReadOnly; + if (flags & QScriptValue::SkipInEnumeration) + attribs |= JSC::DontEnum; + if (flags & QScriptValue::Undeletable) + attribs |= JSC::DontDelete; + attribs |= flags & QScriptValue::UserRange; + thisObject->putWithAttributes(exec, id, jsValue, attribs); + } else { + JSC::PutPropertySlot slot; + thisObject->put(exec, id, jsValue, slot); + } + } +} + +QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags(const JSC::Identifier &id, + const QScriptValue::ResolveFlags &mode) const +{ + JSC::ExecState *exec = engine->currentFrame; + JSC::JSObject *object = JSC::asObject(jscValue); + unsigned attribs = 0; + if (!object->getPropertyAttributes(exec, id, attribs)) { + if ((mode & QScriptValue::ResolvePrototype) && object->prototype() && object->prototype().isObject()) { + QScriptValue proto = engine->scriptValueFromJSCValue(object->prototype()); + return QScriptValuePrivate::get(proto)->propertyFlags(id, mode); + } + return 0; + } + QScriptValue::PropertyFlags result = 0; + if (attribs & JSC::ReadOnly) + result |= QScriptValue::ReadOnly; + if (attribs & JSC::DontEnum) + result |= QScriptValue::SkipInEnumeration; + if (attribs & JSC::DontDelete) + result |= QScriptValue::Undeletable; + //We cannot rely on attribs JSC::Setter/Getter because they are not necesserly set by JSC (bug?) + if (attribs & JSC::Getter || !object->lookupGetter(exec, id).isUndefinedOrNull()) + result |= QScriptValue::PropertyGetter; + if (attribs & JSC::Setter || !object->lookupSetter(exec, id).isUndefinedOrNull()) + result |= QScriptValue::PropertySetter; + if (attribs & QScript::QObjectMemberAttribute) + result |= QScriptValue::QObjectMember; + result |= QScriptValue::PropertyFlag(attribs & QScriptValue::UserRange); + return result; +} + QVariant &QScriptValuePrivate::variantValue() const { Q_ASSERT(jscValue.isObject(&QScriptObject::info)); @@ -405,6 +463,30 @@ void QScriptValuePrivate::detachFromEngine() engine = 0; } +void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine) +{ + if (engine) + return engine->allocateScriptValuePrivate(size); + return qMalloc(size); +} + +void QScriptValuePrivate::operator delete(void *ptr) +{ + QScriptValuePrivate *d = reinterpret_cast<QScriptValuePrivate*>(ptr); + if (d->engine) + d->engine->freeScriptValuePrivate(d); + else + qFree(d); +} + +/*! + \internal +*/ +QScriptValue::QScriptValue(QScriptValuePrivate *d) + : d_ptr(d) +{ +} + /*! Constructs an invalid QScriptValue. */ @@ -439,9 +521,8 @@ QScriptValue::QScriptValue(const QScriptValue &other) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, QScriptValue::SpecialValue value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); switch (value) { case NullValue: d_ptr->initFrom(JSC::jsNull()); @@ -461,9 +542,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, QScriptValue::SpecialValue val registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, bool val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); d_ptr->initFrom(JSC::jsBoolean(val)); } @@ -475,9 +555,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, bool val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, int val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -498,9 +577,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, int val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -521,9 +599,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, uint val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsNumber(exec, val)); @@ -544,9 +621,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val) registers it with the script \a engine. */ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsString(exec, val)); @@ -565,9 +641,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val) #ifndef QT_NO_CAST_FROM_ASCII QScriptValue::QScriptValue(QScriptEngine *engine, const char *val) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine))) { - d_ptr->engine = QScriptEnginePrivate::get(engine); if (engine) { JSC::ExecState *exec = d_ptr->engine->currentFrame; d_ptr->initFrom(JSC::jsString(exec, val)); @@ -583,9 +658,8 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const char *val) Constructs a new QScriptValue with a special \a value. */ QScriptValue::QScriptValue(SpecialValue value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; switch (value) { case NullValue: d_ptr->initFrom(JSC::jsNull()); @@ -602,9 +676,8 @@ QScriptValue::QScriptValue(SpecialValue value) Constructs a new QScriptValue with a boolean \a value. */ QScriptValue::QScriptValue(bool value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(JSC::jsBoolean(value)); } @@ -614,9 +687,8 @@ QScriptValue::QScriptValue(bool value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(int value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -630,9 +702,8 @@ QScriptValue::QScriptValue(int value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(uint value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -646,9 +717,8 @@ QScriptValue::QScriptValue(uint value) Constructs a new QScriptValue with a number \a value. */ QScriptValue::QScriptValue(qsreal value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; JSC::JSValue immediate = JSC::JSImmediate::from(value); if (immediate) d_ptr->initFrom(immediate); @@ -662,9 +732,8 @@ QScriptValue::QScriptValue(qsreal value) Constructs a new QScriptValue with a string \a value. */ QScriptValue::QScriptValue(const QString &value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(value); } @@ -674,9 +743,8 @@ QScriptValue::QScriptValue(const QString &value) Constructs a new QScriptValue with a string \a value. */ QScriptValue::QScriptValue(const QLatin1String &value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(value); } @@ -688,9 +756,8 @@ QScriptValue::QScriptValue(const QLatin1String &value) #ifndef QT_NO_CAST_FROM_ASCII QScriptValue::QScriptValue(const char *value) - : d_ptr(new QScriptValuePrivate) + : d_ptr(new (/*engine=*/0)QScriptValuePrivate(/*engine=*/0)) { - d_ptr->engine = 0; d_ptr->initFrom(QString::fromAscii(value)); } #endif @@ -717,7 +784,7 @@ QScriptValue &QScriptValue::operator=(const QScriptValue &other) bool QScriptValue::isError() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::ErrorInstance::info); } @@ -731,7 +798,7 @@ bool QScriptValue::isError() const bool QScriptValue::isArray() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::JSArray::info); } @@ -745,7 +812,7 @@ bool QScriptValue::isArray() const bool QScriptValue::isDate() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::DateInstance::info); } @@ -759,7 +826,7 @@ bool QScriptValue::isDate() const bool QScriptValue::isRegExp() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::RegExpObject::info); } @@ -774,7 +841,7 @@ bool QScriptValue::isRegExp() const QScriptValue QScriptValue::prototype() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->engine->scriptValueFromJSCValue(JSC::asObject(d->jscValue)->prototype()); } @@ -793,7 +860,7 @@ QScriptValue QScriptValue::prototype() const void QScriptValue::setPrototype(const QScriptValue &prototype) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (prototype.isValid() && prototype.engine() && (prototype.engine() != engine())) { @@ -823,7 +890,7 @@ void QScriptValue::setPrototype(const QScriptValue &prototype) QScriptValue QScriptValue::scope() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); // ### make hidden property return d->property(QLatin1String("__qt_scope__"), QScriptValue::ResolveLocal); @@ -835,7 +902,7 @@ QScriptValue QScriptValue::scope() const void QScriptValue::setScope(const QScriptValue &scope) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (scope.isValid() && scope.engine() && (scope.engine() != engine())) { @@ -867,7 +934,7 @@ void QScriptValue::setScope(const QScriptValue &scope) bool QScriptValue::instanceOf(const QScriptValue &other) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !other.isObject()) + if (!d || !d->isObject() || !other.isObject()) return false; if (other.engine() != engine()) { qWarning("QScriptValue::instanceof: " @@ -1626,9 +1693,10 @@ void QScriptValue::setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; - setProperty(engine()->toStringHandle(name), value, flags); + JSC::ExecState *exec = d->engine->currentFrame; + d->setProperty(JSC::Identifier(exec, name), value, flags); } /*! @@ -1650,7 +1718,7 @@ QScriptValue QScriptValue::property(const QString &name, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->property(name, mode); } @@ -1672,7 +1740,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->property(arrayIndex, mode); } @@ -1693,7 +1761,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, const PropertyFlags &flags) { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (value.engine() && (value.engine() != engine())) { qWarning("QScriptValue::setProperty() failed: " @@ -1743,7 +1811,7 @@ QScriptValue QScriptValue::property(const QScriptString &name, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) + if (!d || !d->isObject() || !name.isValid()) return QScriptValue(); return d->property(name.d_ptr->identifier, mode); } @@ -1766,82 +1834,9 @@ void QScriptValue::setProperty(const QScriptString &name, const PropertyFlags &flags) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) + if (!d || !d->isObject() || !name.isValid()) return; - QScriptEngine *valueEngine = value.engine(); - if (valueEngine && (QScriptEnginePrivate::get(valueEngine) != d->engine)) { - qWarning("QScriptValue::setProperty(%s) failed: " - "cannot set value created in a different engine", - qPrintable(name.toString())); - return; - } - JSC::ExecState *exec = d->engine->currentFrame; - JSC::JSValue jscValue = d->engine->scriptValueToJSCValue(value); - JSC::Identifier id = name.d_ptr->identifier; - JSC::JSObject *thisObject = JSC::asObject(d->jscValue); - JSC::JSValue setter = thisObject->lookupSetter(exec, id); - JSC::JSValue getter = thisObject->lookupGetter(exec, id); - if ((flags & QScriptValue::PropertyGetter) || (flags & QScriptValue::PropertySetter)) { - if (!jscValue) { - // deleting getter/setter - if ((flags & QScriptValue::PropertyGetter) && (flags & QScriptValue::PropertySetter)) { - // deleting both: just delete the property - thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); - } else if (flags & QScriptValue::PropertyGetter) { - // preserve setter, if there is one - thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); - if (setter && setter.isObject()) - thisObject->defineSetter(exec, id, JSC::asObject(setter)); - } else { // flags & QScriptValue::PropertySetter - // preserve getter, if there is one - thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); - if (getter && getter.isObject()) - thisObject->defineGetter(exec, id, JSC::asObject(getter)); - } - } else { - if (jscValue.isObject()) { // ### should check if it has callData() - // defining getter/setter - if (id == exec->propertyNames().underscoreProto) { - qWarning("QScriptValue::setProperty() failed: " - "cannot set getter or setter of native property `__proto__'"); - } else { - if (flags & QScriptValue::PropertyGetter) - thisObject->defineGetter(exec, id, JSC::asObject(jscValue)); - if (flags & QScriptValue::PropertySetter) - thisObject->defineSetter(exec, id, JSC::asObject(jscValue)); - } - } else { - qWarning("QScriptValue::setProperty(): getter/setter must be a function"); - } - } - } else { - // setting the value - if (getter && getter.isObject() && !(setter && setter.isObject())) { - qWarning("QScriptValue::setProperty() failed: " - "property '%s' has a getter but no setter", - qPrintable(name.toString())); - return; - } - if (!jscValue) { - // ### check if it's a getter/setter property - thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); - } else if (flags != QScriptValue::KeepExistingFlags) { - if (thisObject->hasOwnProperty(exec, id)) - thisObject->deleteProperty(exec, id, /*checkDontDelete=*/false); // ### hmmm - can't we just update the attributes? - unsigned attribs = 0; - if (flags & QScriptValue::ReadOnly) - attribs |= JSC::ReadOnly; - if (flags & QScriptValue::SkipInEnumeration) - attribs |= JSC::DontEnum; - if (flags & QScriptValue::Undeletable) - attribs |= JSC::DontDelete; - attribs |= flags & QScriptValue::UserRange; - thisObject->putWithAttributes(exec, id, jscValue, attribs); - } else { - JSC::PutPropertySlot slot; - thisObject->put(exec, id, jscValue, slot); - } - } + d->setProperty(name.d_ptr->identifier, value, flags); } /*! @@ -1853,9 +1848,11 @@ void QScriptValue::setProperty(const QScriptString &name, QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString &name, const ResolveFlags &mode) const { - if (!isObject()) + Q_D(const QScriptValue); + if (!d || !d->isObject()) return 0; - return propertyFlags(engine()->toStringHandle(name), mode); + JSC::ExecState *exec = d->engine->currentFrame; + return d->propertyFlags(JSC::Identifier(exec, name), mode); } @@ -1871,33 +1868,9 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString &nam const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!isObject()) - return 0; - JSC::ExecState *exec = d->engine->currentFrame; - JSC::JSObject *object = JSC::asObject(d->jscValue); - JSC::Identifier id = name.d_ptr->identifier; - unsigned attribs = 0; - if (!object->getPropertyAttributes(exec, id, attribs)) { - if ((mode & QScriptValue::ResolvePrototype) && object->prototype()) - return d->engine->scriptValueFromJSCValue(object->prototype()).propertyFlags(name, mode); + if (!d || !d->isObject() || !name.isValid()) return 0; - } - QScriptValue::PropertyFlags result = 0; - if (attribs & JSC::ReadOnly) - result |= QScriptValue::ReadOnly; - if (attribs & JSC::DontEnum) - result |= QScriptValue::SkipInEnumeration; - if (attribs & JSC::DontDelete) - result |= QScriptValue::Undeletable; - //We cannot rely on attribs JSC::Setter/Getter because they are not necesserly set by JSC (bug?) - if (attribs & JSC::Getter || !object->lookupGetter(exec, id).isUndefinedOrNull()) - result |= QScriptValue::PropertyGetter; - if (attribs & JSC::Setter || !object->lookupSetter(exec, id).isUndefinedOrNull()) - result |= QScriptValue::PropertySetter; - if (attribs & QScript::QObjectMemberAttribute) - result |= QScriptValue::QObjectMember; - result |= QScriptValue::PropertyFlag(attribs & QScriptValue::UserRange); - return result; + return d->propertyFlags(name.d_ptr->identifier, mode); } /*! @@ -1927,7 +1900,12 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, const QScriptValueList &args) { Q_D(const QScriptValue); - if (!isFunction()) + if (!d || !d->isJSC()) + return QScriptValue(); + JSC::JSValue callee = d->jscValue; + JSC::CallData callData; + JSC::CallType callType = callee.getCallData(callData); + if (callType == JSC::CallTypeNone) return QScriptValue(); if (thisObject.engine() && (thisObject.engine() != engine())) { @@ -1936,7 +1914,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, "a different engine"); return QScriptValue(); } - engine()->currentContext()->activationObject(); //force the creation of a context for native function; JSC::ExecState *exec = d->engine->currentFrame; @@ -1944,8 +1921,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, if (!jscThisObject || !jscThisObject.isObject()) jscThisObject = d->engine->globalObject(); - QVector<JSC::JSValue> argsVector; - argsVector.resize(args.size()); + QVarLengthArray<JSC::JSValue, 8> argsVector(args.size()); for (int i = 0; i < args.size(); ++i) { const QScriptValue &arg = args.at(i); if (!arg.isValid()) { @@ -1961,9 +1937,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, } JSC::ArgList jscArgs(argsVector.data(), argsVector.size()); - JSC::JSValue callee = d->jscValue; - JSC::CallData callData; - JSC::CallType callType = callee.getCallData(callData); JSC::JSValue savedException; QScriptValuePrivate::saveException(exec, &savedException); JSC::JSValue result = JSC::call(exec, callee, callType, callData, jscThisObject, jscArgs); @@ -2002,7 +1975,12 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, const QScriptValue &arguments) { Q_D(QScriptValue); - if (!isFunction()) + if (!d || !d->isJSC()) + return QScriptValue(); + JSC::JSValue callee = d->jscValue; + JSC::CallData callData; + JSC::CallType callType = callee.getCallData(callData); + if (callType == JSC::CallTypeNone) return QScriptValue(); if (thisObject.engine() && (thisObject.engine() != engine())) { @@ -2011,7 +1989,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, "a different engine"); return QScriptValue(); } - engine()->currentContext()->activationObject(); //force the creation of a context for native function; JSC::ExecState *exec = d->engine->currentFrame; @@ -2040,9 +2017,6 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, } } - JSC::JSValue callee = d->jscValue; - JSC::CallData callData; - JSC::CallType callType = callee.getCallData(callData); JSC::JSValue savedException; QScriptValuePrivate::saveException(exec, &savedException); JSC::JSValue result = JSC::call(exec, callee, callType, callData, jscThisObject, applyArgs); @@ -2075,13 +2049,17 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, QScriptValue QScriptValue::construct(const QScriptValueList &args) { Q_D(const QScriptValue); - if (!isFunction()) + if (!d || !d->isJSC()) + return QScriptValue(); + JSC::JSValue callee = d->jscValue; + JSC::ConstructData constructData; + JSC::ConstructType constructType = callee.getConstructData(constructData); + if (constructType == JSC::ConstructTypeNone) return QScriptValue(); - engine()->currentContext()->activationObject(); //force the creation of a context for native function; + JSC::ExecState *exec = d->engine->currentFrame; - QVector<JSC::JSValue> argsVector; - argsVector.resize(args.size()); + QVarLengthArray<JSC::JSValue, 8> argsVector(args.size()); for (int i = 0; i < args.size(); ++i) { if (!args.at(i).isValid()) argsVector[i] = JSC::jsUndefined(); @@ -2091,9 +2069,6 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) JSC::ArgList jscArgs(argsVector.data(), argsVector.size()); - JSC::JSValue callee = d->jscValue; - JSC::ConstructData constructData; - JSC::ConstructType constructType = callee.getConstructData(constructData); JSC::JSValue savedException; QScriptValuePrivate::saveException(exec, &savedException); JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, jscArgs); @@ -2123,9 +2098,14 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) QScriptValue QScriptValue::construct(const QScriptValue &arguments) { Q_D(QScriptValue); - if (!isFunction()) + if (!d || !d->isJSC()) + return QScriptValue(); + JSC::JSValue callee = d->jscValue; + JSC::ConstructData constructData; + JSC::ConstructType constructType = callee.getConstructData(constructData); + if (constructType == JSC::ConstructTypeNone) return QScriptValue(); - engine()->currentContext()->activationObject(); //force the creation of a context for native function; + JSC::ExecState *exec = d->engine->currentFrame; JSC::JSValue array = d->engine->scriptValueToJSCValue(arguments); @@ -2148,9 +2128,6 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) } } - JSC::JSValue callee = d->jscValue; - JSC::ConstructData constructData; - JSC::ConstructType constructType = callee.getConstructData(constructData); JSC::JSValue savedException; QScriptValuePrivate::saveException(exec, &savedException); JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, applyArgs); @@ -2295,7 +2272,7 @@ bool QScriptValue::isUndefined() const bool QScriptValue::isObject() const { Q_D(const QScriptValue); - return d && d->isJSC() && d->jscValue.isObject(); + return d && d->isObject(); } /*! @@ -2342,10 +2319,9 @@ bool QScriptValue::isQObject() const bool QScriptValue::isQMetaObject() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return JSC::asObject(d->jscValue)->isObject(&QScript::QMetaObjectWrapperObject::info); - return false; } /*! @@ -2369,7 +2345,7 @@ bool QScriptValue::isValid() const QScriptValue QScriptValue::data() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); if (d->jscValue.isObject(&QScriptObject::info)) { QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); @@ -2391,7 +2367,7 @@ QScriptValue QScriptValue::data() const void QScriptValue::setData(const QScriptValue &data) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; JSC::JSValue other = d->engine->scriptValueToJSCValue(data); if (d->jscValue.isObject(&QScriptObject::info)) { @@ -2445,8 +2421,13 @@ QScriptClass *QScriptValue::scriptClass() const void QScriptValue::setScriptClass(QScriptClass *scriptClass) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info)) + if (!d || !d->isObject()) return; + if (!d->jscValue.isObject(&QScriptObject::info)) { + qWarning("QScriptValue::setScriptClass() failed: " + "cannot change class of non-QScriptObject"); + return; + } QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); QScriptObjectDelegate *delegate = scriptObject->delegate(); if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) { diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 67b9514..afa247a 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -220,6 +220,8 @@ private: // force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called inline QScriptValue(QScriptEngine *, void *); + QScriptValue(QScriptValuePrivate*); + private: QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr; diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index bab59fe..6d57d32 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -55,11 +55,11 @@ #include <QtCore/qobjectdefs.h> -QT_BEGIN_NAMESPACE - #include "wtf/Platform.h" #include "JSValue.h" +QT_BEGIN_NAMESPACE + class QString; class QScriptEnginePrivate; @@ -68,40 +68,45 @@ class QScriptValuePrivate { Q_DISABLE_COPY(QScriptValuePrivate); public: + void* operator new(size_t, QScriptEnginePrivate*); + void operator delete(void*); + enum Type { JSC, Number, String }; - QScriptValuePrivate(); - ~QScriptValuePrivate(); + inline QScriptValuePrivate(QScriptEnginePrivate*); + inline ~QScriptValuePrivate(); - void initFrom(JSC::JSValue value); - void initFrom(double value); - void initFrom(const QString &value); + inline void initFrom(JSC::JSValue value); + inline void initFrom(double value); + inline void initFrom(const QString &value); - bool isJSC() const; + inline bool isJSC() const; + inline bool isObject() const; QVariant &variantValue() const; void setVariantValue(const QVariant &value); - static QScriptValuePrivate *get(const QScriptValue &q) + static inline QScriptValuePrivate *get(const QScriptValue &q) { return q.d_ptr.data(); } - static QScriptValue toPublic(QScriptValuePrivate *d) + static inline QScriptValue toPublic(QScriptValuePrivate *d) { - QScriptValue tmp; - tmp.d_ptr = d; - d->ref.ref(); - return tmp; + return QScriptValue(d); } QScriptValue property(const JSC::Identifier &id, int resolveMode) const; QScriptValue property(quint32 index, int resolveMode) const; - QScriptValue property(const QString &, int resolveMode) const; + inline QScriptValue property(const QString &, int resolveMode) const; + void setProperty(const JSC::Identifier &id, const QScriptValue &value, + const QScriptValue::PropertyFlags &flags); + QScriptValue::PropertyFlags propertyFlags( + const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode) const; void detachFromEngine(); @@ -129,6 +134,23 @@ public: QBasicAtomicInt ref; }; +inline QScriptValuePrivate::QScriptValuePrivate(QScriptEnginePrivate *e) + : engine(e), prev(0), next(0) +{ + ref = 0; +} + +inline bool QScriptValuePrivate::isJSC() const +{ + return (type == JSC); +} + +inline bool QScriptValuePrivate::isObject() const +{ + return isJSC() && jscValue && jscValue.isObject(); +} + +// Rest of inline functions implemented in qscriptengine_p.h QT_END_NAMESPACE diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp index a8a2181..7712b87 100644 --- a/src/script/bridge/qscriptactivationobject.cpp +++ b/src/script/bridge/qscriptactivationobject.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index f6c6792..13b5ebe 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp index 27ec203..4764f68 100644 --- a/src/script/bridge/qscriptfunction.cpp +++ b/src/script/bridge/qscriptfunction.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -59,6 +59,8 @@ ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWrapper); ASSERT_CLASS_FITS_IN_CELL(QScript::FunctionWithArgWrapper); } +QT_BEGIN_NAMESPACE + namespace QScript { diff --git a/src/script/bridge/qscriptglobalobject.cpp b/src/script/bridge/qscriptglobalobject.cpp index eb8673e..3fa5879 100644 --- a/src/script/bridge/qscriptglobalobject.cpp +++ b/src/script/bridge/qscriptglobalobject.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -45,16 +45,17 @@ #include "../api/qscriptengine.h" #include "../api/qscriptengine_p.h" -QT_BEGIN_NAMESPACE - namespace JSC { +QT_USE_NAMESPACE ASSERT_CLASS_FITS_IN_CELL(QScript::GlobalObject); ASSERT_CLASS_FITS_IN_CELL(QScript::OriginalGlobalObjectProxy); } // namespace JSC +QT_BEGIN_NAMESPACE + namespace QScript { @@ -99,6 +100,15 @@ void GlobalObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName JSC::JSGlobalObject::put(exec, propertyName, value, slot); } +void GlobalObject::putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, + JSC::JSValue value, unsigned attributes) +{ + if (customGlobalObject) + customGlobalObject->putWithAttributes(exec, propertyName, value, attributes); + else + JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes); +} + bool GlobalObject::deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, bool checkDontDelete) { diff --git a/src/script/bridge/qscriptglobalobject_p.h b/src/script/bridge/qscriptglobalobject_p.h index 673f7f6..11b1482 100644 --- a/src/script/bridge/qscriptglobalobject_p.h +++ b/src/script/bridge/qscriptglobalobject_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -74,6 +74,8 @@ public: JSC::PropertySlot&); virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); + virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, + JSC::JSValue value, unsigned attributes); virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName, bool checkDontDelete = true); @@ -115,6 +117,8 @@ public: virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot& slot) { originalGlobalObject->JSC::JSGlobalObject::put(exec, propertyName, value, slot); } + virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, unsigned attributes) + { originalGlobalObject->JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes); } virtual bool deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, bool checkDontDelete = true) { return originalGlobalObject->JSC::JSGlobalObject::deleteProperty(exec, propertyName, checkDontDelete); } diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp index a550d39..e59c542 100644 --- a/src/script/bridge/qscriptobject.cpp +++ b/src/script/bridge/qscriptobject.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -43,14 +43,15 @@ #include "qscriptobject_p.h" #include "private/qobject_p.h" -QT_BEGIN_NAMESPACE - namespace JSC { +//QT_USE_NAMESPACE ASSERT_CLASS_FITS_IN_CELL(QScriptObject); ASSERT_CLASS_FITS_IN_CELL(QScriptObjectPrototype); } +QT_BEGIN_NAMESPACE + // masquerading as JSC::JSObject const JSC::ClassInfo QScriptObject::info = { "Object", 0, 0, 0 }; @@ -94,6 +95,8 @@ void QScriptObject::setDelegate(QScriptObjectDelegate *delegate) { if (!d) d = new Data(); + else + delete d->delegate; d->delegate = delegate; } diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h index d499c61..3ae7146 100644 --- a/src/script/bridge/qscriptobject_p.h +++ b/src/script/bridge/qscriptobject_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index b7a0e44..ac540ef 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -61,10 +61,9 @@ #include "RegExpObject.h" #include "RegExpConstructor.h" -QT_BEGIN_NAMESPACE - namespace JSC { +QT_USE_NAMESPACE ASSERT_CLASS_FITS_IN_CELL(QScript::QObjectPrototype); ASSERT_CLASS_FITS_IN_CELL(QScript::QMetaObjectWrapperObject); ASSERT_CLASS_FITS_IN_CELL(QScript::QMetaObjectPrototype); @@ -72,6 +71,8 @@ ASSERT_CLASS_FITS_IN_CELL(QScript::QtFunction); ASSERT_CLASS_FITS_IN_CELL(QScript::QtPropertyFunction); } +QT_BEGIN_NAMESPACE + namespace QScript { @@ -2022,8 +2023,7 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) int argc = parameterTypes.count(); JSC::ExecState *exec = engine->currentFrame; - QVector<JSC::JSValue> argsVector; - argsVector.resize(argc); + QVarLengthArray<JSC::JSValue, 8> argsVector(argc); for (int i = 0; i < argc; ++i) { // ### optimize -- no need to convert via QScriptValue QScriptValue actual; @@ -2210,12 +2210,12 @@ void QObjectData::registerWrapper(QScriptObject *wrapper, } // namespace QScript +QT_END_NAMESPACE + namespace JSC { ASSERT_CLASS_FITS_IN_CELL(QScript::QtFunction); } -QT_END_NAMESPACE - #include "moc_qscriptqobject_p.cpp" diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h index 64853ff..9401910 100644 --- a/src/script/bridge/qscriptqobject_p.h +++ b/src/script/bridge/qscriptqobject_p.h @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp index ee59e4f..ab75a02 100644 --- a/src/script/bridge/qscriptvariant.cpp +++ b/src/script/bridge/qscriptvariant.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,13 +49,14 @@ #include "PrototypeFunction.h" #include "JSString.h" -QT_BEGIN_NAMESPACE - namespace JSC { +QT_USE_NAMESPACE ASSERT_CLASS_FITS_IN_CELL(QScript::QVariantPrototype); } +QT_BEGIN_NAMESPACE + namespace QScript { @@ -136,7 +137,7 @@ static JSC::JSValue JSC_HOST_CALL variantProtoFuncToString(JSC::ExecState *exec, JSC::JSValue value = variantProtoFuncValueOf(exec, callee, thisValue, args); if (value.isObject()) { result = v.toString(); - if (result.isEmpty()) { + if (result.isEmpty() && !v.canConvert(QVariant::String)) { result = "QVariant("; result += v.typeName(); result += ")"; diff --git a/src/script/script.pro b/src/script/script.pro index 5844620..301386d 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -10,6 +10,9 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore include(../qbase.pri) +# Disable a few warnings on Windows. +win32-msvc*: QMAKE_CXXFLAGS += -wd4291 -wd4344 -wd4503 -wd4800 -wd4819 -wd4996 -wd4396 -wd4099 + # disable JIT for now DEFINES += ENABLE_JIT=0 # FIXME: shared the statically built JavaScriptCore diff --git a/src/script/utils/qscriptdate.cpp b/src/script/utils/qscriptdate.cpp index 4f235f6..a6abe4a 100644 --- a/src/script/utils/qscriptdate.cpp +++ b/src/script/utils/qscriptdate.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp index d228745..1288991 100644 --- a/src/scripttools/debugging/qscriptcompletiontask.cpp +++ b/src/scripttools/debugging/qscriptcompletiontask.cpp @@ -76,6 +76,8 @@ public: }; QScriptCompletionTaskPrivate::QScriptCompletionTaskPrivate() + : cursorPosition(0), frameIndex(0), commandScheduler(0), + jobScheduler(0), console(0) { } diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index c9bc650..a316894 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -1019,7 +1019,7 @@ class SyncBreakpointsJob : public QScriptDebuggerCommandSchedulerJob public: SyncBreakpointsJob(QScriptDebuggerPrivate *debugger) : QScriptDebuggerCommandSchedulerJob(debugger), - m_debugger(debugger) {} + m_debugger(debugger), m_index(-1) {} void start() { QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this); diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp index 492b79f..3fc9d7b 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent.cpp +++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp @@ -61,11 +61,11 @@ QT_BEGIN_NAMESPACE */ QScriptDebuggerAgentPrivate::QScriptDebuggerAgentPrivate() + : state(NoState), stepDepth(0), stepCount(0), + targetScriptId(-1), targetLineNumber(-1), returnCounter(0), + nextBreakpointId(1), hitBreakpointId(0), + nextContextId(0), statementCounter(0) { - state = NoState; - nextBreakpointId = 1; - nextContextId = 0; - statementCounter = 0; } QScriptDebuggerAgentPrivate::~QScriptDebuggerAgentPrivate() diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp index d6f63ee..63382d0 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp @@ -131,14 +131,13 @@ private: QScriptDebuggerBackendPrivate::QScriptDebuggerBackendPrivate() + : agent(0), commandExecutor(0), + pendingEvaluateContextIndex(-1), pendingEvaluateLineNumber(-1), + ignoreExceptions(false), + nextScriptValueIteratorId(0), nextScriptObjectSnapshotId(0), + eventReceiver(0), + q_ptr(0) // q_ptr will be set later by QScriptDebuggerBackend constructor { - eventReceiver = 0; - agent = 0; - commandExecutor = 0; - pendingEvaluateLineNumber = -1; - ignoreExceptions = false; - nextScriptValueIteratorId = 0; - nextScriptObjectSnapshotId = 0; } QScriptDebuggerBackendPrivate::~QScriptDebuggerBackendPrivate() diff --git a/src/scripttools/debugging/qscriptdebuggerevent.cpp b/src/scripttools/debugging/qscriptdebuggerevent.cpp index 5fab17e..393f7a9 100644 --- a/src/scripttools/debugging/qscriptdebuggerevent.cpp +++ b/src/scripttools/debugging/qscriptdebuggerevent.cpp @@ -60,6 +60,7 @@ public: }; QScriptDebuggerEventPrivate::QScriptDebuggerEventPrivate() + : type(QScriptDebuggerEvent::None) { } diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp index 167053d..a6096f2 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp @@ -367,7 +367,7 @@ class QScriptDebuggerScriptedConsoleCommandJobPrivate : public QScriptDebuggerConsoleCommandJobPrivate { public: - QScriptDebuggerScriptedConsoleCommandJobPrivate() {} + QScriptDebuggerScriptedConsoleCommandJobPrivate() : command(0), commandCount(0) {} ~QScriptDebuggerScriptedConsoleCommandJobPrivate() {} QScriptDebuggerScriptedConsoleCommandPrivate *command; diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 6a8609e..06ee3e1 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -743,37 +743,31 @@ void QODBCDriverPrivate::splitTableQualifier(const QString & qualifier, QString QODBCDriverPrivate::DefaultCase QODBCDriverPrivate::defaultCase() const { - static bool isInitialized = false; - static DefaultCase ret; - - if (!isInitialized) { - SQLUSMALLINT casing; - int r = SQLGetInfo(hDbc, - SQL_IDENTIFIER_CASE, - &casing, - sizeof(casing), - NULL); - if ( r != SQL_SUCCESS) - ret = Lower;//arbitrary case if driver cannot be queried - else { - switch (casing) { - case (SQL_IC_UPPER): - ret = Upper; - break; - case (SQL_IC_LOWER): - ret = Lower; - break; - case (SQL_IC_SENSITIVE): - ret = Sensitive; - break; - case (SQL_IC_MIXED): - ret = Mixed; - break; - default: - ret = Upper; - } + DefaultCase ret; + SQLUSMALLINT casing; + int r = SQLGetInfo(hDbc, + SQL_IDENTIFIER_CASE, + &casing, + sizeof(casing), + NULL); + if ( r != SQL_SUCCESS) + ret = Mixed;//arbitrary case if driver cannot be queried + else { + switch (casing) { + case (SQL_IC_UPPER): + ret = Upper; + break; + case (SQL_IC_LOWER): + ret = Lower; + break; + case (SQL_IC_SENSITIVE): + ret = Sensitive; + break; + case (SQL_IC_MIXED): + default: + ret = Mixed; + break; } - isInitialized = true; } return ret; } diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 372ea13..94071c9 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1150,12 +1150,13 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const case QVariant::Time: #ifndef QT_NO_DATESTRING if (field.value().toTime().isValid()) { - r = field.value().toTime().toString(Qt::ISODate); + r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); } else #endif { r = QLatin1String("NULL"); } + break; case QVariant::String: { // Escape '\' characters diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index f45a1d3..81afbf9 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -64,6 +64,17 @@ Q_DECLARE_METATYPE(sqlite3_stmt*) QT_BEGIN_NAMESPACE +static QString _q_escapeIdentifier(const QString &identifier) +{ + QString res = identifier; + if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); + res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } + return res; +} + static QVariant::Type qGetColumnType(const QString &tpName) { const QString typeName = tpName.toLower(); @@ -629,7 +640,7 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only schema = tableName.left(indexOfSeparator).append(QLatin1Char('.')); table = tableName.mid(indexOfSeparator + 1); } - q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info ('") + table + QLatin1String("')")); + q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")")); QSqlIndex ind; while (q.next()) { @@ -684,13 +695,7 @@ QVariant QSQLiteDriver::handle() const QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const { - QString res = identifier; - if(!identifier.isEmpty() && !isIdentifierEscaped(identifier, type) ) { - res.replace(QLatin1Char('"'), QLatin1String("\"\"")); - res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); - res.replace(QLatin1Char('.'), QLatin1String("\".\"")); - } - return res; + return _q_escapeIdentifier(identifier); } QT_END_NAMESPACE diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 40cf06b..6f30b90 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -56,20 +56,21 @@ QT_BEGIN_NAMESPACE -#define QT_SVG_DRAW_SHAPE(command) \ - applyStyle(p, states); \ - qreal oldOpacity = p->opacity(); \ - QBrush oldBrush = p->brush(); \ - QPen oldPen = p->pen(); \ - p->setPen(Qt::NoPen); \ - p->setOpacity(oldOpacity * states.fillOpacity); \ - command; \ - p->setOpacity(oldOpacity); \ - p->setPen(oldPen); \ - p->setBrush(Qt::NoBrush); \ - command; \ - p->setBrush(oldBrush); \ - revertStyle(p, states); +#define QT_SVG_DRAW_SHAPE(command) \ + qreal oldOpacity = p->opacity(); \ + QBrush oldBrush = p->brush(); \ + QPen oldPen = p->pen(); \ + p->setPen(Qt::NoPen); \ + p->setOpacity(oldOpacity * states.fillOpacity); \ + command; \ + p->setPen(oldPen); \ + if (oldPen.widthF() != 0) { \ + p->setOpacity(oldOpacity * states.strokeOpacity); \ + p->setBrush(Qt::NoBrush); \ + command; \ + p->setBrush(oldBrush); \ + } \ + p->setOpacity(oldOpacity); void QSvgAnimation::draw(QPainter *, QSvgExtraStates &) @@ -105,7 +106,9 @@ QRectF QSvgCircle::bounds() const void QSvgCircle::draw(QPainter *p, QSvgExtraStates &states) { + applyStyle(p, states); QT_SVG_DRAW_SHAPE(p->drawEllipse(m_bounds)); + revertStyle(p, states); } QSvgArc::QSvgArc(QSvgNode *parent, const QPainterPath &path) @@ -117,7 +120,12 @@ QSvgArc::QSvgArc(QSvgNode *parent, const QPainterPath &path) void QSvgArc::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); - p->drawPath(cubic); + if (p->pen().widthF() != 0) { + qreal oldOpacity = p->opacity(); + p->setOpacity(oldOpacity * states.strokeOpacity); + p->drawPath(cubic); + p->setOpacity(oldOpacity); + } revertStyle(p, states); } @@ -140,7 +148,9 @@ QRectF QSvgEllipse::bounds() const void QSvgEllipse::draw(QPainter *p, QSvgExtraStates &states) { + applyStyle(p, states); QT_SVG_DRAW_SHAPE(p->drawEllipse(m_bounds)); + revertStyle(p, states); } QSvgImage::QSvgImage(QSvgNode *parent, const QImage &image, @@ -171,7 +181,12 @@ QSvgLine::QSvgLine(QSvgNode *parent, const QLineF &line) void QSvgLine::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); - p->drawLine(m_bounds); + if (p->pen().widthF() != 0) { + qreal oldOpacity = p->opacity(); + p->setOpacity(oldOpacity * states.strokeOpacity); + p->drawLine(m_bounds); + p->setOpacity(oldOpacity); + } revertStyle(p, states); } @@ -184,7 +199,10 @@ QSvgPath::QSvgPath(QSvgNode *parent, const QPainterPath &qpath) void QSvgPath::draw(QPainter *p, QSvgExtraStates &states) { + applyStyle(p, states); + m_path.setFillRule(states.fillRule); QT_SVG_DRAW_SHAPE(p->drawPath(m_path)); + revertStyle(p, states); } QRectF QSvgPath::bounds() const @@ -198,7 +216,7 @@ QRectF QSvgPath::bounds() const } QSvgPolygon::QSvgPolygon(QSvgNode *parent, const QPolygonF &poly) - : QSvgNode(parent), m_poly(poly), m_fillRule(Qt::WindingFill) + : QSvgNode(parent), m_poly(poly) { } @@ -216,7 +234,9 @@ QRectF QSvgPolygon::bounds() const void QSvgPolygon::draw(QPainter *p, QSvgExtraStates &states) { - QT_SVG_DRAW_SHAPE(p->drawPolygon(m_poly, m_fillRule)); + applyStyle(p, states); + QT_SVG_DRAW_SHAPE(p->drawPolygon(m_poly, states.fillRule)); + revertStyle(p, states); } @@ -229,13 +249,19 @@ QSvgPolyline::QSvgPolyline(QSvgNode *parent, const QPolygonF &poly) void QSvgPolyline::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); + qreal oldOpacity = p->opacity(); if (p->brush().style() != Qt::NoBrush) { QPen save = p->pen(); p->setPen(QPen(Qt::NoPen)); - p->drawPolygon(m_poly); + p->setOpacity(oldOpacity * states.fillOpacity); + p->drawPolygon(m_poly, states.fillRule); p->setPen(save); } - p->drawPolyline(m_poly); + if (p->pen().widthF() != 0) { + p->setOpacity(oldOpacity * states.strokeOpacity); + p->drawPolyline(m_poly); + } + p->setOpacity(oldOpacity); revertStyle(p, states); } @@ -259,11 +285,13 @@ QRectF QSvgRect::bounds() const void QSvgRect::draw(QPainter *p, QSvgExtraStates &states) { + applyStyle(p, states); if (m_rx || m_ry) { QT_SVG_DRAW_SHAPE(p->drawRoundedRect(m_rect, m_rx, m_ry, Qt::RelativeSize)); } else { QT_SVG_DRAW_SHAPE(p->drawRect(m_rect)); } + revertStyle(p, states); } QSvgTspan * const QSvgText::LINEBREAK = 0; @@ -296,6 +324,8 @@ void QSvgText::setTextArea(const QSizeF &size) void QSvgText::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); + qreal oldOpacity = p->opacity(); + p->setOpacity(oldOpacity * states.fillOpacity); // Force the font to have a size of 100 pixels to avoid truncation problems // when the font is very small. @@ -456,6 +486,7 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) } p->setWorldTransform(oldTransform, false); + p->setOpacity(oldOpacity); revertStyle(p, states); } diff --git a/src/svg/qsvggraphics_p.h b/src/svg/qsvggraphics_p.h index 20310e3..02c312b 100644 --- a/src/svg/qsvggraphics_p.h +++ b/src/svg/qsvggraphics_p.h @@ -155,13 +155,8 @@ public: virtual void draw(QPainter *p, QSvgExtraStates &states); virtual Type type() const; virtual QRectF bounds() const; - void setFillRule(Qt::FillRule f) - { - m_fillRule = f; - } private: QPolygonF m_poly; - Qt::FillRule m_fillRule; }; class QSvgPolyline : public QSvgNode diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index adfe468..5b778d2 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -493,8 +493,7 @@ static bool resolveColor(const QString &colorStr, QColor &color, QSvgHandler *ha int(compo[1]), int(compo[2])); return true; - } else if (colorStr == QLatin1String("inherited") || - colorStr == QT_INHERIT) { + } else if (colorStr == QT_INHERIT) { return false; } else if (colorStr == QLatin1String("currentColor")) { color = handler->currentColor(); @@ -649,7 +648,7 @@ static void parseBrush(QSvgNode *node, QString myId = someId(attributes); if (!value.isEmpty() || !fillRule.isEmpty() || !opacity.isEmpty()) { - QSvgFillStyle *prop = new QSvgFillStyle(0); + QSvgFillStyle *prop = new QSvgFillStyle; //fill-rule attribute handling if (!fillRule.isEmpty() && fillRule != QT_INHERIT) { @@ -670,7 +669,8 @@ static void parseBrush(QSvgNode *node, value = value.remove(0, 3); QSvgStyleProperty *style = styleFromUrl(node, value); if (style) { - prop->setFillStyle(style); + if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) + prop->setFillStyle(reinterpret_cast<QSvgFillStyleProperty *>(style)); } else { QString id = idFromUrl(value); prop->setGradientId(id); @@ -834,154 +834,95 @@ static void parsePen(QSvgNode *node, //qDebug()<<"Node "<<node->type()<<", attrs are "<<value<<width; - if (!value.isEmpty() || !width.isEmpty() || !dashArray.isEmpty() || !linecap.isEmpty() || - !linejoin.isEmpty() || !miterlimit.isEmpty() || !opacity.isEmpty() || - !dashOffset.isEmpty() || !vectorEffect.isEmpty()) { + if (!value.isEmpty() || !dashArray.isEmpty() || !dashOffset.isEmpty() || !linecap.isEmpty() + || !linejoin.isEmpty() || !miterlimit.isEmpty() || !opacity.isEmpty() || !width.isEmpty() + || !vectorEffect.isEmpty()) { - QSvgStrokeStyle *inherited = - static_cast<QSvgStrokeStyle*>(node->parent()->styleProperty( - QSvgStyleProperty::STROKE)); - - QPen pen(handler->defaultPen()); - bool stroke = false; - if (inherited) { - pen = inherited->qpen(); - stroke = inherited->strokePresent(); - } - - // stroke-opacity attribute handling - qreal strokeAlpha; - if (!opacity.isEmpty() && opacity != QT_INHERIT) { - strokeAlpha = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); - } else { - strokeAlpha = pen.color().alphaF(); - } + QSvgStrokeStyle *prop = new QSvgStrokeStyle; //stroke attribute handling - if (!value.isEmpty() && value != QT_INHERIT) { + if ((!value.isEmpty()) && (value != QT_INHERIT) ) { if (value.startsWith(QLatin1String("url"))) { value = value.remove(0, 3); QSvgStyleProperty *style = styleFromUrl(node, value); if (style) { - if (style->type() == QSvgStyleProperty::GRADIENT) { - QBrush b(*((QSvgGradientStyle*)style)->qgradient()); - pen.setBrush(b); - } else if (style->type() == QSvgStyleProperty::SOLID_COLOR) { - pen.setColor( - ((QSvgSolidColorStyle*)style)->qcolor()); - } - stroke = true; + if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) + prop->setStyle(reinterpret_cast<QSvgFillStyleProperty *>(style)); } else { - qWarning() << "QSvgHandler::parsePen could not resolve property" << idFromUrl(value); + QString id = idFromUrl(value); + prop->setGradientId(id); + prop->setGradientResolved(false); } - } else if (value == QLatin1String("none")) { - QColor color; //### fixme: dafalut value for color. - color.setAlphaF(strokeAlpha); - pen.setColor(color); - stroke = false; // This is required because, parent may have a valid stroke but the child may have stroke = "none" - } else { + } else if (value != QLatin1String("none")) { QColor color; - if (resolveColor(value, color, handler)) { - color.setAlphaF(strokeAlpha); - pen.setColor(color); - } - stroke = true; + if (resolveColor(value, color, handler)) + prop->setStroke(QBrush(color)); + } else { + prop->setStroke(QBrush(Qt::NoBrush)); } - } else { - QColor color = pen.color(); - color.setAlphaF(strokeAlpha); - pen.setColor(color); } //stroke-width handling + qreal w = 0; if (!width.isEmpty() && width != QT_INHERIT) { - qreal widthF; QSvgHandler::LengthType lt; - widthF = parseLength(width, lt, handler); - pen.setWidthF(widthF); + prop->setWidth(w = parseLength(width, lt, handler)); + } + + //stroke-dasharray + if (!dashArray.isEmpty() && dashArray != QT_INHERIT) { + if (dashArray == QLatin1String("none")) { + prop->setDashArrayNone(); + } else { + const QChar *s = dashArray.constData(); + QVector<qreal> dashes = parseNumbersList(s); + // if the dash count is odd the dashes should be duplicated + if ((dashes.size() & 1) != 0) + dashes << QVector<qreal>(dashes); + prop->setDashArray(dashes); + } } //stroke-linejoin attribute handling if (!linejoin.isEmpty()) { if (linejoin == QLatin1String("miter")) - pen.setJoinStyle(Qt::SvgMiterJoin); + prop->setLineJoin(Qt::SvgMiterJoin); else if (linejoin == QLatin1String("round")) - pen.setJoinStyle(Qt::RoundJoin); + prop->setLineJoin(Qt::RoundJoin); else if (linejoin == QLatin1String("bevel")) - pen.setJoinStyle(Qt::BevelJoin); + prop->setLineJoin(Qt::BevelJoin); } //stroke-linecap attribute handling if (!linecap.isEmpty()) { if (linecap == QLatin1String("butt")) - pen.setCapStyle(Qt::FlatCap); + prop->setLineCap(Qt::FlatCap); else if (linecap == QLatin1String("round")) - pen.setCapStyle(Qt::RoundCap); + prop->setLineCap(Qt::RoundCap); else if (linecap == QLatin1String("square")) - pen.setCapStyle(Qt::SquareCap); + prop->setLineCap(Qt::SquareCap); } - //strok-dasharray attribute handling - qreal penw = pen.widthF(); - if (!dashArray.isEmpty() && dashArray != QT_INHERIT) { - const QChar *s = dashArray.constData(); - QVector<qreal> dashes = parseNumbersList(s); - qreal *d = dashes.data(); - if (penw != 0) - for (int i = 0; i < dashes.size(); ++i) { - *d /= penw; - ++d; - } - // if the dash count is odd the dashes should be duplicated - if (dashes.size() % 2 != 0) - dashes << QVector<qreal>(dashes); - pen.setDashPattern(dashes); - } else if (inherited) { - QVector<qreal> dashes(inherited->qpen().dashPattern()); - qreal *d = dashes.data(); - if (!penw) - penw = 1.0; - qreal inheritpenw = inherited->qpen().widthF(); - if (!inheritpenw) - inheritpenw = 1.0; - for ( int i = 0; i < dashes.size(); ++i) { - *d *= (inheritpenw/ penw); - ++d; - } - pen.setDashPattern(dashes); - } - - //stroke-dashoffset attribute handling - if (!dashOffset.isEmpty() && dashOffset != QT_INHERIT) { - qreal doffset = toDouble(dashOffset); - if (penw != 0) - doffset /= penw; - pen.setDashOffset(doffset); - } else if (inherited) { - qreal doffset = pen.dashOffset(); - if (!penw) - penw = 1.0; - qreal inheritpenw = inherited->qpen().widthF(); - if (!inheritpenw) - inheritpenw = 1.0; - doffset *= (inheritpenw/ penw); - pen.setDashOffset(doffset); - } + if (!dashOffset.isEmpty() && dashOffset != QT_INHERIT) + prop->setDashOffset(toDouble(dashOffset)); //vector-effect attribute handling if (!vectorEffect.isEmpty()) { if (vectorEffect == QLatin1String("non-scaling-stroke")) - pen.setCosmetic(true); + prop->setVectorEffect(true); else if (vectorEffect == QLatin1String("none")) - pen.setCosmetic(false); + prop->setVectorEffect(false); } + //stroke-miterlimit if (!miterlimit.isEmpty() && miterlimit != QT_INHERIT) - pen.setMiterLimit(toDouble(miterlimit)); + prop->setMiterLimit(toDouble(miterlimit)); + + //stroke-opacity atttribute handling + if (!opacity.isEmpty() && opacity != QT_INHERIT) + prop->setOpacity(qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity)))); - QSvgStrokeStyle *prop = new QSvgStrokeStyle(pen); - prop->setStroke(stroke); node->appendStyleProperty(prop, myId); } } @@ -2770,7 +2711,7 @@ static bool parseStopNode(QSvgStyleProperty *parent, colorStr = QLatin1String("#000000"); } - bool colorOK = constructColor(colorStr, opacityStr, color, handler); + constructColor(colorStr, opacityStr, color, handler); QGradient *grad = style->qgradient(); @@ -2794,8 +2735,6 @@ static bool parseStopNode(QSvgStyleProperty *parent, grad->setColorAt(offset, color); style->setGradientStopsSet(true); - if (!colorOK) - style->addResolve(offset); return true; } @@ -2849,19 +2788,16 @@ static QSvgNode *createSvgNode(QSvgNode *parent, node->setHeight(int(height), type == QSvgHandler::LT_PERCENT); } + QStringList viewBoxValues; if (!viewBoxStr.isEmpty()) { - QStringList lst = viewBoxStr.split(QLatin1Char(' '), QString::SkipEmptyParts); - if (lst.count() != 4) - lst = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts); - int count = lst.count(); - while (count < 4) { - lst.append(QLatin1String("")); - count++; - } - QString xStr = lst.at(0).trimmed(); - QString yStr = lst.at(1).trimmed(); - QString widthStr = lst.at(2).trimmed(); - QString heightStr = lst.at(3).trimmed(); + viewBoxStr = viewBoxStr.replace(QLatin1Char(' '), QLatin1Char(',')); + viewBoxValues = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts); + } + if (viewBoxValues.count() == 4) { + QString xStr = viewBoxValues.at(0).trimmed(); + QString yStr = viewBoxValues.at(1).trimmed(); + QString widthStr = viewBoxValues.at(2).trimmed(); + QString heightStr = viewBoxValues.at(3).trimmed(); QSvgHandler::LengthType lt; qreal x = parseLength(xStr, lt, handler); @@ -3363,7 +3299,7 @@ bool QSvgHandler::startElement(const QString &localName, m_style = prop; m_nodes.top()->appendStyleProperty(prop, someId(attributes), true); } else { - qWarning("Couldn't parse node: %s", qPrintable(localName)); + qWarning("Could not parse node: %s", qPrintable(localName)); } } else if (StyleParseMethod method = findStyleUtilFactoryMethod(localName)) { if (m_style) { @@ -3422,15 +3358,28 @@ bool QSvgHandler::endElement(const QStringRef &localName) QList<QSvgNode*>::iterator itr = ren.begin(); while (itr != ren.end()) { QSvgNode *eleNode = *itr++; - QSvgFillStyle *prop = static_cast<QSvgFillStyle*>(eleNode->styleProperty(QSvgStyleProperty::FILL)); - if (prop && !(prop->isGradientResolved())) { - QString id = prop->getGradientId(); + QSvgFillStyle *fill = static_cast<QSvgFillStyle*>(eleNode->styleProperty(QSvgStyleProperty::FILL)); + if (fill && !(fill->isGradientResolved())) { + QString id = fill->gradientId(); + QSvgStyleProperty *style = structureNode->scopeStyle(id); + if (style) { + if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) + fill->setFillStyle(reinterpret_cast<QSvgFillStyleProperty *>(style)); + } else { + qWarning("Could not resolve property : %s",qPrintable(id)); + fill->setBrush(QBrush(Qt::NoBrush)); + } + } + QSvgStrokeStyle *stroke = static_cast<QSvgStrokeStyle*>(eleNode->styleProperty(QSvgStyleProperty::STROKE)); + if (stroke && !(stroke->isGradientResolved())) { + QString id = stroke->gradientId(); QSvgStyleProperty *style = structureNode->scopeStyle(id); if (style) { - prop->setFillStyle(style); + if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) + stroke->setStyle(reinterpret_cast<QSvgFillStyleProperty *>(style)); } else { - qWarning("Couldn't resolve property : %s",qPrintable(id)); - prop->setBrush(QBrush(Qt::NoBrush)); + qWarning("Could not resolve property : %s",qPrintable(id)); + stroke->setStroke(QBrush(Qt::NoBrush)); } } } diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp index 33907fd..de5a568 100644 --- a/src/svg/qsvgnode.cpp +++ b/src/svg/qsvgnode.cpp @@ -320,9 +320,11 @@ qreal QSvgNode::strokeWidth() const { QSvgStrokeStyle *stroke = static_cast<QSvgStrokeStyle*>( styleProperty(QSvgStyleProperty::STROKE)); - if (!stroke || !stroke->strokePresent()) + if (!stroke) return 0; - return stroke->qpen().widthF(); + if (stroke->stroke().brush().style() == Qt::NoBrush) + return 0; + return stroke->width(); } QT_END_NAMESPACE diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index e1a7049..13a0d30 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -59,9 +59,13 @@ QT_BEGIN_NAMESPACE QSvgExtraStates::QSvgExtraStates() : fillOpacity(1.0) + , strokeOpacity(1.0) , svgFont(0) , textAnchor(Qt::AlignLeft) , fontWeight(400) + , fillRule(Qt::WindingFill) + , strokeDashOffset(0) + , vectorEffect(false) { } @@ -69,6 +73,17 @@ QSvgStyleProperty::~QSvgStyleProperty() { } +void QSvgFillStyleProperty::apply(QPainter *, const QRectF &, QSvgNode *, QSvgExtraStates &) +{ + Q_ASSERT(!"This should not be called!"); +} + +void QSvgFillStyleProperty::revert(QPainter *, QSvgExtraStates &) +{ + Q_ASSERT(!"This should not be called!"); +} + + QSvgQualityStyle::QSvgQualityStyle(int color) : m_colorRendering(color) { @@ -83,83 +98,55 @@ void QSvgQualityStyle::revert(QPainter *, QSvgExtraStates &) } -QSvgFillStyle::QSvgFillStyle(const QBrush &brush) - : m_fill(brush) - , m_style(0) - , m_fillRuleSet(false) +QSvgFillStyle::QSvgFillStyle() + : m_style(0) , m_fillRule(Qt::WindingFill) - , m_fillOpacitySet(false) + , m_oldFillRule(Qt::WindingFill) , m_fillOpacity(1.0) - , m_oldOpacity(0) - , m_gradientResolved(true) - , m_fillSet(true) -{ -} - -QSvgFillStyle::QSvgFillStyle(QSvgStyleProperty *style) - : m_style(style) - , m_fillRuleSet(false) - , m_fillRule(Qt::WindingFill) - , m_fillOpacitySet(false) - , m_fillOpacity(1.0) - , m_oldOpacity(0) - , m_gradientResolved(true) - , m_fillSet(style != 0) + , m_oldFillOpacity(0) + , m_gradientResolved(1) + , m_fillRuleSet(0) + , m_fillOpacitySet(0) + , m_fillSet(0) { } void QSvgFillStyle::setFillRule(Qt::FillRule f) { - m_fillRuleSet = true; + m_fillRuleSet = 1; m_fillRule = f; } void QSvgFillStyle::setFillOpacity(qreal opacity) { - m_fillOpacitySet = true; + m_fillOpacitySet = 1; m_fillOpacity = opacity; } -void QSvgFillStyle::setFillStyle(QSvgStyleProperty* style) +void QSvgFillStyle::setFillStyle(QSvgFillStyleProperty* style) { m_style = style; - m_fillSet = true; + m_fillSet = 1; } void QSvgFillStyle::setBrush(QBrush brush) { m_fill = brush; m_style = 0; - m_fillSet = true; + m_fillSet = 1; } -static void recursivelySetFill(QSvgNode *node, Qt::FillRule f) -{ - if (node->type() == QSvgNode::PATH) { - QSvgPath *path = static_cast<QSvgPath*>(node); - path->qpath()->setFillRule(f); - } else if (node->type() == QSvgNode::POLYGON) { - QSvgPolygon *polygon = static_cast<QSvgPolygon*>(node); - polygon->setFillRule(f); - } else if (node->type() == QSvgNode::G) { - QList<QSvgNode*> renderers = static_cast<QSvgG*>(node)->renderers(); - foreach(QSvgNode *n, renderers) { - recursivelySetFill(n, f); - } - } -} -void QSvgFillStyle::apply(QPainter *p, const QRectF &rect, QSvgNode *node, QSvgExtraStates &states) +void QSvgFillStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &states) { m_oldFill = p->brush(); - m_oldOpacity = states.fillOpacity; + m_oldFillRule = states.fillRule; + m_oldFillOpacity = states.fillOpacity; - if (m_fillRuleSet) { - recursivelySetFill(node, m_fillRule); - m_fillRuleSet = false;//set it only on the first run - } + if (m_fillRuleSet) + states.fillRule = m_fillRule; if (m_fillSet) { if (m_style) - m_style->apply(p, rect, node, states); + p->setBrush(m_style->brush(p, states)); else p->setBrush(m_fill); } @@ -170,13 +157,11 @@ void QSvgFillStyle::apply(QPainter *p, const QRectF &rect, QSvgNode *node, QSvgE void QSvgFillStyle::revert(QPainter *p, QSvgExtraStates &states) { if (m_fillOpacitySet) - states.fillOpacity = m_oldOpacity; - if (m_fillSet) { - if (m_style) - m_style->revert(p, states); - else - p->setBrush(m_oldFill); - } + states.fillOpacity = m_oldFillOpacity; + if (m_fillSet) + p->setBrush(m_oldFill); + if (m_fillRuleSet) + states.fillRule = m_oldFillRule; } QSvgViewportFillStyle::QSvgViewportFillStyle(const QBrush &brush) @@ -286,47 +271,137 @@ void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &states) states.fontWeight = m_oldWeight; } -QSvgStrokeStyle::QSvgStrokeStyle(const QPen &pen) - : m_stroke(pen), m_strokePresent(true) +QSvgStrokeStyle::QSvgStrokeStyle() + : m_strokeOpacity(1.0) + , m_oldStrokeOpacity(0.0) + , m_strokeDashOffset(0) + , m_oldStrokeDashOffset(0) + , m_style(0) + , m_gradientResolved(1) + , m_vectorEffect(0) + , m_oldVectorEffect(0) + , m_strokeSet(0) + , m_strokeDashArraySet(0) + , m_strokeDashOffsetSet(0) + , m_strokeLineCapSet(0) + , m_strokeLineJoinSet(0) + , m_strokeMiterLimitSet(0) + , m_strokeOpacitySet(0) + , m_strokeWidthSet(0) + , m_vectorEffectSet(0) { } -void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &) +void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &states) { m_oldStroke = p->pen(); - if (!m_strokePresent || !m_stroke.widthF() || !m_stroke.color().alphaF()) { - p->setPen(Qt::NoPen); - } else { - p->setPen(m_stroke); + m_oldStrokeOpacity = states.strokeOpacity; + m_oldStrokeDashOffset = states.strokeDashOffset; + m_oldVectorEffect = states.vectorEffect; + + QPen pen = p->pen(); + + qreal oldWidth = pen.widthF(); + qreal width = m_stroke.widthF(); + if (oldWidth == 0) + oldWidth = 1; + if (width == 0) + width = 1; + qreal scale = oldWidth / width; + + if (m_strokeOpacitySet) + states.strokeOpacity = m_strokeOpacity; + + if (m_vectorEffectSet) + states.vectorEffect = m_vectorEffect; + + if (m_strokeSet) { + if (m_style) + pen.setBrush(m_style->brush(p, states)); + else + pen.setBrush(m_stroke.brush()); } -} -void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &) -{ - p->setPen(m_oldStroke); + if (m_strokeWidthSet) + pen.setWidthF(m_stroke.widthF()); + + bool setDashOffsetNeeded = false; + + if (m_strokeDashOffsetSet) { + states.strokeDashOffset = m_strokeDashOffset; + setDashOffsetNeeded = true; + } + + if (m_strokeDashArraySet) { + if (m_stroke.style() == Qt::SolidLine) { + pen.setStyle(Qt::SolidLine); + } else if (m_strokeWidthSet || oldWidth == 1) { + // If both width and dash array was set, the dash array is already scaled correctly. + pen.setDashPattern(m_stroke.dashPattern()); + setDashOffsetNeeded = true; + } else { + // If dash array was set, but not the width, the dash array has to be scaled with respect to the old width. + QVector<qreal> dashes = m_stroke.dashPattern(); + for (int i = 0; i < dashes.size(); ++i) + dashes[i] /= oldWidth; + pen.setDashPattern(dashes); + setDashOffsetNeeded = true; + } + } else if (m_strokeWidthSet && pen.style() != Qt::SolidLine && scale != 1) { + // If the width was set, but not the dash array, the old dash array must be scaled with respect to the new width. + QVector<qreal> dashes = pen.dashPattern(); + for (int i = 0; i < dashes.size(); ++i) + dashes[i] *= scale; + pen.setDashPattern(dashes); + setDashOffsetNeeded = true; + } + + if (m_strokeLineCapSet) + pen.setCapStyle(m_stroke.capStyle()); + if (m_strokeLineJoinSet) + pen.setJoinStyle(m_stroke.joinStyle()); + if (m_strokeMiterLimitSet) + pen.setMiterLimit(m_stroke.miterLimit()); + + if (setDashOffsetNeeded) { + qreal currentWidth = pen.widthF(); + if (currentWidth == 0) + currentWidth = 1; + pen.setDashOffset(states.strokeDashOffset / currentWidth); + } + + pen.setCosmetic(states.vectorEffect); + + p->setPen(pen); } -QSvgSolidColorStyle::QSvgSolidColorStyle(const QColor &color) - : m_solidColor(color) +void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &states) { + p->setPen(m_oldStroke); + states.strokeOpacity = m_oldStrokeOpacity; + states.strokeDashOffset = m_oldStrokeDashOffset; + states.vectorEffect = m_oldVectorEffect; } -void QSvgSolidColorStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &) +void QSvgStrokeStyle::setDashArray(const QVector<qreal> &dashes) { - m_oldFill = p->brush(); - m_oldStroke = p->pen(); - QBrush b = m_oldFill; - b.setColor(m_solidColor); - p->setBrush(b); - QPen pen = m_oldStroke; - pen.setColor(m_solidColor); - p->setPen(pen); + if (m_strokeWidthSet) { + QVector<qreal> d = dashes; + qreal w = m_stroke.widthF(); + if (w != 0 && w != 1) { + for (int i = 0; i < d.size(); ++i) + d[i] /= w; + } + m_stroke.setDashPattern(d); + } else { + m_stroke.setDashPattern(dashes); + } + m_strokeDashArraySet = 1; } -void QSvgSolidColorStyle::revert(QPainter *p, QSvgExtraStates &) +QSvgSolidColorStyle::QSvgSolidColorStyle(const QColor &color) + : m_solidColor(color) { - p->setBrush(m_oldFill); - p->setPen(m_oldStroke); } QSvgGradientStyle::QSvgGradientStyle(QGradient *grad) @@ -334,44 +409,24 @@ QSvgGradientStyle::QSvgGradientStyle(QGradient *grad) { } -void QSvgGradientStyle::apply(QPainter *p, const QRectF &/*rect*/, QSvgNode *, QSvgExtraStates &) +QBrush QSvgGradientStyle::brush(QPainter *, QSvgExtraStates &) { if (!m_link.isEmpty()) { resolveStops(); } - m_oldFill = p->brush(); - - //resolving stop colors - if (!m_resolvePoints.isEmpty()) { - QColor color = p->brush().color(); - if (!color.isValid()) - color = p->pen().color(); - QList<qreal>::const_iterator itr = m_resolvePoints.constBegin(); - for (; itr != m_resolvePoints.constEnd(); ++itr) { - //qDebug()<<"resolving "<<(*itr)<<" to "<<color; - m_gradient->setColorAt(*itr, color); - } - } - // If the gradient is marked as empty, insert transparent black if (!m_gradientStopsSet) { m_gradient->setStops(QGradientStops() << QGradientStop(0.0, QColor(0, 0, 0, 0))); m_gradientStopsSet = true; } - QBrush brush; - brush = QBrush(*m_gradient); + QBrush b(*m_gradient); if (!m_matrix.isIdentity()) - brush.setMatrix(m_matrix); - - p->setBrush(brush); -} + b.setMatrix(m_matrix); -void QSvgGradientStyle::revert(QPainter *p, QSvgExtraStates &) -{ - p->setBrush(m_oldFill); + return b; } @@ -380,11 +435,6 @@ void QSvgGradientStyle::setMatrix(const QMatrix &mat) m_matrix = mat; } -void QSvgGradientStyle::addResolve(qreal offset) -{ - m_resolvePoints.append(offset); -} - QSvgTransformStyle::QSvgTransformStyle(const QTransform &trans) : m_transform(trans) { @@ -490,14 +540,6 @@ void QSvgStyle::apply(QPainter *p, const QRectF &rect, QSvgNode *node, QSvgExtra stroke->apply(p, rect, node, states); } - if (solidColor) { - solidColor->apply(p, rect, node, states); - } - - if (gradient) { - gradient->apply(p, rect, node, states); - } - if (transform) { transform->apply(p, rect, node, states); } @@ -562,14 +604,6 @@ void QSvgStyle::revert(QPainter *p, QSvgExtraStates &states) stroke->revert(p, states); } - if (solidColor) { - solidColor->revert(p, states); - } - - if (gradient) { - gradient->revert(p, states); - } - //animated transforms need to be reverted _before_ //the native transforms if (!animateTransforms.isEmpty()) { @@ -604,7 +638,7 @@ void QSvgStyle::revert(QPainter *p, QSvgExtraStates &states) QSvgAnimateTransform::QSvgAnimateTransform(int startMs, int endMs, int byMs ) : QSvgStyleProperty(), m_from(startMs), m_to(endMs), m_by(byMs), - m_type(Empty), m_count(0), m_finished(false), m_additive(Replace), m_transformApplied(false) + m_type(Empty), m_additive(Replace), m_count(0), m_finished(false), m_transformApplied(false) { m_totalRunningTime = m_to - m_from; } @@ -815,7 +849,9 @@ void QSvgAnimateColor::apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgEx if (totalTimeElapsed < m_from || m_finished) return; - qreal animationFrame = (totalTimeElapsed - m_from) / m_to; + qreal animationFrame = 0; + if (m_totalRunningTime != 0) + animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime; if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { m_finished = true; diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index 056b73b..f358bc1 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -143,9 +143,13 @@ struct QSvgExtraStates QSvgExtraStates(); qreal fillOpacity; + qreal strokeOpacity; QSvgFont *svgFont; Qt::Alignment textAnchor; int fontWeight; + Qt::FillRule fillRule; + qreal strokeDashOffset; + bool vectorEffect; // true if pen is cosmetic }; class QSvgStyleProperty : public QSvgRefCounted @@ -173,6 +177,14 @@ public: virtual Type type() const=0; }; +class QSvgFillStyleProperty : public QSvgStyleProperty +{ +public: + virtual QBrush brush(QPainter *p, QSvgExtraStates &states) = 0; + virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states); + virtual void revert(QPainter *p, QSvgExtraStates &states); +}; + class QSvgQualityStyle : public QSvgStyleProperty { public: @@ -220,15 +232,14 @@ private: class QSvgFillStyle : public QSvgStyleProperty { public: - QSvgFillStyle(const QBrush &brush); - QSvgFillStyle(QSvgStyleProperty *style); + QSvgFillStyle(); virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states); virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; void setFillRule(Qt::FillRule f); void setFillOpacity(qreal opacity); - void setFillStyle(QSvgStyleProperty* style); + void setFillStyle(QSvgFillStyleProperty* style); void setBrush(QBrush brush); const QBrush & qbrush() const @@ -246,7 +257,7 @@ public: return m_fillRule; } - QSvgStyleProperty* style() const + QSvgFillStyleProperty* style() const { return m_style; } @@ -256,7 +267,7 @@ public: m_gradientId = Id; } - QString getGradientId() const + QString gradientId() const { return m_gradientId; } @@ -276,16 +287,19 @@ private: // fill-opacity v v 'inherit' | <OpacityValue.datatype> QBrush m_fill; QBrush m_oldFill; - QSvgStyleProperty *m_style; + QSvgFillStyleProperty *m_style; - bool m_fillRuleSet; Qt::FillRule m_fillRule; - bool m_fillOpacitySet; + Qt::FillRule m_oldFillRule; qreal m_fillOpacity; - qreal m_oldOpacity; + qreal m_oldFillOpacity; + QString m_gradientId; - bool m_gradientResolved; - bool m_fillSet; + uint m_gradientResolved : 1; + + uint m_fillRuleSet : 1; + uint m_fillOpacitySet : 1; + uint m_fillSet : 1; }; class QSvgViewportFillStyle : public QSvgStyleProperty @@ -384,36 +398,121 @@ private: Qt::Alignment m_oldTextAnchor; int m_oldWeight; - unsigned m_familySet : 1; - unsigned m_sizeSet : 1; - unsigned m_styleSet : 1; - unsigned m_variantSet : 1; - unsigned m_weightSet : 1; - unsigned m_textAnchorSet : 1; + uint m_familySet : 1; + uint m_sizeSet : 1; + uint m_styleSet : 1; + uint m_variantSet : 1; + uint m_weightSet : 1; + uint m_textAnchorSet : 1; }; class QSvgStrokeStyle : public QSvgStyleProperty { public: - QSvgStrokeStyle(const QPen &pen); + QSvgStrokeStyle(); virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states); virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; - void setStroke(bool stroke) + void setStroke(QBrush brush) + { + m_stroke.setBrush(brush); + m_style = 0; + m_strokeSet = 1; + } + + void setStyle(QSvgFillStyleProperty *style) + { + m_style = style; + m_strokeSet = 1; + } + + void setDashArray(const QVector<qreal> &dashes); + + void setDashArrayNone() + { + m_stroke.setStyle(Qt::SolidLine); + m_strokeDashArraySet = 1; + } + + void setDashOffset(qreal offset) + { + m_strokeDashOffset = offset; + m_strokeDashOffsetSet = 1; + } + + void setLineCap(Qt::PenCapStyle cap) + { + m_stroke.setCapStyle(cap); + m_strokeLineCapSet = 1; + } + + void setLineJoin(Qt::PenJoinStyle join) + { + m_stroke.setJoinStyle(join); + m_strokeLineJoinSet = 1; + } + + void setMiterLimit(qreal limit) + { + m_stroke.setMiterLimit(limit); + m_strokeMiterLimitSet = 1; + } + + void setOpacity(qreal opacity) + { + m_strokeOpacity = opacity; + m_strokeOpacitySet = 1; + } + + void setWidth(qreal width) + { + m_stroke.setWidthF(width); + m_strokeWidthSet = 1; + Q_ASSERT(!m_strokeDashArraySet); // set width before dash array. + } + + qreal width() + { + return m_stroke.widthF(); + } + + void setVectorEffect(bool nonScalingStroke) + { + m_vectorEffect = nonScalingStroke; + m_vectorEffectSet = 1; + } + + QSvgFillStyleProperty* style() const + { + return m_style; + } + + void setGradientId(const QString &Id) + { + m_gradientId = Id; + } + + QString gradientId() const { - m_strokePresent = stroke; + return m_gradientId; } - bool strokePresent() const + void setGradientResolved(bool resolved) { - return m_strokePresent; + m_gradientResolved = resolved; } - const QPen & qpen() const + bool isGradientResolved() const + { + return m_gradientResolved; + } + + QPen stroke() const { return m_stroke; } + private: // stroke v v 'inherit' | <Paint.datatype> // stroke-dasharray v v 'inherit' | <StrokeDashArrayValue.datatype> @@ -425,22 +524,44 @@ private: // stroke-width v v 'inherit' | <StrokeWidthValue.datatype> QPen m_stroke; QPen m_oldStroke; - bool m_strokePresent; -}; + qreal m_strokeOpacity; + qreal m_oldStrokeOpacity; + qreal m_strokeDashOffset; + qreal m_oldStrokeDashOffset; + QSvgFillStyleProperty *m_style; + QString m_gradientId; + uint m_gradientResolved : 1; + uint m_vectorEffect : 1; + uint m_oldVectorEffect : 1; + + uint m_strokeSet : 1; + uint m_strokeDashArraySet : 1; + uint m_strokeDashOffsetSet : 1; + uint m_strokeLineCapSet : 1; + uint m_strokeLineJoinSet : 1; + uint m_strokeMiterLimitSet : 1; + uint m_strokeOpacitySet : 1; + uint m_strokeWidthSet : 1; + uint m_vectorEffectSet : 1; +}; -class QSvgSolidColorStyle : public QSvgStyleProperty +class QSvgSolidColorStyle : public QSvgFillStyleProperty { public: QSvgSolidColorStyle(const QColor &color); - virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states); - virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; const QColor & qcolor() const { return m_solidColor; } + + QBrush brush(QPainter *, QSvgExtraStates &) + { + return m_solidColor; + } + private: // solid-color v x 'inherit' | <SVGColor.datatype> // solid-opacity v x 'inherit' | <OpacityValue.datatype> @@ -450,13 +571,11 @@ private: QPen m_oldStroke; }; -class QSvgGradientStyle : public QSvgStyleProperty +class QSvgGradientStyle : public QSvgFillStyleProperty { public: QSvgGradientStyle(QGradient *grad); ~QSvgGradientStyle() { delete m_gradient; } - virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states); - virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; void setStopLink(const QString &link, QSvgTinyDocument *doc); @@ -474,8 +593,6 @@ public: return m_gradient; } - void addResolve(qreal offset); - bool gradientStopsSet() const { return m_gradientStopsSet; @@ -485,12 +602,10 @@ public: { m_gradientStopsSet = set; } + + QBrush brush(QPainter *, QSvgExtraStates &); private: QGradient *m_gradient; - QList<qreal> m_resolvePoints; - - QBrush m_oldFill; - QMatrix m_matrix; QSvgTinyDocument *m_doc; diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index 614494f..e6b0e8e 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -240,7 +240,9 @@ void QSvgTinyDocument::draw(QPainter *p, const QRectF &bounds) //sets default style on the painter //### not the most optimal way mapSourceToTarget(p, bounds); - p->setPen(Qt::NoPen); + QPen pen(Qt::NoBrush, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + pen.setMiterLimit(4); + p->setPen(pen); p->setBrush(Qt::black); p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::SmoothPixmapTransform); @@ -281,7 +283,9 @@ void QSvgTinyDocument::draw(QPainter *p, const QString &id, QTransform originalTransform = p->worldTransform(); //XXX set default style on the painter - p->setPen(Qt::NoPen); + QPen pen(Qt::NoBrush, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + pen.setMiterLimit(4); + p->setPen(pen); p->setBrush(Qt::black); p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::SmoothPixmapTransform); diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 9a09c19..e0667bb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1659,10 +1659,8 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) IOPMAssertionRelease(powerID); } #endif -//# ifdef Q_OS_WIN - // rethrow exception to make debugging easier + // Rethrow exception to make debugging easier. throw; -//# endif return 1; } # endif diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 130b565..c9322e9 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -309,6 +309,7 @@ void QTestLog::stopLogging() void QTestLog::warn(const char *msg) { + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); QTest::testLogger->addMessage(QAbstractTestLogger::Warn, msg); @@ -316,9 +317,10 @@ void QTestLog::warn(const char *msg) void QTestLog::info(const char *msg, const char *file, int line) { + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); + QTEST_ASSERT(file); - if (QTest::testLogger) QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); } diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 4c99eaa..a1f44ca 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -216,20 +216,6 @@ int runMoc(int _argc, char **_argv) } } - // report Qt usage for commercial customers with a "metered license" (currently experimental) -#if QT_EDITION != QT_EDITION_OPENSOURCE -#ifdef QT_CONFIGURE_BINARIES_PATH - const char *binariesPath = QT_CONFIGURE_BINARIES_PATH; - QString reporterPath = QString::fromLocal8Bit(binariesPath) + QDir::separator() - + QLatin1String("qtusagereporter"); -#if defined(Q_OS_WIN) - reporterPath += QLatin1String(".exe"); -#endif - if (QFile::exists(reporterPath)) - system(qPrintable(reporterPath + QLatin1String(" moc"))); -#endif -#endif - argc = argv.count(); for (int n = 0; n < argc; ++n) { diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index c03e874..0f3193d 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -58,7 +58,7 @@ struct Type enum ReferenceType { NoReference, Reference, Pointer }; inline Type() : isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} - inline explicit Type(const QByteArray &_name) : name(_name), isVolatile(false), firstToken(NOTOKEN), referenceType(NoReference) {} + inline explicit Type(const QByteArray &_name) : name(_name), isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} QByteArray name; uint isVolatile : 1; uint isScoped : 1; @@ -139,7 +139,7 @@ struct ClassInfoDef struct ClassDef { ClassDef(): - hasQObject(false), hasQGadget(false), notifyableProperties(0){} + hasQObject(false), hasQGadget(false), notifyableProperties(0), begin(0), end(0){} QByteArray classname; QByteArray qualified; QList<QPair<QByteArray, FunctionDef::Access> > superclassList; diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index 9d97085..363f8af 100644 --- a/src/tools/uic/main.cpp +++ b/src/tools/uic/main.cpp @@ -138,21 +138,6 @@ int runUic(int argc, char *argv[]) ++arg; } - // report Qt usage for commercial customers with a "metered license" (currently experimental) -#if QT_EDITION != QT_EDITION_OPENSOURCE -#ifdef QT_CONFIGURE_BINARIES_PATH - const char *binariesPath = QT_CONFIGURE_BINARIES_PATH; - QString reporterPath = QString::fromLocal8Bit(binariesPath); - reporterPath += QDir::separator(); - reporterPath += QLatin1String("qtusagereporter"); -#if defined(Q_OS_WIN) - reporterPath += QLatin1String(".exe"); -#endif - if (QFile::exists(reporterPath)) - system(qPrintable(reporterPath + QLatin1String(" uic"))); -#endif -#endif - QString inputFile; if (fileName) inputFile = QString::fromLocal8Bit(fileName); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index cd9f37e..ac6ba37 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -56,6 +56,7 @@ #include <qxml.h> #include <qvariant.h> #include <qmap.h> +#include <qshareddata.h> #include <qdebug.h> #include <stdio.h> @@ -124,7 +125,8 @@ static void qt_split_namespace(QString& prefix, QString& name, const QString& qN class QDomImplementationPrivate { public: - QDomImplementationPrivate() { ref = 1; } + inline QDomImplementationPrivate() {} + QDomImplementationPrivate* clone(); QAtomicInt ref; static QDomImplementation::InvalidDataPolicy invalidDataPolicy; @@ -537,8 +539,8 @@ public: void clear(); // Variables - QScopedSharedPointer<QDomImplementationPrivate> impl; - QScopedSharedPointer<QDomDocumentTypePrivate> type; + QExplicitlySharedDataPointer<QDomImplementationPrivate> impl; + QExplicitlySharedDataPointer<QDomDocumentTypePrivate> type; void saveDocument(QTextStream& stream, const int indent, QDomNode::EncodingPolicy encUsed) const; @@ -864,10 +866,7 @@ static QString fixedSystemLiteral(const QString &data, bool *ok) QDomImplementationPrivate* QDomImplementationPrivate::clone() { - QDomImplementationPrivate* p = new QDomImplementationPrivate; - // We are not interested in this node - p->ref.deref(); - return p; + return new QDomImplementationPrivate; } /************************************************************** @@ -6149,20 +6148,22 @@ void QDomProcessingInstruction::setData(const QString& d) QDomDocumentPrivate::QDomDocumentPrivate() : QDomNodePrivate(0), + impl(new QDomImplementationPrivate), nodeListTime(1) { - impl.reset(new QDomImplementationPrivate); - type.reset(new QDomDocumentTypePrivate(this, this)); + type = new QDomDocumentTypePrivate(this, this); + type->ref.deref(); name = QLatin1String("#document"); } QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname) : QDomNodePrivate(0), + impl(new QDomImplementationPrivate), nodeListTime(1) { - impl.reset(new QDomImplementationPrivate); - type.reset(new QDomDocumentTypePrivate(this, this)); + type = new QDomDocumentTypePrivate(this, this); + type->ref.deref(); type->name = aname; name = QLatin1String("#document"); @@ -6170,13 +6171,14 @@ QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname) QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt) : QDomNodePrivate(0), + impl(new QDomImplementationPrivate), nodeListTime(1) { - impl.reset(new QDomImplementationPrivate); if (dt != 0) { - type.assign(dt); + type = dt; } else { - type.reset(new QDomDocumentTypePrivate(this, this)); + type = new QDomDocumentTypePrivate(this, this); + type->ref.deref(); } name = QLatin1String("#document"); @@ -6184,10 +6186,10 @@ QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt) QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep) : QDomNodePrivate(n, deep), + impl(n->impl->clone()), nodeListTime(1) { - impl.assign(n->impl->clone()); - type.assign((QDomDocumentTypePrivate*)n->type->cloneNode()); + type = static_cast<QDomDocumentTypePrivate*>(n->type->cloneNode()); type->setParent(this); } @@ -6197,8 +6199,8 @@ QDomDocumentPrivate::~QDomDocumentPrivate() void QDomDocumentPrivate::clear() { - impl.assign(0); - type.assign(0); + impl.reset(); + type.reset(); QDomNodePrivate::clear(); } @@ -6219,8 +6221,9 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProc bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn) { clear(); - impl.reset(new QDomImplementationPrivate); - type.reset(new QDomDocumentTypePrivate(this, this)); + impl = new QDomImplementationPrivate; + type = new QDomDocumentTypePrivate(this, this); + type->ref.deref(); bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces")) && !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes")); @@ -7369,11 +7372,9 @@ QDomComment QDomNode::toComment() const **************************************************************/ QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, bool namespaceProcessing) + : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false), + nsProcessing(namespaceProcessing), locator(0) { - doc = adoc; - node = doc; - cdata = false; - nsProcessing = namespaceProcessing; } QDomHandler::~QDomHandler() @@ -7405,7 +7406,9 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri } else { n = doc->createElement(qName); } - n->setLocation(locator->lineNumber(), locator->columnNumber()); + + if (n) + n->setLocation(locator->lineNumber(), locator->columnNumber()); node->appendChild(n); node = n; @@ -7425,7 +7428,7 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri bool QDomHandler::endElement(const QString&, const QString&, const QString&) { - if (node == doc) + if (!node || node == doc) return false; node = node->parent(); diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 6dadf2f..a296213 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -121,6 +121,7 @@ namespace QPatternist class BasicNodeData { public: + /* No need to initialize the members. See AccelTreeBuilder. */ inline BasicNodeData() { } @@ -209,7 +210,7 @@ namespace QPatternist Depth m_depth; /** - * Technically it is sufficient with 8 bits. However, at least MSVC + * Technically it is sufficient with 7 bits. However, at least MSVC * 2005 miscompiles it such that QXmlNodeModelIndex::Text becomes * -64 instead of 64 with hilarious crashes as result. * diff --git a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h index fb58a61..cbc8f59 100644 --- a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h +++ b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h @@ -99,7 +99,7 @@ public: typedef QList<QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<T> > > List; typedef QVector<QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<T> > > Vector; - inline QAbstractXmlForwardIterator() {} + inline QAbstractXmlForwardIterator() : d_ptr(0) {} virtual ~QAbstractXmlForwardIterator() {} virtual T next() = 0; diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp index dc653d2..9760bdb 100644 --- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp +++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp @@ -83,7 +83,7 @@ Item IdFN::mapToItem(const QString &id, * - Remove invalid @c NCName * - Split IDREFs into individual NCNames * - * @author Frans Englich + * @author Frans Englich <frans.englich@nokia.com> */ class StringSplitter : public QAbstractXmlForwardIterator<QString> { diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h index 195e597..7f68d92 100644 --- a/src/xmlpatterns/parser/qquerytransformparser_p.h +++ b/src/xmlpatterns/parser/qquerytransformparser_p.h @@ -49,57 +49,6 @@ // // We mean it. -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtXmlPatterns of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - /* A Bison parser, made by GNU Bison 2.3a. */ /* Skeleton interface for Bison's Yacc-like parsers in C |