diff --git a/include/picom/backend.h b/include/picom/backend.h index f8a60c98..ab0757a7 100644 --- a/include/picom/backend.h +++ b/include/picom/backend.h @@ -172,49 +172,6 @@ enum backend_image_capability { BACKEND_IMAGE_CAP_DST = 1 << 1, }; -enum backend_command_op { - BACKEND_COMMAND_INVALID = -1, - BACKEND_COMMAND_BLIT, - BACKEND_COMMAND_BLUR, - BACKEND_COMMAND_COPY_AREA, -}; - -/// Symbolic references used as render command source images. The actual `image_handle` -/// will later be filled in by the renderer using this symbolic reference. -enum backend_command_source { - BACKEND_COMMAND_SOURCE_WINDOW, - BACKEND_COMMAND_SOURCE_WINDOW_SAVED, - BACKEND_COMMAND_SOURCE_SHADOW, - BACKEND_COMMAND_SOURCE_BACKGROUND, -}; - -// TODO(yshui) might need better names - -struct backend_command { - enum backend_command_op op; - ivec2 origin; - enum backend_command_source source; - union { - struct { - struct backend_blit_args blit; - /// Region of the screen that will be covered by this blit - /// operations, in screen coordinates. - region_t opaque_region; - }; - struct { - image_handle source_image; - const region_t *region; - } copy_area; - struct backend_blur_args blur; - }; - /// Source mask for the operation. - /// If the `source_mask` of the operation's argument points to this, a mask image - /// will be created for the operation for the renderer. - struct backend_mask_image source_mask; - /// Target mask for the operation. - region_t target_mask; -}; - enum backend_quirk { /// Backend cannot do blur quickly. The compositor will avoid using blur to create /// shadows on this backend diff --git a/src/backend/backend.h b/src/backend/backend.h index 32c037c9..d0f4cfdc 100644 --- a/src/backend/backend.h +++ b/src/backend/backend.h @@ -9,6 +9,49 @@ #include "log.h" +enum backend_command_op { + BACKEND_COMMAND_INVALID = -1, + BACKEND_COMMAND_BLIT, + BACKEND_COMMAND_BLUR, + BACKEND_COMMAND_COPY_AREA, +}; + +/// Symbolic references used as render command source images. The actual `image_handle` +/// will later be filled in by the renderer using this symbolic reference. +enum backend_command_source { + BACKEND_COMMAND_SOURCE_WINDOW, + BACKEND_COMMAND_SOURCE_WINDOW_SAVED, + BACKEND_COMMAND_SOURCE_SHADOW, + BACKEND_COMMAND_SOURCE_BACKGROUND, +}; + +// TODO(yshui) might need better names + +struct backend_command { + enum backend_command_op op; + ivec2 origin; + enum backend_command_source source; + union { + struct { + struct backend_blit_args blit; + /// Region of the screen that will be covered by this blit + /// operations, in screen coordinates. + region_t opaque_region; + }; + struct { + image_handle source_image; + const region_t *region; + } copy_area; + struct backend_blur_args blur; + }; + /// Source mask for the operation. + /// If the `source_mask` of the operation's argument points to this, a mask image + /// will be created for the operation for the renderer. + struct backend_mask_image source_mask; + /// Target mask for the operation. + region_t target_mask; +}; + bool backend_execute(struct backend_base *backend, image_handle target, unsigned ncmds, const struct backend_command cmds[ncmds]); diff --git a/src/renderer/command_builder.c b/src/renderer/command_builder.c index 3f26a1fd..50f3312e 100644 --- a/src/renderer/command_builder.c +++ b/src/renderer/command_builder.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui +#include "backend/backend.h" #include "common.h" #include "layout.h" #include "utils/dynarr.h" diff --git a/src/renderer/damage.c b/src/renderer/damage.c index 5778e717..6eb155f8 100644 --- a/src/renderer/damage.c +++ b/src/renderer/damage.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui +#include "backend/backend.h" #include "layout.h" #include "region.h" #include "utils/dynarr.h"