MCPcopy Create free account
hub / github.com/DentonW/DevIL / iluScale3DNear_

Function iluScale3DNear_

DevIL/src-ILU/src/ilu_scale3d.cpp:54–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53
54ILimage *iluScale3DNear_(ILimage *Image, ILimage *Scaled, ILuint Width, ILuint Height, ILuint Depth)
55{
56 ImgBps = Image->Bps / Image->Bpc;
57 SclBps = Scaled->Bps / Scaled->Bpc;
58 ImgPlane = Image->SizeOfPlane / Image->Bpc;
59 SclPlane = Scaled->SizeOfPlane / Scaled->Bpc;
60
61 switch (Image->Bpc)
62 {
63 case 1:
64 for (z = 0; z < Depth; z++) {
65 NewZ1 = z * SclPlane;
66 NewZ2 = (ILuint)(z / ScaleZ) * ImgPlane;
67 for (y = 0; y < Height; y++) {
68 NewY1 = y * SclBps;
69 NewY2 = (ILuint)(y / ScaleY) * ImgBps;
70 for (x = 0; x < Width; x++) {
71 NewX1 = x * Scaled->Bpp;
72 NewX2 = (ILuint)(x / ScaleX) * Image->Bpp;
73 for (c = 0; c < Scaled->Bpp; c++) {
74 Scaled->Data[NewZ1 + NewY1 + NewX1 + c] =
75 Image->Data[NewZ2 + NewY2 + NewX2 + c];
76 }
77 }
78 }
79 }
80 break;
81
82 case 2:
83 ShortPtr = (ILushort*)Image->Data;
84 SShortPtr = (ILushort*)Scaled->Data;
85 for (z = 0; z < Depth; z++) {
86 NewZ1 = z * SclPlane;
87 NewZ2 = (ILuint)(z / ScaleZ) * ImgPlane;
88 for (y = 0; y < Height; y++) {
89 NewY1 = y * SclBps;
90 NewY2 = (ILuint)(y / ScaleY) * ImgBps;
91 for (x = 0; x < Width; x++) {
92 NewX1 = x * Scaled->Bpp;
93 NewX2 = (ILuint)(x / ScaleX) * Image->Bpp;
94 for (c = 0; c < Scaled->Bpp; c++) {
95 SShortPtr[NewZ1 + NewY1 + NewX1 + c] =
96 ShortPtr[NewZ2 + NewY2 + NewX2 + c];
97 }
98 }
99 }
100 }
101 break;
102
103 case 4:
104 IntPtr = (ILuint*)Image->Data;
105 SIntPtr = (ILuint*)Scaled->Data;
106 for (z = 0; z < Depth; z++) {
107 NewZ1 = z * SclPlane;
108 NewZ2 = (ILuint)(z / ScaleZ) * ImgPlane;
109 for (y = 0; y < Height; y++) {
110 NewY1 = y * SclBps;
111 NewY2 = (ILuint)(y / ScaleY) * ImgBps;

Callers 1

iluScale3D_Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected