1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FRAMEWORKS_WM_INCLUDE_WL_SURFACE_H 17 #define FRAMEWORKS_WM_INCLUDE_WL_SURFACE_H 18 19 #include <linux-explicit-synchronization-unstable-v1-client-protocol.h> 20 #include <refbase.h> 21 #include <viewporter-client-protocol.h> 22 #include <wayland-client-protocol.h> 23 24 #include "wl_buffer.h" 25 26 namespace OHOS { 27 class WlSurface : public RefBase { 28 public: 29 WlSurface(struct wl_surface *ws, 30 struct zwp_linux_surface_synchronization_v1 *zlssv, 31 struct wp_viewport *wv); 32 virtual ~WlSurface() override; 33 34 struct wl_surface *GetRawPtr() const; 35 void *GetUserData() const; 36 void SetUserData(void *data); 37 38 void Attach(sptr<WlBuffer> &buffer, int32_t x, int32_t y); 39 void Damage(int32_t x, int32_t y, uint32_t w, uint32_t h); 40 void Commit(); 41 void SetSurfaceType(wl_surface_type type); 42 void SetBufferTransform(wl_output_transform type); 43 struct zwp_linux_buffer_release_v1 *GetBufferRelease(); 44 void SetAcquireFence(int32_t fence); 45 void SetSource(double x, double y, double w, double h); 46 void SetDestination(uint32_t w, uint32_t h); 47 48 private: 49 struct wl_surface *surf = nullptr; 50 struct zwp_linux_surface_synchronization_v1 *sync = nullptr; 51 struct wp_viewport *viewport = nullptr; 52 enum wl_output_transform bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL; 53 }; 54 } // namespace OHOS 55 56 #endif // FRAMEWORKS_WM_INCLUDE_WL_SURFACE_H 57