Merge remote-tracking branch 'origin/5.3' into 5.4
authorSimon Hausmann <simon.hausmann@digia.com>
Mon, 8 Sep 2014 11:10:21 +0000 (13:10 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Mon, 8 Sep 2014 11:10:21 +0000 (13:10 +0200)
Conflicts:
.qmake.conf
src/qml/jsruntime/qv4arraydata.cpp
src/quick/scenegraph/util/qsgatlastexture.cpp

Change-Id: Ic4c96066d5c37dcf0d5446baed590ea005d445ce

1  2 
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4script.cpp
src/quick/scenegraph/util/qsgatlastexture.cpp
src/quick/util/qquickanimatorcontroller.cpp
src/quick/util/qquickanimatorjob.cpp
src/quick/util/qquickanimatorjob_p.h
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp

@@@ -678,7 -674,61 +678,61 @@@ bool ArrayElementLessThan::operator()(V
      return p1s->toQString() < p2s->toQString();
  }
  
 -void ArrayData::sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint len)
+ template <typename RandomAccessIterator, typename T, typename LessThan>
+ void sortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan)
+ {
+ top:
+     int span = int(end - start);
+     if (span < 2)
+         return;
+     --end;
+     RandomAccessIterator low = start, high = end - 1;
+     RandomAccessIterator pivot = start + span / 2;
+     if (lessThan(*end, *start))
+         qSwap(*end, *start);
+     if (span == 2)
+         return;
+     if (lessThan(*pivot, *start))
+         qSwap(*pivot, *start);
+     if (lessThan(*end, *pivot))
+         qSwap(*end, *pivot);
+     if (span == 3)
+         return;
+     qSwap(*pivot, *end);
+     while (low < high) {
+         while (low < high && lessThan(*low, *end))
+             ++low;
+         while (high > low && lessThan(*end, *high))
+             --high;
+         if (low < high) {
+             qSwap(*low, *high);
+             ++low;
+             --high;
+         } else {
+             break;
+         }
+     }
+     if (lessThan(*low, *end))
+         ++low;
+     qSwap(*end, *low);
+     sortHelper(start, low, t, lessThan);
+     start = low + 1;
+     ++end;
+     goto top;
+ }
 +void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint len)
  {
      if (!len)
          return;
  
      ArrayElementLessThan lessThan(context, thisObject, comparefn);
  
 -    Value *begin = thisObject->arrayData->data;
 +    Value *begin = thisObject->arrayData()->arrayData();
-     std::sort(begin, begin + len, lessThan);
+     sortHelper(begin, begin + len, *begin, lessThan);
  
  #ifdef CHECK_SPARSE_ARRAYS
      thisObject->initSparseArray();
Simple merge
@@@ -304,10 -316,20 +304,19 @@@ void Atlas::uploadBgra(Texture *texture
      // right column
      for (int i=0; i<ih; ++i)
          dst[i] = src[i * bpl + iw - 1];
 -    glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + iw + 1, r.y() + 1, 1, ih, m_externalFormat, GL_UNSIGNED_BYTE, dst);
 +    funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + iw + 1, r.y() + 1, 1, ih, m_externalFormat, GL_UNSIGNED_BYTE, dst);
  
      // Inner part of the image....
-     funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2, m_externalFormat, GL_UNSIGNED_BYTE, src);
+     if (bpl != iw) {
+         int sy = r.y() + 1;
+         int ey = sy + r.height() - 2;
+         for (int y = sy; y < ey; ++y) {
 -            glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + 1, y, r.width() - 2, 1, m_externalFormat, GL_UNSIGNED_BYTE, src);
++            funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + 1, y, r.width() - 2, 1, m_externalFormat, GL_UNSIGNED_BYTE, src);
+             src += bpl;
+         }
+     } else {
 -        glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2, m_externalFormat, GL_UNSIGNED_BYTE, src);
++        funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2, m_externalFormat, GL_UNSIGNED_BYTE, src);
+     }
 -
  }
  
  void Atlas::bind(QSGTexture::Filtering filtering)
Simple merge
Simple merge
@@@ -315,9 -321,9 +315,10 @@@ private slots
      void lazyBindingEvaluation();
      void varPropertyAccessOnObjectWithInvalidContext();
      void importedScriptsAccessOnObjectWithInvalidContext();
+     void importedScriptsWithoutQmlMode();
      void contextObjectOnLazyBindings();
      void garbageCollectionDuringCreation();
 +    void qtbug_39520();
  
  private:
  //    static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);