comparison OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp @ 1610:b7630b1a0253

ISceneLayer::GetBoundingBox() returns void
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Oct 2020 17:13:13 +0100
parents 8563ea5d8ae4
children 59f95b9ea858
comparison
equal deleted inserted replaced
1609:5f5c549499ff 1610:b7630b1a0253
158 AffineTransform2D::CreateOffset(-0.5, -0.5), 158 AffineTransform2D::CreateOffset(-0.5, -0.5),
159 AffineTransform2D::CreateFlip(flipX_, flipY_, width, height)); 159 AffineTransform2D::CreateFlip(flipX_, flipY_, width, height));
160 } 160 }
161 161
162 162
163 bool TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const 163 void TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const
164 { 164 {
165 if (texture_.get() == NULL) 165 target.Clear();
166 { 166
167 return false; 167 if (texture_.get() != NULL)
168 }
169 else
170 { 168 {
171 const AffineTransform2D t = GetTransform(); 169 const AffineTransform2D t = GetTransform();
172 170
173 target.Reset();
174
175 double x, y; 171 double x, y;
176 172
177 x = 0; 173 x = 0;
178 y = 0; 174 y = 0;
179 t.Apply(x, y); 175 t.Apply(x, y);
191 187
192 x = static_cast<double>(texture_->GetWidth()); 188 x = static_cast<double>(texture_->GetWidth());
193 y = static_cast<double>(texture_->GetHeight()); 189 y = static_cast<double>(texture_->GetHeight());
194 t.Apply(x, y); 190 t.Apply(x, y);
195 target.AddPoint(x, y); 191 target.AddPoint(x, y);
196
197 return true;
198 } 192 }
199 } 193 }
200 } 194 }