Changeset 13041 for OpenSceneGraph/trunk/src/osgWidget/Frame.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgWidget/Frame.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgWidget/Frame.cpp
r12366 r13041 72 72 73 73 parent->update(); 74 74 75 75 return true; 76 76 } … … 85 85 Frame::Border::Border(const Border& border, const osg::CopyOp& co): 86 86 Widget (border, co), 87 _border (border._border) 87 _border (border._border) 88 88 { 89 89 } … … 111 111 112 112 if(_border == BORDER_LEFT) setTexCoordRegion(w * 3, 0.0f, w, h); 113 113 114 114 else if(_border == BORDER_RIGHT) setTexCoordRegion(w * 4, 0.0f, w, h); 115 115 … … 141 141 { 142 142 Frame* parent = dynamic_cast<Frame*>(getParent()); 143 143 144 144 if(!parent) return false; 145 145 … … 210 210 ) { 211 211 Frame* frame = 0; 212 212 213 213 // Use an "existing frame" if we have it (for example, if you've in inherited from 214 214 // Frame and want to use this stuff. … … 216 216 217 217 else frame = exFrame; 218 218 219 219 frame->addWidget(new Corner(CORNER_LOWER_LEFT, cw, ch), 0, 0); 220 220 frame->addWidget(new Border(BORDER_BOTTOM, w, ch), 0, 1); … … 321 321 // frame->getEmbeddedWindow()->setTexCoordRegion(cw, ch, tw - (cw * 2.0f), th - (ch * 2.0f)); 322 322 } 323 else 323 else 324 324 { 325 325 OSG_WARN << "createSimpleFrameWithSingleTexture with a null image, the frame " << name << " will be use texture" << std::endl; … … 340 340 left->getWidth() + right->getWidth() + w, 341 341 top->getHeight() + bottom->getHeight() + h 342 ); 342 ); 343 343 } 344 344 … … 360 360 frame = createSimpleFrameWithSingleTexture(name, natifImage.get(), width, height, flags, exFrame); 361 361 362 if (frame && image && natifImage.valid()) 362 if (frame && image && natifImage.valid()) 363 363 { 364 364 const unsigned int bpps = image->getPixelSizeInBits() / 8; … … 389 389 const unsigned int x1, const unsigned int y1, 390 390 const unsigned int x2, const unsigned int y2, 391 osg::Image* destination, 391 osg::Image* destination, 392 392 const unsigned int xd = 0, const unsigned int yd = 0) 393 393 { 394 if ((unsigned int)destination->s() >= xd + (x2 - x1) && 394 if ((unsigned int)destination->s() >= xd + (x2 - x1) && 395 395 (unsigned int)destination->t() >= yd + (y2 - y1)) 396 396 { … … 404 404 for (unsigned int x = 0; x < x2 - x1; ++x) 405 405 { 406 for (unsigned int d = 0; d < bpps; d++) 406 for (unsigned int d = 0; d < bpps; d++) 407 407 { 408 408 T v = srcdata[(y + y1) * source->s() * bpps + (x + x1) * bpps + d]; … … 416 416 } 417 417 418 /** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into 418 /** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into 419 419 another image starting at position (xd, yd). No scaling is done, the 420 pixels are just copied, so the destination image must be at least 420 pixels are just copied, so the destination image must be at least 421 421 (xd + (x2 - x1)) by (yd + (y2 - y1)) pixels. */ 422 422 void copyData(const osg::Image* source, 423 const unsigned int x1, const unsigned int y1, 423 const unsigned int x1, const unsigned int y1, 424 424 const unsigned int x2, const unsigned int y2, 425 osg::Image* destination, 425 osg::Image* destination, 426 426 const unsigned int xd, const unsigned int yd) 427 427 { … … 430 430 if (source->getDataType() == GL_UNSIGNED_BYTE) 431 431 { 432 copyDataImpl<unsigned char>(source, x1, y1, x2, y2, 432 copyDataImpl<unsigned char>(source, x1, y1, x2, y2, 433 433 destination, xd, yd); 434 434 } … … 542 542 return 0; 543 543 } 544 544 545 545 // check size 546 546 int ceilvalue = static_cast<int>(ceil(s * 1.0 / 3));
