aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-04-13 15:50:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-16 21:11:10 +0000
commitd234afdc2e562d395925ca3ac8294398608271a6 (patch)
treedf395701b78e38fc3ddbab5c308cab8af79ea27e
parentf7621cb5bb4ee181d557aeb6fa557819daba5fd2 (diff)
Remove SkPaint::kGenA8FromLCD_Flag.
The original intent of this flag is now handled by SkPixelGeomety on SkSurfaceProps on SkSurface. BUG=skia:7515 Change-Id: I54bb1be072b5b5b2164a59196bfeacac254823c7 Reviewed-on: https://skia-review.googlesource.com/121346 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com>
-rw-r--r--docs/SkPaint_Reference.bmh7
-rw-r--r--include/core/SkFont.h4
-rw-r--r--include/core/SkPaint.h3
-rw-r--r--src/core/SkBitmapDevice.cpp46
-rw-r--r--src/core/SkBitmapDevice.h1
-rw-r--r--src/core/SkCanvas.cpp37
-rw-r--r--src/core/SkDevice.cpp19
-rw-r--r--src/core/SkDevice.h8
-rw-r--r--src/core/SkFont.cpp3
-rw-r--r--src/core/SkPaint.cpp5
-rw-r--r--src/core/SkRemoteGlyphCache.cpp13
-rw-r--r--src/core/SkScalerContext.cpp3
-rw-r--r--src/core/SkTextBlob.cpp3
-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
-rw-r--r--src/pdf/SkPDFDevice.cpp1
-rw-r--r--tests/TextBlobTest.cpp5
21 files changed, 43 insertions, 159 deletions
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 162e4791a2..1467b5338c 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -536,7 +536,6 @@ Set SkPaintDefaults_Hinting at compile time to change the default setting.
kEmbeddedBitmapText_Flag = 0x400,
kAutoHinting_Flag = 0x800,
kVerticalText_Flag = 0x1000,
- kGenA8FromLCD_Flag = 0x2000,
kAllFlags = 0xFFFF,
};
@@ -580,12 +579,6 @@ multiple settings at once.
#Const kVerticalText_Flag 0x1000
mask for setting Vertical_Text
##
- #Const kGenA8FromLCD_Flag 0x2000
- #Private
- Hack for GDI -- do not use if you can help it
- ##
- not intended for public use
- ##
#Const kAllFlags 0xFFFF
mask of all Flags, including private flags and flags reserved for future use
##
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
index e50909aaec..a58ec01926 100644
--- a/include/core/SkFont.h
+++ b/include/core/SkFont.h
@@ -39,7 +39,6 @@ enum SkTextEncoding {
kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap strikes
kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter
kVerticalText_Flag = 0x1000,
- kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
};
SkFont would absorb these:
@@ -52,7 +51,6 @@ enum SkTextEncoding {
kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap strikes
kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter
kVerticalText_Flag = 0x1000,
- kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
leaving these still in paint
@@ -106,7 +104,7 @@ public:
kUseNonlinearMetrics_Flag = 1 << 3,
kVertical_Flag = 1 << 4,
- kGenA8FromLCD_Flag = 1 << 5,
+
kEmbolden_Flag = 1 << 6,
kDevKern_Flag = 1 << 7, // ifdef ANDROID ?
};
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 4cc4a37b50..a77d84d05f 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -238,9 +238,6 @@ public:
kAutoHinting_Flag = 0x800, //!< mask for setting auto-hinting
kVerticalText_Flag = 0x1000, //!< mask for setting vertical text
- /** Hack for GDI -- do not use if you can help it */
- kGenA8FromLCD_Flag = 0x2000,
-
/** mask of all Flags, including private flags and flags reserved for future use */
kAllFlags = 0xFFFF,
};
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index f50ce9e582..f6433afb7e 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -540,15 +540,41 @@ void SkBitmapDevice::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPa
BDDraw(this).drawSprite(bitmap, x, y, paint);
}
+class SkBitmapDeviceFilteredSurfaceProps {
+public:
+ SkBitmapDeviceFilteredSurfaceProps(const SkBitmap& bitmap, const SkPaint& paint,
+ const SkSurfaceProps& surfaceProps) {
+ if (kN32_SkColorType != bitmap.colorType() ||
+ paint.getPathEffect() ||
+ paint.isFakeBoldText() ||
+ paint.getStyle() != SkPaint::kFill_Style ||
+ !paint.isSrcOver())
+ {
+ SkSurfaceProps* newPaint = fLazy.init(surfaceProps.flags(), kUnknown_SkPixelGeometry);
+ fSurfaceProps = newPaint;
+ } else {
+ fSurfaceProps = &surfaceProps;
+ }
+ }
+
+ const SkSurfaceProps& operator()() const { return *fSurfaceProps; }
+
+private:
+ const SkSurfaceProps* fSurfaceProps;
+ SkTLazy<SkSurfaceProps> fLazy;
+};
+
void SkBitmapDevice::drawText(const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) {
- LOOP_TILER( drawText((const char*)text, len, x, y, paint, &fSurfaceProps), nullptr)
+ SkBitmapDeviceFilteredSurfaceProps props(fBitmap, paint, fSurfaceProps);
+ LOOP_TILER( drawText((const char*)text, len, x, y, paint, &props()), nullptr)
}
void SkBitmapDevice::drawPosText(const void* text, size_t len, const SkScalar xpos[],
int scalarsPerPos, const SkPoint& offset, const SkPaint& paint) {
- LOOP_TILER( drawPosText((const char*)text, len, xpos, scalarsPerPos, offset, paint,
- &fSurfaceProps), nullptr)
+ SkBitmapDeviceFilteredSurfaceProps props(fBitmap, paint, fSurfaceProps);
+ LOOP_TILER( drawPosText((const char*)text, len, xpos, scalarsPerPos, offset, paint, &props()),
+ nullptr)
}
void SkBitmapDevice::drawVertices(const SkVertices* vertices, SkBlendMode bmode,
@@ -714,20 +740,6 @@ SkImageFilterCache* SkBitmapDevice::getImageFilterCache() {
///////////////////////////////////////////////////////////////////////////////////////////////////
-bool SkBitmapDevice::onShouldDisableLCD(const SkPaint& paint) const {
- if (kN32_SkColorType != fBitmap.colorType() ||
- paint.getPathEffect() ||
- paint.isFakeBoldText() ||
- paint.getStyle() != SkPaint::kFill_Style ||
- !paint.isSrcOver())
- {
- return true;
- }
- return false;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
void SkBitmapDevice::onSave() {
fRCStack.save();
}
diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h
index 26214261a5..e040b6b0c6 100644
--- a/src/core/SkBitmapDevice.h
+++ b/src/core/SkBitmapDevice.h
@@ -61,7 +61,6 @@ public:
SkRasterHandleAllocator* = nullptr);
protected:
- bool onShouldDisableLCD(const SkPaint&) const override;
void* getRasterHandle() const override { return fRasterHandle; }
/** These are called inside the per-device-layer loop for each draw call.
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index f836491352..635f453bf7 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2380,33 +2380,12 @@ void SkCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattic
LOOPER_END
}
-class SkDeviceFilteredPaint {
-public:
- SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {
- uint32_t filteredFlags = device->filterTextFlags(paint);
- if (filteredFlags != paint.getFlags()) {
- SkPaint* newPaint = fLazy.set(paint);
- newPaint->setFlags(filteredFlags);
- fPaint = newPaint;
- } else {
- fPaint = &paint;
- }
- }
-
- const SkPaint& paint() const { return *fPaint; }
-
-private:
- const SkPaint* fPaint;
- SkLazyPaint fLazy;
-};
-
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
- SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
- iter.fDevice->drawText(text, byteLength, x, y, dfp.paint());
+ iter.fDevice->drawText(text, byteLength, x, y, looper.paint());
}
LOOPER_END
@@ -2419,9 +2398,7 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
- SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
- iter.fDevice->drawPosText(text, byteLength, &pos->fX, 2, textOffset,
- dfp.paint());
+ iter.fDevice->drawPosText(text, byteLength, &pos->fX, 2, textOffset, looper.paint());
}
LOOPER_END
@@ -2435,9 +2412,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
- SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
- iter.fDevice->drawPosText(text, byteLength, xpos, 1, textOffset,
- dfp.paint());
+ iter.fDevice->drawPosText(text, byteLength, xpos, 1, textOffset, looper.paint());
}
LOOPER_END
@@ -2448,8 +2423,7 @@ void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPat
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
- iter.fDevice->drawTextOnPath(text, byteLength, path,
- matrix, looper.paint());
+ iter.fDevice->drawTextOnPath(text, byteLength, path, matrix, looper.paint());
}
LOOPER_END
@@ -2491,8 +2465,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
while (iter.next()) {
- SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
- iter.fDevice->drawTextBlob(blob, x, y, dfp.paint(), drawFilter);
+ iter.fDevice->drawTextBlob(blob, x, y, looper.paint(), drawFilter);
}
LOOPER_END
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 96a7e8dbfe..35cfc9ab71 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -156,8 +156,6 @@ void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
continue;
}
- runPaint.setFlags(this->filterTextFlags(runPaint));
-
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
this->drawText(it.glyphs(), textLen, x + offset.x(), y + offset.y(), runPaint);
@@ -526,23 +524,6 @@ void SkBaseDevice::drawTextRSXform(const void* text, size_t len,
//////////////////////////////////////////////////////////////////////////////////////////
-uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
- uint32_t flags = paint.getFlags();
-
- if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
- return flags;
- }
-
- if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
- || this->onShouldDisableLCD(paint)) {
-
- flags &= ~SkPaint::kLCDRenderText_Flag;
- flags |= SkPaint::kGenA8FromLCD_Flag;
- }
-
- return flags;
-}
-
sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps const&) {
return nullptr;
}
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index 6739230115..fb91c8a444 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -125,12 +125,6 @@ public:
void setGlobalCTM(const SkMatrix& ctm);
virtual void validateDevBounds(const SkIRect&) {}
- /**
- * Returns the text-related flags, possibly modified based on the state of the
- * device (e.g. support for LCD).
- */
- uint32_t filterTextFlags(const SkPaint&) const;
-
protected:
enum TileUsage {
kPossible_TileUsage, //!< the created device may be drawn tiled
@@ -141,8 +135,6 @@ protected:
uint32_t fFlags; // SkPaint::getFlags()
};
- virtual bool onShouldDisableLCD(const SkPaint&) const { return false; }
-
virtual void onSave() {}
virtual void onRestore() {}
virtual void onClipRect(const SkRect& rect, SkClipOp, bool aa) {}
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index ca6cdb13b0..77259ff50c 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -122,9 +122,6 @@ sk_sp<SkFont> SkFont::Testing_CreateFromPaint(const SkPaint& paint) {
if (paint.isEmbeddedBitmapText()) {
flags |= kEmbeddedBitmaps_Flag;
}
- if (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) {
- flags |= kGenA8FromLCD_Flag;
- }
if (paint.isFakeBoldText()) {
flags |= kEmbolden_Flag;
}
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 1e0830e0bc..3dc0af66f1 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -656,8 +656,7 @@ SkPaint::kDevKernText_Flag | \
SkPaint::kLinearText_Flag | \
SkPaint::kLCDRenderText_Flag | \
SkPaint::kEmbeddedBitmapText_Flag | \
-SkPaint::kAutoHinting_Flag | \
-SkPaint::kGenA8FromLCD_Flag )
+SkPaint::kAutoHinting_Flag )
SkScalar SkPaint::setupForAsPaths() {
uint32_t flags = this->getFlags();
@@ -1656,8 +1655,6 @@ void SkPaint::toString(SkString* str) const {
"EmbeddedBitmapText", &needSeparator);
SkAddFlagToString(str, this->isAutohinted(), "Autohinted", &needSeparator);
SkAddFlagToString(str, this->isVerticalText(), "VerticalText", &needSeparator);
- SkAddFlagToString(str, SkToBool(this->getFlags() & SkPaint::kGenA8FromLCD_Flag),
- "GenA8FromLCD", &needSeparator);
} else {
str->append("None");
}
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index b7a0cddd85..84dcdda3cb 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -178,18 +178,6 @@ public:
const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixelGeometry);
return new TrackLayerDevice(this->getGlobalBounds(), surfaceProps);
}
-
- // Stolen from the SkBitmapDevice, but the SkGPUDevice is similar.
- bool onShouldDisableLCD(const SkPaint& paint) const override {
- if (paint.getPathEffect() ||
- paint.isFakeBoldText() ||
- paint.getStyle() != SkPaint::kFill_Style ||
- !paint.isSrcOver())
- {
- return true;
- }
- return false;
- }
};
// -- SkTextBlobCacheDiffCanvas -------------------------------------------------------------------
@@ -221,7 +209,6 @@ void SkTextBlobCacheDiffCanvas::onDrawTextBlob(
// applyFontToPaint() always overwrites the exact same attributes,
// so it is safe to not re-seed the paint for this reason.
it.applyFontToPaint(&runPaint);
- runPaint.setFlags(this->getTopDevice()->filterTextFlags(runPaint));
if (auto looper = runPaint.getLooper()) {
this->processLooper(position, it, runPaint, looper);
} else {
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 27ecca4641..096554437c 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -1008,9 +1008,6 @@ void SkScalerContext::MakeRecAndEffects(const SkPaint& paint,
if (paint.isVerticalText()) {
flags |= SkScalerContext::kVertical_Flag;
}
- if (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) {
- flags |= SkScalerContext::kGenA8FromLCD_Flag;
- }
rec->fFlags = SkToU16(flags);
// these modify fFlags, so do them after assigning fFlags
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index eac2430f5f..2c29d9d613 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -71,8 +71,7 @@ private:
SkPaint::kLCDRenderText_Flag |
SkPaint::kEmbeddedBitmapText_Flag |
SkPaint::kAutoHinting_Flag |
- SkPaint::kVerticalText_Flag |
- SkPaint::kGenA8FromLCD_Flag;
+ SkPaint::kVerticalText_Flag ;
SkScalar fSize;
SkScalar fScaleX;
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,
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 98e34b004e..95864d9cb9 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1421,7 +1421,6 @@ void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
continue;
}
- runPaint.setFlags(this->filterTextFlags(runPaint));
SkPoint offset = it.offset() + SkPoint{x, y};
this->internalDrawText(it.glyphs(), sizeof(SkGlyphID) * it.glyphCount(),
it.pos(), it.positioning(), offset, runPaint,
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index fdc5c3826a..3e51baf534 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -194,7 +194,6 @@ public:
font.setEmbeddedBitmapText(true);
font.setAutohinted(true);
font.setVerticalText(true);
- font.setFlags(font.getFlags() | SkPaint::kGenA8FromLCD_Flag);
// Ensure we didn't pick default values by mistake.
SkPaint defaultPaint;
@@ -213,8 +212,6 @@ public:
REPORTER_ASSERT(reporter, defaultPaint.isEmbeddedBitmapText() != font.isEmbeddedBitmapText());
REPORTER_ASSERT(reporter, defaultPaint.isAutohinted() != font.isAutohinted());
REPORTER_ASSERT(reporter, defaultPaint.isVerticalText() != font.isVerticalText());
- REPORTER_ASSERT(reporter, (defaultPaint.getFlags() & SkPaint::kGenA8FromLCD_Flag) !=
- (font.getFlags() & SkPaint::kGenA8FromLCD_Flag));
SkTextBlobBuilder builder;
AddRun(font, 1, SkTextBlob::kDefault_Positioning, SkPoint::Make(0, 0), builder);
@@ -242,8 +239,6 @@ public:
REPORTER_ASSERT(reporter, paint.isEmbeddedBitmapText() == font.isEmbeddedBitmapText());
REPORTER_ASSERT(reporter, paint.isAutohinted() == font.isAutohinted());
REPORTER_ASSERT(reporter, paint.isVerticalText() == font.isVerticalText());
- REPORTER_ASSERT(reporter, (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) ==
- (font.getFlags() & SkPaint::kGenA8FromLCD_Flag));
it.next();
}