7571f9e490
Mechanically updated via Xcode "Replace Regular Expression": typedef (.*) INHERITED; --> using INHERITED = $1; The ClangTidy approach generated an even larger CL which would have required a significant amount of hand-tweaking to be usable. Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
#include "include/core/SkCanvas.h"
|
|
#include "include/core/SkFont.h"
|
|
#include "include/core/SkPaint.h"
|
|
#include "include/core/SkShader.h"
|
|
#include "samplecode/Sample.h"
|
|
|
|
class LCDView : public Sample {
|
|
public:
|
|
LCDView() {}
|
|
|
|
protected:
|
|
SkString name() override { return SkString("LCD Text"); }
|
|
|
|
void drawBG(SkCanvas* canvas) {
|
|
canvas->drawColor(SK_ColorWHITE);
|
|
}
|
|
|
|
void onDrawContent(SkCanvas* canvas) override {
|
|
this->drawBG(canvas);
|
|
|
|
SkPaint paint;
|
|
|
|
SkScalar textSize = SkIntToScalar(6);
|
|
SkScalar delta = SK_Scalar1;
|
|
const char* text = "HHHamburgefonts iii";
|
|
size_t len = strlen(text);
|
|
SkScalar x0 = SkIntToScalar(10);
|
|
SkScalar x1 = SkIntToScalar(310);
|
|
SkScalar y = SkIntToScalar(20);
|
|
|
|
SkFont font;
|
|
for (int i = 0; i < 20; i++) {
|
|
font.setSize(textSize);
|
|
textSize += delta;
|
|
|
|
font.setEdging(SkFont::Edging::kAntiAlias);
|
|
canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, x0, y, font, paint);
|
|
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
|
|
canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, x1, y, font, paint);
|
|
|
|
y += font.getSpacing();
|
|
}
|
|
}
|
|
|
|
private:
|
|
using INHERITED = Sample;
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
DEF_SAMPLE( return new LCDView(); )
|