SkRemote: simple impl of onDraw*Text*
Review URL: https://codereview.chromium.org/1409273004
This commit is contained in:
parent
5bce23c33a
commit
f271069830
@ -233,6 +233,35 @@ namespace SkRemote {
|
||||
this->onDrawRect(SkRect::MakeLargest(), paint);
|
||||
}
|
||||
|
||||
void Client::onDrawText(const void* text, size_t byteLength, SkScalar x,
|
||||
SkScalar y, const SkPaint& paint) {
|
||||
// Text-as-paths is a temporary hack.
|
||||
// TODO: send SkTextBlobs and SkTypefaces
|
||||
SkPath path;
|
||||
paint.getTextPath(text, byteLength, x, y, &path);
|
||||
this->onDrawPath(path, paint);
|
||||
}
|
||||
|
||||
void Client::onDrawPosText(const void* text, size_t byteLength,
|
||||
const SkPoint pos[], const SkPaint& paint) {
|
||||
// Text-as-paths is a temporary hack.
|
||||
// TODO: send SkTextBlobs and SkTypefaces
|
||||
SkPath path;
|
||||
paint.getPosTextPath(text, byteLength, pos, &path);
|
||||
this->onDrawPath(path, paint);
|
||||
}
|
||||
|
||||
void Client::onDrawPosTextH(const void* text, size_t byteLength,
|
||||
const SkScalar xpos[], SkScalar constY,
|
||||
const SkPaint& paint) {
|
||||
size_t length = paint.countText(text, byteLength);
|
||||
SkAutoTArray<SkPoint> pos(length);
|
||||
for(size_t i = 0; i < length; ++i) {
|
||||
pos[i].set(xpos[i], constY);
|
||||
}
|
||||
this->onDrawPosText(text, byteLength, &pos[0], paint);
|
||||
}
|
||||
|
||||
void Client::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
|
||||
SkPath path;
|
||||
path.addRect(rect);
|
||||
|
@ -98,6 +98,13 @@ namespace SkRemote {
|
||||
void onDrawRect(const SkRect&, const SkPaint&) override;
|
||||
void onDrawPaint(const SkPaint&) override;
|
||||
|
||||
void onDrawText(const void*, size_t, SkScalar,
|
||||
SkScalar, const SkPaint&) override;
|
||||
void onDrawPosText(const void*, size_t, const SkPoint[],
|
||||
const SkPaint&) override;
|
||||
void onDrawPosTextH(const void*, size_t, const SkScalar[], SkScalar,
|
||||
const SkPaint&) override;
|
||||
|
||||
Cache* fCache;
|
||||
Encoder* fEncoder;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user