Revert "app_server: fix transformations in BPicture"
This reverts commit b8e5671d53
.
Reason for revert: Broke all builds.
Change-Id: Ie7c5b4a3c877894a1dc49a9de7a19f79e7eb2ab7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2897
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
b8e5671d53
commit
2d69e313a8
@ -208,18 +208,10 @@ ShapePainter::Draw(BRect frame, bool filled)
|
||||
fPtStack.pop();
|
||||
}
|
||||
|
||||
// this might seem a bit weird, but under R5, the shapes
|
||||
// are always offset by the current pen location
|
||||
BPoint screenOffset
|
||||
= fCanvas->CurrentState()->PenLocation();
|
||||
frame.OffsetBy(screenOffset);
|
||||
|
||||
const SimpleTransform transform = fCanvas->PenToScreenTransform();
|
||||
transform.Apply(&screenOffset);
|
||||
transform.Apply(&frame);
|
||||
|
||||
BPoint offset(fCanvas->CurrentState()->PenLocation());
|
||||
fCanvas->PenToScreenTransform().Apply(&offset);
|
||||
fCanvas->GetDrawingEngine()->DrawShape(frame, opCount, opList,
|
||||
ptCount, ptList, filled, screenOffset, fCanvas->Scale());
|
||||
ptCount, ptList, filled, offset, fCanvas->Scale());
|
||||
|
||||
delete[] opList;
|
||||
delete[] ptList;
|
||||
@ -415,18 +407,9 @@ draw_string(void* _canvas, const char* string, size_t length, float deltaSpace,
|
||||
|
||||
static void
|
||||
draw_string_locations(void* _canvas, const char* string, size_t length,
|
||||
const BPoint* _locations, size_t locationsCount)
|
||||
const BPoint* locations, size_t locationsCount)
|
||||
{
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
BStackOrHeapArray<BPoint, 200> locations(locationsCount);
|
||||
if (!locations.IsValid())
|
||||
return;
|
||||
|
||||
const SimpleTransform transform = canvas->PenToScreenTransform();
|
||||
for (size_t i = 0; i < locationsCount; i++) {
|
||||
locations[i] = _locations[i];
|
||||
transform.Apply(&locations[i]);
|
||||
}
|
||||
|
||||
BPoint location = canvas->GetDrawingEngine()->DrawString(string, length,
|
||||
locations);
|
||||
@ -775,13 +758,8 @@ static void
|
||||
set_transform(void* _canvas, const BAffineTransform& transform)
|
||||
{
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
|
||||
BPoint leftTop(0, 0);
|
||||
canvas->PenToScreenTransform().Apply(&leftTop);
|
||||
|
||||
canvas->CurrentState()->SetTransform(transform);
|
||||
canvas->GetDrawingEngine()->SetTransform(
|
||||
canvas->CurrentState()->CombinedTransform(), leftTop.x, leftTop.y);
|
||||
canvas->GetDrawingEngine()->SetTransform(transform);
|
||||
}
|
||||
|
||||
|
||||
@ -789,15 +767,10 @@ static void
|
||||
translate_by(void* _canvas, double x, double y)
|
||||
{
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
|
||||
BPoint leftTop(0, 0);
|
||||
canvas->PenToScreenTransform().Apply(&leftTop);
|
||||
|
||||
BAffineTransform transform = canvas->CurrentState()->Transform();
|
||||
transform.PreTranslateBy(x, y);
|
||||
canvas->CurrentState()->SetTransform(transform);
|
||||
canvas->GetDrawingEngine()->SetTransform(
|
||||
canvas->CurrentState()->CombinedTransform(), leftTop.x, leftTop.y);
|
||||
canvas->GetDrawingEngine()->SetTransform(transform);
|
||||
}
|
||||
|
||||
|
||||
@ -805,15 +778,10 @@ static void
|
||||
scale_by(void* _canvas, double x, double y)
|
||||
{
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
|
||||
BPoint leftTop(0, 0);
|
||||
canvas->PenToScreenTransform().Apply(&leftTop);
|
||||
|
||||
BAffineTransform transform = canvas->CurrentState()->Transform();
|
||||
transform.PreScaleBy(x, y);
|
||||
canvas->CurrentState()->SetTransform(transform);
|
||||
canvas->GetDrawingEngine()->SetTransform(
|
||||
canvas->CurrentState()->CombinedTransform(), leftTop.x, leftTop.y);
|
||||
canvas->GetDrawingEngine()->SetTransform(transform);
|
||||
}
|
||||
|
||||
|
||||
@ -821,15 +789,10 @@ static void
|
||||
rotate_by(void* _canvas, double angleRadians)
|
||||
{
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
|
||||
BPoint leftTop(0, 0);
|
||||
canvas->PenToScreenTransform().Apply(&leftTop);
|
||||
|
||||
BAffineTransform transform = canvas->CurrentState()->Transform();
|
||||
transform.PreRotateBy(angleRadians);
|
||||
canvas->CurrentState()->SetTransform(transform);
|
||||
canvas->GetDrawingEngine()->SetTransform(
|
||||
canvas->CurrentState()->CombinedTransform(), leftTop.x, leftTop.y);
|
||||
canvas->GetDrawingEngine()->SetTransform(transform);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3671,16 +3671,24 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
link.Read<int32>(&opCount);
|
||||
link.Read<int32>(&ptCount);
|
||||
|
||||
BStackOrHeapArray<uint32, 512> opList(opCount);
|
||||
BStackOrHeapArray<BPoint, 512> ptList(ptCount);
|
||||
if (!opList.IsValid() || !ptList.IsValid()
|
||||
|| link.Read(opList, opCount * sizeof(uint32)) < B_OK
|
||||
|| link.Read(ptList, ptCount * sizeof(BPoint)) < B_OK) {
|
||||
break;
|
||||
uint32* opList = new(std::nothrow) uint32[opCount];
|
||||
BPoint* ptList = new(std::nothrow) BPoint[ptCount];
|
||||
if (opList != NULL && ptList != NULL
|
||||
&& link.Read(opList, opCount * sizeof(uint32)) >= B_OK
|
||||
&& link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) {
|
||||
// This might seem a bit weird, but under BeOS, the shapes
|
||||
// are always offset by the current pen location
|
||||
BPoint penLocation
|
||||
= fCurrentView->CurrentState()->PenLocation();
|
||||
for (int32 i = 0; i < ptCount; i++) {
|
||||
ptList[i] += penLocation;
|
||||
}
|
||||
const bool fill = (code == AS_FILL_SHAPE);
|
||||
picture->WriteDrawShape(opCount, opList, ptCount, ptList, fill);
|
||||
}
|
||||
picture->WriteDrawShape(opCount, opList, ptCount,
|
||||
ptList, code == AS_FILL_SHAPE);
|
||||
|
||||
delete[] opList;
|
||||
delete[] ptList;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -323,10 +323,9 @@ DrawingEngine::SetFont(const DrawState* state)
|
||||
|
||||
|
||||
void
|
||||
DrawingEngine::SetTransform(const BAffineTransform& transform, int32 xOffset,
|
||||
int32 yOffset)
|
||||
DrawingEngine::SetTransform(const BAffineTransform& transform)
|
||||
{
|
||||
fPainter->SetTransform(transform, xOffset, yOffset);
|
||||
fPainter->SetTransform(transform);
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,8 +86,7 @@ public:
|
||||
alpha_function alphaFunc);
|
||||
virtual void SetFont(const ServerFont& font);
|
||||
virtual void SetFont(const DrawState* state);
|
||||
virtual void SetTransform(const BAffineTransform& transform,
|
||||
int32 xOffset, int32 yOffset);
|
||||
virtual void SetTransform(const BAffineTransform& transform);
|
||||
|
||||
void SuspendAutoSync();
|
||||
void Sync();
|
||||
|
@ -68,7 +68,8 @@ public:
|
||||
|
||||
// object settings
|
||||
void SetTransform(BAffineTransform transform,
|
||||
int32 xOffset, int32 yOffset);
|
||||
int32 xOffset = 0,
|
||||
int32 yOffset = 0);
|
||||
|
||||
inline bool IsIdentityTransform() const
|
||||
{ return fIdentityTransform; }
|
||||
|
Loading…
Reference in New Issue
Block a user