use portable typeface
TBR=reed@google.com Review URL: https://codereview.chromium.org/1235873004
This commit is contained in:
parent
e20633ed26
commit
7aa1899c03
@ -10,10 +10,7 @@
|
||||
#include "SkRegion.h"
|
||||
#include "SkShader.h"
|
||||
#include "SkUtils.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkTypeface.h"
|
||||
#include "SkBlurMask.h"
|
||||
|
||||
// effects
|
||||
#include "SkGradientShader.h"
|
||||
@ -48,13 +45,9 @@ static const SkColorType gColorTypes[] = {
|
||||
};
|
||||
|
||||
class ScaledTilingGM : public skiagm::GM {
|
||||
SkAutoTUnref<SkBlurDrawLooper> fLooper;
|
||||
public:
|
||||
ScaledTilingGM(bool powerOfTwoSize)
|
||||
: fLooper(SkBlurDrawLooper::Create(0x88000000,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(1)),
|
||||
SkIntToScalar(2), SkIntToScalar(2)))
|
||||
, fPowerOfTwoSize(powerOfTwoSize) {
|
||||
: fPowerOfTwoSize(powerOfTwoSize) {
|
||||
}
|
||||
|
||||
SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
|
||||
@ -109,9 +102,7 @@ protected:
|
||||
SkPaint p;
|
||||
SkString str;
|
||||
p.setAntiAlias(true);
|
||||
sk_tool_utils::set_portable_typeface(&p);
|
||||
p.setDither(true);
|
||||
p.setLooper(fLooper);
|
||||
sk_tool_utils::set_portable_typeface_always(&p);
|
||||
str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
|
||||
|
||||
p.setTextAlign(SkPaint::kCenter_Align);
|
||||
@ -151,8 +142,7 @@ protected:
|
||||
SkPaint p;
|
||||
SkString str;
|
||||
p.setAntiAlias(true);
|
||||
sk_tool_utils::set_portable_typeface(&p);
|
||||
p.setLooper(fLooper);
|
||||
sk_tool_utils::set_portable_typeface_always(&p);
|
||||
str.printf("%s, %s", gColorTypeNames[i], gFilterNames[j]);
|
||||
canvas->drawText(str.c_str(), str.size(), scale*x, scale*(y + r.height() * 2 / 3), p);
|
||||
}
|
||||
@ -180,7 +170,7 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
|
||||
SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)} };
|
||||
SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 };
|
||||
SkScalar rad = SkIntToScalar(gWidth)/2;
|
||||
SkColor colors[] = { 0xFFFF0000, 0xFF0044FF };
|
||||
SkColor colors[] = { 0xFFFF0000, sk_tool_utils::color_to_565(0xFF0044FF) };
|
||||
|
||||
int index = (int)ty;
|
||||
switch (index % 3) {
|
||||
@ -232,7 +222,7 @@ protected:
|
||||
|
||||
SkPaint p;
|
||||
p.setAntiAlias(true);
|
||||
sk_tool_utils::set_portable_typeface(&p);
|
||||
sk_tool_utils::set_portable_typeface_always(&p);
|
||||
p.setTextAlign(SkPaint::kCenter_Align);
|
||||
|
||||
for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
|
||||
|
Loading…
Reference in New Issue
Block a user