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:
Julian Harnath
2015-07-25 16:31:20 +02:00
parent 6ac468ef24
commit cd621b9585
2 changed files with 20 additions and 0 deletions
+19
View File
@@ -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)
{
+1
View File
@@ -27,6 +27,7 @@ public:
~AlphaMask();
void Update(BRect bounds, BPoint offset);
BPoint Update(BPoint offset);
void SetPrevious(AlphaMask* mask);