remove unused Draw*Text records
Change-Id: I33852b4110fcba93b03725b9aa67787220201880 Reviewed-on: https://skia-review.googlesource.com/c/175761 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
581d637371
commit
ece772d8c2
@ -116,12 +116,9 @@ DRAW(DrawPath, drawPath(r.path, r.paint));
|
||||
DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.bmode, r.paint));
|
||||
DRAW(DrawPicture, drawPicture(r.picture.get(), &r.matrix, r.paint));
|
||||
DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
|
||||
DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
|
||||
DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
|
||||
DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
|
||||
DRAW(DrawRect, drawRect(r.rect, r.paint));
|
||||
DRAW(DrawRegion, drawRegion(r.region, r.paint));
|
||||
DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
|
||||
DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint));
|
||||
DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.paint));
|
||||
DRAW(DrawAtlas, drawAtlas(r.atlas.get(),
|
||||
@ -349,9 +346,6 @@ private:
|
||||
|
||||
Bounds bounds(const Flush&) const { return fCullRect; }
|
||||
|
||||
// FIXME: this method could use better bounds
|
||||
Bounds bounds(const DrawText&) const { return fCullRect; }
|
||||
|
||||
Bounds bounds(const DrawPaint&) const { return fCullRect; }
|
||||
Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw.
|
||||
|
||||
@ -436,33 +430,6 @@ private:
|
||||
return this->adjustAndMap(dst, op.paint);
|
||||
}
|
||||
|
||||
Bounds bounds(const DrawPosText& op) const {
|
||||
const int N = op.paint.countText(op.text, op.byteLength);
|
||||
if (N == 0) {
|
||||
return Bounds::MakeEmpty();
|
||||
}
|
||||
|
||||
SkRect dst;
|
||||
dst.set(op.pos, N);
|
||||
AdjustTextForFontMetrics(&dst, op.paint);
|
||||
return this->adjustAndMap(dst, &op.paint);
|
||||
}
|
||||
Bounds bounds(const DrawPosTextH& op) const {
|
||||
const int N = op.paint.countText(op.text, op.byteLength);
|
||||
if (N == 0) {
|
||||
return Bounds::MakeEmpty();
|
||||
}
|
||||
|
||||
SkScalar left = op.xpos[0], right = op.xpos[0];
|
||||
for (int i = 1; i < N; i++) {
|
||||
left = SkMinScalar(left, op.xpos[i]);
|
||||
right = SkMaxScalar(right, op.xpos[i]);
|
||||
}
|
||||
SkRect dst = { left, op.y, right, op.y };
|
||||
AdjustTextForFontMetrics(&dst, op.paint);
|
||||
return this->adjustAndMap(dst, &op.paint);
|
||||
}
|
||||
|
||||
Bounds bounds(const DrawTextRSXform& op) const {
|
||||
if (op.cull) {
|
||||
return this->adjustAndMap(*op.cull, nullptr);
|
||||
@ -485,30 +452,6 @@ private:
|
||||
return this->adjustAndMap(op.rect, nullptr);
|
||||
}
|
||||
|
||||
static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
|
||||
#ifdef SK_DEBUG
|
||||
SkRect correct = *rect;
|
||||
#endif
|
||||
// crbug.com/373785 ~~> xPad = 4x yPad
|
||||
// crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x
|
||||
const SkScalar yPad = 2.5f * paint.getTextSize(),
|
||||
xPad = 4.0f * yPad;
|
||||
rect->outset(xPad, yPad);
|
||||
#ifdef SK_DEBUG
|
||||
SkFontMetrics metrics;
|
||||
paint.getFontMetrics(&metrics);
|
||||
correct.fLeft += metrics.fXMin;
|
||||
correct.fTop += metrics.fTop;
|
||||
correct.fRight += metrics.fXMax;
|
||||
correct.fBottom += metrics.fBottom;
|
||||
// See skia:2862 for why we ignore small text sizes.
|
||||
SkASSERTF(paint.getTextSize() < 0.001f || rect->contains(correct),
|
||||
"%f %f %f %f vs. %f %f %f %f\n",
|
||||
-xPad, -yPad, +xPad, +yPad,
|
||||
metrics.fXMin, metrics.fTop, metrics.fXMax, metrics.fBottom);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns true if rect was meaningfully adjusted for the effects of paint,
|
||||
// false if the paint could affect the rect in unknown ways.
|
||||
static bool AdjustForPaint(const SkPaint* paint, SkRect* rect) {
|
||||
|
@ -25,14 +25,6 @@
|
||||
#include "SkTextBlob.h"
|
||||
#include "SkVertices.h"
|
||||
|
||||
// Windows.h, will pull in all of the GDI defines. GDI #defines
|
||||
// DrawText to DrawTextA or DrawTextW, but SkRecord has a struct
|
||||
// called DrawText. Since this file does not use GDI, undefing
|
||||
// DrawText makes things less confusing.
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
namespace SkRecords {
|
||||
|
||||
// A list of all the types of canvas calls we can record.
|
||||
@ -72,9 +64,6 @@ namespace SkRecords {
|
||||
M(DrawPatch) \
|
||||
M(DrawPicture) \
|
||||
M(DrawPoints) \
|
||||
M(DrawPosText) \
|
||||
M(DrawPosTextH) \
|
||||
M(DrawText) \
|
||||
M(DrawTextRSXform) \
|
||||
M(DrawRRect) \
|
||||
M(DrawRect) \
|
||||
@ -288,17 +277,6 @@ RECORD(DrawPoints, kDraw_Tag|kHasPaint_Tag,
|
||||
SkCanvas::PointMode mode;
|
||||
unsigned count;
|
||||
SkPoint* pts);
|
||||
RECORD(DrawPosText, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
PODArray<char> text;
|
||||
size_t byteLength;
|
||||
PODArray<SkPoint> pos);
|
||||
RECORD(DrawPosTextH, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
PODArray<char> text;
|
||||
unsigned byteLength;
|
||||
SkScalar y;
|
||||
PODArray<SkScalar> xpos);
|
||||
RECORD(DrawRRect, kDraw_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
SkRRect rrect);
|
||||
@ -308,12 +286,6 @@ RECORD(DrawRect, kDraw_Tag|kHasPaint_Tag,
|
||||
RECORD(DrawRegion, kDraw_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
SkRegion region);
|
||||
RECORD(DrawText, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
PODArray<char> text;
|
||||
size_t byteLength;
|
||||
SkScalar x;
|
||||
SkScalar y);
|
||||
RECORD(DrawTextBlob, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
|
||||
SkPaint paint;
|
||||
sk_sp<const SkTextBlob> blob;
|
||||
|
Loading…
Reference in New Issue
Block a user