Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions shell/platform/android/surface_texture_external_texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,27 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
FML_CHECK(state_ == AttachmentState::kAttached);

if (dl_image_) {
context.canvas->DrawImageRect(
dl_image_, // image
SkRect::Make(dl_image_->bounds()), // source rect
bounds, // destination rect
sampling, // sampling
context.paint, // paint
flutter::DlCanvas::SrcRectConstraint::kStrict // enforce edges
);
DlAutoCanvasRestore autoRestore(context.canvas, true);

// The incoming texture is vertically flipped, so we flip it
// back. OpenGL's coordinate system has Positive Y equivalent to up, while
// Skia's coordinate system has Negative Y equvalent to up.
context.canvas->Translate(bounds.x(), bounds.y() + bounds.height());
context.canvas->Scale(bounds.width(), -bounds.height());

if (!transform_.isIdentity()) {
DlImageColorSource source(dl_image_, DlTileMode::kRepeat,
DlTileMode::kRepeat, sampling, &transform_);

DlPaint paintWithShader;
if (context.paint) {
paintWithShader = *context.paint;
}
paintWithShader.setColorSource(&source);
context.canvas->DrawRect(SkRect::MakeWH(1, 1), paintWithShader);
} else {
context.canvas->DrawImage(dl_image_, {0, 0}, sampling, context.paint);
}
} else {
FML_LOG(ERROR) << "No DlImage available.";
}
Expand Down