void* HardwareBuffer::lock(size_t offset, size_t length, LockOptions options) { assert(!isLocked() && "Cannot lock this buffer, it is already locked!"); void* ret = NULL; if ((length + offset) > mSizeInBytes) { WIND_EXCEPT(Exception::ERR_INVALIDPARAMS, "Lock request out of bounds.", "HardwareBuffer::lock"); } else if (mUseShadowBuffer) { if (options != HBL_READ_ONLY) { mShadowUpdated = TRUE; } ret = mShadowBuffer->lock(offset, length, options); } else { ret = lockImpl(offset, length, options); mIsLocked = TRUE; } mLockStart = offset; mLockSize = length; return ret; }
void* Buffer::lock(unsigned int offset, unsigned int length, BufferLocking options) { assert((!isLocked()) && "Cannot lock this buffer, it is already locked!"); void* ret = lockImpl(offset, length, options); mIsLocked = true; mLockStart = offset; mLockSize = length; return ret; }
const PixelBox& HardwarePixelBuffer::lock(const Image::Box& lockBox, LockOptions options) { if (mUseShadowBuffer) { if (options != HBL_READ_ONLY) { mShadowUpdated = TRUE; } mCurrentLock = static_cast<HardwarePixelBuffer*>(mShadowBuffer)->lock(lockBox, options); } else { mCurrentLock = lockImpl(lockBox, options); mIsLocked = TRUE; } return mCurrentLock; }
//----------------------------------------------------------------------------- const PixelBox& HardwarePixelBuffer::lock(const Image::Box& lockBox, LockOptions options) { if (mUseShadowBuffer) { if (options != HBL_READ_ONLY) { // we have to assume a read / write lock so we use the shadow buffer // and tag for sync on unlock() mShadowUpdated = true; } mCurrentLock = static_cast<HardwarePixelBuffer*>(mpShadowBuffer)->lock(lockBox, options); } else { // Lock the real buffer if there is no shadow buffer mCurrentLock = lockImpl(lockBox, options); mIsLocked = true; } return mCurrentLock; }