MCPcopy Create free account
hub / github.com/cginternals/globjects / imageSizeInBytes

Function imageSizeInBytes

source/globjects/source/pixelformat.cpp:130–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129
130int imageSizeInBytes(const int width, const int height, const int depth, const GLenum format, const GLenum type)
131{
132 if (type == GL_BITMAP)
133 {
134 // handle differently?
135 warning() << "imageSizeInBytes: GL_BITMAP not implemented yet";
136 return -1;
137 }
138
139 int pixelSize = bytesPerPixel(format, type);
140
141 int rowSize = pixelSize * width;
142
143 int alignment = getInteger(GL_PACK_ALIGNMENT); // can be 1, 2, 4 or 8
144
145 rowSize = nextMultiple(rowSize, alignment);
146
147 return rowSize * height * depth;
148}
149
150
151} // namespace globjects

Callers 2

readPixelsToByteArrayMethod · 0.85
getImageMethod · 0.85

Calls 4

warningFunction · 0.85
bytesPerPixelFunction · 0.85
getIntegerFunction · 0.85
nextMultipleFunction · 0.85

Tested by

no test coverage detected