diff options
author | corvid <corvid@lavabit.com> | 2010-03-11 16:47:09 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2010-03-11 16:47:09 +0000 |
commit | 286bfdb1e392ed133642f2e60e6c993102bcbea9 (patch) | |
tree | d856a3a47ced68d8fa7d59447d4592a737cbe3d9 /dw/image.cc | |
parent | 6697c42e7393ce469e8c58c9407930439208fb2a (diff) |
draw image maps when image not loaded
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-March/007393.html
(Johannes has already fixed the Rectangle clipping problem. Why the polygons
aren't shown initially isn't known yet.)
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/dw/image.cc b/dw/image.cc index 457fe8d8..13212cdc 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -38,6 +38,18 @@ ImageMapsList::ImageMap::~ImageMap () delete shapesAndLinks; } +void ImageMapsList::ImageMap::draw (core::View *view,core::style::Style *style, + int x, int y) +{ + container::typed::Iterator <ShapeAndLink> it; + + for (it = shapesAndLinks->iterator (); it.hasNext (); ) { + ShapeAndLink *shapeAndLink = it.getNext (); + + shapeAndLink->shape->draw(view, style, x, y); + } +} + void ImageMapsList::ImageMap::add (core::Shape *shape, int link) { ShapeAndLink *shapeAndLink = new ShapeAndLink (); shapeAndLink->shape = shape; @@ -105,6 +117,15 @@ void ImageMapsList::setCurrentMapDefaultLink (int link) currentMap->setDefaultLink (link); } +void ImageMapsList::drawMap (lout::object::Object *key, core::View *view, + core::style::Style *style, int x, int y) +{ + ImageMap *map = imageMaps->get (key); + + if (map) + map->draw(view, style, x, y); +} + int ImageMapsList::link (object::Object *key, int x, int y) { int link = -1; @@ -348,12 +369,17 @@ void Image::draw (core::View *view, core::Rectangle *area) intersection.x - dx, intersection.y - dy, intersection.width, intersection.height); } else { + core::View *clippingView; + if (altText && altText[0]) { + core::View *usedView = view; + + clippingView = NULL; + if (altTextWidth == -1) altTextWidth = layout->textWidth (getStyle()->font, altText, strlen (altText)); - core::View *clippingView = NULL, *usedView = view; if ((getContentWidth() < altTextWidth) || (getContentHeight() < getStyle()->font->ascent + getStyle()->font->descent)) { @@ -374,6 +400,18 @@ void Image::draw (core::View *view, core::Rectangle *area) if (clippingView) view->mergeClippingView (clippingView); } + if (mapKey) { + clippingView = view->getClippingView (allocation.x + + getStyle()->boxOffsetX (), + allocation.y + + getStyle()->boxOffsetY (), + getContentWidth(), + getContentHeight()); + mapList->drawMap(mapKey, clippingView, getStyle(), + allocation.x + getStyle()->boxOffsetX (), + allocation.y + getStyle()->boxOffsetY ()); + view->mergeClippingView (clippingView); + } } /** TODO: draw selection */ |