| 325 | } |
| 326 | |
| 327 | void FlashControl::update() |
| 328 | { |
| 329 | if (isClean) |
| 330 | return; |
| 331 | |
| 332 | if (mOwner && !mOwner->getVisible()) |
| 333 | return; |
| 334 | |
| 335 | // очищаем текстуру |
| 336 | if (!mIsInitialise) |
| 337 | { |
| 338 | if (mOwner) |
| 339 | { |
| 340 | MyGUI::uint8* destBuffer = static_cast<MyGUI::uint8*>(mOwner->lock()); |
| 341 | memset(destBuffer, 0, mOwner->getTextureRealWidth() * mOwner->getTextureRealHeight() * 4); |
| 342 | mOwner->unlock(); |
| 343 | } |
| 344 | return; |
| 345 | } |
| 346 | |
| 347 | int dirtyWidth = dirtyBounds.right - dirtyBounds.left; |
| 348 | int dirtyHeight = dirtyBounds.bottom - dirtyBounds.top; |
| 349 | int dirtyBufSize = dirtyWidth * dirtyHeight * 4; |
| 350 | |
| 351 | static int lastDirtyWidth = 0; |
| 352 | static int lastDirtyHeight = 0; |
| 353 | |
| 354 | IViewObject* curView = nullptr; |
| 355 | flashInterface->QueryInterface(IID_IViewObject, (void**)&curView); |
| 356 | |
| 357 | if (!oleObject || !curView) |
| 358 | return; |
| 359 | |
| 360 | if (!mainContext || dirtyWidth != lastDirtyWidth || dirtyHeight != lastDirtyHeight) |
| 361 | { |
| 362 | if (mainContext) |
| 363 | { |
| 364 | DeleteDC(mainContext); |
| 365 | mainContext = 0; |
| 366 | } |
| 367 | if (mainBitmap) |
| 368 | { |
| 369 | DeleteObject(mainBitmap); |
| 370 | mainBitmap = 0; |
| 371 | } |
| 372 | |
| 373 | lastDirtyWidth = dirtyWidth; |
| 374 | lastDirtyHeight = dirtyHeight; |
| 375 | |
| 376 | HDC hdc = GetDC(0); |
| 377 | BITMAPINFOHEADER bih = {0}; |
| 378 | bih.biSize = sizeof(BITMAPINFOHEADER); |
| 379 | bih.biBitCount = 32; |
| 380 | bih.biCompression = BI_RGB; |
| 381 | bih.biPlanes = 1; |
| 382 | bih.biWidth = dirtyWidth; |
| 383 | bih.biHeight = -dirtyHeight; |
| 384 | mainContext = CreateCompatibleDC(hdc); |
no test coverage detected