Esempio n. 1
0
    void ImageView::OnPaint(gfx::Canvas* canvas)
    {
        View::OnPaint(canvas);

        if(image_.empty())
        {
            return;
        }

        gfx::Rect image_bounds(GetImageBounds());
        if(image_bounds.IsEmpty())
        {
            return;
        }

        if(image_bounds.size() != gfx::Size(image_.width(), image_.height()))
        {
            // Resize case
            image_.buildMipMap(false);
            SkPaint paint;
            paint.setFilterBitmap(true);
            canvas->DrawBitmapInt(image_, 0, 0, image_.width(), image_.height(),
                image_bounds.x(), image_bounds.y(), image_bounds.width(),
                image_bounds.height(), true, paint);
        }
        else
        {
            canvas->DrawBitmapInt(image_, image_bounds.x(), image_bounds.y());
        }
    }
Esempio n. 2
0
void ClipLineToImage(const Vec3F& line,
										 const ImageRef& size,
										 Vec3F& a,
										 Vec3F& b) {
	vector<Vec3F> bounds;
	GetImageBounds(size, bounds);
	ClipLineToPoly(line, bounds, a, b);
}