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:
parent
eca0436f58
commit
6fc819dae1
2 changed files with 26 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue