Remove drawPosText from SkDevice
Change-Id: I1ca6d5222499e295485a5b7773fa3957410803eb
Reviewed-on: https://skia-review.googlesource.com/150543
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h
index 986fd80..eee8675 100644
--- a/src/core/SkBitmapDevice.h
+++ b/src/core/SkBitmapDevice.h
@@ -146,13 +146,6 @@
class BDDraw;
- /**
- * Does not handle text decoration.
- * Decorations (underline and stike-thru) will be handled by SkCanvas.
- */
- void drawPosText(const void* text, size_t len, const SkScalar pos[],
- int scalarsPerPos, const SkPoint& offset, const SkPaint& paint) override {}
-
// used to change the backend's pixels (and possibly config/rowbytes)
// but cannot change the width/height, so there should be no change to
// any clip information.
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 2e25b05..50555ef 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -202,10 +202,6 @@
}
}
-void SkBaseDevice::drawGlyphRunList(const SkGlyphRunList& glyphRunList) {
- glyphRunList.temporaryShuntToDrawPosText(this, SkPoint::Make(0, 0));
-}
-
void SkBaseDevice::drawBitmapLattice(const SkBitmap& bitmap,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint& paint) {
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index 3e78c9a..4307445 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -217,7 +217,7 @@
SkBlendMode, const SkPaint&) = 0;
virtual void drawShadow(const SkPath&, const SkDrawShadowRec&);
- virtual void drawGlyphRunList(const SkGlyphRunList& glyphRunList);
+ virtual void drawGlyphRunList(const SkGlyphRunList& glyphRunList) = 0;
// default implementation calls drawVertices
virtual void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint);
@@ -325,16 +325,12 @@
friend struct DeviceCM; //for setMatrixClip
friend class SkDraw;
friend class SkDrawIter;
- friend class SkDeviceFilteredPaint;
friend class SkSurface_Raster;
friend class DeviceTestingAccess;
// Temporarily friend the SkGlyphRunBuilder until drawPosText is gone.
friend class SkGlyphRun;
friend class SkGlyphRunList;
- virtual void drawPosText(const void* text, size_t len,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint& paint) = 0;
// used to change the backend's pixels (and possibly config/rowbytes)
// but cannot change the width/height, so there should be no change to
@@ -414,9 +410,8 @@
void drawSprite(const SkBitmap&, int, int, const SkPaint&) override {}
void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint&,
SkCanvas::SrcRectConstraint) override {}
- void drawPosText(const void*, size_t, const SkScalar[], int, const SkPoint&,
- const SkPaint&) override {}
void drawDevice(SkBaseDevice*, int, int, const SkPaint&) override {}
+ void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override {}
void drawVertices(const SkVertices*, const SkVertices::Bone[], int, SkBlendMode,
const SkPaint&) override {}
diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp
index 30d30dc..46c2ac2 100644
--- a/src/core/SkGlyphRun.cpp
+++ b/src/core/SkGlyphRun.cpp
@@ -89,23 +89,6 @@
}
}
-void SkGlyphRun::temporaryShuntToDrawPosText(SkBaseDevice* device, SkPoint origin) {
-
- auto pos = (const SkScalar*) this->positions().data();
-
- if (!fGlyphIDs.empty()) {
- device->drawPosText(
- fGlyphIDs.data(), fGlyphIDs.size() * sizeof(SkGlyphID),
- pos, 2, origin, fRunPaint);
- }
-}
-
-void SkGlyphRun::temporaryShuntToCallback(TemporaryShuntCallback callback) {
- auto bytes = (const char *)fGlyphIDs.data();
- auto pos = (const SkScalar*) this->positions().data();
- callback(fGlyphIDs.size(), bytes, pos);
-}
-
void SkGlyphRun::filloutGlyphsAndPositions(SkGlyphID* glyphIDs, SkPoint* positions) {
memcpy(glyphIDs, fGlyphIDs.data(), fGlyphIDs.size_bytes());
memcpy(positions, fPositions.data(), fPositions.size_bytes());
diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h
index 04339ac..7e85bba 100644
--- a/src/core/SkGlyphRun.h
+++ b/src/core/SkGlyphRun.h
@@ -104,11 +104,6 @@
template <typename PerGlyphPos>
void forEachGlyphAndPosition(PerGlyphPos perGlyph) const;
- // The temporaryShunt calls are to allow inter-operating with existing code while glyph runs
- // are developed.
- void temporaryShuntToDrawPosText(SkBaseDevice* device, SkPoint origin);
- using TemporaryShuntCallback = std::function<void(size_t, const char*, const SkScalar*)>;
- void temporaryShuntToCallback(TemporaryShuntCallback callback);
void filloutGlyphsAndPositions(SkGlyphID* glyphIDs, SkPoint* positions);
size_t runSize() const { return fGlyphIDs.size(); }
@@ -248,11 +243,6 @@
auto size() const -> decltype(fGlyphRuns.size()) { return fGlyphRuns.size(); }
auto empty() const -> decltype(fGlyphRuns.empty()) { return fGlyphRuns.empty(); }
auto operator [] (size_t i) const -> decltype(fGlyphRuns[i]) { return fGlyphRuns[i]; }
- void temporaryShuntToDrawPosText(SkBaseDevice* device, SkPoint origin) const {
- for (auto& run : fGlyphRuns) {
- run.temporaryShuntToDrawPosText(device, origin);
- }
- }
};
class SkGlyphIDSet {
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 6bc4c2d..3a54abb 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1611,13 +1611,6 @@
///////////////////////////////////////////////////////////////////////////////
-void SkGpuDevice::drawPosText(const void* text, size_t byteLength,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint& paint) {
-
- SK_ABORT("Oh no!!! There is not drawPosText for GPU device anymore!");
-}
-
void SkGpuDevice::drawGlyphRunList(const SkGlyphRunList& glyphRunList) {
ASSERT_SINGLE_OWNER
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawGlyphRunList", fContext.get());
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 555e25e..a1a6606 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -84,8 +84,6 @@
const SkPaint& paint, SkCanvas::SrcRectConstraint) override;
void drawSprite(const SkBitmap& bitmap, int x, int y,
const SkPaint& paint) override;
- void drawPosText(const void* text, size_t len, const SkScalar pos[],
- int scalarsPerPos, const SkPoint& offset, const SkPaint&) override;
void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override;
void drawVertices(const SkVertices*, const SkVertices::Bone bones[], int boneCount, SkBlendMode,
const SkPaint&) override;
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 0197b5a..7b02c29 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -93,9 +93,6 @@
const SkRect& dst,
const SkPaint&,
SkCanvas::SrcRectConstraint) override;
- void drawPosText(const void* text, size_t len,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint&) override { SkASSERT(false); }
void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override;
void drawVertices(const SkVertices*, const SkVertices::Bone bones[], int boneCount, SkBlendMode,
const SkPaint&) override;
diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h
index c388045..b6c4d9d 100644
--- a/src/svg/SkSVGDevice.h
+++ b/src/svg/SkSVGDevice.h
@@ -35,12 +35,6 @@
void drawBitmapRect(const SkBitmap&,
const SkRect* srcOrNull, const SkRect& dst,
const SkPaint& paint, SkCanvas::SrcRectConstraint) override;
-
- void drawPosText(const void* text, size_t len,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint& paint) override {
- SK_ABORT("Should never be called.");
- }
void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override;
void drawVertices(const SkVertices*, const SkVertices::Bone bones[], int boneCount, SkBlendMode,
const SkPaint& paint) override;
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index e73b726..84203e7 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -1809,6 +1809,8 @@
SkDEBUGF("XPS drawSprite not yet implemented.");
}
+#if 0
+
HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint,
TypefaceUse** typefaceUse) {
SkAutoResolveDefaultTypeface typeface(paint.getTypeface());
@@ -2091,7 +2093,7 @@
this->ctm(),
paint));
}
-
+#endif
void SkXPSDevice::drawDevice( SkBaseDevice* dev,
int x, int y,
const SkPaint&) {
diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h
index 877eb3b..55558c0 100644
--- a/src/xps/SkXPSDevice.h
+++ b/src/xps/SkXPSDevice.h
@@ -30,6 +30,8 @@
#include "SkTScopedComPtr.h"
#include "SkTypeface.h"
+class SkGlyphRunList;
+
//#define SK_XPS_USE_DETERMINISTIC_IDS
/** \class SkXPSDevice
@@ -96,9 +98,9 @@
const SkRect* srcOrNull, const SkRect& dst,
const SkPaint& paint,
SkCanvas::SrcRectConstraint) override;
- void drawPosText(const void* text, size_t len,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint& paint) override;
+ void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override {
+ SK_ABORT("Needs an implementation");
+ }
void drawVertices(const SkVertices*, const SkVertices::Bone bones[], int boneCount, SkBlendMode,
const SkPaint&) override;
void drawDevice(SkBaseDevice*, int x, int y,