void Bitmap::construct(as_object* /*init*/) { if (_bitmapData) _bitmapData->attach(this); if (!_def && !_bitmapData) return; // Width and height are a maximum of 2880, so there is no risk of // overflow const int w = pixelsToTwips(_width); const int h = pixelsToTwips(_height); SWFMatrix mat; mat.set_scale(1.0 / 20, 1.0 / 20); // Can this be tiled? And smoothing? FillStyle fill = BitmapFill(BitmapFill::CLIPPED, bitmap(), mat, BitmapFill::SMOOTHING_UNSPECIFIED); const size_t fillLeft = _shape.addFillStyle(fill); Path bmpath(w, h, fillLeft, 0, 0, false); bmpath.drawLineTo(w, 0); bmpath.drawLineTo(0, 0); bmpath.drawLineTo(0, h); bmpath.drawLineTo(w, h); _shape.add_path(bmpath); _shape.finalize(); set_invalidated(); }
Bitmap::Bitmap(movie_root& mr, as_object* object, BitmapData_as* bd, DisplayObject* parent) : DisplayObject(mr, object, parent), _bitmapData(bd), _width(_bitmapData->width()), _height(_bitmapData->height()) { _shape.setBounds(SWFRect(0, 0, pixelsToTwips(_width), pixelsToTwips(_height))); assert(bd); assert(!bd->disposed()); }
void qwidget::paintEvent(QPaintEvent *event) { const QRegion& region = event->region(); QRect rect = region.boundingRect(); int xmin = static_cast<int> (pixelsToTwips(rect.x()-1)), ymin = static_cast<int> (pixelsToTwips(rect.y()-1)), xmax = static_cast<int> (pixelsToTwips(rect.right()+1)), ymax = static_cast<int> (pixelsToTwips(rect.bottom()+1)); geometry::Range2d<int> range(xmin, ymin, xmax, ymax); InvalidatedRanges ranges; ranges.add(range); _godfather->setInvalidatedRegions(ranges); _godfather->renderBuffer(); }