diff options
author | caryclark <caryclark@google.com> | 2015-06-15 05:09:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-15 05:09:59 -0700 |
commit | be7f768a357aefb39c42d24b81b24d647bb6ab70 (patch) | |
tree | a5897bcb5ce6dc995cf0cfea5e72a989cc2d16a1 | |
parent | b5b50a07abb454abaf6ab46db20c6db6f5ecf9f6 (diff) |
make gm background colors 565 compatible
Change a batch of GM tests to convert their background color
so that it is representable in 8888 and 565.
Enable portable text in those same tests to minimize platform
differences.
In a couple of bitmap tests, use portable typefaces instead of
choosing 'Times' which may or may not be available on the platform.
R=borenet@google.com
Review URL: https://codereview.chromium.org/1176243006
38 files changed, 67 insertions, 65 deletions
diff --git a/gm/anisotropic.cpp b/gm/anisotropic.cpp index a004d750e1..c1f5190a65 100644 --- a/gm/anisotropic.cpp +++ b/gm/anisotropic.cpp @@ -13,7 +13,7 @@ namespace skiagm { class AnisotropicGM : public GM { public: AnisotropicGM() : fFilterQuality(kHigh_SkFilterQuality) { - this->setBGColor(0xFFCCCCCC); + this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); } protected: diff --git a/gm/arcofzorro.cpp b/gm/arcofzorro.cpp index ef2a36b9fa..6efea27dcc 100644 --- a/gm/arcofzorro.cpp +++ b/gm/arcofzorro.cpp @@ -16,7 +16,7 @@ namespace skiagm { class ArcOfZorroGM : public GM { public: ArcOfZorroGM() { - this->setBGColor(0xFFCCCCCC); + this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); } protected: diff --git a/gm/bigblurs.cpp b/gm/bigblurs.cpp index 2f1011b67d..a92c7fe8df 100644 --- a/gm/bigblurs.cpp +++ b/gm/bigblurs.cpp @@ -19,7 +19,7 @@ namespace skiagm { class BigBlursGM : public GM { public: BigBlursGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/bigmatrix.cpp b/gm/bigmatrix.cpp index 32e637ba66..abe0f4e750 100644 --- a/gm/bigmatrix.cpp +++ b/gm/bigmatrix.cpp @@ -15,7 +15,7 @@ namespace skiagm { class BigMatrixGM : public GM { public: BigMatrixGM() { - this->setBGColor(0xFF66AA99); + this->setBGColor(sk_tool_utils::color_to_565(0xFF66AA99)); } protected: diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index 32e91e3cec..e1268b72dd 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -48,7 +48,7 @@ public: SkBitmap fDst[NUM_CONFIGS]; BitmapCopyGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -75,9 +75,9 @@ protected: src.copyTo(&fDst[i], gColorTypes[i]); } - canvas->clear(0xFFDDDDDD); + canvas->clear(sk_tool_utils::color_to_565(0xFFDDDDDD)); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); SkScalar width = SkIntToScalar(40); SkScalar height = SkIntToScalar(40); diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index 22a297df92..11f93c9868 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -53,7 +53,7 @@ static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { const int scale = 32; paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); const char* name = sk_tool_utils::colortype_name(bm.colorType()); canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8, paint); @@ -80,7 +80,7 @@ public: SkBitmap fBM8, fBM4444, fBM16, fBM32; FilterGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/blurs.cpp b/gm/blurs.cpp index 3fae2b324e..e7b66d5265 100644 --- a/gm/blurs.cpp +++ b/gm/blurs.cpp @@ -12,7 +12,7 @@ class BlursGM : public skiagm::GM { public: BlursGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/bmpfilterqualityrepeat.cpp b/gm/bmpfilterqualityrepeat.cpp index 1097141158..edcd6968f5 100644 --- a/gm/bmpfilterqualityrepeat.cpp +++ b/gm/bmpfilterqualityrepeat.cpp @@ -14,7 +14,7 @@ // the bmp filter respects the repeat mode at the tile seams. class BmpFilterQualityRepeat : public skiagm::GM { public: - BmpFilterQualityRepeat() { this->setBGColor(0xFFCCBBAA); } + BmpFilterQualityRepeat() { this->setBGColor(sk_tool_utils::color_to_565(0xFFCCBBAA)); } protected: @@ -51,6 +51,7 @@ protected: for (size_t q = 0; q < SK_ARRAY_COUNT(kQualities); ++q) { SkPaint paint; + sk_tool_utils::set_portable_typeface_always(&paint); paint.setFilterQuality(kQualities[q].fQuality); SkPaint bmpPaint(paint); SkMatrix lm = SkMatrix::I(); diff --git a/gm/clipdrawdraw.cpp b/gm/clipdrawdraw.cpp index 11561b29a6..9659201054 100644 --- a/gm/clipdrawdraw.cpp +++ b/gm/clipdrawdraw.cpp @@ -20,7 +20,7 @@ namespace skiagm { // can leave 1 pixel wide remnants of the first rect. class ClipDrawDrawGM : public GM { public: - ClipDrawDrawGM() { this->setBGColor(0xFFCCCCCC); } + ClipDrawDrawGM() { this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); } protected: SkString onShortName() override { return SkString("clipdrawdraw"); } diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index 36cf8c59d2..8dcdf15e50 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -49,7 +49,7 @@ class ColorMatrixGM : public GM { public: ColorMatrixGM() { - this->setBGColor(0xFF808080); + this->setBGColor(sk_tool_utils::color_to_565(0xFF808080)); } protected: diff --git a/gm/complexclip3.cpp b/gm/complexclip3.cpp index afabcf69d8..7c22d71eec 100644 --- a/gm/complexclip3.cpp +++ b/gm/complexclip3.cpp @@ -17,7 +17,7 @@ class ComplexClip3GM : public GM { public: ComplexClip3GM(bool doSimpleClipFirst) : fDoSimpleClipFirst(doSimpleClipFirst) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -49,7 +49,7 @@ protected: SkPaint paint; paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); paint.setTextSize(SkIntToScalar(20)); static const struct { diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index 159bf0650a..cea7986cd3 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -25,7 +25,7 @@ namespace skiagm { class ConstColorProcessor : public GM { public: ConstColorProcessor() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -124,6 +124,7 @@ protected: // Draw labels for the input to the processor and the processor to the right of // the test rect. The input label appears above the processor label. SkPaint labelPaint; + sk_tool_utils::set_portable_typeface_always(&labelPaint); labelPaint.setAntiAlias(true); labelPaint.setTextSize(10.f); SkString inputLabel; diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp index 6cfd00e840..a456c0c24a 100644 --- a/gm/dcshader.cpp +++ b/gm/dcshader.cpp @@ -110,7 +110,7 @@ bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMat class DCShaderGM : public GM { public: DCShaderGM() { - this->setBGColor(0xFFAABBCC); + this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); } ~DCShaderGM() override { @@ -210,7 +210,7 @@ protected: } virtual void setFont(SkPaint* paint) { - sk_tool_utils::set_portable_typeface(paint); + sk_tool_utils::set_portable_typeface_always(paint); } virtual const char* text() const { return "Hello, Skia!"; } diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp index 8decc69f60..bb4736826f 100644 --- a/gm/downsamplebitmap.cpp +++ b/gm/downsamplebitmap.cpp @@ -31,7 +31,7 @@ static void make_checker(SkBitmap* bm, int size, int numChecks) { } static void setTypeface(SkPaint* paint, const char name[], SkTypeface::Style style) { - sk_tool_utils::set_portable_typeface(paint, name, style); + sk_tool_utils::set_portable_typeface_always(paint, name, style); } class DownsampleBitmapGM : public skiagm::GM { @@ -44,7 +44,7 @@ public: DownsampleBitmapGM(SkFilterQuality filterQuality) : fFilterQuality(filterQuality) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); fBitmapMade = false; } @@ -126,13 +126,13 @@ class DownsampleBitmapTextGM: public DownsampleBitmapGM { paint.setSubpixelText(true); paint.setTextSize(fTextSize); - setTypeface(&paint, "Times", SkTypeface::kNormal); + setTypeface(&paint, "serif", SkTypeface::kNormal); canvas.drawText("Hamburgefons", 12, fTextSize/2, 1.2f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kBold); + setTypeface(&paint, "serif", SkTypeface::kBold); canvas.drawText("Hamburgefons", 12, fTextSize/2, 2.4f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kItalic); + setTypeface(&paint, "serif", SkTypeface::kItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 3.6f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kBoldItalic); + setTypeface(&paint, "serif", SkTypeface::kBoldItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 4.8f*fTextSize, paint); } private: @@ -202,7 +202,7 @@ public: SkBitmap fBM; ShowMipLevels() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); make_checker(&fBM, 512, 256); } diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp index 25c9843016..74e7e91fe6 100644 --- a/gm/drawlooper.cpp +++ b/gm/drawlooper.cpp @@ -19,7 +19,7 @@ class DrawLooperGM : public skiagm::GM { public: DrawLooperGM() : fLooper(NULL) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } virtual ~DrawLooperGM() { diff --git a/gm/emptypath.cpp b/gm/emptypath.cpp index b3f8016453..64eb28694f 100644 --- a/gm/emptypath.cpp +++ b/gm/emptypath.cpp @@ -92,7 +92,7 @@ protected: SkColor color = rand.nextU(); color = 0xff000000 | color; // force solid - sk_tool_utils::color_to_565(&color); + color = sk_tool_utils::color_to_565(color); this->drawEmpty(canvas, color, rect, gStyles[style].fStyle, gFills[fill].fFill); diff --git a/gm/filltypes.cpp b/gm/filltypes.cpp index 4ba3aeb975..f01f9bdd72 100644 --- a/gm/filltypes.cpp +++ b/gm/filltypes.cpp @@ -13,7 +13,7 @@ class FillTypeGM : public GM { SkPath fPath; public: FillTypeGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } void makePath() { diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp index 7d7c40ff50..d7194c096d 100644 --- a/gm/filterbitmap.cpp +++ b/gm/filterbitmap.cpp @@ -14,7 +14,7 @@ #include "SkTypeface.h" static void setTypeface(SkPaint* paint, const char name[], SkTypeface::Style style) { - sk_tool_utils::set_portable_typeface(paint, name, style); + sk_tool_utils::set_portable_typeface_always(paint, name, style); } static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { @@ -66,7 +66,7 @@ public: FilterBitmapGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -124,13 +124,13 @@ class FilterBitmapTextGM: public FilterBitmapGM { paint.setSubpixelText(true); paint.setTextSize(fTextSize); - setTypeface(&paint, "Times", SkTypeface::kNormal); + setTypeface(&paint, "serif", SkTypeface::kNormal); canvas.drawText("Hamburgefons", 12, fTextSize/2, 1.2f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kBold); + setTypeface(&paint, "serif", SkTypeface::kBold); canvas.drawText("Hamburgefons", 12, fTextSize/2, 2.4f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kItalic); + setTypeface(&paint, "serif", SkTypeface::kItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 3.6f*fTextSize, paint); - setTypeface(&paint, "Times", SkTypeface::kBoldItalic); + setTypeface(&paint, "serif", SkTypeface::kBoldItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 4.8f*fTextSize, paint); } private: diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp index 5ff398e9ad..a4b65e011d 100644 --- a/gm/filterfastbounds.cpp +++ b/gm/filterfastbounds.cpp @@ -150,7 +150,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) { class ImageFilterFastBoundGM : public GM { public: ImageFilterFastBoundGM() { - this->setBGColor(0xFFCCCCCC); + this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); } protected: diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp index d2fc30b82c..b9f5a7ad51 100644 --- a/gm/filterindiabox.cpp +++ b/gm/filterindiabox.cpp @@ -62,7 +62,7 @@ public: SkString fName; FilterIndiaBoxGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } FilterIndiaBoxGM(const char filename[]) : fFilename(filename) { diff --git a/gm/gradientDirtyLaundry.cpp b/gm/gradientDirtyLaundry.cpp index ed5ad51f44..2ba0963013 100644 --- a/gm/gradientDirtyLaundry.cpp +++ b/gm/gradientDirtyLaundry.cpp @@ -66,7 +66,7 @@ static const GradMaker gGradMakers[] = { class GradientsGM : public GM { public: GradientsGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp index 77a02475d2..10499ca986 100644 --- a/gm/gradient_matrix.cpp +++ b/gm/gradient_matrix.cpp @@ -116,7 +116,7 @@ namespace skiagm { class GradientMatrixGM : public GM { public: GradientMatrixGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/gradients.cpp b/gm/gradients.cpp index 4e6aba9521..523a11211a 100644 --- a/gm/gradients.cpp +++ b/gm/gradients.cpp @@ -101,7 +101,7 @@ static const GradMaker gGradMakers[] = { class GradientsGM : public GM { public: GradientsGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -156,7 +156,7 @@ DEF_GM( return new GradientsGM; ) class GradientsLocalPerspectiveGM : public GM { public: GradientsLocalPerspectiveGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/gradients_2pt_conical.cpp b/gm/gradients_2pt_conical.cpp index c865d7177f..1e32426547 100644 --- a/gm/gradients_2pt_conical.cpp +++ b/gm/gradients_2pt_conical.cpp @@ -306,7 +306,7 @@ enum GradCaseType { // these must match the order in gGradCases class ConicalGradientsGM : public GM { public: ConicalGradientsGM(GradCaseType gradCaseType) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); fName.printf("gradients_2pt_conical_%s", gGradCases[gradCaseType].fName); fGradCaseType = gradCaseType; } diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp index 391472a0c7..e706ac634f 100644 --- a/gm/gradients_no_texture.cpp +++ b/gm/gradients_no_texture.cpp @@ -81,7 +81,7 @@ static const GradMaker gGradMakers[] = { class GradientsNoTextureGM : public GM { public: GradientsNoTextureGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/internal_links.cpp b/gm/internal_links.cpp index 3ba3052c6a..e422868ebc 100644 --- a/gm/internal_links.cpp +++ b/gm/internal_links.cpp @@ -20,7 +20,7 @@ namespace skiagm { class InternalLinksGM : public GM { public: InternalLinksGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -61,7 +61,7 @@ private: canvas->drawRect(rect, paint); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); paint.setTextSize(SkIntToScalar(25)); paint.setColor(SK_ColorBLACK); canvas->drawText(text, strlen(text), x, y, paint); diff --git a/gm/modecolorfilters.cpp b/gm/modecolorfilters.cpp index 96b31cb6ef..4fea1f1512 100644 --- a/gm/modecolorfilters.cpp +++ b/gm/modecolorfilters.cpp @@ -56,7 +56,7 @@ static SkShader* make_bg_shader(int checkSize) { class ModeColorFilterGM : public GM { public: ModeColorFilterGM() { - this->setBGColor(0xFF303030); + this->setBGColor(sk_tool_utils::color_to_565(0xFF303030)); } protected: diff --git a/gm/nested.cpp b/gm/nested.cpp index 518a864613..9040ba6fba 100644 --- a/gm/nested.cpp +++ b/gm/nested.cpp @@ -15,7 +15,7 @@ namespace skiagm { class NestedGM : public GM { public: NestedGM(bool doAA, bool flipped) : fDoAA(doAA), fFlipped(flipped) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/pathinterior.cpp b/gm/pathinterior.cpp index f56681ab8a..24fea6854e 100644 --- a/gm/pathinterior.cpp +++ b/gm/pathinterior.cpp @@ -21,7 +21,7 @@ static SkRect inset(const SkRect& r) { class PathInteriorGM : public skiagm::GM { public: PathInteriorGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/gm/rrects.cpp b/gm/rrects.cpp index be46929045..d8d62c4fec 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -27,7 +27,7 @@ public: kEffect_Type, }; RRectGM(Type type) : fType(type) { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); this->setUpRRects(); } diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp index 6845fa1c5c..599cff3469 100644 --- a/gm/shadertext.cpp +++ b/gm/shadertext.cpp @@ -87,7 +87,7 @@ static const GradMaker gGradMakers[] = { class ShaderTextGM : public GM { public: ShaderTextGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -144,7 +144,7 @@ protected: SkPaint paint; paint.setDither(true); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); paint.setTextSize(SkIntToScalar(pointSize)); canvas->save(); diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp index 92a0138acd..cd996b3031 100644 --- a/gm/shadertext2.cpp +++ b/gm/shadertext2.cpp @@ -43,7 +43,7 @@ struct LabeledMatrix { class ShaderText2GM : public GM { public: ShaderText2GM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -90,13 +90,13 @@ protected: SkPaint fillPaint; fillPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&fillPaint); + sk_tool_utils::set_portable_typeface_always(&fillPaint); fillPaint.setTextSize(SkIntToScalar(kPointSize)); fillPaint.setFilterQuality(kLow_SkFilterQuality); SkPaint outlinePaint; outlinePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&outlinePaint); + sk_tool_utils::set_portable_typeface_always(&outlinePaint); outlinePaint.setTextSize(SkIntToScalar(kPointSize)); outlinePaint.setStyle(SkPaint::kStroke_Style); outlinePaint.setStrokeWidth(0.f); @@ -112,7 +112,7 @@ protected: SkPaint labelPaint; labelPaint.setColor(0xff000000); labelPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&labelPaint); + sk_tool_utils::set_portable_typeface_always(&labelPaint); labelPaint.setTextSize(12.f); canvas->translate(15.f, 15.f); diff --git a/gm/shadertext3.cpp b/gm/shadertext3.cpp index 49cdced97e..47dd29e60c 100644 --- a/gm/shadertext3.cpp +++ b/gm/shadertext3.cpp @@ -48,7 +48,7 @@ static const int kPointSize = 300; class ShaderText3GM : public GM { public: ShaderText3GM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: @@ -73,7 +73,7 @@ protected: SkPaint outlinePaint; outlinePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&outlinePaint); + sk_tool_utils::set_portable_typeface_always(&outlinePaint); outlinePaint.setTextSize(SkIntToScalar(kPointSize)); outlinePaint.setStyle(SkPaint::kStroke_Style); outlinePaint.setStrokeWidth(0.f); @@ -107,7 +107,7 @@ protected: SkPaint fillPaint; fillPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&fillPaint); + sk_tool_utils::set_portable_typeface_always(&fillPaint); fillPaint.setTextSize(SkIntToScalar(kPointSize)); fillPaint.setFilterQuality(kLow_SkFilterQuality); fillPaint.setShader(shader); diff --git a/gm/shadows.cpp b/gm/shadows.cpp index adb34b6f0a..5c0e1e123a 100644 --- a/gm/shadows.cpp +++ b/gm/shadows.cpp @@ -30,7 +30,7 @@ public: protected: void onOnceBeforeDraw() override { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); fCirclePath.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(10) ); fRect.set(SkIntToScalar(10), SkIntToScalar(10), SkIntToScalar(30), SkIntToScalar(30)); diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp index c232a2575a..c0aa515507 100644 --- a/gm/simpleaaclip.cpp +++ b/gm/simpleaaclip.cpp @@ -64,7 +64,7 @@ protected: fBasePath.addRoundRect(fBase, SkIntToScalar(5), SkIntToScalar(5)); fRectPath.addRoundRect(fRect, SkIntToScalar(5), SkIntToScalar(5)); - INHERITED::setBGColor(0xFFDDDDDD); + INHERITED::setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } void buildRgn(SkAAClip* clip, SkRegion::Op op) { @@ -156,7 +156,7 @@ protected: SkPaint textPaint; textPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&textPaint); + sk_tool_utils::set_portable_typeface_always(&textPaint); textPaint.setTextSize(SK_Scalar1*24); int xOff = 0; diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp index a188af9c65..9bfa2287ca 100644 --- a/gm/tinybitmap.cpp +++ b/gm/tinybitmap.cpp @@ -32,7 +32,7 @@ static SkBitmap make_bitmap() { class TinyBitmapGM : public GM { public: TinyBitmapGM() { - this->setBGColor(0xFFDDDDDD); + this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp index ec7942b165..4d0e0bde68 100644 --- a/tools/sk_tool_utils.cpp +++ b/tools/sk_tool_utils.cpp @@ -34,10 +34,10 @@ const char* colortype_name(SkColorType ct) { } } -void color_to_565(SkColor* color) { - SkPMColor pmColor = SkPreMultiplyColor(*color); +SkColor color_to_565(SkColor color) { + SkPMColor pmColor = SkPreMultiplyColor(color); U16CPU color16 = SkPixel32ToPixel16(pmColor); - *color = SkPixel16ToColor(color16); + return SkPixel16ToColor(color16); } SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style) { diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h index 4d4a5b4fcd..302de958b5 100644 --- a/tools/sk_tool_utils.h +++ b/tools/sk_tool_utils.h @@ -24,7 +24,7 @@ class SkTextBlobBuilder; namespace sk_tool_utils { const char* colortype_name(SkColorType); - void color_to_565(SkColor* color); + SkColor color_to_565(SkColor color); /** * Sets the paint to use a platform-independent text renderer if FLAGS_portableFonts is set. |