aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp6
-rw-r--r--src/gpu/SkGpuDevice.h1
-rw-r--r--src/gpu/text/GrAtlasTextBlob.cpp5
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp2
-rw-r--r--src/gpu/text/GrTextUtils.cpp21
-rw-r--r--src/gpu/text/GrTextUtils.h9
6 files changed, 6 insertions, 38 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index fca372eabd..f26ed7b8ab 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1676,12 +1676,6 @@ void SkGpuDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
///////////////////////////////////////////////////////////////////////////////
-bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
- return GrTextUtils::ShouldDisableLCD(paint);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
void SkGpuDevice::flush() {
this->flushAndSignalSemaphores(0, nullptr);
}
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index da691a3da3..b6c7bf7cef 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -128,7 +128,6 @@ public:
protected:
bool onReadPixels(const SkPixmap&, int, int) override;
bool onWritePixels(const SkPixmap&, int, int) override;
- bool onShouldDisableLCD(const SkPaint&) const final;
private:
// We want these unreffed in RenderTargetContext, GrContext order.
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 7acf617299..8ec5f4ee6d 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -258,10 +258,11 @@ inline std::unique_ptr<GrAtlasTextOp> GrAtlasTextBlob::makeOp(
std::unique_ptr<GrAtlasTextOp> op;
if (info.drawAsDistanceFields()) {
bool useBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
+ bool useLCD = info.hasUseLCDText() && props.pixelGeometry() != kUnknown_SkPixelGeometry;
op = GrAtlasTextOp::MakeDistanceField(
std::move(grPaint), glyphCount, distanceAdjustTable,
target->colorSpaceInfo().isGammaCorrect(), paint.luminanceColor(),
- info.hasUseLCDText(), useBGR, info.isAntiAliased());
+ useLCD, useBGR, info.isAntiAliased());
} else {
op = GrAtlasTextOp::MakeBitmap(std::move(grPaint), format, glyphCount,
info.hasScaledGlyphs());
@@ -309,7 +310,7 @@ void GrAtlasTextBlob::flush(GrTextUtils::Target* target, const SkSurfaceProps& p
// GrAtlasTextBlob::makeOp only takes uint16_t values for run and subRun indices.
// Encountering something larger than this is highly unlikely, so we'll just not draw it.
int lastRun = SkTMin(fRunCount, (1 << 16)) - 1;
- GrTextUtils::RunPaint runPaint(&paint, nullptr, props);
+ GrTextUtils::RunPaint runPaint(&paint, nullptr);
for (int runIndex = 0; runIndex <= lastRun; runIndex++) {
Run& run = fRuns[runIndex];
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 8f6cba0341..b0f5405649 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -198,7 +198,7 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
// Regenerate textblob
SkTextBlobRunIterator it(blob);
- GrTextUtils::RunPaint runPaint(&paint, drawFilter, props);
+ GrTextUtils::RunPaint runPaint(&paint, drawFilter);
for (int run = 0; !it.done(); it.next(), run++) {
int glyphCount = it.glyphCount();
size_t textLen = glyphCount * sizeof(uint16_t);
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index 7d693d1e29..738cfb68be 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -52,30 +52,9 @@ bool GrTextUtils::RunPaint::modifyForRun(std::function<void(SkPaint*)> paintModF
// The draw filter could have changed either the paint color or color filter.
this->initFilteredColor();
}
- fModifiedPaint.get()->setFlags(FilterTextFlags(fProps, *fModifiedPaint.get()));
return true;
}
-uint32_t GrTextUtils::FilterTextFlags(const SkSurfaceProps& surfaceProps, const SkPaint& paint) {
- uint32_t flags = paint.getFlags();
-
- if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
- return flags;
- }
-
- if (kUnknown_SkPixelGeometry == surfaceProps.pixelGeometry() || ShouldDisableLCD(paint)) {
- flags &= ~SkPaint::kLCDRenderText_Flag;
- flags |= SkPaint::kGenA8FromLCD_Flag;
- }
-
- return flags;
-}
-
-bool GrTextUtils::ShouldDisableLCD(const SkPaint& paint) {
- return paint.getMaskFilter() || paint.getPathEffect() ||
- paint.isFakeBoldText() || paint.getStyle() != SkPaint::kFill_Style;
-}
-
bool GrTextUtils::PathTextIter::next(const SkGlyph** skGlyph, const SkPath** path, SkScalar* xpos) {
SkASSERT(skGlyph);
SkASSERT(path);
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
index ec26a86018..8b07f1c245 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -108,8 +108,8 @@ public:
*/
class RunPaint : public Paint {
public:
- RunPaint(const Paint* paint, SkDrawFilter* filter, const SkSurfaceProps& props)
- : fOriginalPaint(paint), fFilter(filter), fProps(props) {
+ RunPaint(const Paint* paint, SkDrawFilter* filter)
+ : fOriginalPaint(paint), fFilter(filter) {
// Initially we represent the original paint.
fPaint = &fOriginalPaint->skPaint();
fDstColorSpaceInfo = fOriginalPaint->dstColorSpaceInfo();
@@ -122,13 +122,8 @@ public:
SkTLazy<SkPaint> fModifiedPaint;
const Paint* fOriginalPaint;
SkDrawFilter* fFilter;
- const SkSurfaceProps& fProps;
};
- static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const SkPaint& paint);
-
- static bool ShouldDisableLCD(const SkPaint& paint);
-
class PathTextIter : SkTextBaseIter {
public:
PathTextIter(const char text[], size_t length, const SkPaint& paint,