81bf15877f
* fix: make OSR work with viz compositor * fix: update OSR patch * fix: update patch again * fix: update viz_osr.patch for macOS * fix: gn check warnings * chore: no need to change SoftwareOutputDeviceWinProxy * chore: add check in case we missed something * fix: consider scale factor when compare size * fix: make GPU OSR work * fix: autofill popups with OSR * chore: use UNIX line ending for osr_video_consumer * chore: code is already in defined(OS_MACOSX) * fix: share same OSR implementation on macOS This should also fix the crash when there is navigation on macOS. * test: osr window should not crash after navigation * fix: make osr work on Mac properly * fix: software osr on windows * fix: software osr on Linux * fix: compilation error introduced with rebase * fix: split local surface id allocation into two * Update osr_host_display_client_mac.mm * chore: update copyright year * fix: update patch
35 lines
1.1 KiB
Text
35 lines
1.1 KiB
Text
// Copyright (c) 2019 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "atom/browser/osr/osr_host_display_client.h"
|
|
|
|
#include <IOSurface/IOSurface.h>
|
|
|
|
namespace atom {
|
|
|
|
void OffScreenHostDisplayClient::OnDisplayReceivedCALayerParams(
|
|
const gfx::CALayerParams& ca_layer_params) {
|
|
if (!ca_layer_params.is_empty) {
|
|
base::ScopedCFTypeRef<IOSurfaceRef> io_surface(
|
|
IOSurfaceLookupFromMachPort(ca_layer_params.io_surface_mach_port));
|
|
|
|
gfx::Size pixel_size_ = ca_layer_params.pixel_size;
|
|
void* pixels = static_cast<void*>(IOSurfaceGetBaseAddress(io_surface));
|
|
size_t stride = IOSurfaceGetBytesPerRow(io_surface);
|
|
|
|
struct IOSurfacePinner {
|
|
base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
|
|
};
|
|
|
|
SkBitmap bitmap;
|
|
bitmap.installPixels(
|
|
SkImageInfo::MakeN32(pixel_size_.width(), pixel_size_.height(),
|
|
kPremul_SkAlphaType),
|
|
pixels, stride);
|
|
bitmap.setImmutable();
|
|
callback_.Run(ca_layer_params.damage, bitmap);
|
|
}
|
|
}
|
|
|
|
} // namespace atom
|