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
This commit is contained in:
caryclark 2015-06-15 05:28:00 -07:00 committed by Commit bot
parent be7f768a35
commit 0bdb08b1ba
38 changed files with 65 additions and 67 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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);

View File

@ -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:

View File

@ -12,7 +12,7 @@
class BlursGM : public skiagm::GM {
public:
BlursGM() {
this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
this->setBGColor(0xFFDDDDDD);
}
protected:

View File

@ -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();

View File

@ -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"); }

View File

@ -49,7 +49,7 @@ class ColorMatrixGM : public GM {
public:
ColorMatrixGM() {
this->setBGColor(sk_tool_utils::color_to_565(0xFF808080));
this->setBGColor(0xFF808080);
}
protected:

View File

@ -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 {

View File

@ -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;

View File

@ -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!"; }

View File

@ -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);
}

View File

@ -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() {

View File

@ -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);

View File

@ -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() {

View File

@ -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:

View File

@ -150,7 +150,7 @@ static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) {
class ImageFilterFastBoundGM : public GM {
public:
ImageFilterFastBoundGM() {
this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC));
this->setBGColor(0xFFCCCCCC);
}
protected:

View File

@ -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) {

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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;
}

View File

@ -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:

View File

@ -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);

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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();
}

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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:

View File

@ -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) {

View File

@ -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.