GBUFFER.H (66824B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /*************************************************************************** 17 ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S ** 18 *************************************************************************** 19 * * 20 * Project Name : Westwood 32 Bit Library * 21 * * 22 * File Name : GBUFFER.H * 23 * * 24 * Programmer : Phil W. Gorrow * 25 * * 26 * Start Date : May 26, 1994 * 27 * * 28 * Last Update : October 9, 1995 [] * 29 * * 30 *************************************************************************** 31 * * 32 * This module contains the definition for the graphic buffer class. The * 33 * primary functionality of the graphic buffer class is handled by inline * 34 * functions that make a call through function pointers to the correct * 35 * routine. This has two benefits: * 36 * * 37 * * 38 * 1) C++ name mangling is not a big deal since the function pointers * 39 * point to functions in standard C format. * 40 * 2) The function pointers can be changed when we set a different * 41 * graphic mode. This allows us to have both supervga and mcga * 42 * routines present in memory at once. * 43 * * 44 * In the basic library, these functions point to stub routines which just * 45 * return. This makes a product that just uses a graphic buffer take the * 46 * minimum amount of code space. For programs that require MCGA or VESA * 47 * support, all that is necessary to do is link either the MCGA or VESA * 48 * specific libraries in, previous to WWLIB32. The linker will then * 49 * overide the the necessary stub functions automatically. * 50 * * 51 * In addition, there are helpful inline function calls for parameter * 52 * ellimination. This header file gives the defintion for all * 53 * GraphicViewPort and GraphicBuffer classes. * 54 * * 55 * Terminology: * 56 * * 57 * Buffer Class - A class which consists of a pointer to an allocated * 58 * buffer and the size of the buffer that was allocated. * 59 * * 60 * Graphic ViewPort - The Graphic ViewPort defines a window into a * 61 * Graphic Buffer. This means that although a Graphic Buffer * 62 * represents linear memory, this may not be true with a Graphic * 63 * Viewport. All low level functions that act directly on a graphic * 64 * viewport are included within this class. This includes but is not * 65 * limited to most of the functions which can act on a Video Viewport * 66 * Video Buffer. * 67 * * 68 * Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer * 69 * used to represent a rectangular region of graphics memory. * 70 * The HidBuff and BackBuff are excellent examples of a Graphic Buffer. * 71 * * 72 * Below is a tree which shows the relationship of the VideoBuffer and * 73 * Buffer classes to the GraphicBuffer class: * 74 * * 75 * BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H * 76 * ---------- ---------- ---------- ---------- * 77 * | Buffer | | Graphic | | Buffer | | Video | * 78 * | Class | | ViewPort | | Class | | ViewPort | * 79 * ---------- ---------- ---------- ---------- * 80 * \ / \ / * 81 * \ / \ / * 82 * ---------- ---------- * 83 * | Graphic | | Video | * 84 * | Buffer | | Buffer | * 85 * ---------- ---------- * 86 * GBUFFER.H VBUFFER.H * 87 *-------------------------------------------------------------------------* 88 * Functions: * 89 * GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass * 90 * GVPC::Remap -- Short form to remap an entire graphic view port * 91 * GVPC::Get_XPos -- Returns x offset for a graphic viewport class * 92 * GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass * 93 * VVPC::Get_XPos -- Get the x pos of the VP on the Video * 94 * VVPC::Get_YPos -- Get the y pos of the VP on the video * 95 * GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. * 96 * GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class* 97 * GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC * 98 * GVPC::Remap -- Stub function to remap a GVPC * 99 * GVPC::Print -- stub func to print a text string * 100 * GVPC::Print -- Stub function to print an integer * 101 * GVPC::Print -- Stub function to print a short to a graphic viewport * 102 * GVPC::Print -- stub function to print a long on a graphic view port * 103 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 104 105 106 #ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check 107 #define _WIN32 108 #endif // _WIN32 109 110 #define WIN32_LEAN_AND_MEAN 111 #include <ddraw.h> 112 113 114 #ifndef GBUFFER_H 115 #define GBUFFER_H 116 117 /*=========================================================================*/ 118 /* If we have not already loaded the standard library header, than we can */ 119 /* load it. */ 120 /*=========================================================================*/ 121 122 #ifndef WWSTD_H 123 #include "wwstd.h" 124 #endif 125 126 #ifndef DRAWBUFF_H 127 #include "drawbuff.h" 128 #endif 129 130 //#ifndef BUFFER_H 131 #include "buffer.h" 132 //#endif 133 134 #ifndef WINDOWS_H 135 #include "ww_win.h" 136 #endif 137 #include <stdlib.h> 138 139 #include "iconcach.h" 140 141 142 143 //#ifndef FUNCTION_H 144 145 //#pragma off (unreferenced) 146 147 //#ifndef BITMAPCLASS 148 //#define BITMAPCLASS 149 class BitmapClass 150 { 151 public: 152 BitmapClass(int w, int h, unsigned char * data) : 153 Width(w), Height(h), Data(data) {}; 154 155 int Width; 156 int Height; 157 unsigned char * Data; 158 }; 159 160 class TPoint2D 161 { 162 public: 163 TPoint2D(int xx, int yy) : x(xx), y(yy) {}; 164 TPoint2D(void) : x(0), y(0) {}; 165 166 int x; 167 int y; 168 }; 169 //#endif 170 171 //#pragma on (unreferenced) 172 //#endif 173 174 175 ////////////////////////////////////////////////////////////////////////// 176 // 177 // Defines for direct draw 178 // 179 // 180 extern LPDIRECTDRAW DirectDrawObject; //pointer to direct draw object 181 extern HWND MainWindow; //handle to programs main window 182 183 /* 184 ** Pointer to function to call if we detect a focus loss 185 */ 186 extern void (*Gbuffer_Focus_Loss_Function)(void); 187 188 enum GBC_Enum { 189 GBC_NONE = 0, 190 GBC_VIDEOMEM = 1, 191 GBC_VISIBLE = 2, 192 }; 193 194 #define NOT_LOCKED NULL 195 196 /*=========================================================================*/ 197 /* Define the screen width and height to make portability to other modules */ 198 /* easier. */ 199 /*=========================================================================*/ 200 #define DEFAULT_SCREEN_WIDTH 768 201 #define DEFAULT_SCREEN_HEIGHT 768 202 203 /*=========================================================================*/ 204 /* Let the compiler know that a GraphicBufferClass exists so that it can */ 205 /* keep a pointer to it in a VideoViewPortClass. */ 206 /*=========================================================================*/ 207 class GraphicViewPortClass; 208 class GraphicBufferClass; 209 class VideoViewPortClass; 210 class VideoBufferClass; 211 212 GraphicViewPortClass *Set_Logic_Page(GraphicViewPortClass *ptr); 213 GraphicViewPortClass *Set_Logic_Page(GraphicViewPortClass &ptr); 214 215 /*=========================================================================*/ 216 /* GraphicViewPortClass - Holds viewport information on a viewport which */ 217 /* has been attached to a GraphicBuffer. A viewport is effectively a */ 218 /* rectangular subset of the full buffer which is used for clipping and */ 219 /* the like. */ 220 /* */ 221 /* char *Buffer - is the offset to view port buffer */ 222 /* int Width - is the width of view port */ 223 /* int Height - is the height of view port */ 224 /* int XAdd - is add value to go from the end of a line */ 225 /* to the beginning of the next line */ 226 /* int XPos; - x offset into its associated VideoBuffer */ 227 /* int YPos; - y offset into its associated VideoBuffer */ 228 /*=========================================================================*/ 229 class GraphicViewPortClass { 230 public: 231 232 /*===================================================================*/ 233 /* Define the base constructor and destructors for the class */ 234 /*===================================================================*/ 235 GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h); 236 GraphicViewPortClass(); 237 ~GraphicViewPortClass(); 238 239 /*===================================================================*/ 240 /* define functions to get at the private data members */ 241 /*===================================================================*/ 242 long Get_Offset(void); 243 int Get_Height(void); 244 int Get_Width(void); 245 int Get_XAdd(void); 246 int Get_XPos(void); 247 int Get_YPos(void); 248 int Get_Pitch(void); 249 inline BOOL Get_IsDirectDraw(void); 250 GraphicBufferClass *Get_Graphic_Buffer(void); 251 252 /*===================================================================*/ 253 /* Define a function which allows us to change a video viewport on */ 254 /* the fly. */ 255 /*===================================================================*/ 256 BOOL Change(int x, int y, int w, int h); 257 258 /*===================================================================*/ 259 /* Define the set of common graphic functions that are supported by */ 260 /* both Graphic ViewPorts and VideoViewPorts. */ 261 /*===================================================================*/ 262 long Size_Of_Region(int w, int h); 263 void Put_Pixel(int x, int y, unsigned char color); 264 int Get_Pixel(int x, int y); 265 void Clear(unsigned char color = 0); 266 long To_Buffer(int x, int y, int w, int h, void *buff, long size); 267 long To_Buffer(int x, int y, int w, int h, BufferClass *buff); 268 long To_Buffer(BufferClass *buff); 269 HRESULT Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel, 270 int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE); 271 HRESULT Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE); 272 HRESULT Blit( GraphicViewPortClass& dest, BOOL trans = FALSE); 273 HRESULT Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel, 274 int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE); 275 HRESULT Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE); 276 HRESULT Blit( VideoViewPortClass& dest, BOOL trans = FALSE); 277 BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x, 278 int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL); 279 BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x, 280 int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap); 281 BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL); 282 BOOL Scale( GraphicViewPortClass &dest, char *remap); 283 BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x, 284 int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL); 285 BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x, 286 int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap); 287 BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL); 288 BOOL Scale( VideoViewPortClass &dest, char *remap); 289 unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor); 290 unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol); 291 unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol); 292 unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol); 293 294 /*===================================================================*/ 295 /* Define the list of graphic functions which work only with a */ 296 /* graphic buffer. */ 297 /*===================================================================*/ 298 VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color); 299 VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color); 300 VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color); 301 VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1, 302 int x2, int y2, int x3, int y3, int color); 303 VOID Remap(int sx, int sy, int width, int height, VOID *remap); 304 VOID Remap(VOID *remap); 305 void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap); 306 void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window); 307 308 // PG_TO_FIX 309 // This seems to be missing. Might not be needed anyway since it looks like it's only used for UI drawing. ST - 12/17/2018 6:11PM 310 void Texture_Fill_Rect (int xpos, int ypos, int width, int height, void const *shape_pointer, int source_width, int source_height) { 311 return; 312 } 313 314 // This doesnt seem to exist anywhere?? - Steve T 9/26/95 6:05PM 315 // VOID Grey_Out_Region(int x, int y, int width, int height, int color); 316 317 // 318 // New members to lock and unlock the direct draw video memory 319 // 320 inline BOOL Lock (); 321 inline BOOL Unlock(); 322 inline int Get_LockCount(); 323 324 // Member to blit using direct draw access to hardware blitter 325 HRESULT DD_Linear_Blit_To_Linear ( GraphicViewPortClass &dest, int source_x, int source_y, int dest_x, int dest_y, int width , int height, BOOL mask ); 326 327 /*===================================================================*/ 328 /* Define functions to attach the viewport to a graphicbuffer */ 329 /*===================================================================*/ 330 VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h); 331 void Attach(GraphicBufferClass *video_buff, int w, int h); 332 333 protected: 334 335 /*===================================================================*/ 336 /* Define the data used by a GraphicViewPortClass */ 337 /*===================================================================*/ 338 long Offset; // offset to graphic page 339 int Width; // width of graphic page 340 int Height; // height of graphic page 341 int XAdd; // xadd for graphic page (0) 342 int XPos; // x offset in relation to graphicbuff 343 int YPos; // y offset in relation to graphicbuff 344 long Pitch; //Distance from one line to the next 345 GraphicBufferClass *GraphicBuff; // related graphic buff 346 BOOL IsDirectDraw; //Flag to let us know if it is a direct draw surface 347 int LockCount; // Count for stacking locks if non-zero the buffer 348 }; // is a locked DD surface 349 350 /*=========================================================================*/ 351 /* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */ 352 /* allocated buffer. The GraphicBuffer may be drawn to directly */ 353 /* becuase it inherits a ViewPort which represents its physcial size. */ 354 /* */ 355 /* BYTE *Buffer - is the offset to graphic buffer */ 356 /* int Width - is the width of graphic buffer */ 357 /* int Height - is the height of graphic buffer */ 358 /* int XAdd - is the xadd of graphic buffer */ 359 /* int XPos; - will be 0 because it is graphicbuff */ 360 /* int YPos; - will be 0 because it is graphicbuff */ 361 /* long Pitch - modulo of buffer for reading and writing */ 362 /* BOOL IsDirectDraw - flag if its a direct draw surface */ 363 /*=========================================================================*/ 364 class GraphicBufferClass : public GraphicViewPortClass, public BufferClass { 365 366 public: 367 GraphicBufferClass(int w, int h, GBC_Enum flags); 368 GraphicBufferClass(int w, int h, void *buffer, long size); 369 GraphicBufferClass(int w, int h, void *buffer = 0); 370 GraphicBufferClass(void); 371 ~GraphicBufferClass(); 372 373 void DD_Init(GBC_Enum flags); 374 void Init(int w, int h, void *buffer, long size, GBC_Enum flags); 375 void Un_Init(void); 376 void GraphicBufferClass::Attach_DD_Surface (GraphicBufferClass * attach_buffer); 377 BOOL Lock(void); 378 BOOL Unlock(void); 379 380 void Scale_Rotate(BitmapClass &bmp,TPoint2D const &pt,long scale,unsigned char angle); 381 382 // Member to get a pointer to a direct draw surface 383 LPDIRECTDRAWSURFACE Get_DD_Surface ( void ); 384 385 protected: 386 LPDIRECTDRAWSURFACE VideoSurfacePtr; //Pointer to the related direct draw surface 387 DDSURFACEDESC VideoSurfaceDescription;//Description of the said surface 388 389 }; 390 391 392 393 inline int GraphicViewPortClass::Get_LockCount(void) 394 { 395 return (LockCount); 396 } 397 398 399 400 /*********************************************************************************************** 401 * GVPC::Get_IsDirectDraw -- provide read access to the IsDirectDraw flag * 402 * * 403 * * 404 * * 405 * INPUT: Nothing * 406 * * 407 * OUTPUT: IsDirectDraw * 408 * * 409 * WARNINGS: None * 410 * * 411 * HISTORY: * 412 * 11/29/95 1:02PM ST : Created * 413 *=============================================================================================*/ 414 inline BOOL GraphicViewPortClass::Get_IsDirectDraw(void) 415 { 416 return (IsDirectDraw); 417 } 418 419 420 421 /*********************************************************************************************** 422 * GBC::Get_DD_Surface -- returns a pointer to the buffer direct draw surface * 423 * * 424 * * 425 * * 426 * INPUT: Nothing * 427 * * 428 * OUTPUT: ptr to direct draw surface * 429 * * 430 * WARNINGS: None * 431 * * 432 * HISTORY: * 433 * 9/29/95 9:43AM ST : Created * 434 *=============================================================================================*/ 435 inline LPDIRECTDRAWSURFACE GraphicBufferClass::Get_DD_Surface ( void ) 436 { 437 return ( VideoSurfacePtr ); 438 439 } 440 441 442 443 /*********************************************************************************************** 444 * GVPC::Lock -- lock the graphics buffer for reading or writing * 445 * * 446 * * 447 * * 448 * INPUT: Nothing * 449 * * 450 * OUTPUT: TRUE if surface was successfully locked * 451 * * 452 * WARNINGS: None * 453 * * 454 * HISTORY: * 455 * 09-19-95 12:33pm ST : Created * 456 * 10/09/1995 : Moved actually functionality to GraphicBuffer * 457 *=============================================================================================*/ 458 inline BOOL GraphicViewPortClass::Lock(void) 459 { 460 BOOL lock = GraphicBuff->Lock(); 461 if ( !lock ) return(FALSE); 462 463 if (this != GraphicBuff) { 464 Attach(GraphicBuff, XPos, YPos, Width, Height); 465 } 466 return(TRUE); 467 } 468 469 /*********************************************************************************************** 470 * GVPC::Unlock -- unlock the video buffer * 471 * * 472 * * 473 * * 474 * INPUT: Nothing * 475 * * 476 * OUTPUT: TRUE if surface was successfully unlocked * 477 * * 478 * WARNINGS: None * 479 * * 480 * HISTORY: * 481 * 09-19-95 02:20pm ST : Created * 482 * 10/09/1995 : Moved actually functionality to GraphicBuffer * 483 *=============================================================================================*/ 484 inline BOOL GraphicViewPortClass::Unlock(void) 485 { 486 BOOL unlock = GraphicBuff->Unlock(); 487 if (!unlock) return(FALSE); 488 if (this != GraphicBuff && IsDirectDraw && !GraphicBuff->LockCount) { 489 Offset = 0; 490 } 491 return(TRUE); 492 } 493 494 495 /*************************************************************************** 496 * GVPC::GET_OFFSET -- Get offset for virtual view port class instance * 497 * * 498 * INPUT: none * 499 * * 500 * OUTPUT: long the offset for the virtual viewport instance * 501 * * 502 * HISTORY: * 503 * 06/07/1994 PWG : Created. * 504 *=========================================================================*/ 505 inline long GraphicViewPortClass::Get_Offset(void) 506 { 507 return(Offset); 508 } 509 510 /*************************************************************************** 511 * GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance * 512 * * 513 * INPUT: none * 514 * * 515 * OUTPUT: WORD the height of the virtual viewport instance * 516 * * 517 * HISTORY: * 518 * 06/07/1994 PWG : Created. * 519 *=========================================================================*/ 520 inline int GraphicViewPortClass::Get_Height(void) 521 { 522 return(Height); 523 } 524 525 /*************************************************************************** 526 * GVPC::GET_WIDTH -- Get the width of a virtual viewport instance * 527 * * 528 * INPUT: none * 529 * * 530 * OUTPUT: WORD the width of the virtual viewport instance * 531 * * 532 * HISTORY: * 533 * 06/07/1994 PWG : Created. * 534 *=========================================================================*/ 535 inline int GraphicViewPortClass::Get_Width(void) 536 { 537 return(Width); 538 } 539 540 541 /*************************************************************************** 542 * GVPC::GET_XADD -- Get the X add offset for virtual viewport instance * 543 * * 544 * INPUT: none * 545 * * 546 * OUTPUT: WORD the xadd for a virtual viewport instance * 547 * * 548 * HISTORY: * 549 * 06/07/1994 PWG : Created. * 550 *=========================================================================*/ 551 inline int GraphicViewPortClass::Get_XAdd(void) 552 { 553 return(XAdd); 554 } 555 /*************************************************************************** 556 * GVPC::GET_XPOS -- Get the x pos of the VP on the Video * 557 * * 558 * INPUT: none * 559 * * 560 * OUTPUT: WORD the x offset to VideoBufferClass * 561 * * 562 * HISTORY: * 563 * 08/22/1994 SKB : Created. * 564 *=========================================================================*/ 565 inline int GraphicViewPortClass::Get_XPos(void) 566 { 567 return(XPos); 568 } 569 570 571 /*************************************************************************** 572 * GVPC::GET_YPOS -- Get the y pos of the VP on the video * 573 * * 574 * INPUT: none * 575 * * 576 * OUTPUT: WORD the x offset to VideoBufferClass * 577 * * 578 * WARNINGS: * 579 * * 580 * HISTORY: * 581 * 08/22/1994 SKB : Created. * 582 *=========================================================================*/ 583 inline int GraphicViewPortClass::Get_YPos(void) 584 { 585 return(YPos); 586 } 587 588 /*************************************************************************** 589 * GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. * 590 * * 591 * INPUT: * 592 * * 593 * OUTPUT: * 594 * * 595 * HISTORY: * 596 * 08/22/1994 SKB : Created. * 597 *=========================================================================*/ 598 inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void) 599 { 600 return (GraphicBuff); 601 } 602 603 /*************************************************************************** 604 * GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region * 605 * * 606 * INPUT: * 607 * * 608 * OUTPUT: * 609 * * 610 * WARNINGS: * 611 * * 612 * HISTORY: * 613 * 03/01/1995 BWG : Created. * 614 *=========================================================================*/ 615 inline long GraphicViewPortClass::Size_Of_Region(int w, int h) 616 { 617 return Buffer_Size_Of_Region(this, w, h); 618 } 619 620 621 /*************************************************************************** 622 * GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel * 623 * * 624 * INPUT: * 625 * * 626 * OUTPUT: * 627 * * 628 * WARNINGS: * 629 * * 630 * HISTORY: * 631 * 01/06/1995 PWG : Created. * 632 *=========================================================================*/ 633 inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color) 634 { 635 636 if (Lock()){ 637 Buffer_Put_Pixel(this, x, y, color); 638 } 639 Unlock(); 640 641 642 } 643 644 /*************************************************************************** 645 * GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel * 646 * * 647 * INPUT: * 648 * * 649 * OUTPUT: * 650 * * 651 * WARNINGS: * 652 * * 653 * HISTORY: * 654 * 01/06/1995 PWG : Created. * 655 *=========================================================================*/ 656 inline int GraphicViewPortClass::Get_Pixel(int x, int y) 657 { 658 int return_code=0; 659 660 if (Lock()){ 661 return_code=(Buffer_Get_Pixel(this, x, y)); 662 } 663 Unlock(); 664 return(return_code); 665 666 } 667 668 /*************************************************************************** 669 * GVPC::CLEAR -- stub to call curr graphic mode Clear * 670 * * 671 * INPUT: * 672 * * 673 * OUTPUT: * 674 * * 675 * WARNINGS: * 676 * * 677 * HISTORY: * 678 * 01/06/1995 PWG : Created. * 679 *=========================================================================*/ 680 inline void GraphicViewPortClass::Clear(unsigned char color) 681 { 682 if (Lock()){ 683 Buffer_Clear(this, color); 684 } 685 Unlock(); 686 687 } 688 689 /*************************************************************************** 690 * GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer * 691 * * 692 * INPUT: * 693 * * 694 * OUTPUT: * 695 * * 696 * WARNINGS: * 697 * * 698 * HISTORY: * 699 * 01/06/1995 PWG : Created. * 700 *=========================================================================*/ 701 inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size) 702 { 703 long return_code=0; 704 if (Lock()){ 705 return_code = (Buffer_To_Buffer(this, x, y, w, h, buff, size)); 706 } 707 Unlock(); 708 return ( return_code ); 709 } 710 711 /*************************************************************************** 712 * GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer * 713 * * 714 * INPUT: * 715 * * 716 * OUTPUT: * 717 * * 718 * WARNINGS: * 719 * * 720 * HISTORY: * 721 * 01/06/1995 PWG : Created. * 722 *=========================================================================*/ 723 inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff) 724 { 725 long return_code=0; 726 if (Lock()){ 727 return_code = (Buffer_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size())); 728 } 729 Unlock(); 730 return ( return_code ); 731 } 732 733 /*************************************************************************** 734 * GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer * 735 * * 736 * INPUT: * 737 * * 738 * OUTPUT: * 739 * * 740 * WARNINGS: * 741 * * 742 * HISTORY: * 743 * 01/06/1995 PWG : Created. * 744 *=========================================================================*/ 745 inline long GraphicViewPortClass::To_Buffer(BufferClass *buff) 746 { 747 long return_code=0; 748 if (Lock()){ 749 return_code = (Buffer_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size())); 750 } 751 Unlock(); 752 return ( return_code ); 753 } 754 755 /*************************************************************************** 756 * GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC * 757 * * 758 * INPUT: * 759 * * 760 * OUTPUT: * 761 * * 762 * WARNINGS: * 763 * * 764 * HISTORY: * 765 * 01/06/1995 PWG : Created. * 766 *=========================================================================*/ 767 inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel, 768 int dy_pixel, int pixel_width, int pixel_height, BOOL trans) 769 { 770 HRESULT return_code=0; 771 772 if ( IsDirectDraw && dest.IsDirectDraw ){ 773 return(DD_Linear_Blit_To_Linear( dest, XPos+x_pixel, YPos+y_pixel 774 , dest.Get_XPos()+dx_pixel, dest.Get_YPos()+dy_pixel 775 , pixel_width, pixel_height, trans)); 776 } else { 777 778 if (Lock()){ 779 if (dest.Lock()){ 780 return_code=(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel 781 , dx_pixel, dy_pixel 782 , pixel_width, pixel_height, trans)); 783 } 784 dest.Unlock(); 785 } 786 Unlock(); 787 } 788 789 return ( return_code ); 790 } 791 792 /*************************************************************************** 793 * GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC * 794 * * 795 * INPUT: * 796 * * 797 * OUTPUT: * 798 * * 799 * WARNINGS: * 800 * * 801 * HISTORY: * 802 * 01/06/1995 PWG : Created. * 803 *=========================================================================*/ 804 inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans) 805 { 806 HRESULT return_code=0; 807 808 809 if ( IsDirectDraw && dest.IsDirectDraw ){ 810 return(DD_Linear_Blit_To_Linear( dest, XPos, YPos 811 , dest.Get_XPos()+dx, dest.Get_YPos()+dy 812 , Width, Height, trans)); 813 } else { 814 815 if (Lock()){ 816 if (dest.Lock()){ 817 return_code=(Linear_Blit_To_Linear(this, &dest, 0, 0 818 , dx, dy 819 , Width, Height, trans)); 820 } 821 dest.Unlock(); 822 } 823 Unlock(); 824 } 825 826 return (return_code); 827 828 } 829 830 /*************************************************************************** 831 * GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC * 832 * * 833 * INPUT: * 834 * * 835 * OUTPUT: * 836 * * 837 * WARNINGS: * 838 * * 839 * HISTORY: * 840 * 01/06/1995 PWG : Created. * 841 *=========================================================================*/ 842 inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans) 843 { 844 HRESULT return_code=0; 845 846 847 if ( IsDirectDraw && dest.IsDirectDraw ){ 848 return(DD_Linear_Blit_To_Linear( dest, XPos, YPos 849 , dest.Get_XPos(), dest.Get_YPos() 850 , MAX( Width, dest.Get_Width()) 851 , MAX( Height, dest.Get_Height()) 852 , trans)); 853 } else { 854 855 if (Lock()){ 856 if (dest.Lock()){ 857 return_code=(Linear_Blit_To_Linear(this, &dest, 0, 0 858 , 0, 0 859 , Width, Height, trans)); 860 } 861 dest.Unlock(); 862 } 863 Unlock(); 864 } 865 866 return (return_code); 867 868 } 869 870 871 /*************************************************************************** 872 * GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC * 873 * * 874 * INPUT: * 875 * * 876 * OUTPUT: * 877 * * 878 * WARNINGS: * 879 * * 880 * HISTORY: * 881 * 01/06/1995 PWG : Created. * 882 *=========================================================================*/ 883 inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x, 884 int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap) 885 { 886 BOOL return_code=0; 887 if (Lock()){ 888 if (dest.Lock()){ 889 return_code = (Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap)); 890 } 891 dest.Unlock(); 892 } 893 Unlock(); 894 return ( return_code ); 895 } 896 897 /*************************************************************************** 898 * GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC * 899 * * 900 * INPUT: * 901 * * 902 * OUTPUT: * 903 * * 904 * WARNINGS: * 905 * * 906 * HISTORY: * 907 * 01/06/1995 PWG : Created. * 908 *=========================================================================*/ 909 inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x, 910 int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap) 911 { 912 BOOL return_code=0; 913 if (Lock()){ 914 if (dest.Lock()){ 915 return_code = (Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap)); 916 } 917 dest.Unlock(); 918 } 919 Unlock(); 920 return ( return_code ); 921 } 922 923 /*************************************************************************** 924 * GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC * 925 * * 926 * INPUT: * 927 * * 928 * OUTPUT: * 929 * * 930 * WARNINGS: * 931 * * 932 * HISTORY: * 933 * 01/06/1995 PWG : Created. * 934 *=========================================================================*/ 935 inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap) 936 { 937 BOOL return_code=0; 938 if (Lock()){ 939 if (dest.Lock()){ 940 return_code = (Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap)); 941 } 942 dest.Unlock(); 943 } 944 Unlock(); 945 return ( return_code ); 946 } 947 948 /*************************************************************************** 949 * GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC * 950 * * 951 * INPUT: * 952 * * 953 * OUTPUT: * 954 * * 955 * WARNINGS: * 956 * * 957 * HISTORY: * 958 * 01/06/1995 PWG : Created. * 959 *=========================================================================*/ 960 inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap) 961 { 962 BOOL return_code=0; 963 if (Lock()){ 964 if (dest.Lock()){ 965 return_code = (Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap)); 966 } 967 dest.Unlock(); 968 } 969 Unlock(); 970 return ( return_code ); 971 } 972 /*************************************************************************** 973 * GVPC::PRINT -- stub func to print a text string * 974 * * 975 * INPUT: * 976 * * 977 * OUTPUT: * 978 * * 979 * WARNINGS: * 980 * * 981 * HISTORY: * 982 * 01/17/1995 PWG : Created. * 983 *=========================================================================*/ 984 inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol) 985 { 986 unsigned long return_code=0; 987 if (Lock()){ 988 return_code = (Buffer_Print(this, str, x, y, fcol, bcol)); 989 } 990 Unlock(); 991 return ( return_code ); 992 } 993 994 #pragma warning (disable:4996) 995 996 /*************************************************************************** 997 * GVPC::PRINT -- Stub function to print an integer * 998 * * 999 * INPUT: * 1000 * * 1001 * OUTPUT: * 1002 * * 1003 * WARNINGS: * 1004 * * 1005 * HISTORY: * 1006 *=========================================================================*/ 1007 inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol) 1008 { 1009 char str[17]; 1010 1011 unsigned long return_code=0; 1012 if (Lock()){ 1013 return_code = (Buffer_Print(this, itoa(num, str, 10), x, y, fcol, bcol)); 1014 } 1015 Unlock(); 1016 return ( return_code ); 1017 } 1018 1019 /*************************************************************************** 1020 * GVPC::PRINT -- Stub function to print a short to a graphic viewport * 1021 * * 1022 * INPUT: * 1023 * * 1024 * OUTPUT: * 1025 * * 1026 * WARNINGS: * 1027 * * 1028 * HISTORY: * 1029 *=========================================================================*/ 1030 inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol) 1031 { 1032 char str[17]; 1033 1034 unsigned long return_code=0; 1035 if (Lock()){ 1036 return_code = (Buffer_Print(this, itoa(num, str, 10), x, y, fcol, bcol)); 1037 } 1038 Unlock(); 1039 return ( return_code ); 1040 } 1041 1042 /*************************************************************************** 1043 * GVPC::PRINT -- stub function to print a long on a graphic view port * 1044 * * 1045 * INPUT: * 1046 * * 1047 * OUTPUT: * 1048 * * 1049 * WARNINGS: * 1050 * * 1051 * HISTORY: * 1052 *=========================================================================*/ 1053 inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol) 1054 { 1055 char str[33]; 1056 1057 unsigned long return_code=0; 1058 if (Lock()){ 1059 return_code = (Buffer_Print(this, ltoa(num, str,10), x, y, fcol, bcol)); 1060 } 1061 Unlock(); 1062 return ( return_code ); 1063 } 1064 1065 /*************************************************************************** 1066 * GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port * 1067 * * 1068 * INPUT: * 1069 * * 1070 * OUTPUT: * 1071 * * 1072 * WARNINGS: * 1073 * * 1074 * HISTORY: * 1075 *=========================================================================*/ 1076 inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap) 1077 { 1078 if (Lock()){ 1079 Buffer_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap); 1080 } 1081 Unlock(); 1082 } 1083 1084 1085 1086 /*************************************************************************** 1087 * GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port * 1088 * This version clips the tile to a window * 1089 * * 1090 * INPUT: * 1091 * * 1092 * OUTPUT: * 1093 * * 1094 * WARNINGS: * 1095 * * 1096 * HISTORY: * 1097 * 07/31/1995 BWG : Created. * 1098 *=========================================================================*/ 1099 extern BOOL IconCacheAllowed; 1100 inline void GraphicViewPortClass::Draw_Stamp(void const * icondata, int icon, int x_pixel, int y_pixel, void const * remap, int clip_window) 1101 { 1102 int cache_index=-1; 1103 1104 int drewit = 0; 1105 if (IconCacheAllowed){ 1106 if (IsDirectDraw){ 1107 if (!remap){ 1108 cache_index = Is_Icon_Cached(icondata,icon); 1109 } 1110 1111 if (cache_index != -1){ 1112 if (CachedIcons[cache_index].Get_Is_Cached() ){ 1113 CachedIcons[cache_index].Draw_It (GraphicBuff->Get_DD_Surface() , x_pixel, y_pixel, 1114 WindowList[clip_window][WINDOWX] + XPos, 1115 WindowList[clip_window][WINDOWY] +YPos, 1116 WindowList[clip_window][WINDOWWIDTH], 1117 WindowList[clip_window][WINDOWHEIGHT]); 1118 CachedIconsDrawn++; 1119 drewit = 1; 1120 } 1121 } 1122 } 1123 } 1124 1125 1126 if (drewit == 0) { 1127 if (Lock()){ 1128 UnCachedIconsDrawn++; 1129 Buffer_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX], WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH], WindowList[clip_window][WINDOWHEIGHT]); 1130 } 1131 } 1132 Unlock(); 1133 } 1134 1135 1136 /*************************************************************************** 1137 * GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class * 1138 * * 1139 * INPUT: * 1140 * * 1141 * OUTPUT: * 1142 * * 1143 * WARNINGS: * 1144 * * 1145 * HISTORY: * 1146 * 01/16/1995 PWG : Created. * 1147 *=========================================================================*/ 1148 inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color) 1149 { 1150 if (Lock()){ 1151 Buffer_Draw_Line(this, sx, sy, dx, dy, color); 1152 } 1153 Unlock(); 1154 } 1155 1156 /*************************************************************************** 1157 * GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC * 1158 * * 1159 * INPUT: * 1160 * * 1161 * OUTPUT: * 1162 * * 1163 * WARNINGS: * 1164 * * 1165 * HISTORY: * 1166 * 01/16/1995 PWG : Created. * 1167 *=========================================================================*/ 1168 inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color) 1169 { 1170 if ( AllowHardwareBlitFills 1171 && IsDirectDraw 1172 && ( (dx-sx) * (dy-sy) >= (32*32) ) 1173 && GraphicBuff->Get_DD_Surface()->GetBltStatus(DDGBS_CANBLT) == DD_OK){ 1174 DDBLTFX blit_effects; 1175 RECT dest_rectangle; 1176 1177 dest_rectangle.left =sx+XPos; 1178 dest_rectangle.top =sy+YPos; 1179 dest_rectangle.right =dx+XPos; 1180 dest_rectangle.bottom=dy+YPos; 1181 1182 if (dest_rectangle.left<XPos){ 1183 dest_rectangle.left=XPos; 1184 } 1185 1186 if (dest_rectangle.right >= Width + XPos){ 1187 dest_rectangle.right = Width +XPos -1; 1188 } 1189 1190 if (dest_rectangle.top<YPos){ 1191 dest_rectangle.top=YPos; 1192 } 1193 1194 if (dest_rectangle.bottom >= Height + YPos){ 1195 dest_rectangle.bottom = Height + YPos -1; 1196 } 1197 1198 if (dest_rectangle.left >= dest_rectangle.right) return; 1199 if (dest_rectangle.top >= dest_rectangle.bottom) return; 1200 1201 dest_rectangle.right++; 1202 dest_rectangle.bottom++; 1203 1204 blit_effects.dwSize=sizeof(blit_effects); 1205 blit_effects.dwFillColor = color; 1206 GraphicBuff->Get_DD_Surface()->Blt(&dest_rectangle, 1207 NULL, 1208 NULL, 1209 DDBLT_WAIT | DDBLT_ASYNC | DDBLT_COLORFILL, 1210 &blit_effects); 1211 } else { 1212 if (Lock()){ 1213 Buffer_Fill_Rect(this, sx, sy, dx, dy, color); 1214 Unlock(); 1215 } 1216 } 1217 } 1218 1219 1220 /*************************************************************************** 1221 * GVPC::REMAP -- Stub function to remap a GVPC * 1222 * * 1223 * INPUT: * 1224 * * 1225 * OUTPUT: * 1226 * * 1227 * WARNINGS: * 1228 * * 1229 * HISTORY: * 1230 * 01/16/1995 PWG : Created. * 1231 *=========================================================================*/ 1232 inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap) 1233 { 1234 if (Lock()){ 1235 Buffer_Remap(this, sx, sy, width, height, remap); 1236 } 1237 Unlock(); 1238 } 1239 1240 1241 inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1, 1242 int x2, int y2, int x3, int y3, int color) 1243 { 1244 if (Lock()){ 1245 Buffer_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color); 1246 } 1247 Unlock(); 1248 } 1249 1250 /*************************************************************************** 1251 * GVPC::REMAP -- Short form to remap an entire graphic view port * 1252 * * 1253 * INPUT: BYTE * to the remap table to use * 1254 * * 1255 * OUTPUT: none * 1256 * * 1257 * HISTORY: * 1258 * 07/01/1994 PWG : Created. * 1259 *=========================================================================*/ 1260 inline VOID GraphicViewPortClass::Remap(VOID *remap) 1261 { 1262 if (Lock()){ 1263 Buffer_Remap(this, 0, 0, Width, Height, remap); 1264 } 1265 Unlock(); 1266 } 1267 1268 inline int GraphicViewPortClass::Get_Pitch(void) 1269 { 1270 return(Pitch); 1271 } 1272 /*=========================================================================*/ 1273 /* The following BufferClass functions are defined here because they act */ 1274 /* on graphic viewports. */ 1275 /*=========================================================================*/ 1276 1277 1278 /*************************************************************************** 1279 * BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page * 1280 * * 1281 * INPUT: * 1282 * * 1283 * OUTPUT: * 1284 * * 1285 * WARNINGS: * 1286 * * 1287 * HISTORY: * 1288 * 01/12/1995 PWG : Created. * 1289 *=========================================================================*/ 1290 inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view) 1291 { 1292 long return_code=0; 1293 if (view.Lock()){ 1294 return_code = (Buffer_To_Page(x, y, w, h, Buffer, &view)); 1295 } 1296 view.Unlock(); 1297 return ( return_code ); 1298 } 1299 1300 /*************************************************************************** 1301 * BC::TO_PAGE -- Copys a buffer class to a page with definable w, h * 1302 * * 1303 * INPUT: int width - the width of copy region * 1304 * int height - the height of copy region * 1305 * GVPC& dest - virtual viewport to copy to * 1306 * * 1307 * OUTPUT: none * 1308 * * 1309 * WARNINGS: x and y position are the upper left corner of the dest * 1310 * viewport * 1311 * * 1312 * HISTORY: * 1313 * 07/01/1994 PWG : Created. * 1314 *=========================================================================*/ 1315 inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view) 1316 { 1317 long return_code=0; 1318 if (view.Lock()){ 1319 return_code = (Buffer_To_Page(0, 0, w, h, Buffer, &view)); 1320 } 1321 view.Unlock(); 1322 return ( return_code ); 1323 } 1324 /*************************************************************************** 1325 * BC::TO_PAGE -- Copys a buffer class to a page with definable w, h * 1326 * * 1327 * INPUT: GVPC& dest - virtual viewport to copy to * 1328 * * 1329 * OUTPUT: none * 1330 * * 1331 * WARNINGS: x and y position are the upper left corner of the dest * 1332 * viewport. width and height are assumed to be the * 1333 * viewport's width and height. * 1334 * * 1335 * HISTORY: * 1336 * 07/01/1994 PWG : Created. * 1337 *=========================================================================*/ 1338 inline long BufferClass::To_Page(GraphicViewPortClass &view) 1339 { 1340 long return_code=0; 1341 if (view.Lock()){ 1342 return_code = (Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view)); 1343 } 1344 view.Unlock(); 1345 return ( return_code ); 1346 } 1347 /*************************************************************************** 1348 * BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h * 1349 * * 1350 * INPUT: int x - x pixel on viewport to copy from * 1351 * int y - y pixel on viewport to copy from * 1352 * int width - the width of copy region * 1353 * int height - the height of copy region * 1354 * GVPC& dest - virtual viewport to copy to * 1355 * * 1356 * OUTPUT: none * 1357 * * 1358 * HISTORY: * 1359 * 07/01/1994 PWG : Created. * 1360 *=========================================================================*/ 1361 inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view) 1362 { 1363 long return_code=0; 1364 if (view.Lock()){ 1365 return_code = (Buffer_To_Page(x, y, w, h, Buffer, &view)); 1366 } 1367 view.Unlock(); 1368 return ( return_code ); 1369 } 1370 1371 1372 #endif