From 0bdb08b1ba8fbd18c4838f86a23f1ef4b3a3bfdf Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 15 Jun 2015 05:28:00 -0700 Subject: [PATCH] Revert of make gm background colors 565 compatible (patchset #2 id:20001 of https://codereview.chromium.org/1176243006/) Reason for revert: breaks many bots with refcnt error Original issue's description: > 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 > > Committed: https://skia.googlesource.com/skia/+/be7f768a357aefb39c42d24b81b24d647bb6ab70 TBR=borenet@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1184123002 --- gm/anisotropic.cpp | 2 +- gm/arcofzorro.cpp | 2 +- gm/bigblurs.cpp | 2 +- gm/bigmatrix.cpp | 2 +- gm/bitmapcopy.cpp | 6 +++--- gm/bitmapfilters.cpp | 4 ++-- gm/blurs.cpp | 2 +- gm/bmpfilterqualityrepeat.cpp | 3 +-- gm/clipdrawdraw.cpp | 2 +- gm/colormatrix.cpp | 2 +- gm/complexclip3.cpp | 4 ++-- gm/constcolorprocessor.cpp | 3 +-- gm/dcshader.cpp | 4 ++-- gm/downsamplebitmap.cpp | 14 +++++++------- gm/drawlooper.cpp | 2 +- gm/emptypath.cpp | 2 +- gm/filltypes.cpp | 2 +- gm/filterbitmap.cpp | 12 ++++++------ gm/filterfastbounds.cpp | 2 +- gm/filterindiabox.cpp | 2 +- gm/gradientDirtyLaundry.cpp | 2 +- gm/gradient_matrix.cpp | 2 +- gm/gradients.cpp | 4 ++-- gm/gradients_2pt_conical.cpp | 2 +- gm/gradients_no_texture.cpp | 2 +- gm/internal_links.cpp | 4 ++-- gm/modecolorfilters.cpp | 2 +- gm/nested.cpp | 2 +- gm/pathinterior.cpp | 2 +- gm/rrects.cpp | 2 +- gm/shadertext.cpp | 4 ++-- gm/shadertext2.cpp | 8 ++++---- gm/shadertext3.cpp | 6 +++--- gm/shadows.cpp | 2 +- gm/simpleaaclip.cpp | 4 ++-- gm/tinybitmap.cpp | 2 +- tools/sk_tool_utils.cpp | 6 +++--- tools/sk_tool_utils.h | 2 +- 38 files changed, 65 insertions(+), 67 deletions(-) diff --git a/gm/anisotropic.cpp b/gm/anisotropic.cpp index c1f5190a65..a004d750e1 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(sk_tool_utils::color_to_565(0xFFCCCCCC)); + this->setBGColor(0xFFCCCCCC); } protected: diff --git a/gm/arcofzorro.cpp b/gm/arcofzorro.cpp index 6efea27dcc..ef2a36b9fa 100644 --- a/gm/arcofzorro.cpp +++ b/gm/arcofzorro.cpp @@ -16,7 +16,7 @@ namespace skiagm { class ArcOfZorroGM : public GM { public: ArcOfZorroGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); + this->setBGColor(0xFFCCCCCC); } protected: diff --git a/gm/bigblurs.cpp b/gm/bigblurs.cpp index a92c7fe8df..2f1011b67d 100644 --- a/gm/bigblurs.cpp +++ b/gm/bigblurs.cpp @@ -19,7 +19,7 @@ namespace skiagm { class BigBlursGM : public GM { public: BigBlursGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/bigmatrix.cpp b/gm/bigmatrix.cpp index abe0f4e750..32e637ba66 100644 --- a/gm/bigmatrix.cpp +++ b/gm/bigmatrix.cpp @@ -15,7 +15,7 @@ namespace skiagm { class BigMatrixGM : public GM { public: BigMatrixGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFF66AA99)); + this->setBGColor(0xFF66AA99); } protected: diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index e1268b72dd..32e91e3cec 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -48,7 +48,7 @@ public: SkBitmap fDst[NUM_CONFIGS]; BitmapCopyGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -75,9 +75,9 @@ protected: src.copyTo(&fDst[i], gColorTypes[i]); } - canvas->clear(sk_tool_utils::color_to_565(0xFFDDDDDD)); + canvas->clear(0xFFDDDDDD); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&paint); + sk_tool_utils::set_portable_typeface(&paint); SkScalar width = SkIntToScalar(40); SkScalar height = SkIntToScalar(40); diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index 11f93c9868..22a297df92 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_always(&paint); + sk_tool_utils::set_portable_typeface(&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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/blurs.cpp b/gm/blurs.cpp index e7b66d5265..3fae2b324e 100644 --- a/gm/blurs.cpp +++ b/gm/blurs.cpp @@ -12,7 +12,7 @@ class BlursGM : public skiagm::GM { public: BlursGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/bmpfilterqualityrepeat.cpp b/gm/bmpfilterqualityrepeat.cpp index edcd6968f5..1097141158 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(sk_tool_utils::color_to_565(0xFFCCBBAA)); } + BmpFilterQualityRepeat() { this->setBGColor(0xFFCCBBAA); } protected: @@ -51,7 +51,6 @@ 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 9659201054..11561b29a6 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(sk_tool_utils::color_to_565(0xFFCCCCCC)); } + ClipDrawDrawGM() { this->setBGColor(0xFFCCCCCC); } protected: SkString onShortName() override { return SkString("clipdrawdraw"); } diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp index 8dcdf15e50..36cf8c59d2 100644 --- a/gm/colormatrix.cpp +++ b/gm/colormatrix.cpp @@ -49,7 +49,7 @@ class ColorMatrixGM : public GM { public: ColorMatrixGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFF808080)); + this->setBGColor(0xFF808080); } protected: diff --git a/gm/complexclip3.cpp b/gm/complexclip3.cpp index 7c22d71eec..afabcf69d8 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -49,7 +49,7 @@ protected: SkPaint paint; paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&paint); + sk_tool_utils::set_portable_typeface(&paint); paint.setTextSize(SkIntToScalar(20)); static const struct { diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index cea7986cd3..159bf0650a 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -25,7 +25,7 @@ namespace skiagm { class ConstColorProcessor : public GM { public: ConstColorProcessor() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -124,7 +124,6 @@ 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 a456c0c24a..6cfd00e840 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(sk_tool_utils::color_to_565(0xFFAABBCC)); + this->setBGColor(0xFFAABBCC); } ~DCShaderGM() override { @@ -210,7 +210,7 @@ protected: } virtual void setFont(SkPaint* paint) { - sk_tool_utils::set_portable_typeface_always(paint); + sk_tool_utils::set_portable_typeface(paint); } virtual const char* text() const { return "Hello, Skia!"; } diff --git a/gm/downsamplebitmap.cpp b/gm/downsamplebitmap.cpp index bb4736826f..8decc69f60 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_always(paint, name, style); + sk_tool_utils::set_portable_typeface(paint, name, style); } class DownsampleBitmapGM : public skiagm::GM { @@ -44,7 +44,7 @@ public: DownsampleBitmapGM(SkFilterQuality filterQuality) : fFilterQuality(filterQuality) { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); fBitmapMade = false; } @@ -126,13 +126,13 @@ class DownsampleBitmapTextGM: public DownsampleBitmapGM { paint.setSubpixelText(true); paint.setTextSize(fTextSize); - setTypeface(&paint, "serif", SkTypeface::kNormal); + setTypeface(&paint, "Times", SkTypeface::kNormal); canvas.drawText("Hamburgefons", 12, fTextSize/2, 1.2f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kBold); + setTypeface(&paint, "Times", SkTypeface::kBold); canvas.drawText("Hamburgefons", 12, fTextSize/2, 2.4f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kItalic); + setTypeface(&paint, "Times", SkTypeface::kItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 3.6f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kBoldItalic); + setTypeface(&paint, "Times", SkTypeface::kBoldItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 4.8f*fTextSize, paint); } private: @@ -202,7 +202,7 @@ public: SkBitmap fBM; ShowMipLevels() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); make_checker(&fBM, 512, 256); } diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp index 74e7e91fe6..25c9843016 100644 --- a/gm/drawlooper.cpp +++ b/gm/drawlooper.cpp @@ -19,7 +19,7 @@ class DrawLooperGM : public skiagm::GM { public: DrawLooperGM() : fLooper(NULL) { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } virtual ~DrawLooperGM() { diff --git a/gm/emptypath.cpp b/gm/emptypath.cpp index 64eb28694f..b3f8016453 100644 --- a/gm/emptypath.cpp +++ b/gm/emptypath.cpp @@ -92,7 +92,7 @@ protected: SkColor color = rand.nextU(); color = 0xff000000 | color; // force solid - color = sk_tool_utils::color_to_565(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 f01f9bdd72..4ba3aeb975 100644 --- a/gm/filltypes.cpp +++ b/gm/filltypes.cpp @@ -13,7 +13,7 @@ class FillTypeGM : public GM { SkPath fPath; public: FillTypeGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } void makePath() { diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp index d7194c096d..7d7c40ff50 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_always(paint, name, style); + sk_tool_utils::set_portable_typeface(paint, name, style); } static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { @@ -66,7 +66,7 @@ public: FilterBitmapGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -124,13 +124,13 @@ class FilterBitmapTextGM: public FilterBitmapGM { paint.setSubpixelText(true); paint.setTextSize(fTextSize); - setTypeface(&paint, "serif", SkTypeface::kNormal); + setTypeface(&paint, "Times", SkTypeface::kNormal); canvas.drawText("Hamburgefons", 12, fTextSize/2, 1.2f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kBold); + setTypeface(&paint, "Times", SkTypeface::kBold); canvas.drawText("Hamburgefons", 12, fTextSize/2, 2.4f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kItalic); + setTypeface(&paint, "Times", SkTypeface::kItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 3.6f*fTextSize, paint); - setTypeface(&paint, "serif", SkTypeface::kBoldItalic); + setTypeface(&paint, "Times", SkTypeface::kBoldItalic); canvas.drawText("Hamburgefons", 12, fTextSize/2, 4.8f*fTextSize, paint); } private: diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp index a4b65e011d..5ff398e9ad 100644 --- a/gm/filterfastbounds.cpp +++ b/gm/filterfastbounds.cpp @@ -150,7 +150,7 @@ static void create_paints(SkImageFilter* source, SkTArray* paints) { class ImageFilterFastBoundGM : public GM { public: ImageFilterFastBoundGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); + this->setBGColor(0xFFCCCCCC); } protected: diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp index b9f5a7ad51..d2fc30b82c 100644 --- a/gm/filterindiabox.cpp +++ b/gm/filterindiabox.cpp @@ -62,7 +62,7 @@ public: SkString fName; FilterIndiaBoxGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } FilterIndiaBoxGM(const char filename[]) : fFilename(filename) { diff --git a/gm/gradientDirtyLaundry.cpp b/gm/gradientDirtyLaundry.cpp index 2ba0963013..ed5ad51f44 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp index 10499ca986..77a02475d2 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/gradients.cpp b/gm/gradients.cpp index 523a11211a..4e6aba9521 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -156,7 +156,7 @@ DEF_GM( return new GradientsGM; ) class GradientsLocalPerspectiveGM : public GM { public: GradientsLocalPerspectiveGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/gradients_2pt_conical.cpp b/gm/gradients_2pt_conical.cpp index 1e32426547..c865d7177f 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(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 e706ac634f..391472a0c7 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/internal_links.cpp b/gm/internal_links.cpp index e422868ebc..3ba3052c6a 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -61,7 +61,7 @@ private: canvas->drawRect(rect, paint); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&paint); + sk_tool_utils::set_portable_typeface(&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 4fea1f1512..96b31cb6ef 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(sk_tool_utils::color_to_565(0xFF303030)); + this->setBGColor(0xFF303030); } protected: diff --git a/gm/nested.cpp b/gm/nested.cpp index 9040ba6fba..518a864613 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/pathinterior.cpp b/gm/pathinterior.cpp index 24fea6854e..f56681ab8a 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/gm/rrects.cpp b/gm/rrects.cpp index d8d62c4fec..be46929045 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -27,7 +27,7 @@ public: kEffect_Type, }; RRectGM(Type type) : fType(type) { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); this->setUpRRects(); } diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp index 599cff3469..6845fa1c5c 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -144,7 +144,7 @@ protected: SkPaint paint; paint.setDither(true); paint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&paint); + sk_tool_utils::set_portable_typeface(&paint); paint.setTextSize(SkIntToScalar(pointSize)); canvas->save(); diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp index cd996b3031..92a0138acd 100644 --- a/gm/shadertext2.cpp +++ b/gm/shadertext2.cpp @@ -43,7 +43,7 @@ struct LabeledMatrix { class ShaderText2GM : public GM { public: ShaderText2GM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -90,13 +90,13 @@ protected: SkPaint fillPaint; fillPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&fillPaint); + sk_tool_utils::set_portable_typeface(&fillPaint); fillPaint.setTextSize(SkIntToScalar(kPointSize)); fillPaint.setFilterQuality(kLow_SkFilterQuality); SkPaint outlinePaint; outlinePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&outlinePaint); + sk_tool_utils::set_portable_typeface(&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_always(&labelPaint); + sk_tool_utils::set_portable_typeface(&labelPaint); labelPaint.setTextSize(12.f); canvas->translate(15.f, 15.f); diff --git a/gm/shadertext3.cpp b/gm/shadertext3.cpp index 47dd29e60c..49cdced97e 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: @@ -73,7 +73,7 @@ protected: SkPaint outlinePaint; outlinePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&outlinePaint); + sk_tool_utils::set_portable_typeface(&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_always(&fillPaint); + sk_tool_utils::set_portable_typeface(&fillPaint); fillPaint.setTextSize(SkIntToScalar(kPointSize)); fillPaint.setFilterQuality(kLow_SkFilterQuality); fillPaint.setShader(shader); diff --git a/gm/shadows.cpp b/gm/shadows.cpp index 5c0e1e123a..adb34b6f0a 100644 --- a/gm/shadows.cpp +++ b/gm/shadows.cpp @@ -30,7 +30,7 @@ public: protected: void onOnceBeforeDraw() override { - this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(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 c0aa515507..c232a2575a 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + INHERITED::setBGColor(0xFFDDDDDD); } void buildRgn(SkAAClip* clip, SkRegion::Op op) { @@ -156,7 +156,7 @@ protected: SkPaint textPaint; textPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface_always(&textPaint); + sk_tool_utils::set_portable_typeface(&textPaint); textPaint.setTextSize(SK_Scalar1*24); int xOff = 0; diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp index 9bfa2287ca..a188af9c65 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(sk_tool_utils::color_to_565(0xFFDDDDDD)); + this->setBGColor(0xFFDDDDDD); } protected: diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp index 4d0e0bde68..ec7942b165 100644 --- a/tools/sk_tool_utils.cpp +++ b/tools/sk_tool_utils.cpp @@ -34,10 +34,10 @@ const char* colortype_name(SkColorType ct) { } } -SkColor color_to_565(SkColor color) { - SkPMColor pmColor = SkPreMultiplyColor(color); +void color_to_565(SkColor* color) { + SkPMColor pmColor = SkPreMultiplyColor(*color); U16CPU color16 = SkPixel32ToPixel16(pmColor); - return SkPixel16ToColor(color16); + *color = 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 302de958b5..4d4a5b4fcd 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); - SkColor color_to_565(SkColor color); + void color_to_565(SkColor* color); /** * Sets the paint to use a platform-independent text renderer if FLAGS_portableFonts is set.