comparison Framework/Scene2D/CairoCompositor.cpp @ 1211:d10d2acb8a02 broker

compositors do not keep a reference to the scene anymore
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 16:47:21 +0100
parents 1091b2adeb5a
children 0ca50d275b9a
comparison
equal deleted inserted replaced
1210:644baa70373d 1211:d10d2acb8a02
83 return NULL; 83 return NULL;
84 } 84 }
85 } 85 }
86 86
87 87
88 CairoCompositor::CairoCompositor(const Scene2D& scene, 88 CairoCompositor::CairoCompositor(unsigned int canvasWidth,
89 unsigned int canvasWidth, 89 unsigned int canvasHeight)
90 unsigned int canvasHeight) :
91 helper_(scene, *this)
92 { 90 {
91 ResetScene();
93 UpdateSize(canvasWidth, canvasHeight); 92 UpdateSize(canvasWidth, canvasHeight);
94 } 93 }
95 94
96 void CairoCompositor::UpdateSize(unsigned int canvasWidth, 95 void CairoCompositor::UpdateSize(unsigned int canvasWidth,
97 unsigned int canvasHeight) 96 unsigned int canvasHeight)
152 SetFont(index, alphabet.release()); 151 SetFont(index, alphabet.release());
153 } 152 }
154 #endif 153 #endif
155 154
156 155
157 void CairoCompositor::Refresh() 156 void CairoCompositor::Refresh(const Scene2D& scene)
158 { 157 {
159 context_.reset(new CairoContext(canvas_)); 158 context_.reset(new CairoContext(canvas_));
160 159
161 // https://www.cairographics.org/FAQ/#clear_a_surface 160 // https://www.cairographics.org/FAQ/#clear_a_surface
162 cairo_set_source_rgba(context_->GetObject(), 0, 0, 0, 255); 161 cairo_set_source_rgba(context_->GetObject(), 0, 0, 0, 255);
163 cairo_paint(context_->GetObject()); 162 cairo_paint(context_->GetObject());
164 163
165 helper_.Refresh(canvas_.GetWidth(), canvas_.GetHeight()); 164 helper_->Refresh(scene, canvas_.GetWidth(), canvas_.GetHeight());
166 context_.reset(); 165 context_.reset();
167 } 166 }
168 167
169 168
170 Orthanc::ImageAccessor* CairoCompositor::RenderText(size_t fontIndex, 169 Orthanc::ImageAccessor* CairoCompositor::RenderText(size_t fontIndex,