mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Workaround for surface size on Fuchsia/Magma (flutter/engine#3458)
Allow surface size to be passed by caller temporarily until we get a proper Display API
This commit is contained in:
parent
c94fba31a0
commit
f6a5f79902
@ -8,6 +8,11 @@ namespace vulkan {
|
||||
|
||||
VulkanNativeSurfaceMagma::VulkanNativeSurfaceMagma() = default;
|
||||
|
||||
VulkanNativeSurfaceMagma::VulkanNativeSurfaceMagma(int32_t width,
|
||||
int32_t height) {
|
||||
size_ = SkISize::Make(width, height);
|
||||
}
|
||||
|
||||
VulkanNativeSurfaceMagma::~VulkanNativeSurfaceMagma() = default;
|
||||
|
||||
const char* VulkanNativeSurfaceMagma::GetExtensionName() const {
|
||||
@ -50,7 +55,12 @@ bool VulkanNativeSurfaceMagma::IsValid() const {
|
||||
}
|
||||
|
||||
SkISize VulkanNativeSurfaceMagma::GetSize() const {
|
||||
return SkISize::Make(2160, 1440);
|
||||
if (size_.width() != 0 && size_.height() != 0) {
|
||||
return size_;
|
||||
} else {
|
||||
// TODO: Don't hardcode this after we get a proper Fuchsia Display API.
|
||||
return SkISize::Make(2160, 1440);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace vulkan
|
||||
|
||||
@ -14,6 +14,11 @@ class VulkanNativeSurfaceMagma : public vulkan::VulkanNativeSurface {
|
||||
public:
|
||||
VulkanNativeSurfaceMagma();
|
||||
|
||||
// Alternate constructor which allows the caller to specify the surface's
|
||||
// width and height.
|
||||
// TODO: Remove this once we have a Fuchsia Display API.
|
||||
VulkanNativeSurfaceMagma(int32_t surface_width, int32_t surface_height);
|
||||
|
||||
~VulkanNativeSurfaceMagma();
|
||||
|
||||
const char* GetExtensionName() const override;
|
||||
@ -29,6 +34,7 @@ class VulkanNativeSurfaceMagma : public vulkan::VulkanNativeSurface {
|
||||
SkISize GetSize() const override;
|
||||
|
||||
private:
|
||||
SkISize size_;
|
||||
FTL_DISALLOW_COPY_AND_ASSIGN(VulkanNativeSurfaceMagma);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user