FIx imagemakewithfilter test in OOPRDDL config
If we have a DDL context, we can't make texture backed images and we should skip this test. Notably, we intentionally do not want this test to fall back to raster in this case. Bug: skia:104662 Change-Id: I9c1fdf1608d177f905838cbbbd66f1a3ab61134a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303264 Commit-Queue: Adlai Holler <adlai@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com> Commit-Queue: Nathaniel Nifong <nifong@google.com> Auto-Submit: Adlai Holler <adlai@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Nathaniel Nifong <nifong@google.com>
This commit is contained in:
parent
cffb062092
commit
73424fd506
@ -223,7 +223,7 @@ protected:
|
||||
fAuxImage = surface->makeImageSnapshot();
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
|
||||
FilterFactory filters[] = {
|
||||
color_filter_factory,
|
||||
blur_filter_factory,
|
||||
@ -270,9 +270,18 @@ protected:
|
||||
// These need to be GPU-backed when on the GPU to ensure that the image filters use the GPU
|
||||
// code paths (otherwise they may choose to do CPU filtering then upload)
|
||||
sk_sp<SkImage> mainImage, auxImage;
|
||||
if (auto direct = GrAsDirectContext(canvas->recordingContext())) {
|
||||
|
||||
auto recording = canvas->recordingContext();
|
||||
if (recording) {
|
||||
// In a DDL context, we can't use the GPU code paths and we will drop the work – skip.
|
||||
auto direct = GrAsDirectContext(recording);
|
||||
if (!direct) {
|
||||
*errorMsg = "Requires a direct context.";
|
||||
return DrawResult::kSkip;
|
||||
}
|
||||
if (direct->abandoned()) {
|
||||
return;
|
||||
*errorMsg = "Direct context abandoned.";
|
||||
return DrawResult::kSkip;
|
||||
}
|
||||
mainImage = fMainImage->makeTextureImage(direct);
|
||||
auxImage = fAuxImage->makeTextureImage(direct);
|
||||
@ -281,10 +290,10 @@ protected:
|
||||
auxImage = fAuxImage;
|
||||
}
|
||||
if (!mainImage || !auxImage) {
|
||||
return;
|
||||
return DrawResult::kFail;
|
||||
}
|
||||
SkASSERT(mainImage && (mainImage->isTextureBacked() || !canvas->recordingContext()));
|
||||
SkASSERT(auxImage && (auxImage->isTextureBacked() || !canvas->recordingContext()));
|
||||
SkASSERT(mainImage && (mainImage->isTextureBacked() || !recording));
|
||||
SkASSERT(auxImage && (auxImage->isTextureBacked() || !recording));
|
||||
|
||||
SkScalar MARGIN = SkIntToScalar(40);
|
||||
SkScalar DX = mainImage->width() + MARGIN;
|
||||
@ -328,6 +337,7 @@ protected:
|
||||
canvas->restore();
|
||||
canvas->translate(0, DY);
|
||||
}
|
||||
return DrawResult::kOk;
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user