Make the SkGlyphRunPainter clearly GPU only
This includes using SkNoPixelsDevice for the GlyphTrackingDevice in the SkChromeRemoteGlyphCache because it is the only thing that uses SkGlyphRunPainter outside of GPU. Change-Id: Id22e538b2c1aa0d65433878e428c9465fe222d12 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/539558 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
04a696455b
commit
31dffc0ed7
@ -790,6 +790,7 @@ RemoteStrike* SkStrikeServerImpl::getOrCreateCache(const SkStrikeSpec& strikeSpe
|
||||
}
|
||||
|
||||
// -- GlyphTrackingDevice --------------------------------------------------------------------------
|
||||
#if SK_SUPPORT_GPU
|
||||
class GlyphTrackingDevice final : public SkNoPixelsDevice {
|
||||
public:
|
||||
GlyphTrackingDevice(
|
||||
@ -810,7 +811,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
void onDrawGlyphRunList(SkCanvas*,
|
||||
const SkGlyphRunList& glyphRunList,
|
||||
const SkPaint& initialPaint,
|
||||
@ -858,7 +858,6 @@ protected:
|
||||
control,
|
||||
&fConvertPainter);
|
||||
}
|
||||
#endif // SK_SUPPORT_GPU
|
||||
|
||||
private:
|
||||
SkStrikeServerImpl* const fStrikeServerImpl;
|
||||
@ -866,6 +865,7 @@ private:
|
||||
SkGlyphRunListPainter fPainter;
|
||||
SkGlyphRunListPainter fConvertPainter;
|
||||
};
|
||||
#endif // SK_SUPPORT_GPU
|
||||
|
||||
// -- SkStrikeServer -------------------------------------------------------------------------------
|
||||
SkStrikeServer::SkStrikeServer(DiscardableHandleManager* dhm)
|
||||
@ -877,10 +877,15 @@ std::unique_ptr<SkCanvas> SkStrikeServer::makeAnalysisCanvas(int width, int heig
|
||||
const SkSurfaceProps& props,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
bool DFTSupport) {
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<SkBaseDevice> trackingDevice(new GlyphTrackingDevice(SkISize::Make(width, height),
|
||||
props, this->impl(),
|
||||
std::move(colorSpace),
|
||||
DFTSupport));
|
||||
#else
|
||||
sk_sp<SkBaseDevice> trackingDevice(new SkNoPixelsDevice(
|
||||
SkIRect::MakeWH(width, height), props, std::move(colorSpace)));
|
||||
#endif
|
||||
return std::make_unique<SkCanvas>(std::move(trackingDevice));
|
||||
}
|
||||
|
||||
|
@ -249,6 +249,7 @@ void SkGlyphRunListPainterCPU::drawForBitmapDevice(
|
||||
}
|
||||
|
||||
// -- SkGlyphRunListPainter ------------------------------------------------------------------------
|
||||
#if SK_SUPPORT_GPU
|
||||
SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props,
|
||||
SkScalerContextFlags flags,
|
||||
SkStrikeForGPUCacheInterface* strikeCache)
|
||||
@ -261,7 +262,6 @@ SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props,
|
||||
SkStrikeForGPUCacheInterface* strikeCache)
|
||||
: SkGlyphRunListPainter{props, compute_scaler_context_flags(colorSpace), strikeCache} {}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
SkGlyphRunListPainter::SkGlyphRunListPainter(const skgpu::v1::SurfaceDrawContext& sdc)
|
||||
: SkGlyphRunListPainter{sdc.surfaceProps(),
|
||||
compute_scaler_context_flags(sdc.colorInfo().colorSpace()),
|
||||
|
@ -81,18 +81,16 @@ private:
|
||||
const SkScalerContextFlags fScalerContextFlags;
|
||||
};
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
class SkGlyphRunListPainter {
|
||||
public:
|
||||
SkGlyphRunListPainter(const SkSurfaceProps& props,
|
||||
const SkColorSpace* colorSpace,
|
||||
SkStrikeForGPUCacheInterface* strikeCache);
|
||||
#if SK_SUPPORT_GPU
|
||||
// The following ctor is used exclusively by the GPU, and will always use the global
|
||||
// strike cache.
|
||||
explicit SkGlyphRunListPainter(const skgpu::v1::SurfaceDrawContext&);
|
||||
#endif // SK_SUPPORT_GPU
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
// A nullptr for process means that the calls to the cache will be performed, but none of the
|
||||
// callbacks will be called.
|
||||
// N.B. The positionMatrix has already been translated to the glyph run list origin.
|
||||
@ -102,7 +100,6 @@ public:
|
||||
const SkPaint& drawPaint,
|
||||
const GrSDFTControl& control,
|
||||
const char* tag = nullptr);
|
||||
#endif // SK_SUPPORT_GPU
|
||||
|
||||
private:
|
||||
SkGlyphRunListPainter(const SkSurfaceProps& props,
|
||||
@ -155,5 +152,5 @@ public:
|
||||
const SkFont& runFont,
|
||||
const GrSDFTMatrixRange& matrixRange) = 0;
|
||||
};
|
||||
|
||||
#endif // SK_SUPPORT_GPU
|
||||
#endif // SkGlyphRunPainter_DEFINED
|
||||
|
Loading…
Reference in New Issue
Block a user