Fix some cases of updating draw state while recording a BPicture
* Also implemented recording DrawString(string, length, BPoint[] locations), which was previously not recorded at all. * Also implemented playing back recently added drawing commands in PicturePlayer.cpp. I don't quite understand what this is actually used for, but it seemed it was forgotten. I just followed the pattern already established in the code. * The other important bit in this change is to update the pen location when it is needed while recording a BPicture. Often the BView will use PenLocation() in order to transmit drawing commands to the app_server which use absolute coordinates only. This isn't actually so nice, since it means the client has to wait for the server to transmit the current pen location. If there were dedicated link-commands for pen-relative drawing commands, the client could just keep sending without waiting for the server. In any case, the app_server needs to update the pen location in the current DrawState and even the DrawingEngine even while recording a picture, because some next command may need up-2-date state information, such as the font state and the pen location. * I have not yet tried to find /all/ instances where the DrawState needs to be updated while recording. This change should repair /all/ font state changes, all versions of drawing a string, and all versions of StrokeLine(). Change-Id: Ia0f23e7b1cd058f70f76a5849acb2d02e0f0da09 Reviewed-on: https://review.haiku-os.org/c/817 Reviewed-by: Stephan Aßmus <[email protected]>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright 2006-2015 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2006-2018 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stefano Ceccherini, [email protected]
|
||||
* Julian Harnath, <[email protected]>
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
#ifndef _PICTURE_DATA_WRITER_H
|
||||
#define _PICTURE_DATA_WRITER_H
|
||||
@@ -84,6 +85,9 @@ public:
|
||||
status_t WriteDrawString(const BPoint& where,
|
||||
const char* string, const int32& length,
|
||||
const escapement_delta& delta);
|
||||
status_t WriteDrawString(const char* string,
|
||||
int32 length, const BPoint* locations,
|
||||
int32 locationCount);
|
||||
status_t WriteDrawShape(const int32& opCount,
|
||||
const void* opList, const int32& ptCount,
|
||||
const void* ptList, const bool& fill);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku Inc.
|
||||
* Copyright 2001-2018, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers ([email protected])
|
||||
* Stefano Ceccherini ([email protected])
|
||||
* Marcus Overhagen ([email protected])
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
#ifndef _PICTURE_PLAYER_H
|
||||
#define _PICTURE_PLAYER_H
|
||||
@@ -91,6 +92,8 @@ struct picture_player_callbacks {
|
||||
void (*clip_to_rect)(void* userData, const BRect& rect, bool inverse);
|
||||
void (*clip_to_shape)(void* userData, int32 opCount, const uint32 opList[],
|
||||
int32 ptCount, const BPoint ptList[], bool inverse);
|
||||
void (*draw_string_locations)(void* userData, const char* string,
|
||||
size_t length, const BPoint locations[], size_t locationCount);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ enum {
|
||||
B_PIC_FILL_ARC = 0x0114,
|
||||
B_PIC_STROKE_ELLIPSE = 0x0115,
|
||||
B_PIC_FILL_ELLIPSE = 0x0116,
|
||||
B_PIC_DRAW_STRING_LOCATIONS = 0x0117,
|
||||
|
||||
B_PIC_ENTER_STATE_CHANGE = 0x0200,
|
||||
B_PIC_SET_CLIPPING_RECTS = 0x0201,
|
||||
@@ -61,7 +62,7 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
const static uint32 kOpsTableSize = 50;
|
||||
const static uint32 kOpsTableSize = 51;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user