| 48 | } |
| 49 | |
| 50 | void BitmapDrawable::present(tgfx::Context* context) { |
| 51 | if (bitmap == nullptr) { |
| 52 | return; |
| 53 | } |
| 54 | auto hardwareBuffer = bitmap->getHardwareBuffer(); |
| 55 | if (hardwareBuffer != nullptr) { |
| 56 | context->submit(true); |
| 57 | pixelCopied = true; |
| 58 | return; |
| 59 | } |
| 60 | if (offscreenSurface != nullptr) { |
| 61 | auto pixels = bitmap->lockPixels(); |
| 62 | if (pixels == nullptr) { |
| 63 | return; |
| 64 | } |
| 65 | pixelCopied = offscreenSurface->readPixels(bitmap->info(), pixels); |
| 66 | bitmap->unlockPixels(); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | std::shared_ptr<tgfx::Surface> BitmapDrawable::onCreateSurface(tgfx::Context* context) { |
| 71 | if (bitmap == nullptr) { |
nothing calls this directly
no test coverage detected