MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / tileEquals

Method tileEquals

common/Frame.cpp:146–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145
146bool Frame::tileEquals(Frame *last, int x, int y, int width, int height)
147{
148 bool bu = (flags & FRAME_BOTTOMUP);
149
150 if(x < 0 || y < 0 || width < 1 || height < 1 || (x + width) > hdr.width
151 || (y + height) > hdr.height)
152 throw Error("Frame::tileEquals", "Argument out of range");
153
154 if(last && hdr.width == last->hdr.width && hdr.height == last->hdr.height
155 && hdr.framew == last->hdr.framew && hdr.frameh == last->hdr.frameh
156 && hdr.qual == last->hdr.qual && hdr.subsamp == last->hdr.subsamp
157 && pf->id == last->pf->id && pf->size == last->pf->size
158 && hdr.winid == last->hdr.winid && hdr.dpynum == last->hdr.dpynum)
159 {
160 if(bits && last->bits)
161 {
162 unsigned char *newBits =
163 &bits[pitch * (bu ? hdr.height - y - height : y) + pf->size * x];
164 unsigned char *oldBits =
165 &last->bits[last->pitch * (bu ? hdr.height - y - height : y) +
166 pf->size * x];
167 for(int i = 0; i < height; i++)
168 {
169 if(memcmp(&newBits[pitch * i], &oldBits[last->pitch * i],
170 pf->size * width))
171 return false;
172 }
173 }
174 if(stereo && rbits && last->rbits)
175 {
176 unsigned char *newBits =
177 &rbits[pitch * (bu ? hdr.height - y - height : y) + pf->size * x];
178 unsigned char *oldBits =
179 &last->rbits[last->pitch * (bu ? hdr.height - y - height : y) +
180 pf->size * x];
181 for(int i = 0; i < height; i++)
182 {
183 if(memcmp(&newBits[pitch * i], &oldBits[last->pitch * i],
184 pf->size * width))
185 return false;
186 }
187 }
188 return true;
189 }
190 return false;
191}
192
193
194void Frame::makeAnaglyph(Frame &r, Frame &g, Frame &b)

Callers 1

compressSendMethod · 0.80

Calls 1

ErrorClass · 0.50

Tested by

no test coverage detected