• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 BLIT_CHECK_H
17 #define BLIT_CHECK_H
18 #include "display_type.h"
19 
20 namespace {
21 struct ColorRGBAf {
22     ColorRGBAf(uint32_t r, uint32_t g, uint32_t b, uint32_t a);
ClearColorRGBAf23     inline void Clear()
24     {
25         mR = 0;
26         mB = 0;
27         mG = 0;
28         mA = 0;
29     }
30     float mR = 0;
31     float mB = 0;
32     float mG = 0;
33     float mA = 0;
34 };
35 
36 struct ColorRGBA32 {
37     explicit ColorRGBA32(ColorRGBAf colorFrom);
38     explicit ColorRGBA32(uint32_t pixel);
39     bool Compare(ColorRGBA32 &other);
40     uint32_t mC = 0;
41     uint8_t mR = 0;
42     uint8_t mB = 0;
43     uint8_t mG = 0;
44     uint8_t mA = 0;
45 };
46 }
47 class SoftBlit {
48 public:
49     SoftBlit(const BufferHandle &srcBuffer, const IRect &srcRect, const BufferHandle &dstBuffer, const IRect &dstRect,
50         const BlendType type);
51     bool RunAndCheck(const BufferHandle &exBuffer);
~SoftBlit()52     ~SoftBlit() {}
53 
54 private:
55     IRect mSrcRect = { 0 };
56     IRect mDstRect = { 0 };
57     BufferHandle mSrcBuffer = { 0 };
58     BufferHandle mDstBuffer = { 0 };
59     BlendType mType = BLEND_BUTT;
60 };
61 
62 #endif // BLIT_CHECK_H
63