Change bold code snippets to inline code blocks
This commit is contained in:
parent
f658bfbb40
commit
3c76d884ef
185 changed files with 1772 additions and 1772 deletions
22
39-01.md
22
39-01.md
|
|
@ -106,16 +106,16 @@ Our original polygon filling code involved three major tasks, each
|
|||
performed by a separate function:
|
||||
|
||||
* Tracing each polygon edge to generate a coordinate list (performed
|
||||
by the function **ScanEdge);**
|
||||
by the function `ScanEdge`);
|
||||
* Drawing the scanned-out horizontal lines that constitute the filled
|
||||
polygon (**DrawHorizontalLineList** ); and
|
||||
polygon (`DrawHorizontalLineList`); and
|
||||
* Characterizing the polygon and coordinating the tracing and drawing
|
||||
(**FillConvexPolygon** ).
|
||||
(`FillConvexPolygon`).
|
||||
|
||||
The amount of time that the previous chapter's sample program spent in
|
||||
each of these areas is shown in Table 39.1. As you can see, half the
|
||||
time was spent drawing and the other half was spent tracing the polygon
|
||||
edges (the time spent in **FillConvexPolygon** was relatively
|
||||
edges (the time spent in `FillConvexPolygon` was relatively
|
||||
minuscule), so we have our choice of where to begin optimizing.
|
||||
|
||||
#### Fast Drawing {#Heading4}
|
||||
|
|
@ -131,16 +131,16 @@ succession, using something along the lines of **\*ScrPtr++ =
|
|||
FillColor;** inside a loop.
|
||||
|
||||
However, it seems silly to use a loop when the x86 has an instruction,
|
||||
**REP STOS**, that's uniquely suited to filling linear memory buffers.
|
||||
There's no way to use **REP STOS** directly in C code, but it's a good
|
||||
bet that the **memset** library function uses **REP STOS**, so you could
|
||||
greatly enhance performance by using **memset** to draw each scan line
|
||||
`REP STOS`, that's uniquely suited to filling linear memory buffers.
|
||||
There's no way to use `REP STOS` directly in C code, but it's a good
|
||||
bet that the `memset` library function uses `REP STOS`, so you could
|
||||
greatly enhance performance by using `memset` to draw each scan line
|
||||
of the polygon in a single shot. That, however, is easier said than
|
||||
done. The **memset** function linked in from the library is tied to the
|
||||
done. The `memset` function linked in from the library is tied to the
|
||||
memory model in use; in small (which includes Tiny, Small, or Medium)
|
||||
data models **memset** accepts only near pointers, so it can't be used
|
||||
data models `memset` accepts only near pointers, so it can't be used
|
||||
to access screen memory. Consequently, a large (which includes Compact,
|
||||
Large, or Huge) data model must be used to allow **memset** to draw to
|
||||
Large, or Huge) data model must be used to allow `memset` to draw to
|
||||
display memory—a clear case of the tail wagging the dog. This is an
|
||||
excellent example of why, although it is possible to use C to do
|
||||
virtually anything, it's sometimes much simpler just to use a little
|
||||
|
|
|
|||
Loading…
Reference in a new issue