extend GPUSink::onDraw with a canvas wrapper function
Change-Id: Id504947e3533c5cf2c9e91de9737959e0440dbec Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524317 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
dae0b24b21
commit
6ccc3b0658
@ -1488,7 +1488,8 @@ bool GPUSink::readBack(SkSurface* surface, SkBitmap* dst) const {
|
||||
|
||||
Result GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
|
||||
const GrContextOptions& baseOptions,
|
||||
std::function<void(GrDirectContext*)> initContext) const {
|
||||
std::function<void(GrDirectContext*)> initContext,
|
||||
std::function<SkCanvas*(SkCanvas*)> wrapCanvas) const {
|
||||
GrContextOptions grOptions = baseOptions;
|
||||
|
||||
// We don't expect the src to mess with the persistent cache or the executor.
|
||||
@ -1517,7 +1518,12 @@ Result GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
|
||||
factory.abandonContexts();
|
||||
}
|
||||
|
||||
Result result = src.draw(direct, surface->getCanvas());
|
||||
auto canvas = surface->getCanvas();
|
||||
if (wrapCanvas != nullptr) {
|
||||
canvas = wrapCanvas(canvas);
|
||||
}
|
||||
|
||||
Result result = src.draw(direct, canvas);
|
||||
if (!result.isOk()) {
|
||||
return result;
|
||||
}
|
||||
|
@ -373,7 +373,8 @@ public:
|
||||
Result draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
|
||||
Result onDraw(const Src&, SkBitmap*, SkWStream*, SkString*,
|
||||
const GrContextOptions& baseOptions,
|
||||
std::function<void(GrDirectContext*)> initContext = nullptr) const;
|
||||
std::function<void(GrDirectContext*)> initContext = nullptr,
|
||||
std::function<SkCanvas*(SkCanvas*)> wrapCanvas = nullptr) const;
|
||||
|
||||
sk_gpu_test::GrContextFactory::ContextType contextType() const { return fContextType; }
|
||||
const sk_gpu_test::GrContextFactory::ContextOverrides& contextOverrides() const {
|
||||
|
Loading…
Reference in New Issue
Block a user