Example #1
0
void stroke_selection(Image* image,
                      const gfx::Point& offset,
                      const Mask* origMask,
                      const color_t color)
{
  ASSERT(origMask);
  ASSERT(origMask->bitmap());
  if (!origMask || !origMask->bitmap())
    return;

  gfx::Rect bounds = origMask->bounds();
  if (bounds.isEmpty())
    return;

  Mask mask;
  mask.reserve(bounds);
  mask.freeze();
  modify_selection(
    SelectionModifier::Border,
    origMask, &mask, 1,
    BrushType::kCircleBrushType);
  mask.unfreeze();

  // Both mask must have the same bounds.
  ASSERT(mask.bounds() == origMask->bounds());

  if (mask.bitmap())
    fill_selection(image, offset, &mask, color);
}