Remove SkPicture::hasText()
No longer used in Chromium. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1978533002 Review-Url: https://codereview.chromium.org/1978533002
This commit is contained in:
parent
b11cf50b4a
commit
1e2e33a74d
@ -139,10 +139,6 @@ public:
|
||||
*/
|
||||
virtual int approximateOpCount() const = 0;
|
||||
|
||||
/** Return true if this picture contains text.
|
||||
*/
|
||||
virtual bool hasText() const = 0;
|
||||
|
||||
/** Returns the approximate byte size of this picture, not including large ref'd objects. */
|
||||
virtual size_t approximateBytesUsed() const = 0;
|
||||
|
||||
|
@ -63,7 +63,6 @@ const SkBigPicture::Analysis& SkBigPicture::analysis() const {
|
||||
}
|
||||
|
||||
SkRect SkBigPicture::cullRect() const { return fCullRect; }
|
||||
bool SkBigPicture::hasText() const { return this->analysis().fHasText; }
|
||||
bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWillPlaybackBitmaps; }
|
||||
int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPathsAndDashEffects; }
|
||||
int SkBigPicture::approximateOpCount() const { return fRecord->count(); }
|
||||
@ -83,18 +82,15 @@ SkPicture const* const* SkBigPicture::drawablePicts() const {
|
||||
|
||||
void SkBigPicture::Analysis::init(const SkRecord& record) {
|
||||
TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::init()");
|
||||
SkTextHunter text;
|
||||
SkBitmapHunter bitmap;
|
||||
SkPathCounter path;
|
||||
|
||||
bool hasText = false, hasBitmap = false;
|
||||
bool hasBitmap = false;
|
||||
for (int i = 0; i < record.count(); i++) {
|
||||
hasText = hasText || record.visit(i, text);
|
||||
hasBitmap = hasBitmap || record.visit(i, bitmap);
|
||||
record.visit(i, path);
|
||||
}
|
||||
|
||||
fHasText = hasText;
|
||||
fWillPlaybackBitmaps = hasBitmap;
|
||||
fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects, 255);
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ public:
|
||||
// SkPicture overrides
|
||||
void playback(SkCanvas*, AbortCallback*) const override;
|
||||
SkRect cullRect() const override;
|
||||
bool hasText() const override;
|
||||
bool willPlayBackBitmaps() const override;
|
||||
int approximateOpCount() const override;
|
||||
size_t approximateBytesUsed() const override;
|
||||
@ -71,7 +70,6 @@ private:
|
||||
|
||||
uint8_t fNumSlowPathsAndDashEffects;
|
||||
bool fWillPlaybackBitmaps : 1;
|
||||
bool fHasText : 1;
|
||||
};
|
||||
|
||||
int numSlowPaths() const override;
|
||||
|
@ -23,7 +23,6 @@ public:
|
||||
size_t approximateBytesUsed() const override { return sizeof(*this); }
|
||||
int approximateOpCount() const override { return 0; }
|
||||
SkRect cullRect() const override { return SkRect::MakeEmpty(); }
|
||||
bool hasText() const override { return false; }
|
||||
int numSlowPaths() const override { return 0; }
|
||||
bool willPlayBackBitmaps() const override { return false; }
|
||||
};
|
||||
@ -42,7 +41,6 @@ public:
|
||||
size_t approximateBytesUsed() const override { return sizeof(*this); }
|
||||
int approximateOpCount() const override { return 1; }
|
||||
SkRect cullRect() const override { return fCull; }
|
||||
bool hasText() const override { return SkTextHunter()(fOp); }
|
||||
bool willPlayBackBitmaps() const override { return SkBitmapHunter()(fOp); }
|
||||
int numSlowPaths() const override {
|
||||
SkPathCounter counter;
|
||||
|
@ -14,18 +14,6 @@
|
||||
#include "SkRecords.h"
|
||||
#include "SkTLogic.h"
|
||||
|
||||
struct SkTextHunter {
|
||||
// Most ops never have text. Some always do. Subpictures know themeselves.
|
||||
bool operator()(const SkRecords::DrawPicture& op) { return op.picture->hasText(); }
|
||||
bool operator()(const SkRecords::DrawDrawable&) { /*TODO*/ return false; }
|
||||
|
||||
template <typename T>
|
||||
SK_WHEN(T::kTags & SkRecords::kHasText_Tag, bool) operator()(const T&) { return true; }
|
||||
template <typename T>
|
||||
SK_WHEN(!(T::kTags & SkRecords::kHasText_Tag), bool) operator()(const T&) { return false; }
|
||||
};
|
||||
|
||||
|
||||
// N.B. This name is slightly historical: hunting season is now open for SkImages too.
|
||||
struct SkBitmapHunter {
|
||||
// Some ops have a paint, some have an optional paint. Either way, get back a pointer.
|
||||
|
@ -473,69 +473,6 @@ static void test_savelayer_extraction(skiatest::Reporter* reporter) {
|
||||
}
|
||||
}
|
||||
|
||||
static void test_has_text(skiatest::Reporter* reporter) {
|
||||
SkPictureRecorder recorder;
|
||||
|
||||
SkCanvas* canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint());
|
||||
}
|
||||
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
|
||||
REPORTER_ASSERT(reporter, !picture->hasText());
|
||||
|
||||
SkPoint point = SkPoint::Make(10, 10);
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
canvas->drawText("Q", 1, point.fX, point.fY, SkPaint());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
canvas->drawPosText("Q", 1, &point, SkPaint());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
canvas->drawPosTextH("Q", 1, &point.fX, point.fY, SkPaint());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
SkPath path;
|
||||
path.moveTo(0, 0);
|
||||
path.lineTo(50, 50);
|
||||
|
||||
canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, SkPaint());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
SkPath path;
|
||||
path.moveTo(0, 0);
|
||||
path.lineTo(50, 50);
|
||||
|
||||
canvas->drawTextOnPath("Q", 1, path, nullptr, SkPaint());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
|
||||
// Nest the previous picture inside a new one.
|
||||
canvas = recorder.beginRecording(100,100);
|
||||
{
|
||||
canvas->drawPicture(picture.get());
|
||||
}
|
||||
picture = recorder.finishRecordingAsPicture();
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
}
|
||||
|
||||
static void set_canvas_to_save_count_4(SkCanvas* canvas) {
|
||||
canvas->restoreToCount(1);
|
||||
canvas->save();
|
||||
@ -1180,7 +1117,6 @@ static void test_typeface(skiatest::Reporter* reporter) {
|
||||
paint.setTypeface(SkTypeface::MakeFromName("Arial", SkTypeface::kItalic));
|
||||
canvas->drawText("Q", 1, 0, 10, paint);
|
||||
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
|
||||
REPORTER_ASSERT(reporter, picture->hasText());
|
||||
SkDynamicMemoryWStream stream;
|
||||
picture->serialize(&stream);
|
||||
}
|
||||
@ -1198,7 +1134,6 @@ DEF_TEST(Picture, reporter) {
|
||||
#if SK_SUPPORT_GPU
|
||||
test_gpu_veto(reporter);
|
||||
#endif
|
||||
test_has_text(reporter);
|
||||
test_images_are_found_by_willPlayBackBitmaps(reporter);
|
||||
test_analysis(reporter);
|
||||
test_clip_bound_opt(reporter);
|
||||
|
Loading…
Reference in New Issue
Block a user