[4] | 1 | /****************************************************************************** |
---|
| 2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
| 3 | * |
---|
| 4 | * Module: sageBlockPartition.h |
---|
| 5 | * Author : Byungil Jeong |
---|
| 6 | * |
---|
| 7 | * Copyright (C) 2004 Electronic Visualization Laboratory, |
---|
| 8 | * University of Illinois at Chicago |
---|
| 9 | * |
---|
| 10 | * All rights reserved. |
---|
| 11 | * |
---|
| 12 | * Redistribution and use in source and binary forms, with or without |
---|
| 13 | * modification, are permitted provided that the following conditions are met: |
---|
| 14 | * |
---|
| 15 | * * Redistributions of source code must retain the above copyright |
---|
| 16 | * notice, this list of conditions and the following disclaimer. |
---|
| 17 | * * Redistributions in binary form must reproduce the above |
---|
| 18 | * copyright notice, this list of conditions and the following disclaimer |
---|
| 19 | * in the documentation and/or other materials provided with the distribution. |
---|
| 20 | * * Neither the name of the University of Illinois at Chicago nor |
---|
| 21 | * the names of its contributors may be used to endorse or promote |
---|
| 22 | * products derived from this software without specific prior written permission. |
---|
| 23 | * |
---|
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
| 29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 31 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 32 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 35 | * |
---|
| 36 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
| 37 | * http://www.evl.uic.edu/cavern/forum/ |
---|
| 38 | * |
---|
| 39 | *****************************************************************************/ |
---|
| 40 | |
---|
| 41 | #ifndef _SAGE_BLOCK_PARTITION_H |
---|
| 42 | #define _SAGE_BLOCK_PARTITION_H |
---|
| 43 | |
---|
| 44 | #include "sageBase.h" |
---|
| 45 | #include "sageBlock.h" |
---|
| 46 | |
---|
| 47 | class pixelBlockMap { |
---|
| 48 | public: |
---|
| 49 | int blockID; |
---|
| 50 | int infoID; |
---|
| 51 | int count; |
---|
| 52 | pixelBlockMap *next; |
---|
| 53 | |
---|
| 54 | pixelBlockMap() : blockID(0), infoID(0), next(NULL) {} |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | class blockMontageMap : public pixelBlockMap { |
---|
| 58 | public: |
---|
| 59 | int x, y; |
---|
| 60 | |
---|
| 61 | blockMontageMap() : x(0), y(0) { next = NULL; } |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | class sageBlockPartition : public sageRect { |
---|
| 65 | private: |
---|
| 66 | int blockWidth, blockHeight; |
---|
| 67 | int rowNum, colNum; |
---|
| 68 | int blockNum, totalBlockNum; |
---|
| 69 | sageRect viewPort; |
---|
| 70 | sageRect blockLayout; |
---|
| 71 | sageRect displayLayout; |
---|
| 72 | int vRowNum, vColNum, vOffsetX, vOffsetY; |
---|
| 73 | pixelBlockMap **blockTable; |
---|
| 74 | int entryNum; |
---|
| 75 | |
---|
| 76 | public: |
---|
| 77 | sageBlockPartition(int bw, int bh, int iw, int ih); |
---|
| 78 | void getBlock(int id, sagePixelBlock &rect); |
---|
| 79 | void setViewPort(sageRect &rect); |
---|
| 80 | int getVisibleBlockID(int idx); |
---|
| 81 | void getVisibleBlock(int idx, sagePixelBlock &block); |
---|
| 82 | void adjustBlockCoord(sagePixelBlock &block); |
---|
| 83 | int setStreamInfo(int infoID, sageRect &window); |
---|
| 84 | int setStreamInfo(int infoID, int begin, int end); |
---|
| 85 | bool insertBlockMap(pixelBlockMap *map); |
---|
| 86 | pixelBlockMap* getBlockMap(int blockID); |
---|
| 87 | void clearBlockTable(); |
---|
| 88 | void initBlockTable(); |
---|
| 89 | void genBlockTable(int monIdx); |
---|
| 90 | inline int getBlockNum() { return blockNum; } |
---|
| 91 | inline int tableEntryNum() { return entryNum; } |
---|
| 92 | inline void setDisplayLayout(sageRect &layout) { displayLayout = layout; } |
---|
| 93 | inline sageRect& getViewPort() { return viewPort; } |
---|
| 94 | inline sageRect& getBlockLayout() { return blockLayout; } |
---|
| 95 | void setTileLayout(sageRect tileRect); |
---|
| 96 | void getBlockPosition(sagePixelBlock &block); |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | #endif |
---|