コード例 #1
0
ファイル: ImageAndroid.cpp プロジェクト: wufuyue/TCL_S820
static void round(SkIRect* dst, const WebCore::FloatRect& src)
{
    dst->set(SkScalarRound(SkFloatToScalar(src.x())),
             SkScalarRound(SkFloatToScalar(src.y())),
             SkScalarRound(SkFloatToScalar((src.x() + src.width()))),
             SkScalarRound(SkFloatToScalar((src.y() + src.height()))));
}
コード例 #2
0
inline static float offsetToMiddleOfGlyph(const WebCore::SimpleFontData* fontData, WebCore::Glyph glyph)
{
		if (fontData->platformData().orientation() == WebCore::Horizontal) {
				WebCore::FloatRect bounds = fontData->boundsForGlyph(glyph);
        return bounds.x() + bounds.width() / 2;
    }
    // FIXME: Use glyph bounds once they make sense for vertical fonts.
    return fontData->widthForGlyph(glyph) / 2;
}