| 136 | } |
| 137 | |
| 138 | bool ScreenshotCommandHandler::IsSameColour() { |
| 139 | int bytes_per_pixel = this->image_->GetBPP() / 8; |
| 140 | if (bytes_per_pixel >= 3) { |
| 141 | BYTE* root_pixel_pointer = reinterpret_cast<BYTE*>(this->image_->GetBits()); |
| 142 | int pitch = this->image_->GetPitch(); |
| 143 | int first_pixel_red = *(root_pixel_pointer); |
| 144 | int first_pixel_green = *(root_pixel_pointer + 1); |
| 145 | int first_pixel_blue = *(root_pixel_pointer + 2); |
| 146 | |
| 147 | for (int i = 0; i < this->image_->GetWidth(); ++i) { |
| 148 | for (int j = 0; j < this->image_->GetHeight(); ++j) { |
| 149 | int current_pixel_offset = (pitch * j) + (bytes_per_pixel * i); |
| 150 | int current_pixel_red = *(root_pixel_pointer + current_pixel_offset); |
| 151 | int current_pixel_green = *(root_pixel_pointer + current_pixel_offset + 1); |
| 152 | int current_pixel_blue = *(root_pixel_pointer + current_pixel_offset + 2); |
| 153 | if (first_pixel_red != current_pixel_red || |
| 154 | first_pixel_green != current_pixel_green || |
| 155 | first_pixel_blue != current_pixel_blue) { |
| 156 | return false; |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } else { |
| 161 | COLORREF firstPixelColour = this->image_->GetPixel(0, 0); |
| 162 | for (int i = 0; i < this->image_->GetWidth(); ++i) { |
| 163 | for (int j = 0; j < this->image_->GetHeight(); ++j) { |
| 164 | if (this->image_->GetPixel(i, j)) { |
| 165 | return false; |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | HRESULT ScreenshotCommandHandler::GetBase64Data(std::string& data) { |
| 175 | LOG(TRACE) << "Entering ScreenshotCommandHandler::GetBase64Data"; |