#include <qpicture_p.h>
Collaboration diagram for QPicturePrivate:

Definition at line 49 of file qpicture_p.h.
Public Types | |
| enum | PaintCommand |
Public Member Functions | |
| QPicturePrivate () | |
| bool | checkFormat () |
| void | resetFormat () |
Public Attributes | |
| QAtomic | ref |
| QBuffer | pictb |
| int | trecs |
| bool | formatOk |
| int | formatMajor |
| int | formatMinor |
| QRect | brect |
| QRect | override_rect |
| QPaintEngine * | paintEngine |
| QPicture * | q_ptr |
Friends | |
| class | QPicturePaintEngine |
| Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &s, const QPicture &r) |
| Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &s, QPicture &r) |
Definition at line 57 of file qpicture_p.h.
00057 { 00058 PdcNOP = 0, // <void> 00059 PdcDrawPoint = 1, // point 00060 PdcDrawFirst = PdcDrawPoint, 00061 PdcMoveTo = 2, // point 00062 PdcLineTo = 3, // point 00063 PdcDrawLine = 4, // point,point 00064 PdcDrawRect = 5, // rect 00065 PdcDrawRoundRect = 6, // rect,ival,ival 00066 PdcDrawEllipse = 7, // rect 00067 PdcDrawArc = 8, // rect,ival,ival 00068 PdcDrawPie = 9, // rect,ival,ival 00069 PdcDrawChord = 10, // rect,ival,ival 00070 PdcDrawLineSegments = 11, // ptarr 00071 PdcDrawPolyline = 12, // ptarr 00072 PdcDrawPolygon = 13, // ptarr,ival 00073 PdcDrawCubicBezier = 14, // ptarr 00074 PdcDrawText = 15, // point,str 00075 PdcDrawTextFormatted = 16, // rect,ival,str 00076 PdcDrawPixmap = 17, // rect,pixmap 00077 PdcDrawImage = 18, // rect,image 00078 PdcDrawText2 = 19, // point,str 00079 PdcDrawText2Formatted = 20, // rect,ival,str 00080 PdcDrawTextItem = 21, // pos,text,font,flags 00081 PdcDrawLast = PdcDrawTextItem, 00082 PdcDrawPoints = 22, // ptarr,ival,ival 00083 PdcDrawWinFocusRect = 23, // rect,color 00084 PdcDrawTiledPixmap = 24, // rect,pixmap,point 00085 PdcDrawPath = 25, // path 00086 00087 // no painting commands below PdcDrawLast. 00088 00089 PdcBegin = 30, // <void> 00090 PdcEnd = 31, // <void> 00091 PdcSave = 32, // <void> 00092 PdcRestore = 33, // <void> 00093 PdcSetdev = 34, // device - PRIVATE 00094 PdcSetBkColor = 40, // color 00095 PdcSetBkMode = 41, // ival 00096 PdcSetROP = 42, // ival 00097 PdcSetBrushOrigin = 43, // point 00098 PdcSetFont = 45, // font 00099 PdcSetPen = 46, // pen 00100 PdcSetBrush = 47, // brush 00101 PdcSetTabStops = 48, // ival 00102 PdcSetTabArray = 49, // ival,ivec 00103 PdcSetUnit = 50, // ival 00104 PdcSetVXform = 51, // ival 00105 PdcSetWindow = 52, // rect 00106 PdcSetViewport = 53, // rect 00107 PdcSetWXform = 54, // ival 00108 PdcSetWMatrix = 55, // matrix,ival 00109 PdcSaveWMatrix = 56, 00110 PdcRestoreWMatrix = 57, 00111 PdcSetClip = 60, // ival 00112 PdcSetClipRegion = 61, // rgn 00113 PdcSetClipPath = 62, // path 00114 PdcSetRenderHint = 63, // ival 00115 00116 PdcReservedStart = 0, // codes 0-199 are reserved 00117 PdcReservedStop = 199 // for Qt 00118 };
| QPicturePrivate::QPicturePrivate | ( | ) | [inline] |
| bool QPicturePrivate::checkFormat | ( | ) |
Definition at line 854 of file qpicture.cpp.
References brect, buf, QBuffer::buffer(), c, QBuffer::close(), formatMajor, formatMinor, formatOk, h, QIODevice::isOpen(), l, mfhdr_maj, QBuffer::open(), PdcBegin, pictb, qChecksum(), qt_mfhdr_tag, qWarning(), QIODevice::ReadOnly, resetFormat(), s, QBuffer::size(), t, and w.
Referenced by QPicture::boundingRect().
00855 { 00856 resetFormat(); 00857 00858 // can't check anything in an empty buffer 00859 if (pictb.size() == 0 || pictb.isOpen()) 00860 return false; 00861 00862 pictb.open(QIODevice::ReadOnly); // open buffer device 00863 QDataStream s; 00864 s.setDevice(&pictb); // attach data stream to buffer 00865 00866 char mf_id[4]; // picture header tag 00867 s.readRawData(mf_id, 4); // read actual tag 00868 if (memcmp(mf_id, qt_mfhdr_tag, 4) != 0) { // wrong header id 00869 qWarning("QPicturePaintEngine::checkFormat: Incorrect header"); 00870 pictb.close(); 00871 return false; 00872 } 00873 00874 int cs_start = sizeof(quint32); // pos of checksum word 00875 int data_start = cs_start + sizeof(quint16); 00876 quint16 cs,ccs; 00877 QByteArray buf = pictb.buffer(); // pointer to data 00878 00879 s >> cs; // read checksum 00880 ccs = (quint16) qChecksum(buf.constData() + data_start, buf.size() - data_start); 00881 if (ccs != cs) { 00882 qWarning("QPicturePaintEngine::checkFormat: Invalid checksum %x, %x expected", 00883 ccs, cs); 00884 pictb.close(); 00885 return false; 00886 } 00887 00888 quint16 major, minor; 00889 s >> major >> minor; // read version number 00890 if (major > mfhdr_maj) { // new, incompatible version 00891 qWarning("QPicturePaintEngine::checkFormat: Incompatible version %d.%d", 00892 major, minor); 00893 pictb.close(); 00894 return false; 00895 } 00896 s.setVersion(major != 4 ? major : 3); 00897 00898 quint8 c, clen; 00899 s >> c >> clen; 00900 if (c == QPicturePrivate::PdcBegin) { 00901 if (!(major >= 1 && major <= 3)) { 00902 qint32 l, t, w, h; 00903 s >> l >> t >> w >> h; 00904 brect = QRect(l, t, w, h); 00905 } 00906 } else { 00907 qWarning("QPicturePaintEngine::checkFormat: Format error"); 00908 pictb.close(); 00909 return false; 00910 } 00911 pictb.close(); 00912 00913 formatOk = true; // picture seems to be ok 00914 formatMajor = major; 00915 formatMinor = minor; 00916 return true; 00917 }
Here is the call graph for this function:

| void QPicturePrivate::resetFormat | ( | ) |
Definition at line 839 of file qpicture.cpp.
References formatMajor, formatMinor, formatOk, mfhdr_maj, and mfhdr_min.
Referenced by checkFormat().
00840 { 00841 formatOk = false; 00842 formatMajor = mfhdr_maj; 00843 formatMinor = mfhdr_min; 00844 }
friend class QPicturePaintEngine [friend] |
Definition at line 52 of file qpicture_p.h.
| Q_GUI_EXPORT QDataStream& operator<< | ( | QDataStream & | s, | |
| const QPicture & | r | |||
| ) | [friend] |
| Q_GUI_EXPORT QDataStream& operator>> | ( | QDataStream & | s, | |
| QPicture & | r | |||
| ) | [friend] |
Definition at line 121 of file qpicture_p.h.
Definition at line 127 of file qpicture_p.h.
Definition at line 132 of file qpicture_p.h.
Definition at line 133 of file qpicture_p.h.
1.5.1