diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-03-30 15:12:41 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-03-30 17:03:43 +0300 |
commit | 88e0ed32888f4a87ec1192e3b54aebe8686e029c (patch) | |
tree | 2659678f6a9adfd6605c7fb17b219b9166364ade /source/blender/compositor/operations/COM_GlareFogGlowOperation.cc | |
parent | b48a573adb1e8ba254c5b3ea58bf1bb2a013ce89 (diff) |
Cleanup: Use constexpr.
Diffstat (limited to 'source/blender/compositor/operations/COM_GlareFogGlowOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_GlareFogGlowOperation.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 6b3d08a9315..1e121c246f4 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -273,7 +273,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect()); memset(rdst->getBuffer(), 0, - rdst->getWidth() * rdst->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); + rdst->getWidth() * rdst->getHeight() * COM_data_type_num_channels(DataType::Color) * + sizeof(float)); // convolution result width & height w2 = 2 * kernelWidth - 1; @@ -289,7 +290,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) // normalize convolutor wt[0] = wt[1] = wt[2] = 0.0f; for (y = 0; y < kernelHeight; y++) { - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_data_type_num_channels(DataType::Color)]; for (x = 0; x < kernelWidth; x++) { add_v3_v3(wt, colp[x]); } @@ -304,7 +305,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) wt[2] = 1.0f / wt[2]; } for (y = 0; y < kernelHeight; y++) { - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_data_type_num_channels(DataType::Color)]; for (x = 0; x < kernelWidth; x++) { mul_v3_v3(colp[x], wt); } @@ -338,7 +339,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) // in2, channel ch -> data1 for (y = 0; y < kernelHeight; y++) { fp = &data1ch[y * w2]; - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * + COM_data_type_num_channels(DataType::Color)]; for (x = 0; x < kernelWidth; x++) { fp[x] = colp[x][ch]; } @@ -353,7 +355,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) continue; } fp = &data2[y * w2]; - colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_NUM_CHANNELS_COLOR]; + colp = + (fRGB *)&imageBuffer[yy * imageWidth * COM_data_type_num_channels(DataType::Color)]; for (x = 0; x < xbsz; x++) { int xx = xbl * xbsz + x; if (xx >= imageWidth) { @@ -383,7 +386,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) continue; } fp = &data2[y * w2]; - colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&rdst + ->getBuffer()[yy * imageWidth * COM_data_type_num_channels(DataType::Color)]; for (x = 0; x < (int)w2; x++) { const int xx = xbl * xbsz + x - hw; if ((xx < 0) || (xx >= imageWidth)) { @@ -399,8 +403,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) MEM_freeN(data2); MEM_freeN(data1); - memcpy( - dst, rdst->getBuffer(), sizeof(float) * imageWidth * imageHeight * COM_NUM_CHANNELS_COLOR); + memcpy(dst, + rdst->getBuffer(), + sizeof(float) * imageWidth * imageHeight * COM_data_type_num_channels(DataType::Color)); delete (rdst); } |