Fresco/Berlin/modules/Figures ImageImpl.cc,1.14,1.15 ImageImpl.hh,1.7,1.8 PolyFigure.cc,1.13,1.14 PolyFigure.hh,1.8,1.9
Tobias Hunger <[email protected]> Mon, 27 Oct 2003 17:09:10 +0000
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Figures
In directory purcel:/tmp/cvs-serv5328/Berlin/modules/Figures
Modified Files:
ImageImpl.cc ImageImpl.hh PolyFigure.cc PolyFigure.hh
Log Message:
Make sure all classes defined by Kits are in the Kit's namespace. Do some
coding style fixups while touching the files anyway.
Index: ImageImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Figures/ImageImpl.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- ImageImpl.cc 29 May 2002 06:49:39 -0000 1.14
+++ ImageImpl.cc 27 Oct 2003 17:08:37 -0000 1.15
@@ -31,55 +31,58 @@
using namespace Prague;
using namespace Fresco;
-ImageImpl::ImageImpl(Raster_ptr r)
- : raster(RefCount_var<Fresco::Raster>::increment(r))
+Berlin::FigureKit::ImageImpl::ImageImpl(Raster_ptr r) :
+ raster(RefCount_var<Fresco::Raster>::increment(r))
{
- Fresco::Raster::Info info = raster->header();
- width = info.width*10.;
- height = info.height*10.;
+ Fresco::Raster::Info info = raster->header();
+ width = info.width*10.;
+ height = info.height*10.;
}
-ImageImpl::~ImageImpl() { Trace trace("ImageImpl::~ImageImpl");}
-void ImageImpl::request(Fresco::Graphic::Requisition &r)
+Berlin::FigureKit::ImageImpl::~ImageImpl()
+{ Trace trace("ImageImpl::~ImageImpl"); }
+void Berlin::FigureKit::ImageImpl::request(Fresco::Graphic::Requisition &r)
{
- r.x.defined = true;
- r.x.natural = r.x.maximum = r.x.minimum = width;
- r.x.align = 0.;
- r.y.defined = true;
- r.y.natural = r.y.maximum = r.y.minimum = height;
- r.y.align = 0.;
+ r.x.defined = true;
+ r.x.natural = r.x.maximum = r.x.minimum = width;
+ r.x.align = 0.;
+ r.y.defined = true;
+ r.y.natural = r.y.maximum = r.y.minimum = height;
+ r.y.align = 0.;
}
-void ImageImpl::draw(DrawTraversal_ptr traversal)
+void Berlin::FigureKit::ImageImpl::draw(DrawTraversal_ptr traversal)
{
- if (!traversal->intersects_allocation()) return;
- DrawingKit_var drawing = traversal->drawing();
- drawing->draw_image(raster);
+ if (!traversal->intersects_allocation()) return;
+ DrawingKit_var drawing = traversal->drawing();
+ drawing->draw_image(raster);
}
-void ImageImpl::update(const CORBA::Any &)
+void Berlin::FigureKit::ImageImpl::update(const CORBA::Any &)
{
- need_redraw();
+ need_redraw();
}
-void ImageImpl::activate_composite()
+void Berlin::FigureKit::ImageImpl::activate_composite()
{
- raster->attach(Observer_var(_this()));
+ raster->attach(Observer_var(_this()));
}
-Texture::Texture(Raster_ptr r) : raster(RefCount_var<Fresco::Raster>::increment(r)) {}
-Texture::~Texture() {}
-void Texture::traverse(Traversal_ptr traversal) { traversal->visit(Graphic_var(_this()));}
-void Texture::draw(DrawTraversal_ptr traversal)
+Berlin::FigureKit::Texture::Texture(Raster_ptr r) :
+ raster(RefCount_var<Fresco::Raster>::increment(r)) { }
+Berlin::FigureKit::Texture::~Texture() { }
+void Berlin::FigureKit::Texture::traverse(Traversal_ptr traversal)
+{ traversal->visit(Graphic_var(_this())); }
+void Berlin::FigureKit::Texture::draw(DrawTraversal_ptr traversal)
{
- DrawingKit_var drawing = traversal->drawing();
- drawing->save();
- drawing->texture(raster);
- drawing->surface_fillstyle(DrawingKit::textured);
- MonoGraphic::traverse(traversal);
- drawing->restore();
+ DrawingKit_var drawing = traversal->drawing();
+ drawing->save();
+ drawing->texture(raster);
+ drawing->surface_fillstyle(DrawingKit::textured);
+ MonoGraphic::traverse(traversal);
+ drawing->restore();
}
-void Texture::pick(PickTraversal_ptr traversal)
+void Berlin::FigureKit::Texture::pick(PickTraversal_ptr traversal)
{
- MonoGraphic::traverse(traversal);
+ MonoGraphic::traverse(traversal);
}
Index: ImageImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Figures/ImageImpl.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ImageImpl.hh 29 May 2002 06:49:39 -0000 1.7
+++ ImageImpl.hh 27 Oct 2003 17:08:37 -0000 1.8
@@ -32,37 +32,45 @@
#include <Berlin/MonoGraphic.hh>
#include <Berlin/RefCountVar.hh>
-class ImageImpl : public virtual POA_Fresco::Image,
- public virtual ViewImpl,
- public GraphicImpl
+namespace Berlin
{
-public:
- ImageImpl(Fresco::Raster_ptr);
- ~ImageImpl();
-
- virtual Fresco::Raster_ptr data() { return Fresco::Raster::_duplicate(raster);}
- virtual void data(Fresco::Raster_ptr r) { raster = r;}
+ namespace FigureKit
+ {
+ class ImageImpl : public virtual POA_Fresco::Image,
+ public virtual ViewImpl,
+ public GraphicImpl
+ {
+ public:
+ ImageImpl(Fresco::Raster_ptr);
+ ~ImageImpl();
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void draw(Fresco::DrawTraversal_ptr);
- virtual void update(const CORBA::Any &);
-protected:
- virtual void activate_composite();
-private:
- RefCount_var<Fresco::Raster> raster;
- Fresco::Coord width, height;
-};
+ virtual Fresco::Raster_ptr data()
+ { return Fresco::Raster::_duplicate(raster); }
+ virtual void data(Fresco::Raster_ptr r) { raster = r; }
-class Texture : public MonoGraphic
-{
-public:
- Texture(Fresco::Raster_ptr);
- ~Texture();
- virtual void traverse(Fresco::Traversal_ptr);
- virtual void draw(Fresco::DrawTraversal_ptr);
- virtual void pick(Fresco::PickTraversal_ptr);
-private:
- RefCount_var<Fresco::Raster> raster;
-};
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void draw(Fresco::DrawTraversal_ptr);
+ virtual void update(const CORBA::Any &);
+ protected:
+ virtual void activate_composite();
+ private:
+ RefCount_var<Fresco::Raster> raster;
+ Fresco::Coord width, height;
+ };
+
+ class Texture : public MonoGraphic
+ {
+ public:
+ Texture(Fresco::Raster_ptr);
+ ~Texture();
+ virtual void traverse(Fresco::Traversal_ptr);
+ virtual void draw(Fresco::DrawTraversal_ptr);
+ virtual void pick(Fresco::PickTraversal_ptr);
+ private:
+ RefCount_var<Fresco::Raster> raster;
+ };
+
+ } // namespace
+} // namespace
#endif
Index: PolyFigure.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Figures/PolyFigure.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- PolyFigure.cc 29 May 2002 06:49:39 -0000 1.13
+++ PolyFigure.cc 27 Oct 2003 17:08:37 -0000 1.14
@@ -1,7 +1,7 @@
/*$Id$
*
* This source file is a part of the Fresco Project.
- * Copyright (C) 1999 Stefan Seefeld <[email protected]>
+ * Copyright (C) 1999 Stefan Seefeld <[email protected]>
* http://www.fresco.org
*
* This library is free software; you can redistribute it and/or
@@ -32,77 +32,80 @@
using namespace Prague;
using namespace Fresco;
-PolyFigure::PolyFigure()
- : _tx(new TransformImpl),
- _bbox(new RegionImpl)
-{
-}
+Berlin::FigureKit::PolyFigure::PolyFigure() :
+ _tx(new TransformImpl),
+ _bbox(new RegionImpl)
+{ }
-PolyFigure::PolyFigure(const PolyFigure &pf)
- : _tx(new TransformImpl),
- _bbox(new RegionImpl)
+Berlin::FigureKit::PolyFigure::PolyFigure(const PolyFigure &pf) :
+ _tx(new TransformImpl),
+ _bbox(new RegionImpl)
{
_bbox->valid = pf._bbox->valid;
if (_bbox->valid) _bbox->copy(Region_var(pf._bbox->_this()));
}
-PolyFigure::~PolyFigure()
+Berlin::FigureKit::PolyFigure::~PolyFigure()
{
}
-void PolyFigure::update_bbox()
+void Berlin::FigureKit::PolyFigure::update_bbox()
{
- if (!_bbox->valid)
+ if (!_bbox->valid)
{
- CORBA::ULong n = num_children();
- if (n > 0)
- {
- Allocation::Info info;
- for (CORBA::ULong i = 0; i < n; i++)
- _children[i].peer->extension(info, Region_var(_bbox->_this()));
- }
+ CORBA::ULong n = num_children();
+ if (n > 0)
+ {
+ Allocation::Info info;
+ for (CORBA::ULong i = 0; i < n; i++)
+ _children[i].peer->extension(info, Region_var(_bbox->_this()));
+ }
}
}
-void PolyFigure::allocate(Tag, const Allocation::Info &info)
+void Berlin::FigureKit::PolyFigure::allocate(Tag, const Allocation::Info &info)
{
- // undefine the allocation...how ? -Stefan
-// info.allocation->;
- info.transformation->premultiply(Transform_var(_tx->_this()));
+ // undefine the allocation...how ? -Stefan
+ // info.allocation->;
+ info.transformation->premultiply(Transform_var(_tx->_this()));
}
-void PolyFigure::request(Fresco::Graphic::Requisition &r)
+void Berlin::FigureKit::PolyFigure::request(Fresco::Graphic::Requisition &r)
{
- GraphicImpl::init_requisition(r);
- Impl_var<RegionImpl> region(new RegionImpl);
- update_bbox();
- if (_bbox->valid)
+ GraphicImpl::init_requisition(r);
+ Impl_var<RegionImpl> region(new RegionImpl);
+ update_bbox();
+ if (_bbox->valid)
{
- region->copy(Region_var(_bbox->_this()));
- region->apply_transform(Transform_var(_tx->_this()));
- Coord x_lead = -region->lower.x, x_trail = region->upper.x;
- Coord y_lead = -region->lower.y, y_trail = region->upper.y;
- GraphicImpl::require_lead_trail(r.x, x_lead, x_lead, x_lead, x_trail, x_trail, x_trail);
- GraphicImpl::require_lead_trail(r.y, y_lead, y_lead, y_lead, y_trail, y_trail, y_trail);
+ region->copy(Region_var(_bbox->_this()));
+ region->apply_transform(Transform_var(_tx->_this()));
+ Coord x_lead = -region->lower.x, x_trail = region->upper.x;
+ Coord y_lead = -region->lower.y, y_trail = region->upper.y;
+ GraphicImpl::require_lead_trail(r.x, x_lead, x_lead, x_lead,
+ x_trail, x_trail, x_trail);
+ GraphicImpl::require_lead_trail(r.y, y_lead, y_lead, y_lead,
+ y_trail, y_trail, y_trail);
}
}
// If given transform is nil, PolyFigure::extension considers this a flag
// meaning "ok to calculate an imprecise extension" and thus bounding box
// can be used.
-
-void PolyFigure::extension(const Allocation::Info &info, Region_ptr region)
+
+void Berlin::FigureKit::PolyFigure::extension(const Allocation::Info &info,
+ Region_ptr region)
{
- Impl_var<RegionImpl> tmp(new RegionImpl);
- update_bbox();
- if (_bbox->valid)
+ Impl_var<RegionImpl> tmp(new RegionImpl);
+ update_bbox();
+ if (_bbox->valid)
{
- Impl_var<TransformImpl> transformation(new TransformImpl);
- if (!CORBA::is_nil(info.transformation)) transformation->copy(info.transformation);
- transformation->premultiply(Transform_var(_tx->_this()));
- tmp->copy(Region_var(_bbox->_this()));
- tmp->apply_transform(Transform_var(transformation->_this()));
- region->merge_union(Region_var(tmp->_this()));
+ Impl_var<TransformImpl> transformation(new TransformImpl);
+ if (!CORBA::is_nil(info.transformation))
+ transformation->copy(info.transformation);
+ transformation->premultiply(Transform_var(_tx->_this()));
+ tmp->copy(Region_var(_bbox->_this()));
+ tmp->apply_transform(Transform_var(transformation->_this()));
+ region->merge_union(Region_var(tmp->_this()));
}
}
@@ -111,56 +114,66 @@
* and then call PolyGraphic::traverse, we need to push
* the figure's trafo as well ! -stefan
*/
-void PolyFigure::traverse(Traversal_ptr traversal)
+void Berlin::FigureKit::PolyFigure::traverse(Traversal_ptr traversal)
{
- Trace trace("PolyFigure::traverse");
- update_bbox();
- if (!_bbox->valid) return;
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- region->copy(Region_var(_bbox->_this()));
- region->apply_transform(Transform_var(_tx->_this()));
- if (!traversal->intersects_region(Region_var(region->_this()))) return;
- CORBA::Long n = num_children();
- for (CORBA::Long i = 0; i != n && traversal->ok(); i++)
+ Trace trace("PolyFigure::traverse");
+ update_bbox();
+ if (!_bbox->valid) return;
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ region->copy(Region_var(_bbox->_this()));
+ region->apply_transform(Transform_var(_tx->_this()));
+ if (!traversal->intersects_region(Region_var(region->_this()))) return;
+ CORBA::Long n = num_children();
+ for (CORBA::Long i = 0; i != n && traversal->ok(); i++)
{
- Graphic_var child = _children[i].peer;
- if (CORBA::is_nil(child)) continue;
- try { traversal->traverse_child(child, _children[i].localId, Region_var(_bbox->_this()), Transform_var(_tx->_this()));}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _children [i].peer = Fresco::Graphic::_nil ();}
- catch (const CORBA::COMM_FAILURE &) { _children [i].peer = Fresco::Graphic::_nil ();}
+ Graphic_var child = _children[i].peer;
+ if (CORBA::is_nil(child)) continue;
+ try
+ {
+ traversal->traverse_child(child, _children[i].localId,
+ Region_var(_bbox->_this()),
+ Transform_var(_tx->_this()));
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ {
+ _children [i].peer = Fresco::Graphic::_nil ();
+ }
+ catch (const CORBA::COMM_FAILURE &)
+ {
+ _children [i].peer = Fresco::Graphic::_nil ();
+ }
}
-
}
-Transform_ptr PolyFigure::transformation()
+Transform_ptr Berlin::FigureKit::PolyFigure::transformation()
{
- return _tx->_this();
+ return _tx->_this();
}
-void PolyFigure::need_redraw()
+void Berlin::FigureKit::PolyFigure::need_redraw()
{
- GraphicImpl::need_redraw();
- // Calling GraphicImpl::needRedraw does not allow us to take
- // advantage of bbox for damage. However, to do damage with
- // bbox, we would need to grow the transformed bbox to compensate
- // for the brush size of leaves. (In truth, we should do the same for
- // the cull test as well since currently culling will prevent redraw
- // when the outer part of an outer leaf's brush is damaged.)
+ GraphicImpl::need_redraw();
+ // Calling GraphicImpl::needRedraw does not allow us to take
+ // advantage of bbox for damage. However, to do damage with
+ // bbox, we would need to grow the transformed bbox to compensate
+ // for the brush size of leaves. (In truth, we should do the same for
+ // the cull test as well since currently culling will prevent redraw
+ // when the outer part of an outer leaf's brush is damaged.)
}
-void PolyFigure::need_resize()
+void Berlin::FigureKit::PolyFigure::need_resize()
{
- _bbox->valid = false;
- PolyGraphic::need_resize();
+ _bbox->valid = false;
+ PolyGraphic::need_resize();
}
-UPolyFigure::UPolyFigure(const UPolyFigure &up) : PolyFigure(up) {}
+Berlin::FigureKit::UPolyFigure::UPolyFigure(const UPolyFigure &up) : PolyFigure(up) { }
/*
* FIXME !!!: implement this according to Fresco's comments
* in figures.idl: FigureKit::ugroup()
*/
-void UPolyFigure::traverse(Traversal_ptr traversal)
+void Berlin::FigureKit::UPolyFigure::traverse(Traversal_ptr traversal)
{
- Trace trace("UPolyFigure::traverse");
+ Trace trace("UPolyFigure::traverse");
}
Index: PolyFigure.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Figures/PolyFigure.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- PolyFigure.hh 29 May 2002 06:49:39 -0000 1.8
+++ PolyFigure.hh 27 Oct 2003 17:08:37 -0000 1.9
@@ -1,7 +1,7 @@
/*$Id$
*
* This source file is a part of the Fresco Project.
- * Copyright (C) 1999 Stefan Seefeld <[email protected]>
+ * Copyright (C) 1999 Stefan Seefeld <[email protected]>
* http://www.fresco.org
*
* This library is free software; you can redistribute it and/or
@@ -29,47 +29,54 @@
class TransformImpl;
-class PolyFigure : public virtual POA_Figure::FigureBase,
- public PolyGraphic
+namespace Berlin
{
-public:
- PolyFigure();
- PolyFigure(const PolyFigure &);
- virtual ~PolyFigure();
+ namespace FigureKit
+ {
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void extension(const Fresco::Allocation::Info &, Fresco::Region_ptr);
- virtual void traverse(Fresco::Traversal_ptr);
- virtual Fresco::Transform_ptr transformation();
- virtual void need_redraw();
- virtual void need_resize();
- virtual void allocate(Fresco::Tag, const Fresco::Allocation::Info &);
+ class PolyFigure : public virtual POA_Figure::FigureBase, public PolyGraphic
+ {
+ public:
+ PolyFigure();
+ PolyFigure(const PolyFigure &);
+ virtual ~PolyFigure();
- /*
- * shameless hack !!!: eventually these settings are dealt with
- * by styles so PolyFigures simply ignore it...
- * -stefan
- */
- Figure::Mode type() { return 0;}
- void type(Figure::Mode) {}
- Fresco::Color foreground() { return Fresco::Color();}
- void foreground(const Fresco::Color &) {}
- Fresco::Color background() { return Fresco::Color();}
- void background(const Fresco::Color &) {}
- virtual void resize() {}
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void extension(const Fresco::Allocation::Info &, Fresco::Region_ptr);
+ virtual void traverse(Fresco::Traversal_ptr);
+ virtual Fresco::Transform_ptr transformation();
+ virtual void need_redraw();
+ virtual void need_resize();
+ virtual void allocate(Fresco::Tag, const Fresco::Allocation::Info &);
-protected:
- void update_bbox();
- Impl_var<TransformImpl> _tx;
- Impl_var<RegionImpl> _bbox;
-};
+ /*
+ * shameless hack !!!: eventually these settings are dealt with
+ * by styles so PolyFigures simply ignore it...
+ * -stefan
+ */
+ Figure::Mode type() { return 0;}
+ void type(Figure::Mode) {}
+ Fresco::Color foreground() { return Fresco::Color();}
+ void foreground(const Fresco::Color &) {}
+ Fresco::Color background() { return Fresco::Color();}
+ void background(const Fresco::Color &) {}
+ virtual void resize() {}
-class UPolyFigure : public PolyFigure
-{
-public:
- UPolyFigure() {}
- UPolyFigure(const UPolyFigure &);
- virtual void traverse(Fresco::Traversal_ptr);
-};
+ protected:
+ void update_bbox();
+ Impl_var<TransformImpl> _tx;
+ Impl_var<RegionImpl> _bbox;
+ };
+
+ class UPolyFigure : public PolyFigure
+ {
+ public:
+ UPolyFigure() {}
+ UPolyFigure(const UPolyFigure &);
+ virtual void traverse(Fresco::Traversal_ptr);
+ };
+
+ } // namespace
+} // namespace
#endif