diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llui/llui.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llui/llui.cpp')
-rw-r--r-- | linden/indra/llui/llui.cpp | 175 |
1 files changed, 86 insertions, 89 deletions
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp index ec8c94e..aafd3af 100644 --- a/linden/indra/llui/llui.cpp +++ b/linden/indra/llui/llui.cpp | |||
@@ -55,6 +55,7 @@ | |||
55 | //#include "llstartup.h" | 55 | //#include "llstartup.h" |
56 | #include "llui.h" | 56 | #include "llui.h" |
57 | #include "llview.h" | 57 | #include "llview.h" |
58 | #include "lllineeditor.h" | ||
58 | #include "llwindow.h" | 59 | #include "llwindow.h" |
59 | 60 | ||
60 | #include "llglheaders.h" | 61 | #include "llglheaders.h" |
@@ -73,7 +74,6 @@ std::list<LLString> gUntranslated; | |||
73 | 74 | ||
74 | LLControlGroup* LLUI::sConfigGroup = NULL; | 75 | LLControlGroup* LLUI::sConfigGroup = NULL; |
75 | LLControlGroup* LLUI::sColorsGroup = NULL; | 76 | LLControlGroup* LLUI::sColorsGroup = NULL; |
76 | LLControlGroup* LLUI::sAssetsGroup = NULL; | ||
77 | LLImageProviderInterface* LLUI::sImageProvider = NULL; | 77 | LLImageProviderInterface* LLUI::sImageProvider = NULL; |
78 | LLUIAudioCallback LLUI::sAudioCallback = NULL; | 78 | LLUIAudioCallback LLUI::sAudioCallback = NULL; |
79 | LLVector2 LLUI::sGLScaleFactor(1.f, 1.f); | 79 | LLVector2 LLUI::sGLScaleFactor(1.f, 1.f); |
@@ -321,7 +321,7 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st | |||
321 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) | 321 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) |
322 | { | 322 | { |
323 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) | 323 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) |
324 | if( gGLManager.mATIOffsetVerticalLines && (x1 == x2) ) | 324 | if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) |
325 | { | 325 | { |
326 | x1++; | 326 | x1++; |
327 | x2++; | 327 | x2++; |
@@ -340,7 +340,7 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) | |||
340 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) | 340 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) |
341 | { | 341 | { |
342 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) | 342 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) |
343 | if( gGLManager.mATIOffsetVerticalLines && (x1 == x2) ) | 343 | if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) |
344 | { | 344 | { |
345 | x1++; | 345 | x1++; |
346 | x2++; | 346 | x2++; |
@@ -458,24 +458,30 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma | |||
458 | return; | 458 | return; |
459 | } | 459 | } |
460 | 460 | ||
461 | // scale screen size of borders down | 461 | // shrink scaling region to be proportional to clipped image region |
462 | LLRectf clipped_scale_rect = uv_rect; | 462 | LLRectf scale_rect_uv( |
463 | clipped_scale_rect.intersectWith(scale_rect); | 463 | uv_rect.mLeft + (scale_rect.mLeft * uv_rect.getWidth()), |
464 | uv_rect.mBottom + (scale_rect.mTop * uv_rect.getHeight()), | ||
465 | uv_rect.mLeft + (scale_rect.mRight * uv_rect.getWidth()), | ||
466 | uv_rect.mBottom + (scale_rect.mBottom * uv_rect.getHeight())); | ||
467 | |||
468 | S32 image_natural_width = llround((F32)image->getWidth(0) * uv_rect.getWidth()); | ||
469 | S32 image_natural_height = llround((F32)image->getHeight(0) * uv_rect.getHeight()); | ||
464 | 470 | ||
465 | LLRect draw_rect(0, height, width, 0); | 471 | LLRect draw_rect(0, height, width, 0); |
466 | LLRect draw_scale_rect(llround((F32)image->getWidth() * scale_rect.mLeft), | 472 | LLRect draw_scale_rect(llround(scale_rect_uv.mLeft * (F32)image->getWidth(0)), |
467 | llround((F32)image->getHeight() * scale_rect.mTop), | 473 | llround(scale_rect_uv.mTop * (F32)image->getHeight(0)), |
468 | llround((F32)image->getWidth() * scale_rect.mRight), | 474 | llround(scale_rect_uv.mRight * (F32)image->getWidth(0)), |
469 | llround((F32)image->getHeight() * scale_rect.mBottom)); | 475 | llround(scale_rect_uv.mBottom * (F32)image->getHeight(0))); |
470 | // scale fixed region of image up with drawn region | 476 | // scale fixed region of image to drawn region |
471 | draw_scale_rect.mRight += width - image->getWidth(); | 477 | draw_scale_rect.mRight += width - image_natural_width; |
472 | draw_scale_rect.mTop += height - image->getHeight(); | 478 | draw_scale_rect.mTop += height - image_natural_height; |
473 | 479 | ||
474 | S32 border_shrink_width = llmax(0, draw_scale_rect.mLeft - draw_scale_rect.mRight); | 480 | S32 border_shrink_width = llmax(0, draw_scale_rect.mLeft - draw_scale_rect.mRight); |
475 | S32 border_shrink_height = llmax(0, draw_scale_rect.mBottom - draw_scale_rect.mTop); | 481 | S32 border_shrink_height = llmax(0, draw_scale_rect.mBottom - draw_scale_rect.mTop); |
476 | 482 | ||
477 | F32 shrink_width_ratio = scale_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image->getWidth() * (1.f - scale_rect.getWidth())); | 483 | F32 shrink_width_ratio = scale_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - scale_rect.getWidth())); |
478 | F32 shrink_height_ratio = scale_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image->getHeight() * (1.f - scale_rect.getHeight())); | 484 | F32 shrink_height_ratio = scale_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - scale_rect.getHeight())); |
479 | 485 | ||
480 | F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); | 486 | F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); |
481 | draw_scale_rect.mLeft = llround((F32)draw_scale_rect.mLeft * shrink_scale); | 487 | draw_scale_rect.mLeft = llround((F32)draw_scale_rect.mLeft * shrink_scale); |
@@ -515,117 +521,117 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma | |||
515 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); | 521 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); |
516 | gGL.vertex2i(0, 0); | 522 | gGL.vertex2i(0, 0); |
517 | 523 | ||
518 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); | 524 | gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mBottom); |
519 | gGL.vertex2i(draw_scale_rect.mLeft, 0); | 525 | gGL.vertex2i(draw_scale_rect.mLeft, 0); |
520 | 526 | ||
521 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 527 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom); |
522 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 528 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
523 | 529 | ||
524 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom); | 530 | gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mBottom); |
525 | gGL.vertex2i(0, draw_scale_rect.mBottom); | 531 | gGL.vertex2i(0, draw_scale_rect.mBottom); |
526 | 532 | ||
527 | // draw bottom middle | 533 | // draw bottom middle |
528 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); | 534 | gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mBottom); |
529 | gGL.vertex2i(draw_scale_rect.mLeft, 0); | 535 | gGL.vertex2i(draw_scale_rect.mLeft, 0); |
530 | 536 | ||
531 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom); | 537 | gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mBottom); |
532 | gGL.vertex2i(draw_scale_rect.mRight, 0); | 538 | gGL.vertex2i(draw_scale_rect.mRight, 0); |
533 | 539 | ||
534 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 540 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom); |
535 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 541 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
536 | 542 | ||
537 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 543 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom); |
538 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 544 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
539 | 545 | ||
540 | // draw bottom right | 546 | // draw bottom right |
541 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom); | 547 | gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mBottom); |
542 | gGL.vertex2i(draw_scale_rect.mRight, 0); | 548 | gGL.vertex2i(draw_scale_rect.mRight, 0); |
543 | 549 | ||
544 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); | 550 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); |
545 | gGL.vertex2i(width, 0); | 551 | gGL.vertex2i(width, 0); |
546 | 552 | ||
547 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom); | 553 | gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mBottom); |
548 | gGL.vertex2i(width, draw_scale_rect.mBottom); | 554 | gGL.vertex2i(width, draw_scale_rect.mBottom); |
549 | 555 | ||
550 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 556 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom); |
551 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 557 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
552 | 558 | ||
553 | // draw left | 559 | // draw left |
554 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom); | 560 | gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mBottom); |
555 | gGL.vertex2i(0, draw_scale_rect.mBottom); | 561 | gGL.vertex2i(0, draw_scale_rect.mBottom); |
556 | 562 | ||
557 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 563 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom); |
558 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 564 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
559 | 565 | ||
560 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 566 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop); |
561 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 567 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
562 | 568 | ||
563 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop); | 569 | gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mTop); |
564 | gGL.vertex2i(0, draw_scale_rect.mTop); | 570 | gGL.vertex2i(0, draw_scale_rect.mTop); |
565 | 571 | ||
566 | // draw middle | 572 | // draw middle |
567 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 573 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom); |
568 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 574 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
569 | 575 | ||
570 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 576 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom); |
571 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 577 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
572 | 578 | ||
573 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 579 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop); |
574 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 580 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
575 | 581 | ||
576 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 582 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop); |
577 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 583 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
578 | 584 | ||
579 | // draw right | 585 | // draw right |
580 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 586 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom); |
581 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 587 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
582 | 588 | ||
583 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom); | 589 | gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mBottom); |
584 | gGL.vertex2i(width, draw_scale_rect.mBottom); | 590 | gGL.vertex2i(width, draw_scale_rect.mBottom); |
585 | 591 | ||
586 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop); | 592 | gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mTop); |
587 | gGL.vertex2i(width, draw_scale_rect.mTop); | 593 | gGL.vertex2i(width, draw_scale_rect.mTop); |
588 | 594 | ||
589 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 595 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop); |
590 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 596 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
591 | 597 | ||
592 | // draw top left | 598 | // draw top left |
593 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop); | 599 | gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mTop); |
594 | gGL.vertex2i(0, draw_scale_rect.mTop); | 600 | gGL.vertex2i(0, draw_scale_rect.mTop); |
595 | 601 | ||
596 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 602 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop); |
597 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 603 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
598 | 604 | ||
599 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); | 605 | gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mTop); |
600 | gGL.vertex2i(draw_scale_rect.mLeft, height); | 606 | gGL.vertex2i(draw_scale_rect.mLeft, height); |
601 | 607 | ||
602 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); | 608 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); |
603 | gGL.vertex2i(0, height); | 609 | gGL.vertex2i(0, height); |
604 | 610 | ||
605 | // draw top middle | 611 | // draw top middle |
606 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 612 | gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop); |
607 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 613 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
608 | 614 | ||
609 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 615 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop); |
610 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 616 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
611 | 617 | ||
612 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop); | 618 | gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mTop); |
613 | gGL.vertex2i(draw_scale_rect.mRight, height); | 619 | gGL.vertex2i(draw_scale_rect.mRight, height); |
614 | 620 | ||
615 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); | 621 | gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mTop); |
616 | gGL.vertex2i(draw_scale_rect.mLeft, height); | 622 | gGL.vertex2i(draw_scale_rect.mLeft, height); |
617 | 623 | ||
618 | // draw top right | 624 | // draw top right |
619 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 625 | gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop); |
620 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 626 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
621 | 627 | ||
622 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop); | 628 | gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mTop); |
623 | gGL.vertex2i(width, draw_scale_rect.mTop); | 629 | gGL.vertex2i(width, draw_scale_rect.mTop); |
624 | 630 | ||
625 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); | 631 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); |
626 | gGL.vertex2i(width, height); | 632 | gGL.vertex2i(width, height); |
627 | 633 | ||
628 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop); | 634 | gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mTop); |
629 | gGL.vertex2i(draw_scale_rect.mRight, height); | 635 | gGL.vertex2i(draw_scale_rect.mRight, height); |
630 | } | 636 | } |
631 | gGL.end(); | 637 | gGL.end(); |
@@ -1556,20 +1562,14 @@ void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3 | |||
1556 | gl_segmented_rect_3d_tex(border_scale, border_width, border_height, width_vec, height_vec, ROUNDED_RECT_TOP); | 1562 | gl_segmented_rect_3d_tex(border_scale, border_width, border_height, width_vec, height_vec, ROUNDED_RECT_TOP); |
1557 | } | 1563 | } |
1558 | 1564 | ||
1559 | class LLShowXUINamesListener: public LLSimpleListener | 1565 | bool handleShowXUINamesChanged(const LLSD& newvalue) |
1560 | { | 1566 | { |
1561 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 1567 | LLUI::sShowXUINames = newvalue.asBoolean(); |
1562 | { | 1568 | return true; |
1563 | LLUI::sShowXUINames = (BOOL) event->getValue().asBoolean(); | 1569 | } |
1564 | return true; | ||
1565 | } | ||
1566 | }; | ||
1567 | static LLShowXUINamesListener show_xui_names_listener; | ||
1568 | |||
1569 | 1570 | ||
1570 | void LLUI::initClass(LLControlGroup* config, | 1571 | void LLUI::initClass(LLControlGroup* config, |
1571 | LLControlGroup* colors, | 1572 | LLControlGroup* colors, |
1572 | LLControlGroup* assets, | ||
1573 | LLImageProviderInterface* image_provider, | 1573 | LLImageProviderInterface* image_provider, |
1574 | LLUIAudioCallback audio_callback, | 1574 | LLUIAudioCallback audio_callback, |
1575 | const LLVector2* scale_factor, | 1575 | const LLVector2* scale_factor, |
@@ -1577,7 +1577,6 @@ void LLUI::initClass(LLControlGroup* config, | |||
1577 | { | 1577 | { |
1578 | sConfigGroup = config; | 1578 | sConfigGroup = config; |
1579 | sColorsGroup = colors; | 1579 | sColorsGroup = colors; |
1580 | sAssetsGroup = assets; | ||
1581 | sImageProvider = image_provider; | 1580 | sImageProvider = image_provider; |
1582 | sAudioCallback = audio_callback; | 1581 | sAudioCallback = audio_callback; |
1583 | sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor; | 1582 | sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor; |
@@ -1585,11 +1584,13 @@ void LLUI::initClass(LLControlGroup* config, | |||
1585 | LLFontGL::sShadowColor = colors->getColor("ColorDropShadow"); | 1584 | LLFontGL::sShadowColor = colors->getColor("ColorDropShadow"); |
1586 | 1585 | ||
1587 | LLUI::sShowXUINames = LLUI::sConfigGroup->getBOOL("ShowXUINames"); | 1586 | LLUI::sShowXUINames = LLUI::sConfigGroup->getBOOL("ShowXUINames"); |
1588 | LLUI::sConfigGroup->getControl("ShowXUINames")->addListener(&show_xui_names_listener); | 1587 | LLUI::sConfigGroup->getControl("ShowXUINames")->getSignal()->connect(boost::bind(&handleShowXUINamesChanged, _1)); |
1589 | } | 1588 | } |
1590 | 1589 | ||
1591 | void LLUI::cleanupClass() | 1590 | void LLUI::cleanupClass() |
1592 | { | 1591 | { |
1592 | sImageProvider->cleanUp(); | ||
1593 | LLLineEditor::cleanupClass(); | ||
1593 | } | 1594 | } |
1594 | 1595 | ||
1595 | 1596 | ||
@@ -1732,28 +1733,15 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) | |||
1732 | glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); | 1733 | glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); |
1733 | } | 1734 | } |
1734 | 1735 | ||
1735 | //static | ||
1736 | LLUUID LLUI::findAssetUUIDByName(const LLString &asset_name) | ||
1737 | { | ||
1738 | if(asset_name == LLString::null) return LLUUID::null; | ||
1739 | LLString foundValue = LLUI::sConfigGroup->findString(asset_name); | ||
1740 | if(foundValue==LLString::null) | ||
1741 | { | ||
1742 | foundValue = LLUI::sAssetsGroup->findString(asset_name); | ||
1743 | } | ||
1744 | if(foundValue == LLString::null){ | ||
1745 | return LLUUID::null; | ||
1746 | } | ||
1747 | return LLUUID( foundValue ); | ||
1748 | } | ||
1749 | |||
1750 | //static | 1736 | //static |
1751 | LLUIImage* LLUI::getUIImageByName(const LLString& name) | 1737 | LLUIImage* LLUI::getUIImage(const LLString& name) |
1752 | { | 1738 | { |
1753 | return sImageProvider->getUIImageByID(findAssetUUIDByName(name)); | 1739 | if (!name.empty()) |
1740 | return sImageProvider->getUIImage(name); | ||
1741 | else | ||
1742 | return NULL; | ||
1754 | } | 1743 | } |
1755 | 1744 | ||
1756 | |||
1757 | // static | 1745 | // static |
1758 | void LLUI::setHtmlHelp(LLHtmlHelp* html_help) | 1746 | void LLUI::setHtmlHelp(LLHtmlHelp* html_help) |
1759 | { | 1747 | { |
@@ -1834,7 +1822,8 @@ LLLocalClipRect::LLLocalClipRect(const LLRect &rect, BOOL enabled) | |||
1834 | // LLUIImage | 1822 | // LLUIImage |
1835 | // | 1823 | // |
1836 | 1824 | ||
1837 | LLUIImage::LLUIImage(LLPointer<LLImageGL> image) : | 1825 | LLUIImage::LLUIImage(const LLString& name, LLPointer<LLImageGL> image) : |
1826 | mName(name), | ||
1838 | mImage(image), | 1827 | mImage(image), |
1839 | mScaleRegion(0.f, 1.f, 1.f, 0.f), | 1828 | mScaleRegion(0.f, 1.f, 1.f, 0.f), |
1840 | mClipRegion(0.f, 1.f, 1.f, 0.f), | 1829 | mClipRegion(0.f, 1.f, 1.f, 0.f), |
@@ -1898,24 +1887,32 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c | |||
1898 | mScaleRegion); | 1887 | mScaleRegion); |
1899 | } | 1888 | } |
1900 | 1889 | ||
1901 | void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) const | 1890 | void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const |
1902 | { | 1891 | { |
1903 | gl_draw_scaled_image_with_border( | 1892 | LLRect border_rect; |
1904 | x, y, | 1893 | border_rect.setOriginAndSize(x, y, width, height); |
1905 | getWidth(), getHeight(), | 1894 | border_rect.stretch(border_width, border_width); |
1906 | mImage, | 1895 | drawSolid(border_rect, color); |
1907 | color, | ||
1908 | TRUE, | ||
1909 | mClipRegion, | ||
1910 | mScaleRegion); | ||
1911 | } | 1896 | } |
1912 | 1897 | ||
1913 | S32 LLUIImage::getWidth() const | 1898 | S32 LLUIImage::getWidth() const |
1914 | { | 1899 | { |
1915 | return mImage->getWidth(0); | 1900 | // return clipped dimensions of actual image area |
1901 | return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth()); | ||
1916 | } | 1902 | } |
1917 | 1903 | ||
1918 | S32 LLUIImage::getHeight() const | 1904 | S32 LLUIImage::getHeight() const |
1919 | { | 1905 | { |
1920 | return mImage->getHeight(0); | 1906 | // return clipped dimensions of actual image area |
1907 | return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight()); | ||
1908 | } | ||
1909 | |||
1910 | S32 LLUIImage::getTextureWidth() const | ||
1911 | { | ||
1912 | return mImage->getWidth(0); | ||
1913 | } | ||
1914 | |||
1915 | S32 LLUIImage::getTextureHeight() const | ||
1916 | { | ||
1917 | return mImage->getHeight(0); | ||
1921 | } | 1918 | } |