NakedMemory Dib24To32(int width, int height, NakedMemory& old) { auto orowbytes = round_4(width * 3); if (orowbytes * height != old.GetSize()) { LOGERROR("Dib size not correct!"); return NakedMemory(); } auto nrowbytes = width * 4; NakedMemory newd(nrowbytes * height); auto nrows = (uint8_t*)newd.Get(); auto orows = (uint8_t*)old.Get(); for (int i = 0;i < height;i++) { auto pn = nrows; auto po = orows; for (int j = 0;j < width;j++) { pn[0] = po[0]; pn[1] = po[1]; pn[2] = po[2]; pn[4] = 0; pn += 4; po += 3; } nrows += nrowbytes; orows += orowbytes; } return std::move(newd); }
NakedMemory Dib32To24(int width, int height, NakedMemory& old, NakedMemory& alpha) { if (width * 4 * height != old.GetSize()) { LOGERROR("Dib size not correct!"); return NakedMemory(); } auto nrowbytes = round_4(width * 3); auto arowbytes = round_4(width); auto orowbytes = width * 4; NakedMemory newd(nrowbytes * height); NakedMemory newa(arowbytes * height); auto nrows = (uint8_t*)newd.Get(); auto orows = (uint8_t*)old.Get(); auto arows = (uint8_t*)newa.Get(); for (int i = 0;i < height;i++) { auto pn = nrows; auto po = orows; auto pa = arows; for (int j = 0;j < width;j++) { pn[0] = po[0]; pn[1] = po[1]; pn[2] = po[2]; *pa++ = po[3]; pn += 3; po += 4; } nrows += nrowbytes; orows += orowbytes; arows += arowbytes; } alpha = std::move(newa); return std::move(newd); }
PCommitable AttributesDimension::copy() const { checkNotCheckedOut(); PAttributesDimension newd(new AttributesDimension(*this)); return newd; }
PCommitable CubeDimension::copy() const { checkNotCheckedOut(); PCubeDimension newd(new CubeDimension(*this)); return newd; }
PCommitable EngineCpuMT::copy() const { checkNotCheckedOut(); PEngineBase newd(new EngineCpuMT(*this)); return newd; }
PCommitable NormalDimension::copy() const { checkNotCheckedOut(); PNormalDimension newd(new NormalDimension(*this)); return newd; }
PCommitable RightsDimension::copy() const { checkNotCheckedOut(); PRightsDimension newd(new RightsDimension(*this)); return newd; }
PCommitable ConfigDatabase::copy() const { checkNotCheckedOut(); PConfigDatabase newd(new ConfigDatabase(*this)); return newd; }
PCommitable UserInfoDatabase::copy() const { checkNotCheckedOut(); PUserInfoDatabase newd(new UserInfoDatabase(*this)); return newd; }
PCommitable SubsetViewDimension::copy() const { checkNotCheckedOut(); PSubsetViewDimension newd(new SubsetViewDimension(*this)); return newd; }