MCPcopy Create free account
hub / github.com/Tencent/libpag / ExpandRectRange

Function ExpandRectRange

exporter/src/utils/ImageData.cpp:137–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void ExpandRectRange(ImageRect& dstRect, const ImageRect& srcRect, const ImageRect& lastRect,
138 int width, int height, int expand) {
139
140 int leftExpand = 0;
141 int topExpand = 0;
142 int rightExpand = 0;
143 int bottomExpand = 0;
144
145 if (InRange(srcRect.xPos, lastRect.xPos, lastRect.width)) {
146 leftExpand = std::min(expand, srcRect.xPos);
147 }
148 if (InRange(srcRect.xPos + srcRect.width, lastRect.xPos, lastRect.width)) {
149 rightExpand = std::min(expand, width - (srcRect.xPos + srcRect.width));
150 }
151 if (InRange(srcRect.yPos, lastRect.yPos, lastRect.height)) {
152 topExpand = std::min(expand, srcRect.yPos);
153 }
154 if (InRange(srcRect.yPos + srcRect.height, lastRect.yPos, lastRect.height)) {
155 bottomExpand = std::min(expand, height - (srcRect.yPos + srcRect.height));
156 }
157
158 dstRect.xPos = srcRect.xPos - leftExpand;
159 dstRect.yPos = srcRect.yPos - topExpand;
160 dstRect.width = srcRect.width + leftExpand + rightExpand;
161 dstRect.height = srcRect.height + topExpand + bottomExpand;
162}
163
164pag::ByteData* EncodeImageData(uint8_t* rgbaBytes, int width, int height, int rowBytes,
165 int quality) {

Callers 1

GetBitmapSequenceFunction · 0.85

Calls 1

InRangeFunction · 0.70

Tested by

no test coverage detected