Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -6,29 +6,29 @@ Also, page flipping wastes a good deal of time waiting for the page to
flip at the end of the frame. Dirty-rectangle animation never needs to
wait for anything because partially drawn images are never present in
display memory. Actually, in one sense, partially drawn images are
sometimes present because it’s possible for a rectangle to be partially
sometimes present because it's possible for a rectangle to be partially
drawn when the scanning raster beam reaches that part of the screen.
This causes the rectangle to appear partially drawn for one frame,
producing a phenomenon I call “shearing.” Fortunately, shearing tends
producing a phenomenon I call "shearing." Fortunately, shearing tends
not to be particularly distracting, especially for fairly small images,
but it can be a problem when copying large areas. This is one area in
which dirty-rectangle animation falls short of page flipping, because
page flipping has perfect display quality, never showing anything other
than a completely finished frame. Similarly, dirty-rectangle copying may
take two or more frame times to finish, so even if shearing doesn’t
happen, it’s still possible to have the images in the various dirty
take two or more frame times to finish, so even if shearing doesn't
happen, it's still possible to have the images in the various dirty
rectangles show up non-simultaneously. In my experience, this latter
phenomenon is not a serious problem, but do be aware of it.
### Dirty Rectangles in Action {#Heading7}
Listing 45.1 demonstrates dirty-rectangle animation. This is a very
simple implementation, in several respects. For one thing, it’s written
simple implementation, in several respects. For one thing, it's written
entirely in C, and animation fairly cries out for assembly language. For
another thing, it uses far pointers, which C often handles with less
than optimal efficiency, especially because I haven’t used library
than optimal efficiency, especially because I haven't used library
functions to copy and fill memory. (I did this so the code would work in
any memory model.) Also, Listing 45.1 doesn’t attempt to coalesce
any memory model.) Also, Listing 45.1 doesn't attempt to coalesce
rectangles so as to perform a minimum number of display-memory accesses;
instead, it copies each dirty rectangle to the screen, even if it
overlaps with another rectangle, so some pixels are copied multiple
@ -37,7 +37,7 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
**LISTING 45.1 L45-1.C**
/* Sample simple dirty-rectangle animation program. Doesn’t attempt to coalesce
/* Sample simple dirty-rectangle animation program. Doesn't attempt to coalesce
rectangles to minimize display memory accesses. Not even vaguely optimized!
Tested with Borland C++ in the small model. */
@ -75,7 +75,7 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
/* If set to 1, ignore dirty rectangle list and copy the whole screen. */
int DrawWholeScreen = 0;
/* Pixels for image we’ll animate */
/* Pixels for image we'll animate */
#define IMAGE_WIDTH 11
#define IMAGE_HEIGHT 11
char ImagePixels[] = {
@ -95,7 +95,7 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
#define NUM_ENTITIES 10
Entity Entities[NUM_ENTITIES];
/* pointer to system buffer into which we’ll draw */
/* pointer to system buffer into which we'll draw */
char far *SystemBufferPtr;
/* pointer to screen */
@ -111,10 +111,10 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
unsigned int TempCount;
char far *TempPtr;
union REGS regs;
/* Allocate memory for the system buffer into which we’ll draw */
/* Allocate memory for the system buffer into which we'll draw */
if (!(SystemBufferPtr = farmalloc((unsigned int)SCREEN_WIDTH*
SCREEN_HEIGHT))) {
printf("Couldn’t get memory\n");
printf("Couldn't get memory\n");
exit(1);
}
/* Clear the system buffer */
@ -125,7 +125,7 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
/* Point to the screen */
ScreenPtr = MK_FP(SCREEN_SEGMENT, 0);
/* Set up the entities we’ll animate, at random locations */
/* Set up the entities we'll animate, at random locations */
randomize();
for (i = 0; i < NUM_ENTITIES; i++) {
Entities[i].X = random(SCREEN_WIDTH - IMAGE_WIDTH);
@ -284,7 +284,7 @@ on my 486/33, 10 11x11 images animate at a very respectable clip.
/* Point to the destination in the system buffer */
RowPtr = SystemBufferPtr + (Entities[i].Y*SCREEN_WIDTH) + Entities[i].X;
/* Clear the entity’s rectangle */
/* Clear the entity's rectangle */
for (j = 0; j < IMAGE_HEIGHT; j++) {
/* Clear a row */
for (k = 0, TempPtr = RowPtr; k < IMAGE_WIDTH; k++) {