688{
690
691
692
693
694
695
696
697
698
699 quint8 **buf;
701 qint32 last_max, last_index;
702
705 for (qint32 i = 0; i <
m_yRadius + 1; i++) {
706 buf[i] =
new quint8[
rect.width()];
707 }
708
710 quint8* buffer = new quint8[buffer_size];
711
713 memset(buffer, 255, buffer_size);
714 else
715 memset(buffer, 0, buffer_size);
716
721 else
727 else
729 }
731 for (qint32 j = 0 ; j <
m_xRadius + 1; j++) max[0][j] = 0;
732
733
735
736 quint8* out =
new quint8[
rect.width()];
737
738 qint32* circ =
new qint32[2 *
m_xRadius + 1];
739
741
742
744
747
749 memcpy(buf[0], buf[1],
rect.width());
750 else
751 memset(buf[0], 0,
rect.width());
752
753
754 for (qint32 x = 0;
x <
rect.width();
x++) {
755 max[
x][0] = buf[0][
x];
756 for (qint32 j = 1; j <
m_yRadius + 1; j++)
757 max[x][j] =
MIN(buf[j][x], max[x][j-1]);
758 }
759
760 for (qint32 y = 0;
y <
rect.height();
y++) {
766 else
768
769 for (qint32 x = 0 ;
x <
rect.width();
x++) {
771 max[
x][i] =
MIN(
MIN(max[x][i - 1], buf[i - 1][x]), buf[i][x]);
772 }
773 max[
x][0] = buf[0][
x];
774 }
775 last_max =
max[0][circ[-1]];
776 last_index = 0;
777
778 for (qint32 x = 0 ;
x <
rect.width();
x++) {
779 last_index--;
780 if (last_index >= 0) {
781 if (last_max == 0)
783 else {
784 last_max = 255;
786 if (last_max > max[x + i][circ[i]]) {
787 last_max =
max[
x + i][circ[i]];
788 last_index = i;
789 }
791 }
792 } else {
796 if (last_max > max[x + i][circ[i]]) {
797 last_max =
max[
x + i][circ[i]];
798 last_index = i;
799 }
801 }
802 }
804 }
805
806
809
810 delete[] circ;
811 delete[] buffer;
813 for (qint32 i = 0; i <
m_yRadius + 1; i++)
814 delete[] buf[i];
815 delete[] buf;
816 delete[] out;
817}
void readBytes(quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h) const
void writeBytes(const quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h)
void rotatePointers(quint8 **p, quint32 n)
void computeBorder(qint32 *circ, qint32 xradius, qint32 yradius)
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()