MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / bitmapCompareThread

Function bitmapCompareThread

source/util/player.cpp:124–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122static std::condition_variable comparingCond;
123
124void bitmapCompareThread(Player* player) {
125 while (comparingPixels != COMPARING_PIXELS_DONE) {
126 {
127 std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex);
128 comparingCond.wait(boxedWineCriticalSection);
129 if (comparingPixels == COMPARING_PIXELS_DONE) {
130 break;
131 }
132 comparingPixels = COMPARING_PIXELS_WORKING;
133 }
134 if (outputLen < bufferlen) {
135 if (output) {
136 delete[] output;
137 }
138 output = new U8[bufferlen];
139 outputLen = bufferlen;
140 }
141 if (pixelmatch(image_data, image_width * 4, buffer, image_width * 4, image_width, image_height, output) == 0) {
142 std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex);
143 if (comparingPixels == COMPARING_PIXELS_DONE) {
144 break;
145 }
146 comparingPixels = COMPARING_PIXELS_SUCCESS;
147 } else {
148 std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex);
149 if (comparingPixels == COMPARING_PIXELS_DONE) {
150 break;
151 }
152 comparingPixels = COMPARING_PIXELS_WAITING;
153 }
154 Platform::nanoSleep(500000l);
155 }
156}
157
158void Player::runSlice() {
159 // at least 10 ms between mouse moves

Callers

nothing calls this directly

Calls 2

pixelmatchFunction · 0.85
waitMethod · 0.45

Tested by

no test coverage detected