Skip to content

Commit

Permalink
Minor changes to avoid warning about double <-> float conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Jan 12, 2021
1 parent cedc831 commit 74fbd0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion gfx/matrix_skia.h
Expand Up @@ -101,7 +101,8 @@ namespace gfx {

RectF mapRect(const RectF& src) const {
SkRect dst;
m_skMatrix.mapRect(&dst, SkRect::MakeXYWH(src.x, src.y, src.w, src.h));
m_skMatrix.mapRect(&dst, SkRect::MakeXYWH(SkScalar(src.x), SkScalar(src.y),
SkScalar(src.w), SkScalar(src.h)));
return RectF(dst.x(), dst.y(), dst.width(), dst.height());
}

Expand Down
8 changes: 4 additions & 4 deletions os/skia/skia_helpers.h
Expand Up @@ -29,13 +29,13 @@ inline SkIRect to_skia(const gfx::Rect& rc) {
}

inline SkRect to_skia(const gfx::RectF& rc) {
return SkRect::MakeXYWH(rc.x, rc.y, rc.w, rc.h);
return SkRect::MakeXYWH(SkScalar(rc.x), SkScalar(rc.y), SkScalar(rc.w), SkScalar(rc.h));
}

inline SkRect to_skia_fix(const gfx::RectF& rc) {
return SkRect::MakeXYWH(rc.x, rc.y,
std::max(0.0, rc.w-1),
std::max(0.0, rc.h-1));
return SkRect::MakeXYWH(SkScalar(rc.x), SkScalar(rc.y),
SkScalar(std::max(0.0, rc.w-1)),
SkScalar(std::max(0.0, rc.h-1)));
}

inline void to_skia(const Paint& paint, SkPaint& skPaint) {
Expand Down
2 changes: 1 addition & 1 deletion os/surface.h
Expand Up @@ -116,7 +116,7 @@ namespace os {
void drawCircle(const gfx::PointF& center,
float radius,
const os::Paint& paint) {
drawCircle(center.x, center.y, radius, paint);
drawCircle(float(center.x), float(center.y), radius, paint);
}

void drawCircle(const gfx::Point& center,
Expand Down

0 comments on commit 74fbd0a

Please sign in to comment.