[Impeller] fix scaling of trampoline import of GLES textures into Vulkan. (#161331)
Not sure if this just needs the dpr transform or the entire canvas transform. Fixes https://github.com/flutter/flutter/issues/159688 ## Before  ## After 
This commit is contained in:
@@ -122,15 +122,17 @@ void SurfaceTextureExternalTextureVKImpeller::ProcessFrame(
|
||||
VALIDATION_LOG << "Invalid external texture.";
|
||||
return;
|
||||
}
|
||||
SkMatrix matrix = context.canvas->GetTransform();
|
||||
SkRect mapped_bounds = matrix.mapRect(bounds);
|
||||
|
||||
const auto& surface_context =
|
||||
SurfaceContextVK::Cast(*context.aiks_context->GetContext());
|
||||
const auto& context_vk = ContextVK::Cast(*surface_context.GetParent());
|
||||
|
||||
auto dst_texture =
|
||||
GetCachedTextureSource(surface_context.GetParent(), //
|
||||
ISize::MakeWH(bounds.width(), bounds.height()) //
|
||||
);
|
||||
auto dst_texture = GetCachedTextureSource(
|
||||
surface_context.GetParent(), //
|
||||
ISize::MakeWH(mapped_bounds.width(), mapped_bounds.height()) //
|
||||
);
|
||||
if (!dst_texture || !dst_texture->IsValid()) {
|
||||
VALIDATION_LOG << "Could not fetch trampoline texture target.";
|
||||
return;
|
||||
@@ -224,7 +226,10 @@ void SurfaceTextureExternalTextureVKImpeller::DrawFrame(
|
||||
PaintContext& context,
|
||||
const SkRect& bounds,
|
||||
const DlImageSampling sampling) const {
|
||||
context.canvas->DrawImage(dl_image_, SkPoint{0, 0}, sampling, context.paint);
|
||||
context.canvas->DrawImageRect(
|
||||
dl_image_,
|
||||
SkRect::MakeSize(SkSize::Make(dl_image_->width(), dl_image_->height())),
|
||||
bounds, sampling, context.paint);
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
Reference in New Issue
Block a user