Get the pixel size in bytes. @return pixel size, or 0 if the format is unknown, or pixels are not aligned to bytes. */
| 662 | @return pixel size, or 0 if the format is unknown, or pixels are not aligned to bytes. |
| 663 | */ |
| 664 | static int getBytesPerPixel(const cairo_format_t format) noexcept |
| 665 | { |
| 666 | switch (format) |
| 667 | { |
| 668 | case CAIRO_FORMAT_ARGB32: |
| 669 | case CAIRO_FORMAT_RGB24: |
| 670 | return 4; |
| 671 | case CAIRO_FORMAT_A8: |
| 672 | return 1; |
| 673 | default: |
| 674 | DISTRHO_SAFE_ASSERT(false); |
| 675 | return 0; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | static cairo_surface_t* getRegion(cairo_surface_t* origsurface, int x, int y, int width, int height) noexcept |
| 680 | { |