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
78 lines
2.1 KiB
C++
78 lines
2.1 KiB
C++
/*
|
|
* Copyright 2012 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"
|
|
#include "SkPaint.h"
|
|
#include "SkRandom.h"
|
|
#include "SkTemplates.h"
|
|
|
|
class GetPosTextPathGM : public skiagm::GM {
|
|
public:
|
|
GetPosTextPathGM() {}
|
|
|
|
protected:
|
|
virtual uint32_t onGetFlags() const SK_OVERRIDE {
|
|
return kSkipTiled_Flag;
|
|
}
|
|
|
|
SkString onShortName() {
|
|
return SkString("getpostextpath");
|
|
}
|
|
|
|
SkISize onISize() { return skiagm::make_isize(480, 780); }
|
|
|
|
static void strokePath(SkCanvas* canvas, const SkPath& path) {
|
|
SkPaint paint;
|
|
paint.setAntiAlias(true);
|
|
paint.setColor(SK_ColorRED);
|
|
paint.setStyle(SkPaint::kStroke_Style);
|
|
canvas->drawPath(path, paint);
|
|
}
|
|
|
|
virtual void onDraw(SkCanvas* canvas) {
|
|
// explicitly add spaces, to test a prev. bug
|
|
const char* text = "Ham bur ge fons";
|
|
int len = SkToInt(strlen(text));
|
|
SkPath path;
|
|
|
|
SkPaint paint;
|
|
paint.setAntiAlias(true);
|
|
paint.setTextSize(SkIntToScalar(48));
|
|
|
|
canvas->translate(SkIntToScalar(10), SkIntToScalar(64));
|
|
|
|
canvas->drawText(text, len, 0, 0, paint);
|
|
paint.getTextPath(text, len, 0, 0, &path);
|
|
strokePath(canvas, path);
|
|
path.reset();
|
|
|
|
SkAutoTArray<SkPoint> pos(len);
|
|
SkAutoTArray<SkScalar> widths(len);
|
|
paint.getTextWidths(text, len, &widths[0]);
|
|
|
|
SkLCGRandom rand;
|
|
SkScalar x = SkIntToScalar(20);
|
|
SkScalar y = SkIntToScalar(100);
|
|
for (int i = 0; i < len; ++i) {
|
|
pos[i].set(x, y + rand.nextSScalar1() * 24);
|
|
x += widths[i];
|
|
}
|
|
|
|
canvas->translate(0, SkIntToScalar(64));
|
|
|
|
canvas->drawPosText(text, len, &pos[0], paint);
|
|
paint.getPosTextPath(text, len, &pos[0], &path);
|
|
strokePath(canvas, path);
|
|
}
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
static skiagm::GM* F(void*) { return new GetPosTextPathGM; }
|
|
static skiagm::GMRegistry gR(F);
|