a90c680386
- Rename TileGrid -> Quilt to avoid the name overload. - Tag all failing GMs with kSkipTiled_Flag. You may be wondering, do any GMs pass? Yes, some do! And that trends towards all of them as we increase --quiltTile. Two GMs only fail in --quilt mode in 565. Otherwise all GMs which fail are skipped, and those which don't fail aren't. (The 8888 variants of those two GMs are skipped even though they pass.) BUG=skia:2477 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/256373002 git-svn-id: http://skia.googlecode.com/svn/trunk@14457 2bbb7eff-a529-9590-31e7-b0007b416f81
83 lines
2.1 KiB
C++
83 lines
2.1 KiB
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "gm.h"
|
|
#include "SkCanvas.h"
|
|
|
|
static void test_nulldev(SkCanvas* canvas) {
|
|
SkBitmap bm;
|
|
bm.setConfig(SkBitmap::kARGB_8888_Config, 30, 30);
|
|
// notice: no pixels mom! be sure we don't crash
|
|
// https://code.google.com/p/chromium/issues/detail?id=352616
|
|
SkCanvas c(bm);
|
|
|
|
SkBitmap src;
|
|
src.allocN32Pixels(10, 10);
|
|
src.eraseColor(SK_ColorRED);
|
|
|
|
// ensure we don't crash
|
|
c.writePixels(src, 0, 0);
|
|
}
|
|
|
|
static void draw_text_stroked(SkCanvas* canvas, const SkPaint& paint) {
|
|
SkPaint p(paint);
|
|
SkPoint loc = { 20, 450 };
|
|
|
|
canvas->drawText("P", 1, loc.fX, loc.fY - 225, p);
|
|
canvas->drawPosText("P", 1, &loc, p);
|
|
|
|
p.setColor(SK_ColorRED);
|
|
p.setStyle(SkPaint::kStroke_Style);
|
|
p.setStrokeWidth(10);
|
|
|
|
canvas->drawText("P", 1, loc.fX, loc.fY - 225, p);
|
|
canvas->drawPosText("P", 1, &loc, p);
|
|
}
|
|
|
|
class StrokeTextGM : public skiagm::GM {
|
|
// Skia has a threshold above which it draws text via paths instead of using scalercontext
|
|
// and caching the glyph. This GM wants to ensure that we draw stroking correctly on both
|
|
// sides of this threshold.
|
|
enum {
|
|
kBelowThreshold_TextSize = 255,
|
|
kAboveThreshold_TextSize = 257
|
|
};
|
|
public:
|
|
StrokeTextGM() {}
|
|
|
|
protected:
|
|
virtual uint32_t onGetFlags() const SK_OVERRIDE {
|
|
return kSkipTiled_Flag;
|
|
}
|
|
|
|
virtual SkString onShortName() SK_OVERRIDE {
|
|
return SkString("stroketext");
|
|
}
|
|
|
|
virtual SkISize onISize() SK_OVERRIDE {
|
|
return SkISize::Make(640, 480);
|
|
}
|
|
|
|
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
|
if (true) { test_nulldev(canvas); }
|
|
SkPaint paint;
|
|
paint.setAntiAlias(true);
|
|
|
|
paint.setTextSize(kBelowThreshold_TextSize);
|
|
draw_text_stroked(canvas, paint);
|
|
|
|
canvas->translate(200, 0);
|
|
paint.setTextSize(kAboveThreshold_TextSize);
|
|
draw_text_stroked(canvas, paint);
|
|
}
|
|
|
|
private:
|
|
typedef skiagm::GM INHERITED;
|
|
};
|
|
|
|
DEF_GM( return SkNEW(StrokeTextGM); )
|