* get rid of RGBColor usage where it is not needed, this simplified many things,

possibly making them a little faster too
* mess with decorator button size calculation to make the whole layout scale
  more agreeable with the font size (no more fixed offsets/insets), but it
  is work in progress
* DefaultDecorator no longer allocated the border color array, it is part of
  the object now
* small memory footprint optimizations in ViewLayer, Decorator and WindowLayer


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22003 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-08-17 12:56:20 +00:00
parent 5d19a6e65c
commit f7e1df7560
48 changed files with 425 additions and 509 deletions

View File

@ -482,7 +482,7 @@ Decorator::DrawZoom(void)
}
RGBColor
rgb_color
Decorator::UIColor(color_which which)
{
// TODO: for now - calling ui_color() from within the app_server

View File

@ -116,7 +116,7 @@ class Decorator {
virtual void DrawTitle();
virtual void DrawZoom();
RGBColor UIColor(color_which which);
rgb_color UIColor(color_which which);
protected:
int32 _TitleWidth() const
@ -149,11 +149,11 @@ class Decorator {
BRect fBorderRect;
private:
bool fClosePressed;
bool fZoomPressed;
bool fMinimizePressed;
bool fClosePressed : 1;
bool fZoomPressed : 1;
bool fMinimizePressed : 1;
bool fIsFocused;
bool fIsFocused : 1;
BString fTitle;
};

View File

@ -17,7 +17,6 @@
#include "DrawState.h"
#include "FontManager.h"
#include "PatternHandler.h"
#include "RGBColor.h"
#include <WindowPrivate.h>
@ -90,13 +89,12 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
{
DefaultDecorator::SetLook(settings, look);
fFrameColors = new RGBColor[6];
fFrameColors[0].SetColor(152, 152, 152);
fFrameColors[1].SetColor(255, 255, 255);
fFrameColors[2].SetColor(216, 216, 216);
fFrameColors[3].SetColor(136, 136, 136);
fFrameColors[4].SetColor(152, 152, 152);
fFrameColors[5].SetColor(96, 96, 96);
fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[1] = (rgb_color){ 255, 255, 255, 255 };
fFrameColors[2] = (rgb_color){ 216, 216, 216, 255 };
fFrameColors[3] = (rgb_color){ 136, 136, 136, 255 };
fFrameColors[4] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[5] = (rgb_color){ 96, 96, 96, 255 };
// Set appropriate colors based on the current focus value. In this case, each decorator
// defaults to not having the focus.
@ -116,7 +114,6 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
DefaultDecorator::~DefaultDecorator()
{
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
delete [] fFrameColors;
}
@ -605,21 +602,23 @@ DefaultDecorator::_DoLayout()
if (hasTab) {
// distance from one item of the tab bar to another.
// In this case the text and close/zoom rects
fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook)
? 10 : 18;
fTextOffset = (fLook == B_FLOATING_WINDOW_LOOK
|| fLook == kLeftTitledWindowLook) ? 10 : 18;
font_height fontHeight;
fDrawState.Font().GetHeight(fontHeight);
if (fLook != kLeftTitledWindowLook) {
fTabRect.Set(fFrame.left - fBorderWidth,
fFrame.top - fBorderWidth - ceilf(fontHeight.ascent + fontHeight.descent + 7.0),
fFrame.top - fBorderWidth
- ceilf(fontHeight.ascent + fontHeight.descent + 7.0),
((fFrame.right - fFrame.left) < 35.0 ?
fFrame.left + 35.0 : fFrame.right) + fBorderWidth,
fFrame.top - fBorderWidth);
} else {
fTabRect.Set(fFrame.left - fBorderWidth - ceilf(fontHeight.ascent + fontHeight.descent + 5.0),
fFrame.top - fBorderWidth, fFrame.left - fBorderWidth,
fTabRect.Set(fFrame.left - fBorderWidth
- ceilf(fontHeight.ascent + fontHeight.descent + 5.0),
fFrame.top - fBorderWidth, fFrame.left - fBorderWidth,
fFrame.bottom + fBorderWidth);
}
@ -631,10 +630,11 @@ DefaultDecorator::_DoLayout()
float offset;
float size;
_GetButtonSizeAndOffset(fTabRect, &offset, &size);
float inset;
_GetButtonSizeAndOffset(fTabRect, &offset, &size, &inset);
// fMinTabSize contains just the room for the buttons
fMinTabSize = 4.0 + fTextOffset;
fMinTabSize = inset * 2 + fTextOffset;
if ((fFlags & B_NOT_CLOSABLE) == 0)
fMinTabSize += offset + size;
if ((fFlags & B_NOT_ZOOMABLE) == 0)
@ -701,8 +701,10 @@ DefaultDecorator::_DoLayout()
if (fTabOffset < 0)
fTabOffset = 0;
if (fTabLocation != 0.0
&& fTabOffset > (fRightBorder.right - fLeftBorder.left - fTabRect.Width()))
fTabOffset = uint32(fRightBorder.right - fLeftBorder.left - fTabRect.Width());
&& fTabOffset > (fRightBorder.right - fLeftBorder.left
- fTabRect.Width()))
fTabOffset = uint32(fRightBorder.right - fLeftBorder.left
- fTabRect.Width());
fTabRect.OffsetBy(fTabOffset, 0);
// finally, layout the buttons and text within the tab rect
@ -737,38 +739,38 @@ DefaultDecorator::_DrawFrame(BRect invalid)
if (invalid.Intersects(fTopBorder)) {
for (int8 i = 0; i < 5; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
BPoint(r.right - i, r.top + i),
fFrameColors[i]);
BPoint(r.right - i, r.top + i), fFrameColors[i]);
}
if (fTabRect.IsValid()) {
// grey along the bottom of the tab (overwrites "white" from frame)
fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 2, fTabRect.bottom + 1),
BPoint(fTabRect.right - 2, fTabRect.bottom + 1),
fFrameColors[2]);
// grey along the bottom of the tab
// (overwrites "white" from frame)
fDrawingEngine->StrokeLine(
BPoint(fTabRect.left + 2, fTabRect.bottom + 1),
BPoint(fTabRect.right - 2, fTabRect.bottom + 1),
fFrameColors[2]);
}
}
// left
if (invalid.Intersects(fLeftBorder.InsetByCopy(0, -fBorderWidth))) {
for (int8 i = 0; i < 5; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
BPoint(r.left + i, r.bottom - i),
fFrameColors[i]);
BPoint(r.left + i, r.bottom - i), fFrameColors[i]);
}
}
// bottom
if (invalid.Intersects(fBottomBorder)) {
for (int8 i = 0; i < 5; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.bottom - i),
BPoint(r.right - i, r.bottom - i),
fFrameColors[(4 - i) == 4 ? 5 : (4 - i)]);
BPoint(r.right - i, r.bottom - i),
fFrameColors[(4 - i) == 4 ? 5 : (4 - i)]);
}
}
// right
if (invalid.Intersects(fRightBorder.InsetByCopy(0, -fBorderWidth))) {
for (int8 i = 0; i < 5; i++) {
fDrawingEngine->StrokeLine(BPoint(r.right - i, r.top + i),
BPoint(r.right - i, r.bottom - i),
fFrameColors[(4 - i) == 4 ? 5 : (4 - i)]);
BPoint(r.right - i, r.bottom - i),
fFrameColors[(4 - i) == 4 ? 5 : (4 - i)]);
}
}
break;
@ -781,44 +783,46 @@ DefaultDecorator::_DrawFrame(BRect invalid)
if (invalid.Intersects(fTopBorder)) {
for (int8 i = 0; i < 3; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
BPoint(r.right - i, r.top + i),
fFrameColors[i * 2]);
BPoint(r.right - i, r.top + i), fFrameColors[i * 2]);
}
if (fTabRect.IsValid() && fLook != kLeftTitledWindowLook) {
// grey along the bottom of the tab (overwrites "white" from frame)
fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 2, fTabRect.bottom + 1),
BPoint(fTabRect.right - 2, fTabRect.bottom + 1),
fFrameColors[2]);
// grey along the bottom of the tab
// (overwrites "white" from frame)
fDrawingEngine->StrokeLine(
BPoint(fTabRect.left + 2, fTabRect.bottom + 1),
BPoint(fTabRect.right - 2, fTabRect.bottom + 1),
fFrameColors[2]);
}
}
// left
if (invalid.Intersects(fLeftBorder.InsetByCopy(0, -fBorderWidth))) {
for (int8 i = 0; i < 3; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
BPoint(r.left + i, r.bottom - i),
fFrameColors[i * 2]);
BPoint(r.left + i, r.bottom - i), fFrameColors[i * 2]);
}
if (fLook == kLeftTitledWindowLook && fTabRect.IsValid()) {
// grey along the right side of the tab (overwrites "white" from frame)
fDrawingEngine->StrokeLine(BPoint(fTabRect.right + 1, fTabRect.top + 2),
BPoint(fTabRect.right + 1, fTabRect.bottom - 2),
fFrameColors[2]);
// grey along the right side of the tab
// (overwrites "white" from frame)
fDrawingEngine->StrokeLine(
BPoint(fTabRect.right + 1, fTabRect.top + 2),
BPoint(fTabRect.right + 1, fTabRect.bottom - 2),
fFrameColors[2]);
}
}
// bottom
if (invalid.Intersects(fBottomBorder)) {
for (int8 i = 0; i < 3; i++) {
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.bottom - i),
BPoint(r.right - i, r.bottom - i),
fFrameColors[(2 - i) == 2 ? 5 : (2 - i) * 2]);
BPoint(r.right - i, r.bottom - i),
fFrameColors[(2 - i) == 2 ? 5 : (2 - i) * 2]);
}
}
// right
if (invalid.Intersects(fRightBorder.InsetByCopy(0, -fBorderWidth))) {
for (int8 i = 0; i < 3; i++) {
fDrawingEngine->StrokeLine(BPoint(r.right - i, r.top + i),
BPoint(r.right - i, r.bottom - i),
fFrameColors[(2 - i) == 2 ? 5 : (2 - i) * 2]);
BPoint(r.right - i, r.bottom - i),
fFrameColors[(2 - i) == 2 ? 5 : (2 - i) * 2]);
}
}
break;
@ -846,23 +850,24 @@ DefaultDecorator::_DrawFrame(BRect invalid)
float x = r.right - 3;
float y = r.bottom - 3;
fDrawingEngine->FillRect(BRect(x - 13, y - 13, x, y), fFrameColors[2]);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15), BPoint(x - 15, y - 2),
fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14), BPoint(x - 14, y - 1),
fFrameColors[1]);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15), BPoint(x - 2, y - 15),
fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14), BPoint(x - 1, y - 14),
fFrameColors[1]);
fDrawingEngine->FillRect(BRect(x - 13, y - 13, x, y),
fFrameColors[2]);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
BPoint(x - 15, y - 2), fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14),
BPoint(x - 14, y - 1), fFrameColors[1]);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
BPoint(x - 2, y - 15), fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14),
BPoint(x - 1, y - 14), fFrameColors[1]);
if (!IsFocus())
break;
for (int8 i = 1; i <= 4; i++) {
for (int8 j = 1; j <= i; j++) {
BPoint pt1(x - (3 * j) + 1, y - (3 * (5 - i)) + 1);
BPoint pt2(x - (3 * j) + 2, y - (3 * (5 - i)) + 2);
BPoint pt1(x - (3 * j) + 1, y - (3 * (5 - i)) + 1);
BPoint pt2(x - (3 * j) + 2, y - (3 * (5 - i)) + 2);
fDrawingEngine->StrokePoint(pt1, fFrameColors[0]);
fDrawingEngine->StrokePoint(pt2, fFrameColors[1]);
}
@ -876,16 +881,18 @@ DefaultDecorator::_DrawFrame(BRect invalid)
case kLeftTitledWindowLook:
{
if (!invalid.Intersects(BRect(fRightBorder.right - 22,
fBottomBorder.bottom - 22, fRightBorder.right - 1,
fBottomBorder.bottom - 1)))
fBottomBorder.bottom - 22, fRightBorder.right - 1,
fBottomBorder.bottom - 1)))
break;
fDrawingEngine->StrokeLine(BPoint(fRightBorder.left, fBottomBorder.bottom - 22),
BPoint(fRightBorder.right - 1, fBottomBorder.bottom - 22),
fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(fRightBorder.right - 22, fBottomBorder.top),
BPoint(fRightBorder.right - 22, fBottomBorder.bottom - 1),
fFrameColors[0]);
fDrawingEngine->StrokeLine(
BPoint(fRightBorder.left, fBottomBorder.bottom - 22),
BPoint(fRightBorder.right - 1, fBottomBorder.bottom - 22),
fFrameColors[0]);
fDrawingEngine->StrokeLine(
BPoint(fRightBorder.right - 22, fBottomBorder.top),
BPoint(fRightBorder.right - 22, fBottomBorder.bottom - 1),
fFrameColors[0]);
break;
}
@ -908,26 +915,34 @@ DefaultDecorator::_DrawTab(BRect invalid)
return;
// outer frame
fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.LeftBottom(), fFrameColors[0]);
fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.RightTop(), fFrameColors[0]);
if (fLook != kLeftTitledWindowLook)
fDrawingEngine->StrokeLine(fTabRect.RightTop(),fTabRect.RightBottom(), fFrameColors[5]);
else
fDrawingEngine->StrokeLine(fTabRect.LeftBottom(),fTabRect.RightBottom(), fFrameColors[5]);
fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.LeftBottom(),
fFrameColors[0]);
fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.RightTop(),
fFrameColors[0]);
if (fLook != kLeftTitledWindowLook) {
fDrawingEngine->StrokeLine(fTabRect.RightTop(), fTabRect.RightBottom(),
fFrameColors[5]);
} else {
fDrawingEngine->StrokeLine(fTabRect.LeftBottom(),
fTabRect.RightBottom(), fFrameColors[5]);
}
// bevel
fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1),
BPoint(fTabRect.left + 1, fTabRect.bottom - (fLook == kLeftTitledWindowLook ? 1 : 0)),
BPoint(fTabRect.left + 1,
fTabRect.bottom - (fLook == kLeftTitledWindowLook ? 1 : 0)),
fTabColorLight);
fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1),
BPoint(fTabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1), fTabRect.top + 1),
BPoint(fTabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1),
fTabRect.top + 1),
fTabColorLight);
if (fLook != kLeftTitledWindowLook) {
fDrawingEngine->StrokeLine(BPoint(fTabRect.right - 1, fTabRect.top + 2),
BPoint(fTabRect.right - 1, fTabRect.bottom), fTabColorShadow);
} else {
fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 2, fTabRect.bottom - 1),
fDrawingEngine->StrokeLine(
BPoint(fTabRect.left + 2, fTabRect.bottom - 1),
BPoint(fTabRect.right, fTabRect.bottom - 1), fTabColorShadow);
}
@ -964,8 +979,8 @@ DefaultDecorator::_DrawTitle(BRect r)
{
STRACE(("_DrawTitle(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom));
fDrawingEngine->SetHighColor(fTextColor.GetColor32());
fDrawingEngine->SetLowColor(fTabColor.GetColor32());
fDrawingEngine->SetHighColor(fTextColor);
fDrawingEngine->SetLowColor(fTabColor);
fDrawingEngine->SetFont(fDrawState.Font());
// figure out position of text
@ -976,11 +991,13 @@ DefaultDecorator::_DrawTitle(BRect r)
if (fLook != kLeftTitledWindowLook) {
titlePos.x = fCloseRect.IsValid() ? fCloseRect.right + fTextOffset
: fTabRect.left + fTextOffset;
titlePos.y = floorf(((fTabRect.top + 2.0) + fTabRect.bottom + fontHeight.ascent
+ fontHeight.descent) / 2.0 - fontHeight.descent + 0.5);
titlePos.y = floorf(((fTabRect.top + 2.0) + fTabRect.bottom
+ fontHeight.ascent + fontHeight.descent) / 2.0
- fontHeight.descent + 0.5);
} else {
titlePos.x = floorf(((fTabRect.left + 2.0) + fTabRect.right + fontHeight.ascent
+ fontHeight.descent) / 2.0 - fontHeight.descent + 0.5);
titlePos.x = floorf(((fTabRect.left + 2.0) + fTabRect.right
+ fontHeight.ascent + fontHeight.descent) / 2.0
- fontHeight.descent + 0.5);
titlePos.y = fZoomRect.IsValid() ? fZoomRect.top - fTextOffset
: fTabRect.bottom - fTextOffset;
}
@ -1015,37 +1032,30 @@ DefaultDecorator::_SetFocus()
// SetFocus() performs necessary duties for color swapping and
// other things when a window is deactivated or activated.
if (IsFocus() || ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook)
&& (fFlags & B_AVOID_FOCUS) != 0)) {
if (IsFocus()
|| ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook)
&& (fFlags & B_AVOID_FOCUS) != 0)) {
fTabColor = UIColor(B_WINDOW_TAB_COLOR);
fTextColor = UIColor(B_WINDOW_TEXT_COLOR);
fButtonHighColor.SetColor(tint_color(fTabColor.GetColor32(), B_LIGHTEN_2_TINT));
fButtonLowColor.SetColor(tint_color(fTabColor.GetColor32(), B_DARKEN_1_TINT));
fButtonHighColor = tint_color(fTabColor, B_LIGHTEN_2_TINT);
fButtonLowColor = tint_color(fTabColor, B_DARKEN_1_TINT);
// fFrameColors[0].SetColor(152, 152, 152);
// fFrameColors[1].SetColor(255, 255, 255);
fFrameColors[2].SetColor(216, 216, 216);
fFrameColors[3].SetColor(136, 136, 136);
// fFrameColors[4].SetColor(152, 152, 152);
// fFrameColors[5].SetColor(96, 96, 96);
fFrameColors[2] = (rgb_color){ 216, 216, 216, 255 };
fFrameColors[3] = (rgb_color){ 136, 136, 136, 255 };
} else {
fTabColor = UIColor(B_WINDOW_INACTIVE_TAB_COLOR);
fTextColor = UIColor(B_WINDOW_INACTIVE_TEXT_COLOR);
fButtonHighColor.SetColor(tint_color(fTabColor.GetColor32(), B_LIGHTEN_2_TINT));
fButtonLowColor.SetColor(tint_color(fTabColor.GetColor32(), B_DARKEN_1_TINT));
fButtonHighColor = tint_color(fTabColor, B_LIGHTEN_2_TINT);
fButtonLowColor = tint_color(fTabColor, B_DARKEN_1_TINT);
// fFrameColors[0].SetColor(152, 152, 152);
// fFrameColors[1].SetColor(255, 255, 255);
fFrameColors[2].SetColor(232, 232, 232);
fFrameColors[3].SetColor(148, 148, 148);
// fFrameColors[4].SetColor(152, 152, 152);
// fFrameColors[5].SetColor(96, 96, 96);
fFrameColors[2] = (rgb_color){ 232, 232, 232, 255 };
fFrameColors[3] = (rgb_color){ 148, 148, 148, 255 };
}
fTabColorLight = RGBColor(tint_color(fTabColor.GetColor32(),
(B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2));
fTabColorShadow = RGBColor(tint_color(fTabColor.GetColor32(),
B_DARKEN_2_TINT));
fTabColorLight = tint_color(fTabColor,
(B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2);
fTabColorShadow = tint_color(fTabColor,
B_DARKEN_2_TINT);
}
// _SetColors
@ -1067,18 +1077,18 @@ DefaultDecorator::_DrawBlendedRect(BRect r, bool down)
int32 w = r.IntegerWidth();
int32 h = r.IntegerHeight();
RGBColor temprgbcol;
rgb_color tempColor;
rgb_color halfColor, startColor, endColor;
float rstep, gstep, bstep;
int steps = w < h ? w : h;
if (down) {
startColor = fButtonLowColor.GetColor32();
endColor = fButtonHighColor.GetColor32();
startColor = fButtonLowColor;
endColor = fButtonHighColor;
} else {
startColor = fButtonHighColor.GetColor32();
endColor = fButtonLowColor.GetColor32();
startColor = fButtonHighColor;
endColor = fButtonLowColor;
}
halfColor = make_blend_color(startColor, endColor, 0.5);
@ -1088,19 +1098,19 @@ DefaultDecorator::_DrawBlendedRect(BRect r, bool down)
bstep = float(startColor.blue - halfColor.blue) / steps;
for (int32 i = 0; i <= steps; i++) {
temprgbcol.SetColor(uint8(startColor.red - (i * rstep)),
uint8(startColor.green - (i * gstep)),
uint8(startColor.blue - (i * bstep)));
tempColor.red = uint8(startColor.red - (i * rstep));
tempColor.green = uint8(startColor.green - (i * gstep));
tempColor.blue = uint8(startColor.blue - (i * bstep));
fDrawingEngine->StrokeLine(BPoint(r.left, r.top + i),
BPoint(r.left + i, r.top), temprgbcol);
BPoint(r.left + i, r.top), tempColor);
temprgbcol.SetColor(uint8(halfColor.red - (i * rstep)),
uint8(halfColor.green - (i * gstep)),
uint8(halfColor.blue - (i * bstep)));
tempColor.red = uint8(halfColor.red - (i * rstep));
tempColor.green = uint8(halfColor.green - (i * gstep));
tempColor.blue = uint8(halfColor.blue - (i * bstep));
fDrawingEngine->StrokeLine(BPoint(r.left + steps, r.top + i),
BPoint(r.left + i, r.top + steps), temprgbcol);
BPoint(r.left + i, r.top + steps), tempColor);
}
fDrawingEngine->StrokeRect(r, fFrameColors[3]);
}
@ -1108,16 +1118,23 @@ DefaultDecorator::_DrawBlendedRect(BRect r, bool down)
// _GetButtonSizeAndOffset
void
DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
float* _size) const
float* _size, float* _inset) const
{
*_offset = fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook ? 4.0 : 5.0;
float tabSize = fLook == kLeftTitledWindowLook ?
tabRect.Width() : tabRect.Height();
bool smallTab = fLook == B_FLOATING_WINDOW_LOOK
|| fLook == kLeftTitledWindowLook;
*_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.5)
: floorf(fDrawState.Font().Size() / 2.0);
*_inset = smallTab ? floorf(fDrawState.Font().Size() / 5.0)
: floorf(fDrawState.Font().Size() / 6.0);
printf("");
// "+ 2" so that the rects are centered within the solid area
// (without the 2 pixels for the top border)
if (fLook != kLeftTitledWindowLook)
*_size = tabRect.Height() - 2.0 * *_offset + 2.0f;
else
*_size = tabRect.Width() - 2.0 * *_offset + 2.0f;
*_size = tabSize - *_inset * *_offset + *_inset;
}
// _LayoutTabItems
@ -1126,7 +1143,8 @@ DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
{
float offset;
float size;
_GetButtonSizeAndOffset(tabRect, &offset, &size);
float inset;
_GetButtonSizeAndOffset(tabRect, &offset, &size, &inset);
// calulate close rect based on the tab rectangle
if (fLook != kLeftTitledWindowLook) {
@ -1160,9 +1178,9 @@ DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
// truncated for no apparent reason - OTOH the title does
// also not appear perfectly in the middle
if (fLook != kLeftTitledWindowLook)
size = (fZoomRect.left - fCloseRect.right) - fTextOffset * 2 + 2;
size = (fZoomRect.left - fCloseRect.right) - fTextOffset * 2 + inset;
else
size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + 2;
size = (fZoomRect.top - fCloseRect.bottom) - fTextOffset * 2 + inset;
fTruncatedTitle = Title();
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END, size);

View File

@ -19,43 +19,40 @@ class Desktop;
class DefaultDecorator: public Decorator {
public:
DefaultDecorator(DesktopSettings& settings,
BRect frame,
window_look look,
uint32 flags);
BRect frame, window_look look,
uint32 flags);
virtual ~DefaultDecorator();
virtual void SetTitle(const char* string,
BRegion* updateRegion = NULL);
BRegion* updateRegion = NULL);
virtual void SetLook(DesktopSettings& settings,
window_look look,
BRegion* updateRegion = NULL);
window_look look,
BRegion* updateRegion = NULL);
virtual void SetFlags(uint32 flags,
BRegion* updateRegion = NULL);
BRegion* updateRegion = NULL);
virtual void MoveBy(BPoint offset);
virtual void ResizeBy(BPoint offset, BRegion* dirty);
virtual bool SetTabLocation(float location,
BRegion* updateRegion = NULL);
BRegion* updateRegion = NULL);
virtual float TabLocation() const
{ return (float)fTabOffset; }
virtual bool SetSettings(const BMessage& settings,
BRegion* updateRegion = NULL);
BRegion* updateRegion = NULL);
virtual bool GetSettings(BMessage* settings) const;
virtual void Draw(BRect updateRect);
virtual void Draw();
virtual void GetSizeLimits(int32* minWidth,
int32* minHeight,
int32* maxWidth,
int32* maxHeight) const;
virtual void GetSizeLimits(int32* minWidth, int32* minHeight,
int32* maxWidth, int32* maxHeight) const;
virtual void GetFootprint(BRegion* region);
virtual click_type Clicked(BPoint pt, int32 buttons,
int32 modifiers);
int32 modifiers);
protected:
virtual void _DoLayout();
@ -73,18 +70,18 @@ class DefaultDecorator: public Decorator {
private:
void _DrawBlendedRect(BRect r, bool down);
void _GetButtonSizeAndOffset(const BRect& tabRect,
float* offset,
float*size) const;
float* offset, float* size,
float* inset) const;
void _LayoutTabItems(const BRect& tabRect);
RGBColor fButtonHighColor;
RGBColor fButtonLowColor;
RGBColor fTextColor;
RGBColor fTabColor;
RGBColor fTabColorLight;
RGBColor fTabColorShadow;
rgb_color fButtonHighColor;
rgb_color fButtonLowColor;
rgb_color fTextColor;
rgb_color fTabColor;
rgb_color fTabColorLight;
rgb_color fTabColorShadow;
RGBColor* fFrameColors;
rgb_color fFrameColors[6];
// Individual rects for handling window frame
// rendering the proper way

View File

@ -799,7 +799,7 @@ void
Desktop::_SetWorkspace(int32 index)
{
int32 previousIndex = fCurrentWorkspace;
RGBColor previousColor = fWorkspaces[fCurrentWorkspace].Color();
rgb_color previousColor = fWorkspaces[fCurrentWorkspace].Color();
bool movedMouseEventWindow = false;
if (fMouseEventWindow != NULL) {

View File

@ -27,8 +27,8 @@ DrawState::DrawState()
: fOrigin(0.0, 0.0),
fScale(1.0),
fClippingRegion(NULL),
fHighColor(0, 0, 0, 255),
fLowColor(255, 255, 255, 255),
fHighColor((rgb_color){ 0, 0, 0, 255 }),
fLowColor((rgb_color){ 255, 255, 255, 255 }),
fPattern(kSolidHigh),
fDrawingMode(B_OP_COPY),
fAlphaSrcMode(B_PIXEL_ALPHA),
@ -253,8 +253,8 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const
// Attach view state
link.Attach<BPoint>(fPenLocation);
link.Attach<float>(fPenSize);
link.Attach<rgb_color>(fHighColor.GetColor32());
link.Attach<rgb_color>(fLowColor.GetColor32());
link.Attach<rgb_color>(fHighColor);
link.Attach<rgb_color>(fLowColor);
link.Attach<uint64>(fPattern.GetInt64());
link.Attach<BPoint>(fOrigin);
link.Attach<uint8>((uint8)fDrawingMode);
@ -434,14 +434,14 @@ DrawState::SetClippingRegion(const BRegion* region)
void
DrawState::SetHighColor(const RGBColor& color)
DrawState::SetHighColor(const rgb_color& color)
{
fHighColor = color;
}
void
DrawState::SetLowColor(const RGBColor& color)
DrawState::SetLowColor(const rgb_color& color)
{
fLowColor = color;
}
@ -606,8 +606,10 @@ DrawState::PrintToStream() const
printf("\t Pen Location and Size: (%.1f, %.1f) - %.2f (%.2f)\n",
fPenLocation.x, fPenLocation.y, PenSize(), fPenSize);
printf("\t HighColor: "); fHighColor.PrintToStream();
printf("\t LowColor: "); fLowColor.PrintToStream();
printf("\t HighColor: r=%d g=%d b=%d a=%d\n",
fHighColor.red, fHighColor.green, fHighColor.blue, fHighColor.alpha);
printf("\t LowColor: r=%d g=%d b=%d a=%d\n",
fLowColor.red, fLowColor.green, fLowColor.blue, fLowColor.alpha);
printf("\t Pattern: %llu\n", fPattern.GetInt64());
printf("\t DrawMode: %lu\n", (uint32)fDrawingMode);

View File

@ -17,7 +17,6 @@
#include <Point.h>
#include <View.h> // for B_FONT_ALL
#include "RGBColor.h"
#include "FontManager.h"
#include "ServerFont.h"
#include "PatternHandler.h"
@ -78,12 +77,12 @@ class DrawState {
inline BRect ClippingRectAt(int32 index) const;*/
// color
void SetHighColor(const RGBColor& color);
const RGBColor& HighColor() const
void SetHighColor(const rgb_color& color);
const rgb_color& HighColor() const
{ return fHighColor; }
void SetLowColor(const RGBColor& color);
const RGBColor& LowColor() const
void SetLowColor(const rgb_color& color);
const rgb_color& LowColor() const
{ return fLowColor; }
void SetPattern(const Pattern& pattern);
@ -147,8 +146,8 @@ class DrawState {
BRegion* fClippingRegion;
RGBColor fHighColor;
RGBColor fLowColor;
rgb_color fHighColor;
rgb_color fLowColor;
Pattern fPattern;
drawing_mode fDrawingMode;

View File

@ -2231,7 +2231,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
index = fDesktop->CurrentWorkspace();
Workspace workspace(*fDesktop, index);
fLink.Attach<rgb_color>(workspace.Color().GetColor32());
fLink.Attach<rgb_color>(workspace.Color());
fDesktop->Unlock();
fLink.Flush();

View File

@ -10,8 +10,6 @@
#define SERVER_BITMAP_H
#include "RGBColor.h"
#include <GraphicsDefs.h>
#include <Rect.h>
#include <OS.h>

View File

@ -548,7 +548,7 @@ set_pen_size(ViewLayer *view, float size)
static void
set_fore_color(ViewLayer *view, rgb_color color)
{
view->CurrentState()->SetHighColor(RGBColor(color));
view->CurrentState()->SetHighColor(color);
view->Window()->GetDrawingEngine()->SetHighColor(color);
}
@ -556,7 +556,7 @@ set_fore_color(ViewLayer *view, rgb_color color)
static void
set_back_color(ViewLayer *view, rgb_color color)
{
view->CurrentState()->SetLowColor(RGBColor(color));
view->CurrentState()->SetLowColor(color);
view->Window()->GetDrawingEngine()->SetLowColor(color);
}
@ -823,8 +823,8 @@ ServerPicture::SyncState(ViewLayer *view)
//WriteSetPattern(*view->CurrentState()->GetPattern().GetInt8());
WriteSetDrawingMode(view->CurrentState()->GetDrawingMode());
WriteSetHighColor(view->CurrentState()->HighColor().GetColor32());
WriteSetLowColor(view->CurrentState()->LowColor().GetColor32());
WriteSetHighColor(view->CurrentState()->HighColor());
WriteSetLowColor(view->CurrentState()->LowColor());
ExitStateChange();
}

View File

@ -1586,7 +1586,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
link.Read(&c, sizeof(rgb_color));
fCurrentLayer->SetViewColor(RGBColor(c));
fCurrentLayer->SetViewColor(c);
break;
}
@ -1595,7 +1595,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
Title(), fCurrentLayer->Name()));
fLink.StartMessage(B_OK);
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->HighColor().GetColor32());
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->HighColor());
fLink.Flush();
break;
@ -1604,7 +1604,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
Title(), fCurrentLayer->Name()));
fLink.StartMessage(B_OK);
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->LowColor().GetColor32());
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->LowColor());
fLink.Flush();
break;
@ -1613,7 +1613,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
Title(), fCurrentLayer->Name()));
fLink.StartMessage(B_OK);
fLink.Attach<rgb_color>(fCurrentLayer->ViewColor().GetColor32());
fLink.Attach<rgb_color>(fCurrentLayer->ViewColor());
fLink.Flush();
break;
@ -1699,7 +1699,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
if (bitmap != NULL && bitmap->Overlay() != NULL) {
bitmap->Overlay()->SetFlags(options);
colorKey = bitmap->Overlay()->Color().GetColor32();
colorKey = bitmap->Overlay()->Color();
}
} else
status = B_BAD_VALUE;
@ -1849,7 +1849,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
rgb_color c;
link.Read(&c, sizeof(rgb_color));
fCurrentLayer->CurrentState()->SetHighColor(RGBColor(c));
fCurrentLayer->CurrentState()->SetHighColor(c);
fWindowLayer->GetDrawingEngine()->SetHighColor(c);
break;
}
@ -1860,7 +1860,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
rgb_color c;
link.Read(&c, sizeof(rgb_color));
fCurrentLayer->CurrentState()->SetLowColor(RGBColor(c));
fCurrentLayer->CurrentState()->SetLowColor(c);
fWindowLayer->GetDrawingEngine()->SetLowColor(c);
break;
}

View File

@ -80,7 +80,7 @@ ViewLayer::ViewLayer(IntRect frame, IntPoint scrollingOffset, const char* name,
fFrame(frame),
fScrollingOffset(scrollingOffset),
fViewColor(RGBColor(255, 255, 255)),
fViewColor((rgb_color){ 255, 255, 255, 255 }),
fDrawState(new (nothrow) DrawState),
fViewBitmap(NULL),
@ -1175,7 +1175,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
return;
}
if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) {
if (fViewBitmap != NULL || fViewColor != B_TRANSPARENT_COLOR) {
// we can only draw within our own area
BRegion* redraw = fWindow->GetRegion(ScreenClipping(windowContentClipping));
if (!redraw)
@ -1265,7 +1265,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
}
if (!fViewColor.IsTransparentMagic()) {
if (fViewColor != B_TRANSPARENT_COLOR) {
// fill visible region with view color,
// this version of FillRegion ignores any
// clipping, that's why "redraw" needs to

View File

@ -13,7 +13,6 @@
#define VIEW_LAYER_H
#include "RGBColor.h"
#include "IntRect.h"
#include <GraphicsDefs.h>
@ -157,10 +156,8 @@ class ViewLayer {
const BRegion& LocalClipping() const { return fLocalClipping; }
const RGBColor& ViewColor() const
const rgb_color& ViewColor() const
{ return fViewColor; }
void SetViewColor(const RGBColor& color)
{ fViewColor = color; }
void SetViewColor(const rgb_color& color)
{ fViewColor = color; }
@ -246,7 +243,7 @@ class ViewLayer {
// scrolling offset
IntPoint fScrollingOffset;
RGBColor fViewColor;
rgb_color fViewColor;
DrawState* fDrawState;
ServerBitmap* fViewBitmap;
IntRect fBitmapSource;
@ -256,10 +253,10 @@ class ViewLayer {
uint32 fResizeMode;
uint32 fFlags;
bool fHidden;
bool fVisible;
bool fBackgroundDirty;
bool fIsDesktopBackground;
bool fHidden : 1;
bool fVisible : 1;
bool fBackgroundDirty : 1;
bool fIsDesktopBackground : 1;
uint32 fEventMask;
uint32 fEventOptions;

View File

@ -374,7 +374,7 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
if (fDecorator) {
fDecorator->ResizeBy(x, y, dirtyRegion);
//if (dirtyRegion) {
//fDrawingEngine->FillRegion(*dirtyRegion, RGBColor(255, 255, 0, 255));
//fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 255, 255, 0, 255 });
//snooze(40000);
//}
}
@ -385,7 +385,7 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
}
//if (dirtyRegion)
//fDrawingEngine->FillRegion(*dirtyRegion, RGBColor(0, 255, 255, 255));
//fDrawingEngine->FillRegion(*dirtyRegion, (rgb_color){ 0, 255, 255, 255 });
// send a message to the client informing about the changed size
BRect frame(Frame());
@ -412,7 +412,7 @@ WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy)
view->ScrollBy(dx, dy, dirty);
//fDrawingEngine->FillRegion(dirty, RGBColor(255, 0, 255, 255));
//fDrawingEngine->FillRegion(dirty, rgb_color{ 255, 0, 255, 255 });
//snooze(2000);
if (IsVisible() && view->IsVisible()) {
@ -715,7 +715,7 @@ WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion)
if (layerRegion.CountRects() > 0) {
layerRegion.IntersectWith(&layer->ScreenClipping(&fContentRegion));
//fDrawingEngine->FillRegion(layerRegion, RGBColor(0, 255, 0, 255));
//fDrawingEngine->FillRegion(layerRegion, rgb_color{ 0, 255, 0, 255 });
//snooze(10000);
fDirtyCause |= UPDATE_REQUEST;
_TriggerContentRedraw(layerRegion);
@ -1817,7 +1817,7 @@ WindowLayer::_TransferToUpdateSession(BRegion* contentDirtyRegion)
if (contentDirtyRegion->CountRects() <= 0)
return;
//fDrawingEngine->FillRegion(*contentDirtyRegion, RGBColor(sPendingColor));
//fDrawingEngine->FillRegion(*contentDirtyRegion, sPendingColor);
//snooze(10000);
// add to pending
@ -1910,7 +1910,7 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link)
//sPendingColor.red = rand() % 255;
//sPendingColor.green = rand() % 255;
//sPendingColor.blue = rand() % 255;
//fDrawingEngine->FillRegion(*dirty, RGBColor(sCurrentColor));
//fDrawingEngine->FillRegion(*dirty, sCurrentColor);
//snooze(10000);
link.StartMessage(B_OK);
@ -1929,7 +1929,7 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link)
link.Flush();
if (!fCurrentUpdateSession.IsExpose() && fDrawingEngine->LockParallelAccess()) {
//fDrawingEngine->FillRegion(dirty, RGBColor(255, 0, 0, 255));
//fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 });
fDrawingEngine->SuspendAutoSync();
fTopLayer->Draw(fDrawingEngine, dirty,

View File

@ -333,12 +333,12 @@ class WindowLayer {
UpdateSession fPendingUpdateSession;
// these two flags are supposed to ensure a sane
// and consistent update session
bool fUpdateRequested;
bool fInUpdate;
bool fUpdateRequested : 1;
bool fInUpdate : 1;
bool fHidden;
bool fMinimized;
bool fIsFocus;
bool fHidden : 1;
bool fMinimized : 1;
bool fIsFocus : 1;
window_look fLook;
window_feel fFeel;

View File

@ -17,7 +17,7 @@
#include <stdlib.h>
static RGBColor kDefaultColor = RGBColor(51, 102, 152);
static rgb_color kDefaultColor = (rgb_color){ 51, 102, 152, 255 };
Workspace::Private::Private()
@ -38,7 +38,7 @@ Workspace::Private::SetDisplaysFromDesktop(Desktop* desktop)
void
Workspace::Private::SetColor(const RGBColor& color)
Workspace::Private::SetColor(const rgb_color& color)
{
fColor = color;
}
@ -49,7 +49,7 @@ Workspace::Private::RestoreConfiguration(const BMessage& settings)
{
rgb_color color;
if (settings.FindInt32("color", (int32 *)&color) == B_OK)
fColor.SetColor(color);
fColor = color;
}
@ -59,16 +59,15 @@ Workspace::Private::RestoreConfiguration(const BMessage& settings)
void
Workspace::Private::StoreConfiguration(BMessage& settings)
{
rgb_color color = fColor.GetColor32();
settings.RemoveName("color");
settings.AddInt32("color", *(int32 *)&color);
settings.AddInt32("color", *(int32 *)&fColor);
}
void
Workspace::Private::_SetDefaults()
{
fColor.SetColor(kDefaultColor);
fColor = kDefaultColor;
}
@ -96,7 +95,7 @@ Workspace::~Workspace()
}
const RGBColor&
const rgb_color&
Workspace::Color() const
{
return fWorkspace.Color();
@ -104,7 +103,7 @@ Workspace::Color() const
void
Workspace::SetColor(const RGBColor& color, bool makeDefault)
Workspace::SetColor(const rgb_color& color, bool makeDefault)
{
if (color == Color())
return;

View File

@ -9,11 +9,10 @@
#define WORKSPACE_H
#include <SupportDefs.h>
#include <InterfaceDefs.h>
class Desktop;
class RGBColor;
class WindowLayer;
@ -22,8 +21,8 @@ class Workspace {
Workspace(Desktop& desktop, int32 index);
~Workspace();
const RGBColor& Color() const;
void SetColor(const RGBColor& color, bool makeDefault);
const rgb_color& Color() const;
void SetColor(const rgb_color& color, bool makeDefault);
bool IsCurrent() const
{ return fCurrentWorkspace; }

View File

@ -9,7 +9,6 @@
#define WORKSPACE_PRIVATE_H
#include "RGBColor.h"
#include "WindowList.h"
#include "Workspace.h"
@ -42,8 +41,8 @@ class Workspace::Private {
// configuration
const RGBColor& Color() const { return fColor; }
void SetColor(const RGBColor& color);
const rgb_color& Color() const { return fColor; }
void SetColor(const rgb_color& color);
void RestoreConfiguration(const BMessage& settings);
void StoreConfiguration(BMessage& settings);
@ -57,7 +56,7 @@ class Workspace::Private {
BObjectList<display_info> fDisplays;
RGBColor fColor;
rgb_color fColor;
};
#endif /* WORKSPACE_PRIVATE_H */

View File

@ -26,8 +26,8 @@ WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset,
fSelectedWorkspace(-1),
fHasMoved(false)
{
fDrawState->SetLowColor(RGBColor(255, 255, 255));
fDrawState->SetHighColor(RGBColor(0, 0, 0));
fDrawState->SetLowColor((rgb_color){ 255, 255, 255, 255 });
fDrawState->SetHighColor((rgb_color){ 0, 0, 0, 255 });
}
@ -161,11 +161,11 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
return;
// ToDo: let decorator do this!
RGBColor yellow;
rgb_color yellow;
if (decorator != NULL)
yellow = decorator->UIColor(B_WINDOW_TAB_COLOR);
RGBColor frameColor(180, 180, 180);
RGBColor white(255, 255, 255);
rgb_color frameColor = (rgb_color){ 180, 180, 180, 255 };
rgb_color white = (rgb_color){ 255, 255, 255, 255 };
if (!active) {
_DarkenColor(yellow);
@ -174,7 +174,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
}
if (window == fSelectedWindow) {
// TODO: what about standard navigation color here?
frameColor.SetColor(80, 80, 80);
frameColor = (rgb_color){ 80, 80, 80, 255 };
}
if (tabFrame.left < frame.left)
@ -237,16 +237,16 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
bool active = workspace.IsCurrent();
if (active) {
// draw active frame
RGBColor black(0, 0, 0);
rgb_color black = (rgb_color){ 0, 0, 0, 255 };
drawingEngine->StrokeRect(rect, black);
} else if (index == fSelectedWorkspace) {
RGBColor gray(80, 80, 80);
rgb_color gray = (rgb_color){ 80, 80, 80, 255 };
drawingEngine->StrokeRect(rect, gray);
}
rect.InsetBy(1, 1);
RGBColor color = workspace.Color();
rgb_color color = workspace.Color();
if (!active)
_DarkenColor(color);
@ -279,9 +279,9 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
void
WorkspacesLayer::_DarkenColor(RGBColor& color) const
WorkspacesLayer::_DarkenColor(rgb_color& color) const
{
color = tint_color(color.GetColor32(), B_DARKEN_2_TINT);
color = tint_color(color, B_DARKEN_2_TINT);
}

View File

@ -48,7 +48,7 @@ class WorkspacesLayer : public ViewLayer {
void _DrawWorkspace(DrawingEngine* drawingEngine, BRegion& redraw,
int32 index);
void _DarkenColor(RGBColor& color) const;
void _DarkenColor(rgb_color& color) const;
void _Invalidate() const;
private:

View File

@ -972,11 +972,12 @@ AccelerantHWInterface::CopyRegion(const clipping_rect* sortedRectList,
// FillRegion
void
AccelerantHWInterface::FillRegion(/*const*/ BRegion& region, const RGBColor& color,
bool autoSync)
AccelerantHWInterface::FillRegion(/*const*/ BRegion& region,
const rgb_color& color, bool autoSync)
{
if (fAccFillRect && fAccAcquireEngine) {
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken, &fEngineToken) >= B_OK) {
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken,
&fEngineToken) >= B_OK) {
// convert the region
uint32 count;
@ -1136,34 +1137,33 @@ AccelerantHWInterface::_RegionToRectParams(/*const*/ BRegion* region,
// _NativeColor
uint32
AccelerantHWInterface::_NativeColor(const RGBColor& color) const
AccelerantHWInterface::_NativeColor(const rgb_color& color) const
{
// NOTE: This functions looks somehow suspicios to me.
// It assumes that all graphics cards have the same native endianess, no?
switch (fDisplayMode.space) {
case B_CMAP8:
case B_GRAY8:
return color.GetColor8();
return RGBColor(color).GetColor8();
case B_RGB15_BIG:
case B_RGBA15_BIG:
case B_RGB15_LITTLE:
case B_RGBA15_LITTLE:
return color.GetColor15();
return RGBColor(color).GetColor15();
case B_RGB16_BIG:
case B_RGB16_LITTLE:
return color.GetColor16();
return RGBColor(color).GetColor16();
case B_RGB32_BIG:
case B_RGBA32_BIG:
case B_RGB32_LITTLE:
case B_RGBA32_LITTLE: {
rgb_color c = color.GetColor32();
uint32 native = (c.alpha << 24) |
(c.red << 16) |
(c.green << 8) |
(c.blue);
uint32 native = (color.alpha << 24) |
(color.red << 16) |
(color.green << 8) |
(color.blue);
return native;
}
}

View File

@ -73,7 +73,7 @@ public:
uint32 count,
int32 xOffset, int32 yOffset);
virtual void FillRegion(/*const*/ BRegion& region,
const RGBColor& color,
const rgb_color& color,
bool autoSync);
virtual void InvertRegion(/*const*/ BRegion& region);
@ -101,7 +101,7 @@ private:
status_t _UpdateFrameBufferConfig();
void _RegionToRectParams(/*const*/ BRegion* region,
uint32* count) const;
uint32 _NativeColor(const RGBColor& color) const;
uint32 _NativeColor(const rgb_color& color) const;
status_t _SetFallbackMode(display_mode& mode) const;
void _SetSystemPalette();
void _SetGrayscalePalette();

View File

@ -946,10 +946,12 @@ DWindowHWInterface::CopyRegion(const clipping_rect* sortedRectList,
// FillRegion
void
DWindowHWInterface::FillRegion(/*const*/ BRegion& region, const RGBColor& color, bool autoSync)
DWindowHWInterface::FillRegion(/*const*/ BRegion& region,
const rgb_color& color, bool autoSync)
{
if (fAccFillRect && fAccAcquireEngine) {
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken, &fEngineToken) >= B_OK) {
if (fAccAcquireEngine(B_2D_ACCELERATION, 0xff, &fSyncToken,
&fEngineToken) >= B_OK) {
// convert the region
uint32 count;
@ -1081,34 +1083,33 @@ DWindowHWInterface::_RegionToRectParams(/*const*/ BRegion* region,
// _NativeColor
uint32
DWindowHWInterface::_NativeColor(const RGBColor& color) const
DWindowHWInterface::_NativeColor(const rgb_color& color) const
{
// NOTE: This functions looks somehow suspicios to me.
// It assumes that all graphics cards have the same native endianess, no?
switch (fDisplayMode.space) {
case B_CMAP8:
case B_GRAY8:
return color.GetColor8();
return RGBColor(color).GetColor8();
case B_RGB15_BIG:
case B_RGBA15_BIG:
case B_RGB15_LITTLE:
case B_RGBA15_LITTLE:
return color.GetColor15();
return RGBColor(color).GetColor15();
case B_RGB16_BIG:
case B_RGB16_LITTLE:
return color.GetColor16();
return RGBColor(color).GetColor16();
case B_RGB32_BIG:
case B_RGBA32_BIG:
case B_RGB32_LITTLE:
case B_RGBA32_LITTLE: {
rgb_color c = color.GetColor32();
uint32 native = (c.alpha << 24) |
(c.red << 16) |
(c.green << 8) |
(c.blue);
uint32 native = (color.alpha << 24) |
(color.red << 16) |
(color.green << 8) |
(color.blue);
return native;
}
}

View File

@ -59,7 +59,7 @@ class DWindowHWInterface : public HWInterface {
uint32 count,
int32 xOffset, int32 yOffset);
virtual void FillRegion(/*const*/ BRegion& region,
const RGBColor& color,
const rgb_color& color,
bool autoSync);
virtual void InvertRegion(/*const*/ BRegion& region);
@ -92,7 +92,7 @@ class DWindowHWInterface : public HWInterface {
void _RegionToRectParams(/*const*/ BRegion* region,
uint32* count) const;
uint32 _NativeColor(const RGBColor& color) const;
uint32 _NativeColor(const rgb_color& color) const;

View File

@ -648,10 +648,10 @@ DrawingEngine::DrawPolygon(BPoint* ptlist, int32 numpts,
}
}
// #pragma mark - RGBColor
// #pragma mark - rgb_color
void
DrawingEngine::StrokePoint(const BPoint& pt, const RGBColor &color)
DrawingEngine::StrokePoint(const BPoint& pt, const rgb_color &color)
{
StrokeLine(pt, pt, color);
}
@ -662,7 +662,7 @@ DrawingEngine::StrokePoint(const BPoint& pt, const RGBColor &color)
// * it assumes a one pixel wide line
void
DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end,
const RGBColor &color)
const rgb_color &color)
{
CRASH_IF_NOT_LOCKED
@ -671,7 +671,7 @@ DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end,
touched = fPainter->ClipRect(touched);
bool cursorTouched = fGraphicsCard->HideSoftwareCursor(touched);
if (!fPainter->StraightLine(start, end, color.GetColor32())) {
if (!fPainter->StraightLine(start, end, color)) {
fPainter->SetHighColor(color);
fPainter->SetDrawingMode(B_OP_OVER);
fPainter->StrokeLine(start, end);
@ -684,7 +684,7 @@ DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end,
// this function is used to draw a one pixel wide rect
void
DrawingEngine::StrokeRect(BRect r, const RGBColor &color)
DrawingEngine::StrokeRect(BRect r, const rgb_color &color)
{
CRASH_IF_NOT_LOCKED
@ -693,7 +693,7 @@ DrawingEngine::StrokeRect(BRect r, const RGBColor &color)
if (clipped.IsValid()) {
bool cursorTouched = fGraphicsCard->HideSoftwareCursor(clipped);
fPainter->StrokeRect(r, color.GetColor32());
fPainter->StrokeRect(r, color);
fGraphicsCard->Invalidate(clipped);
if (cursorTouched)
@ -703,7 +703,7 @@ DrawingEngine::StrokeRect(BRect r, const RGBColor &color)
void
DrawingEngine::FillRect(BRect r, const RGBColor& color)
DrawingEngine::FillRect(BRect r, const rgb_color& color)
{
CRASH_IF_NOT_LOCKED
@ -723,7 +723,7 @@ DrawingEngine::FillRect(BRect r, const RGBColor& color)
fSuspendSyncLevel == 0
|| cursorTouched);
} else {
fPainter->FillRect(r, color.GetColor32());
fPainter->FillRect(r, color);
fGraphicsCard->Invalidate(r);
}
@ -735,7 +735,7 @@ DrawingEngine::FillRect(BRect r, const RGBColor& color)
void
DrawingEngine::FillRegion(BRegion& r, const RGBColor& color)
DrawingEngine::FillRegion(BRegion& r, const rgb_color& color)
{
CRASH_IF_NOT_LOCKED
@ -751,7 +751,7 @@ DrawingEngine::FillRegion(BRegion& r, const RGBColor& color)
} else {
int32 count = r.CountRects();
for (int32 i = 0; i < count; i++) {
fPainter->FillRectNoClipping(r.RectAt(i), color.GetColor32());
fPainter->FillRectNoClipping(r.RectAt(i), color);
}
fGraphicsCard->Invalidate(frame);

View File

@ -24,7 +24,6 @@ class BRegion;
class DrawState;
class Painter;
class RGBColor;
class ServerBitmap;
class ServerCursor;
class ServerFont;
@ -104,12 +103,12 @@ public:
void DrawPolygon(BPoint *ptlist, int32 numpts,
BRect bounds, bool filled, bool closed);
// these RGBColor versions are used internally by the server
// these rgb_color versions are used internally by the server
void StrokePoint(const BPoint& pt,
const RGBColor& color);
void StrokeRect(BRect r, const RGBColor &color);
void FillRect(BRect r, const RGBColor &color);
void FillRegion(BRegion& r, const RGBColor& color);
const rgb_color& color);
void StrokeRect(BRect r, const rgb_color &color);
void FillRect(BRect r, const rgb_color &color);
void FillRegion(BRegion& r, const rgb_color& color);
void StrokeRect(BRect r);
void FillRect(BRect r);
@ -129,7 +128,7 @@ public:
// this version used by Decorator
void StrokeLine(const BPoint& start,
const BPoint& end, const RGBColor& color);
const BPoint& end, const rgb_color& color);
void StrokeLine(const BPoint& start,
const BPoint& end);

View File

@ -23,7 +23,6 @@
class Overlay;
class RenderingBuffer;
class RGBColor;
class ServerBitmap;
class ServerCursor;
class UpdateQueue;
@ -98,7 +97,7 @@ class HWInterface : protected MultiLocker {
uint32 count,
int32 xOffset, int32 yOffset) {}
virtual void FillRegion(/*const*/ BRegion& region,
const RGBColor& color,
const rgb_color& color,
bool autoSync) {}
virtual void InvertRegion(/*const*/ BRegion& region) {}

View File

@ -14,8 +14,6 @@
#include <BitmapPrivate.h>
#include <InterfaceDefs.h>
const static bigtime_t kOverlayTimeout = 1000000LL;
// after 1 second, the team holding the lock will be killed
@ -62,7 +60,7 @@ Overlay::Overlay(HWInterface& interface, ServerBitmap* bitmap,
fOverlayToken(token)
{
fSemaphore = create_sem(1, "overlay lock");
fColor.SetColor(21, 16, 21, 16);
fColor = (rgb_color){ 21, 16, 21, 16 };
// TODO: whatever fine color we want to use here...
fWindow.offset_top = 0;
@ -221,7 +219,7 @@ Overlay::SetColorSpace(uint32 colorSpace)
return;
uint8 colorShift = 0, greenShift = 0, alphaShift = 0;
rgb_color colorKey = fColor.GetColor32();
rgb_color colorKey = fColor;
switch (colorSpace) {
case B_CMAP8:

View File

@ -9,7 +9,7 @@
#define OVERLAY_H
#include "RGBColor.h"
#include <InterfaceDefs.h>
#include <video_overlay.h>
@ -48,7 +48,7 @@ class Overlay {
sem_id Semaphore() const
{ return fSemaphore; }
const RGBColor& Color() const
const rgb_color& Color() const
{ return fColor; }
void Configure(const BRect& source, const BRect& destination);
@ -65,7 +65,7 @@ class Overlay {
overlay_view fView;
overlay_window fWindow;
sem_id fSemaphore;
RGBColor fColor;
rgb_color fColor;
};
#endif // OVERLAY_H

View File

@ -107,7 +107,7 @@ Painter::AttachToBuffer(RenderingBuffer* buffer)
// These are the AGG renderes and rasterizes which
// will be used for stroking paths
_SetRendererColor(fPatternHandler.HighColor().GetColor32());
_SetRendererColor(fPatternHandler.HighColor());
}
}
@ -152,8 +152,8 @@ Painter::SetDrawState(const DrawState* data, int32 xOffset, int32 yOffset)
// adopt the color *after* the pattern is set
// to set the renderers to the correct color
SetHighColor(data->HighColor().GetColor32());
SetLowColor(data->LowColor().GetColor32());
SetHighColor(data->HighColor());
SetLowColor(data->LowColor());
if (updateDrawingMode || fPixelFormat.UsesOpCopyForText())
_UpdateDrawingMode();
@ -179,7 +179,7 @@ Painter::ConstrainClipping(const BRegion* region)
void
Painter::SetHighColor(const rgb_color& color)
{
if (fPatternHandler.HighColor().GetColor32() == color)
if (fPatternHandler.HighColor() == color)
return;
fPatternHandler.SetHighColor(color);
if (*(fPatternHandler.GetR5Pattern()) == B_SOLID_HIGH)
@ -245,10 +245,10 @@ Painter::SetPattern(const pattern& p, bool drawingText)
// update renderer color if necessary
if (fPatternHandler.IsSolidHigh()) {
// pattern was not solid high before
_SetRendererColor(fPatternHandler.HighColor().GetColor32());
_SetRendererColor(fPatternHandler.HighColor());
} else if (fPatternHandler.IsSolidLow()) {
// pattern was not solid low before
_SetRendererColor(fPatternHandler.LowColor().GetColor32());
_SetRendererColor(fPatternHandler.LowColor());
}
}
}
@ -290,10 +290,10 @@ Painter::StrokeLine(BPoint a, BPoint b)
pattern pat = *fPatternHandler.GetR5Pattern();
if (pat == B_SOLID_HIGH
&& StraightLine(a, b, fPatternHandler.HighColor().GetColor32())) {
&& StraightLine(a, b, fPatternHandler.HighColor())) {
return;
} else if (pat == B_SOLID_LOW
&& StraightLine(a, b, fPatternHandler.LowColor().GetColor32())) {
&& StraightLine(a, b, fPatternHandler.LowColor())) {
return;
}
}
@ -574,12 +574,12 @@ Painter::StrokeRect(const BRect& r) const
if (p == B_SOLID_HIGH) {
BRect rect(a, b);
StrokeRect(rect,
fPatternHandler.HighColor().GetColor32());
fPatternHandler.HighColor());
return _Clipped(rect);
} else if (p == B_SOLID_LOW) {
BRect rect(a, b);
StrokeRect(rect,
fPatternHandler.LowColor().GetColor32());
fPatternHandler.LowColor());
return _Clipped(rect);
}
}
@ -638,11 +638,11 @@ Painter::FillRect(const BRect& r) const
pattern p = *fPatternHandler.GetR5Pattern();
if (p == B_SOLID_HIGH) {
BRect rect(a, b);
FillRect(rect, fPatternHandler.HighColor().GetColor32());
FillRect(rect, fPatternHandler.HighColor());
return _Clipped(rect);
} else if (p == B_SOLID_LOW) {
BRect rect(a, b);
FillRect(rect, fPatternHandler.LowColor().GetColor32());
FillRect(rect, fPatternHandler.LowColor());
return _Clipped(rect);
}
}
@ -650,12 +650,12 @@ Painter::FillRect(const BRect& r) const
pattern p = *fPatternHandler.GetR5Pattern();
if (p == B_SOLID_HIGH) {
BRect rect(a, b);
_BlendRect32(rect, fPatternHandler.HighColor().GetColor32());
_BlendRect32(rect, fPatternHandler.HighColor());
return _Clipped(rect);
} else if (p == B_SOLID_LOW) {
rgb_color c = fPatternHandler.LowColor().GetColor32();
rgb_color c = fPatternHandler.LowColor();
if (fAlphaSrcMode == B_CONSTANT_ALPHA)
c.alpha = fPatternHandler.HighColor().GetColor32().alpha;
c.alpha = fPatternHandler.HighColor().alpha;
BRect rect(a, b);
_BlendRect32(rect, c);
return _Clipped(rect);

View File

@ -12,7 +12,6 @@
#include "AGGTextRenderer.h"
#include "FontManager.h"
#include "PatternHandler.h"
#include "RGBColor.h"
#include "ServerFont.h"
#include "defines.h"
@ -53,21 +52,12 @@ class Painter {
// object settings
void SetHighColor(const rgb_color& color);
inline void SetHighColor(uint8 r, uint8 g, uint8 b, uint8 a = 255);
inline void SetHighColor(const RGBColor& color)
{ SetHighColor(color.GetColor32()); }
inline rgb_color HighColor() const
{ return fPatternHandler.
HighColor().GetColor32(); }
{ return fPatternHandler.HighColor(); }
void SetLowColor(const rgb_color& color);
inline void SetLowColor(uint8 r, uint8 g, uint8 b, uint8 a = 255);
inline void SetLowColor(const RGBColor& color)
{ SetLowColor(color.GetColor32()); }
inline rgb_color LowColor() const
{ return fPatternHandler.
LowColor().GetColor32(); }
{ return fPatternHandler.LowColor(); }
void SetPenSize(float size);
inline float PenSize() const
@ -290,30 +280,6 @@ mutable agg::conv_curve<agg::path_storage> fCurve;
mutable AGGTextRenderer fTextRenderer;
};
// SetHighColor
inline void
Painter::SetHighColor(uint8 r, uint8 g, uint8 b, uint8 a)
{
rgb_color color;
color.red = r;
color.green = g;
color.blue = b;
color.alpha = a;
SetHighColor(color);
}
// SetLowColor
inline void
Painter::SetLowColor(uint8 r, uint8 g, uint8 b, uint8 a)
{
rgb_color color;
color.red = r;
color.green = g;
color.blue = b;
color.alpha = a;
SetLowColor(color);
}
#endif // PAINTER_H

View File

@ -41,7 +41,7 @@ blend_pixel_add(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_ADD(p, color.red, color.green, color.blue);
} else {
@ -58,7 +58,7 @@ blend_hline_add(int x, int y, unsigned len,
uint8* p = buffer->row_ptr(y) + (x << 2);
if (cover == 255) {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
ASSIGN_ADD(p, color.red, color.green, color.blue);
@ -67,7 +67,7 @@ blend_hline_add(int x, int y, unsigned len,
} while(--len);
} else {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_ADD(p, color.red, color.green, color.blue, cover);
@ -85,7 +85,7 @@ blend_solid_hspan_add(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_ADD(p, color.red, color.green, color.blue);
@ -109,7 +109,7 @@ blend_solid_vspan_add(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_ADD(p, color.red, color.green, color.blue);

View File

@ -32,8 +32,8 @@ blend_pixel_alpha_cc(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
uint16 alpha = pattern->HighColor().GetColor32().alpha * cover;
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = pattern->HighColor().alpha * cover;
if (alpha == 255 * 255) {
ASSIGN_ALPHA_CC(p, color.red, color.green, color.blue);
} else {
@ -47,7 +47,7 @@ blend_hline_alpha_cc(int x, int y, unsigned len,
const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
uint16 alpha = color.alpha * cover;
if (alpha == 255 * 255) {
// cache the low and high color as 32bit values
@ -59,7 +59,7 @@ blend_hline_alpha_cc(int x, int y, unsigned len,
p8[2] = color.red;
p8[3] = 255;
// low color
color = pattern->LowColor().GetColor32();
color = pattern->LowColor();
uint32 vl;
p8 = (uint8*)&vl;
p8[0] = color.blue;
@ -79,7 +79,7 @@ blend_hline_alpha_cc(int x, int y, unsigned len,
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_ALPHA_CC(p, color.red, color.green, color.blue, alpha);
x++;
p += 4;
@ -94,9 +94,9 @@ blend_solid_hspan_alpha_cc(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = hAlpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {
@ -118,9 +118,9 @@ blend_solid_vspan_alpha_cc(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = hAlpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {
@ -144,7 +144,7 @@ blend_color_hspan_alpha_cc(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
if (covers) {
// non-solid opacity
do {

View File

@ -32,8 +32,8 @@ blend_pixel_alpha_co(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
uint16 alpha = pattern->HighColor().GetColor32().alpha * cover;
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = pattern->HighColor().alpha * cover;
if (alpha == 255 * 255) {
ASSIGN_ALPHA_CO(p, color.red, color.green, color.blue);
} else {
@ -47,7 +47,7 @@ blend_hline_alpha_co(int x, int y, unsigned len,
const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
uint16 alpha = color.alpha * cover;
if (alpha == 255*255) {
// cache the low and high color as 32bit values
@ -59,7 +59,7 @@ blend_hline_alpha_co(int x, int y, unsigned len,
p8[2] = color.red;
p8[3] = 255;
// low color
color = pattern->LowColor().GetColor32();
color = pattern->LowColor();
uint32 vl;
p8 = (uint8*)&vl;
p8[0] = color.blue;
@ -79,7 +79,7 @@ blend_hline_alpha_co(int x, int y, unsigned len,
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_ALPHA_CO(p, color.red, color.green, color.blue, alpha);
x++;
p += 4;
@ -94,9 +94,9 @@ blend_solid_hspan_alpha_co(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = hAlpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {
@ -120,9 +120,9 @@ blend_solid_vspan_alpha_co(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = hAlpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {
@ -146,7 +146,7 @@ blend_color_hspan_alpha_co(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
if (covers) {
// non-solid opacity
do {

View File

@ -17,7 +17,7 @@ blend_pixel_alpha_co_solid(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint16 alpha = pattern->HighColor().GetColor32().alpha * cover;
uint16 alpha = pattern->HighColor().alpha * cover;
if (alpha == 255 * 255) {
ASSIGN_ALPHA_CO(p, c.r, c.g, c.b);
} else {
@ -31,7 +31,7 @@ blend_hline_alpha_co_solid(int x, int y, unsigned len,
const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint16 alpha = pattern->HighColor().GetColor32().alpha * cover;
uint16 alpha = pattern->HighColor().alpha * cover;
if (alpha == 255 * 255) {
// cache the color as 32bit values
uint32 v;
@ -69,7 +69,7 @@ blend_solid_hspan_alpha_co_solid(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
uint16 alpha = hAlpha * *covers;
if (alpha) {
@ -94,7 +94,7 @@ blend_solid_vspan_alpha_co_solid(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
uint8 hAlpha = pattern->HighColor().GetColor32().alpha;
uint8 hAlpha = pattern->HighColor().alpha;
do {
uint16 alpha = hAlpha * *covers;
if (alpha) {

View File

@ -32,7 +32,7 @@ blend_pixel_alpha_pc(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * cover;
if (alpha == 255*255) {
ASSIGN_ALPHA_PC(p, color.red, color.green, color.blue);
@ -49,7 +49,7 @@ blend_hline_alpha_pc(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * cover;
if (alpha) {
if (alpha == 255) {
@ -71,7 +71,7 @@ blend_solid_hspan_alpha_pc(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * *covers;
if (alpha) {
if(alpha == 255 * 255) {
@ -94,7 +94,7 @@ blend_solid_vspan_alpha_pc(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {

View File

@ -32,7 +32,7 @@ blend_pixel_alpha_po(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * cover;
if (alpha == 255 * 255) {
ASSIGN_ALPHA_PO(p, color.red, color.green, color.blue);
@ -49,7 +49,7 @@ blend_hline_alpha_po(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * cover;
if (alpha) {
if (alpha == 255) {
@ -71,7 +71,7 @@ blend_solid_hspan_alpha_po(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * *covers;
if (alpha) {
if(alpha == 255 * 255) {
@ -96,7 +96,7 @@ blend_solid_vspan_alpha_po(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
uint16 alpha = color.alpha * *covers;
if (alpha) {
if (alpha == 255 * 255) {

View File

@ -39,7 +39,7 @@ blend_pixel_blend(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_BLEND(p, color.red, color.green, color.blue);
} else {
@ -56,7 +56,7 @@ blend_hline_blend(int x, int y, unsigned len,
uint8* p = buffer->row_ptr(y) + (x << 2);
if (cover == 255) {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
ASSIGN_BLEND(p, color.red, color.green, color.blue);
@ -65,7 +65,7 @@ blend_hline_blend(int x, int y, unsigned len,
} while(--len);
} else {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_BLEND(p, color.red, color.green, color.blue, cover);
@ -83,7 +83,7 @@ blend_solid_hspan_blend(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_BLEND(p, color.red, color.green, color.blue);
@ -107,7 +107,7 @@ blend_solid_vspan_blend(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_BLEND(p, color.red, color.green, color.blue);

View File

@ -33,11 +33,11 @@ blend_pixel_copy(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_COPY(p, color.red, color.green, color.blue, color.alpha);
} else {
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
BLEND_COPY(p, color.red, color.green, color.blue, cover,
l.red, l.green, l.blue);
}
@ -52,7 +52,7 @@ blend_hline_copy(int x, int y, unsigned len,
if (cover == 255) {
// cache the low and high color as 32bit values
// high color
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
uint32 vh;
uint8* p8 = (uint8*)&vh;
p8[0] = (uint8)color.blue;
@ -60,7 +60,7 @@ blend_hline_copy(int x, int y, unsigned len,
p8[2] = (uint8)color.red;
p8[3] = 255;
// low color
color = pattern->LowColor().GetColor32();
color = pattern->LowColor();
uint32 vl;
p8 = (uint8*)&vl;
p8[0] = (uint8)color.blue;
@ -79,9 +79,9 @@ blend_hline_copy(int x, int y, unsigned len,
} while(--len);
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_COPY(p, color.red, color.green, color.blue, cover,
l.red, l.green, l.blue);
x++;
@ -97,9 +97,9 @@ blend_solid_hspan_copy(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_COPY(p, color.red, color.green, color.blue, color.alpha);
@ -123,9 +123,9 @@ blend_solid_vspan_copy(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_COPY(p, color.red, color.green, color.blue, color.alpha);
@ -148,7 +148,7 @@ blend_color_hspan_copy(int x, int y, unsigned len, const color_type* colors,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
if (covers) {
// non-solid opacity
do {

View File

@ -20,7 +20,7 @@ blend_pixel_copy_text(int x, int y, const color_type& c, uint8 cover,
if (cover == 255) {
ASSIGN_COPY(p, c.r, c.g, c.b, c.a);
} else {
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
BLEND_COPY(p, c.r, c.g, c.b, cover,
l.red, l.green, l.blue);
}
@ -48,7 +48,7 @@ blend_hline_copy_text(int x, int y, unsigned len,
} while(--len);
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
do {
BLEND_COPY(p, c.r, c.g, c.b, cover,
l.red, l.green, l.blue);
@ -68,7 +68,7 @@ blend_solid_hspan_copy_text(int x, int y, unsigned len,
// uint8* p = buffer->row_ptr(y) + (x << 2);
uint32* p = (uint32*)(buffer->row_ptr(y) + (x << 2));
const uint32* cache = (const uint32*)pattern->OpCopyColorCache();
// rgb_color l = pattern->LowColor().GetColor32();
// rgb_color l = pattern->LowColor();
do {
// if (*covers) {
*p = cache[*covers];
@ -95,7 +95,7 @@ blend_solid_vspan_copy_text(int x, int y, unsigned len,
const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
do {
if (*covers) {
if (*covers == 255) {
@ -120,7 +120,7 @@ blend_color_hspan_copy_text(int x, int y, unsigned len,
const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color l = pattern->LowColor().GetColor32();
rgb_color l = pattern->LowColor();
if (covers) {
// non-solid opacity
do {

View File

@ -33,7 +33,7 @@ blend_pixel_erase(int x, int y, const color_type& c, uint8 cover,
{
if (pattern->IsHighColor(x, y)) {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->LowColor().GetColor32();
rgb_color color = pattern->LowColor();
if (cover == 255) {
ASSIGN_ERASE(p, color.red, color.green, color.blue);
} else {
@ -49,7 +49,7 @@ blend_hline_erase(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
if (cover == 255) {
rgb_color color = pattern->LowColor().GetColor32();
rgb_color color = pattern->LowColor();
uint32 v;
uint8* p8 = (uint8*)&v;
p8[0] = (uint8)color.blue;
@ -65,7 +65,7 @@ blend_hline_erase(int x, int y, unsigned len,
} while(--len);
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->LowColor().GetColor32();
rgb_color color = pattern->LowColor();
do {
if (pattern->IsHighColor(x, y)) {
BLEND_ERASE(p, color.red, color.green, color.blue, cover);
@ -83,7 +83,7 @@ blend_solid_hspan_erase(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->LowColor().GetColor32();
rgb_color color = pattern->LowColor();
do {
if (pattern->IsHighColor(x, y)) {
if (*covers) {
@ -109,7 +109,7 @@ blend_solid_vspan_erase(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->LowColor().GetColor32();
rgb_color color = pattern->LowColor();
do {
if (pattern->IsHighColor(x, y)) {
if (*covers) {

View File

@ -41,7 +41,7 @@ blend_pixel_max(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_MAX(p, color.red, color.green, color.blue);
} else {
@ -58,7 +58,7 @@ blend_hline_max(int x, int y, unsigned len,
uint8* p = buffer->row_ptr(y) + (x << 2);
if (cover == 255) {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
ASSIGN_MAX(p, color.red, color.green, color.blue);
@ -67,7 +67,7 @@ blend_hline_max(int x, int y, unsigned len,
} while(--len);
} else {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_MAX(p, color.red, color.green, color.blue, cover);
@ -85,7 +85,7 @@ blend_solid_hspan_max(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_MAX(p, color.red, color.green, color.blue);
@ -109,7 +109,7 @@ blend_solid_vspan_max(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_MAX(p, color.red, color.green, color.blue);

View File

@ -35,7 +35,7 @@ blend_pixel_min(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_MIN(p, color.red, color.green, color.blue);
} else {
@ -52,7 +52,7 @@ blend_hline_min(int x, int y, unsigned len,
uint8* p = buffer->row_ptr(y) + (x << 2);
if (cover == 255) {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
ASSIGN_MIN(p, color.red, color.green, color.blue);
@ -61,7 +61,7 @@ blend_hline_min(int x, int y, unsigned len,
} while(--len);
} else {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_MIN(p, color.red, color.green, color.blue, cover);
@ -79,7 +79,7 @@ blend_solid_hspan_min(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_MIN(p, color.red, color.green, color.blue);
@ -103,7 +103,7 @@ blend_solid_vspan_min(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_MIN(p, color.red, color.green, color.blue);

View File

@ -33,7 +33,7 @@ blend_pixel_over(int x, int y, const color_type& c, uint8 cover,
{
if (pattern->IsHighColor(x, y)) {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
if (cover == 255) {
ASSIGN_OVER(p, color.red, color.green, color.blue);
} else {
@ -49,7 +49,7 @@ blend_hline_over(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
if (cover == 255) {
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
uint32 v;
uint8* p8 = (uint8*)&v;
p8[0] = (uint8)color.blue;
@ -65,7 +65,7 @@ blend_hline_over(int x, int y, unsigned len,
} while(--len);
} else {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
do {
if (pattern->IsHighColor(x, y)) {
BLEND_OVER(p, color.red, color.green, color.blue, cover);
@ -83,7 +83,7 @@ blend_solid_hspan_over(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
do {
if (pattern->IsHighColor(x, y)) {
if (*covers) {
@ -109,7 +109,7 @@ blend_solid_vspan_over(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->HighColor().GetColor32();
rgb_color color = pattern->HighColor();
do {
if (pattern->IsHighColor(x, y)) {
if (*covers) {

View File

@ -57,8 +57,8 @@ blend_pixel_select(int x, int y, const color_type& c, uint8 cover,
{
if (pattern->IsHighColor(x, y)) {
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color high = pattern->HighColor().GetColor32();
rgb_color low = pattern->LowColor().GetColor32();
rgb_color high = pattern->HighColor();
rgb_color low = pattern->LowColor();
rgb_color color;
if (compare(p, high, low, &color)) {
if (cover == 255) {
@ -77,8 +77,8 @@ blend_hline_select(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color high = pattern->HighColor().GetColor32();
rgb_color low = pattern->LowColor().GetColor32();
rgb_color high = pattern->HighColor();
rgb_color low = pattern->LowColor();
rgb_color color;
if (cover == 255) {
do {
@ -107,8 +107,8 @@ blend_solid_hspan_select(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color high = pattern->HighColor().GetColor32();
rgb_color low = pattern->LowColor().GetColor32();
rgb_color high = pattern->HighColor();
rgb_color low = pattern->LowColor();
rgb_color color;
do {
if (pattern->IsHighColor(x, y)) {
@ -135,8 +135,8 @@ blend_solid_vspan_select(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color high = pattern->HighColor().GetColor32();
rgb_color low = pattern->LowColor().GetColor32();
rgb_color high = pattern->HighColor();
rgb_color low = pattern->LowColor();
rgb_color color;
do {
if (pattern->IsHighColor(x, y)) {
@ -163,8 +163,8 @@ blend_color_hspan_select(int x, int y, unsigned len,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color high = pattern->HighColor().GetColor32();
rgb_color low = pattern->LowColor().GetColor32();
rgb_color high = pattern->HighColor();
rgb_color low = pattern->LowColor();
rgb_color color;
if (covers) {
// non-solid opacity

View File

@ -43,7 +43,7 @@ blend_pixel_subtract(int x, int y, const color_type& c, uint8 cover,
agg_buffer* buffer, const PatternHandler* pattern)
{
uint8* p = buffer->row_ptr(y) + (x << 2);
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (cover == 255) {
ASSIGN_SUBTRACT(p, color.red, color.green, color.blue);
} else {
@ -60,7 +60,7 @@ blend_hline_subtract(int x, int y, unsigned len,
uint8* p = buffer->row_ptr(y) + (x << 2);
if (cover == 255) {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
ASSIGN_SUBTRACT(p, color.red, color.green, color.blue);
@ -69,7 +69,7 @@ blend_hline_subtract(int x, int y, unsigned len,
} while(--len);
} else {
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
BLEND_SUBTRACT(p, color.red, color.green, color.blue, cover);
@ -87,7 +87,7 @@ blend_solid_hspan_subtract(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_SUBTRACT(p, color.red, color.green, color.blue);
@ -111,7 +111,7 @@ blend_solid_vspan_subtract(int x, int y, unsigned len,
{
uint8* p = buffer->row_ptr(y) + (x << 2);
do {
rgb_color color = pattern->R5ColorAt(x, y);
rgb_color color = pattern->ColorAt(x, y);
if (*covers) {
if (*covers == 255) {
ASSIGN_SUBTRACT(p, color.red, color.green, color.blue);

View File

@ -159,38 +159,6 @@ PatternHandler::SetPattern(const pattern& pat)
fPattern = pat;
}
/*!
\brief Set the colors for the pattern to use
\param high High color for the handler
\param low Low color for the handler
*/
void
PatternHandler::SetColors(const RGBColor& high, const RGBColor& low)
{
fHighColor = high;
fLowColor = low;
}
/*!
\brief Set the high color for the pattern to use
\param color High color for the handler
*/
void
PatternHandler::SetHighColor(const RGBColor& color)
{
fHighColor = color;
}
/*!
\brief Set the low color for the pattern to use
\param color Low color for the handler
*/
void
PatternHandler::SetLowColor(const RGBColor& color)
{
fLowColor = color;
}
/*!
\brief Set the colors for the pattern to use
\param high High color for the handler
@ -200,6 +168,7 @@ void
PatternHandler::SetColors(const rgb_color& high, const rgb_color& low)
{
fHighColor = high;
fLowColor = low;
}
/*!
@ -227,7 +196,7 @@ PatternHandler::SetLowColor(const rgb_color& color)
\param pt Coordinates to get the color for
\return Color for the coordinates
*/
RGBColor
rgb_color
PatternHandler::ColorAt(const BPoint &pt) const
{
return ColorAt(pt.x, pt.y);
@ -239,7 +208,7 @@ PatternHandler::ColorAt(const BPoint &pt) const
\param y Y coordinate to get the color for
\return Color for the coordinates
*/
RGBColor
rgb_color
PatternHandler::ColorAt(float x, float y) const
{
return ColorAt(int(x), int(y));
@ -272,13 +241,8 @@ PatternHandler::SetOffsets(int32 x, int32 y)
void
PatternHandler::MakeOpCopyColorCache()
{
rgb_color highColor = fHighColor.GetColor32();
rgb_color lowColor = fLowColor.GetColor32();
uint64 t1 = *(uint32*)&highColor;
uint32 t2 = *(uint32*)&lowColor;
uint64 colors = (t1 << 32) | t2;
uint64 t = *(uint32*)&fHighColor;
uint64 colors = (t << 32) | *(uint32*)&fLowColor;
if (fColorsWhenCached == colors)
return;
@ -286,13 +250,13 @@ PatternHandler::MakeOpCopyColorCache()
fColorsWhenCached = colors;
// ramp from low color to high color
uint8 rA = fLowColor.GetColor32().red;
uint8 gA = fLowColor.GetColor32().green;
uint8 bA = fLowColor.GetColor32().blue;
uint8 rA = fLowColor.red;
uint8 gA = fLowColor.green;
uint8 bA = fLowColor.blue;
uint8 rB = fHighColor.GetColor32().red;
uint8 gB = fHighColor.GetColor32().green;
uint8 bB = fHighColor.GetColor32().blue;
uint8 rB = fHighColor.red;
uint8 gB = fHighColor.green;
uint8 bB = fHighColor.blue;
for (int32 i = 0; i < 256; i++) {
// NOTE: rgb is twisted around, since this is

View File

@ -12,7 +12,6 @@
#include <stdio.h>
#include <string.h>
#include <GraphicsDefs.h>
#include "RGBColor.h"
class Pattern {
public:
@ -95,25 +94,19 @@ class PatternHandler {
void SetPattern(const Pattern& p);
void SetPattern(const pattern& p);
void SetColors(const RGBColor& high, const RGBColor& low);
void SetHighColor(const RGBColor& color);
void SetLowColor(const RGBColor& color);
void SetColors(const rgb_color& high, const rgb_color& low);
void SetColors(const rgb_color& high,
const rgb_color& low);
void SetHighColor(const rgb_color& color);
void SetLowColor(const rgb_color& color);
RGBColor HighColor() const
rgb_color HighColor() const
{ return fHighColor; }
RGBColor LowColor() const
rgb_color LowColor() const
{ return fLowColor; }
RGBColor ColorAt(const BPoint& pt) const;
RGBColor ColorAt(float x, float y) const;
inline RGBColor ColorAt(int x, int y) const;
// TODO: any ideas for a better name of the rgb_color version of this function?
inline rgb_color R5ColorAt(int x, int y) const;
rgb_color ColorAt(const BPoint& pt) const;
rgb_color ColorAt(float x, float y) const;
inline rgb_color ColorAt(int x, int y) const;
bool IsHighColor(const BPoint& pt) const;
inline bool IsHighColor(int x, int y) const;
@ -137,8 +130,8 @@ class PatternHandler {
private:
Pattern fPattern;
RGBColor fHighColor;
RGBColor fLowColor;
rgb_color fHighColor;
rgb_color fLowColor;
uint16 fXOffset;
uint16 fYOffset;
@ -153,31 +146,19 @@ class PatternHandler {
\param y Y coordinate to get the color for
\return Color for the coordinates
*/
inline RGBColor
inline rgb_color
PatternHandler::ColorAt(int x, int y) const
{
return IsHighColor(x, y) ? fHighColor : fLowColor;
}
/*!
\brief Obtains the color in the pattern at the specified coordinates
\param x X coordinate to get the color for
\param y Y coordinate to get the color for
\return Color for the coordinates
*/
inline rgb_color
PatternHandler::R5ColorAt(int x, int y) const
{
return IsHighColor(x, y) ? fHighColor.GetColor32() : fLowColor.GetColor32();
}
/*!
\brief Obtains the value of the pattern at the specified coordinates
\param pt Coordinates to get the value for
\return Value for the coordinates - true if high, false if low.
*/
inline bool
inline bool
PatternHandler::IsHighColor(int x, int y) const
{
x -= fXOffset;