app_server: add method to shift alpha masks
* Allow shifting the offset of alpha masks without changing the size. Ideally, we only need to reattach the buffer in the shifted position, saving the work of reallocating and redrawing the mask picture. Needed for layers support.
This commit is contained in:
@@ -89,6 +89,25 @@ AlphaMask::Update(BRect bounds, BPoint offset)
|
||||
}
|
||||
|
||||
|
||||
BPoint
|
||||
AlphaMask::Update(BPoint offset)
|
||||
{
|
||||
BPoint oldOffset = fViewOffset;
|
||||
fViewOffset = offset;
|
||||
|
||||
if (oldOffset == fCachedOffset && fCachedBitmap != NULL) {
|
||||
// No need to redraw the picture when only the offset is shifted
|
||||
fCachedOffset = offset;
|
||||
_AttachMaskToBuffer();
|
||||
}
|
||||
|
||||
if (fPreviousMask != NULL)
|
||||
fPreviousMask->Update(offset);
|
||||
|
||||
return oldOffset;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AlphaMask::SetPrevious(AlphaMask* mask)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
~AlphaMask();
|
||||
|
||||
void Update(BRect bounds, BPoint offset);
|
||||
BPoint Update(BPoint offset);
|
||||
|
||||
void SetPrevious(AlphaMask* mask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user