void gegl_sampler_prepare (GeglSampler *self) { GeglSamplerClass *klass; g_return_if_fail (GEGL_IS_SAMPLER (self)); klass = GEGL_SAMPLER_GET_CLASS (self); if (klass->prepare) klass->prepare (self); self->fish = babl_fish (self->interpolate_format, self->format); /* * This makes the cache rect invalid, in case the data in the buffer * has changed: */ self->sampler_rectangle[0].width = 0; self->sampler_rectangle[0].height = 0; #if 0 if (self->cache_buffer) /* Force a regetting of the region, even though the cached getter may be valid. */ { g_free (self->cache_buffer); self->cache_buffer = NULL; } #endif self->get = klass->get; /* cache the sampler in the instance */ }
void gegl_sampler_prepare (GeglSampler *self) { GeglSamplerClass *klass; g_return_if_fail (GEGL_IS_SAMPLER (self)); klass = GEGL_SAMPLER_GET_CLASS (self); if (!self->buffer) /* happens when extent of sampler is queried */ return; if (!self->format) self->format = self->buffer->soft_format; if (klass->prepare) klass->prepare (self); if (!self->fish) self->fish = babl_fish (self->interpolate_format, self->format); /* * This makes the cache rect invalid, in case the data in the buffer * has changed: */ self->level[0].sampler_rectangle.width = 0; self->level[0].sampler_rectangle.height = 0; }
void gegl_sampler_set_buffer (GeglSampler *self, GeglBuffer *buffer) { GeglSamplerClass *klass; g_return_if_fail (GEGL_IS_SAMPLER (self)); klass = GEGL_SAMPLER_GET_CLASS (self); if (klass->set_buffer) klass->set_buffer (self, buffer); }