mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Fix transparency in capturePage (#12561)
* Fix transparent window capture. Transparency is preserved and not converted to black pixels anymore * Add test to make sure aplha channel exists in captured image
This commit is contained in:
committed by
Cheng Zhao
parent
eca0436f58
commit
6fc819dae1
@@ -276,6 +276,9 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||
void OnCapturePageDone(const base::Callback<void(const gfx::Image&)>& callback,
|
||||
const SkBitmap& bitmap,
|
||||
content::ReadbackResponse response) {
|
||||
// Hack to enable transparency in captured image
|
||||
// TODO(nitsakh) Remove hack once fixed in chromium
|
||||
const_cast<SkBitmap&>(bitmap).setAlphaType(kPremul_SkAlphaType);
|
||||
callback.Run(gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user