* Renamed the drawing functions in DrawingEngine to

remove the *Gradient part. In general, there is
  a lot of code duplication now, also in Painter. I
  will need to find a way to elliminate this again.
  Also, all the stroking functions should be gradient
  enabled as well.
* Improved the look of the DefaultDecorater, inspired
  by the patch from Dennis Washington. I did not adopt
  the changes which give backwards compatibility
  problems, though, like changing the window border
  width or the single border decorator color. But I
  reckon these changes are overall even a bit smoother.
* Fixed a long standing decorator bug, where the resize
  area of the border was visually different than the
  click recognition.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28951 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-01-19 10:31:43 +00:00
parent 82fcd4339f
commit ce5d64725d
4 changed files with 102 additions and 88 deletions
+57 -51
View File
@@ -23,6 +23,7 @@
#include <WindowPrivate.h> #include <WindowPrivate.h>
#include <Autolock.h> #include <Autolock.h>
#include <GradientLinear.h>
#include <Rect.h> #include <Rect.h>
#include <View.h> #include <View.h>
@@ -94,15 +95,16 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
// common colors to both focus and non focus state // common colors to both focus and non focus state
fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 }; fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[1] = (rgb_color){ 255, 255, 255, 255 }; fFrameColors[1] = (rgb_color){ 240, 240, 240, 255 };
fFrameColors[4] = (rgb_color){ 152, 152, 152, 255 }; fFrameColors[4] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[5] = (rgb_color){ 96, 96, 96, 255 }; fFrameColors[5] = (rgb_color){ 124, 124, 124, 255 };
// state based colors // state based colors
fFocusFrameColors[0] = (rgb_color){ 216, 216, 216, 255 }; fFocusFrameColors[0] = (rgb_color){ 224, 224, 224, 255 };
fFocusFrameColors[1] = (rgb_color){ 136, 136, 136, 255 }; fFocusFrameColors[1] = (rgb_color){ 208, 208, 208, 255 };
fNonFocusFrameColors[0] = (rgb_color){ 232, 232, 232, 255 }; fNonFocusFrameColors[0] = (rgb_color){ 232, 232, 232, 255 };
fNonFocusFrameColors[1] = (rgb_color){ 148, 148, 148, 255 }; fNonFocusFrameColors[1] = (rgb_color){ 216, 216, 216, 255 };
fNonFocusFrameColors[1] = fNonFocusFrameColors[0];
fFocusTabColor = UIColor(B_WINDOW_TAB_COLOR); fFocusTabColor = UIColor(B_WINDOW_TAB_COLOR);
fFocusTextColor = UIColor(B_WINDOW_TEXT_COLOR); fFocusTextColor = UIColor(B_WINDOW_TEXT_COLOR);
@@ -583,8 +585,8 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|| fLook == B_FLOATING_WINDOW_LOOK || fLook == B_FLOATING_WINDOW_LOOK
|| fLook == B_MODAL_WINDOW_LOOK || fLook == B_MODAL_WINDOW_LOOK
|| fLook == kLeftTitledWindowLook)) { || fLook == kLeftTitledWindowLook)) {
BRect temp(BPoint(fBottomBorder.right - 18, BRect temp(BPoint(fBottomBorder.right - 22,
fBottomBorder.bottom - 18), fBottomBorder.RightBottom()); fBottomBorder.bottom - 22), fBottomBorder.RightBottom());
if (temp.Contains(point)) if (temp.Contains(point))
return DEC_RESIZE; return DEC_RESIZE;
} }
@@ -896,8 +898,16 @@ DefaultDecorator::_DrawFrame(BRect invalid)
float x = r.right - 3; float x = r.right - 3;
float y = r.bottom - 3; float y = r.bottom - 3;
fDrawingEngine->FillRect(BRect(x - 13, y - 13, x, y), BRect bg(x - 13, y - 13, x, y);
fFrameColors[2]);
BGradientLinear gradient;
gradient.SetStart(bg.LeftTop());
gradient.SetEnd(bg.RightBottom());
gradient.AddColor(fFrameColors[1], 0);
gradient.AddColor(fFrameColors[2], 255);
fDrawingEngine->FillRect(bg, gradient);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15), fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
BPoint(x - 15, y - 2), fFrameColors[0]); BPoint(x - 15, y - 2), fFrameColors[0]);
fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14), fDrawingEngine->StrokeLine(BPoint(x - 14, y - 14),
@@ -910,12 +920,14 @@ DefaultDecorator::_DrawFrame(BRect invalid)
if (!IsFocus()) if (!IsFocus())
break; break;
static const rgb_color kWhite
= (rgb_color){ 255, 255, 255, 255 };
for (int8 i = 1; i <= 4; i++) { for (int8 i = 1; i <= 4; i++) {
for (int8 j = 1; j <= i; j++) { for (int8 j = 1; j <= i; j++) {
BPoint pt1(x - (3 * j) + 1, y - (3 * (5 - i)) + 1); BPoint pt1(x - (3 * j) + 1, y - (3 * (5 - i)) + 1);
BPoint pt2(x - (3 * j) + 2, y - (3 * (5 - i)) + 2); BPoint pt2(x - (3 * j) + 2, y - (3 * (5 - i)) + 2);
fDrawingEngine->StrokePoint(pt1, fFrameColors[0]); fDrawingEngine->StrokePoint(pt1, fFrameColors[0]);
fDrawingEngine->StrokePoint(pt2, fFrameColors[1]); fDrawingEngine->StrokePoint(pt2, kWhite);
} }
} }
break; break;
@@ -993,12 +1005,19 @@ DefaultDecorator::_DrawTab(BRect invalid)
} }
// fill // fill
BGradientLinear gradient;
gradient.SetStart(fTabRect.LeftTop());
gradient.AddColor(fTabColorLight, 0);
gradient.AddColor(fTabColor, 255);
if (fLook != kLeftTitledWindowLook) { if (fLook != kLeftTitledWindowLook) {
gradient.SetEnd(fTabRect.LeftBottom());
fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2, fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2,
fTabRect.right - 2, fTabRect.bottom), fTabColor); fTabRect.right - 2, fTabRect.bottom), gradient);
} else { } else {
gradient.SetEnd(fTabRect.RightTop());
fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2, fDrawingEngine->FillRect(BRect(fTabRect.left + 2, fTabRect.top + 2,
fTabRect.right, fTabRect.bottom - 2), fTabColor); fTabRect.right, fTabRect.bottom - 2), gradient);
} }
_DrawTitle(fTabRect); _DrawTitle(fTabRect);
@@ -1034,8 +1053,8 @@ DefaultDecorator::_DrawTitle(BRect r)
{ {
STRACE(("_DrawTitle(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom)); STRACE(("_DrawTitle(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom));
fDrawingEngine->SetDrawingMode(B_OP_OVER);
fDrawingEngine->SetHighColor(fTextColor); fDrawingEngine->SetHighColor(fTextColor);
fDrawingEngine->SetLowColor(fTabColor);
fDrawingEngine->SetFont(fDrawState.Font()); fDrawingEngine->SetFont(fDrawState.Font());
// figure out position of text // figure out position of text
@@ -1059,6 +1078,8 @@ DefaultDecorator::_DrawTitle(BRect r)
fDrawingEngine->DrawString(fTruncatedTitle.String(), fTruncatedTitleLength, fDrawingEngine->DrawString(fTruncatedTitle.String(), fTruncatedTitleLength,
titlePos); titlePos);
fDrawingEngine->SetDrawingMode(B_OP_COPY);
} }
@@ -1102,9 +1123,9 @@ DefaultDecorator::_SetFocus()
fButtonFocus = false; fButtonFocus = false;
} }
fTabColorLight = tint_color(fTabColor, fTabColorLight = tint_color(fTabColor, B_LIGHTEN_2_TINT);
fTabColorShadow = tint_color(fTabColor,
(B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2); (B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2);
fTabColorShadow = tint_color(fTabColor, B_DARKEN_2_TINT);
} }
@@ -1138,12 +1159,12 @@ DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
if (bitmap == NULL) if (bitmap == NULL)
return; return;
// TODO: find out why locking sometimes deadlocks here and re-add locking
// once the problem is fixed (or remove this comment if locking isn't
// necessary at all...)
bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled(); bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled();
fDrawingEngine->SetCopyToFrontEnabled(true); fDrawingEngine->SetCopyToFrontEnabled(true);
drawing_mode oldMode;
fDrawingEngine->SetDrawingMode(B_OP_OVER, oldMode);
fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect); fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect);
fDrawingEngine->SetDrawingMode(oldMode);
fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled); fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled);
} }
@@ -1156,46 +1177,30 @@ void
DefaultDecorator::_DrawBlendedRect(DrawingEngine* engine, BRect rect, DefaultDecorator::_DrawBlendedRect(DrawingEngine* engine, BRect rect,
bool down, bool focus) bool down, bool focus)
{ {
// Actually just draws a blended square // figure out which colors to use
int32 width = rect.IntegerWidth();
int32 height = rect.IntegerHeight();
int32 steps = width < height ? width : height;
rgb_color startColor, endColor; rgb_color startColor, endColor;
rgb_color tabColor = focus ? fFocusTabColor : fNonFocusTabColor; rgb_color tabColor = focus ? fFocusTabColor : fNonFocusTabColor;
if (down) { if (down) {
startColor = tint_color(tabColor, B_DARKEN_1_TINT); startColor = tint_color(tabColor, B_DARKEN_1_TINT);
endColor = tint_color(tabColor, B_LIGHTEN_2_TINT);; endColor = tint_color(tabColor, B_LIGHTEN_2_TINT);
} else { } else {
startColor = tint_color(tabColor, B_LIGHTEN_2_TINT); startColor = tint_color(tabColor, B_LIGHTEN_MAX_TINT);
endColor = tint_color(tabColor, B_DARKEN_1_TINT); endColor = tabColor;
} }
rgb_color halfColor = make_blend_color(startColor, endColor, 0.5); // fill
rect.InsetBy(1, 1);
BGradientLinear gradient;
gradient.SetStart(rect.LeftTop());
gradient.SetEnd(rect.RightBottom());
gradient.AddColor(startColor, 0);
gradient.AddColor(endColor, 255);
float rstep = float(startColor.red - halfColor.red) / steps; engine->FillRect(rect, gradient);
float gstep = float(startColor.green - halfColor.green) / steps;
float bstep = float(startColor.blue - halfColor.blue) / steps;
rgb_color tempColor; // outline
for (int32 i = 0; i <= steps; i++) { rect.InsetBy(-1, -1);
tempColor.red = uint8(startColor.red - (i * rstep)); engine->StrokeRect(rect, tint_color(tabColor, B_DARKEN_2_TINT));
tempColor.green = uint8(startColor.green - (i * gstep));
tempColor.blue = uint8(startColor.blue - (i * bstep));
engine->StrokeLine(BPoint(rect.left, rect.top + i),
BPoint(rect.left + i, rect.top), tempColor);
tempColor.red = uint8(halfColor.red - (i * rstep));
tempColor.green = uint8(halfColor.green - (i * gstep));
tempColor.blue = uint8(halfColor.blue - (i * bstep));
engine->StrokeLine(BPoint(rect.left + steps, rect.top + i),
BPoint(rect.left + i, rect.top + steps), tempColor);
}
engine->StrokeRect(rect,
focus ? fFocusFrameColors[1] : fNonFocusFrameColors[1]);
} }
@@ -1311,8 +1316,6 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
return NULL; return NULL;
BRect rect(0, 0, width - 1, height - 1); BRect rect(0, 0, width - 1, height - 1);
sBitmapDrawingEngine->FillRect(rect,
focus ? object->fFocusTabColor : object->fNonFocusTabColor);
STRACE(("DefaultDecorator creating bitmap for %s %sfocus %s at size %ldx%ld\n", STRACE(("DefaultDecorator creating bitmap for %s %sfocus %s at size %ldx%ld\n",
item == DEC_CLOSE ? "close" : "zoom", focus ? "" : "non-", item == DEC_CLOSE ? "close" : "zoom", focus ? "" : "non-",
@@ -1324,6 +1327,9 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
case DEC_ZOOM: case DEC_ZOOM:
{ {
// init the background
sBitmapDrawingEngine->FillRect(rect, B_TRANSPARENT_COLOR);
float inset = floorf(width / 4.0); float inset = floorf(width / 4.0);
BRect zoomRect(rect); BRect zoomRect(rect);
zoomRect.left += inset; zoomRect.left += inset;
+9 -9
View File
@@ -2363,7 +2363,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&rect); fCurrentView->ConvertToScreenForDrawing(&rect);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillRectGradient(rect, *gradient); drawingEngine->FillRect(rect, *gradient);
break; break;
} }
case AS_VIEW_DRAW_BITMAP: case AS_VIEW_DRAW_BITMAP:
@@ -2437,7 +2437,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
break; break;
fCurrentView->ConvertToScreenForDrawing(&r); fCurrentView->ConvertToScreenForDrawing(&r);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillArcGradient(r, angle, span, *gradient); drawingEngine->FillArc(r, angle, span, *gradient);
break; break;
} }
case AS_STROKE_BEZIER: case AS_STROKE_BEZIER:
@@ -2472,7 +2472,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
if (link.ReadGradient(&gradient) != B_OK) if (link.ReadGradient(&gradient) != B_OK)
break; break;
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillBezierGradient(pts, *gradient); drawingEngine->FillBezier(pts, *gradient);
break; break;
} }
case AS_STROKE_ELLIPSE: case AS_STROKE_ELLIPSE:
@@ -2501,7 +2501,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
break; break;
fCurrentView->ConvertToScreenForDrawing(&rect); fCurrentView->ConvertToScreenForDrawing(&rect);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillEllipseGradient(rect, *gradient); drawingEngine->FillEllipse(rect, *gradient);
break; break;
} }
case AS_STROKE_ROUNDRECT: case AS_STROKE_ROUNDRECT:
@@ -2537,7 +2537,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
break; break;
fCurrentView->ConvertToScreenForDrawing(&rect); fCurrentView->ConvertToScreenForDrawing(&rect);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillRoundRectGradient(rect, xrad, yrad, *gradient); drawingEngine->FillRoundRect(rect, xrad, yrad, *gradient);
break; break;
} }
case AS_STROKE_TRIANGLE: case AS_STROKE_TRIANGLE:
@@ -2578,7 +2578,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
break; break;
fCurrentView->ConvertToScreenForDrawing(&rect); fCurrentView->ConvertToScreenForDrawing(&rect);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillTriangleGradient(pts, rect, *gradient); drawingEngine->FillTriangle(pts, rect, *gradient);
break; break;
} }
case AS_STROKE_POLYGON: case AS_STROKE_POLYGON:
@@ -2628,7 +2628,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&polyFrame); fCurrentView->ConvertToScreenForDrawing(&polyFrame);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillPolygonGradient(pointList, pointCount, drawingEngine->FillPolygon(pointList, pointCount,
polyFrame, *gradient, isClosed && pointCount > 2); polyFrame, *gradient, isClosed && pointCount > 2);
} }
delete[] pointList; delete[] pointList;
@@ -2699,7 +2699,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&ptList[i]); fCurrentView->ConvertToScreenForDrawing(&ptList[i]);
} }
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillShapeGradient(shapeFrame, opCount, opList, drawingEngine->FillShape(shapeFrame, opCount, opList,
ptCount, ptList, *gradient); ptCount, ptList, *gradient);
} }
@@ -2734,7 +2734,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
fCurrentView->ConvertToScreenForDrawing(&region); fCurrentView->ConvertToScreenForDrawing(&region);
fCurrentView->ConvertToScreenForDrawing(gradient); fCurrentView->ConvertToScreenForDrawing(gradient);
drawingEngine->FillRegionGradient(region, *gradient); drawingEngine->FillRegion(region, *gradient);
break; break;
} }
case AS_STROKE_LINEARRAY: case AS_STROKE_LINEARRAY:
+25 -16
View File
@@ -269,6 +269,14 @@ DrawingEngine::SetDrawingMode(drawing_mode mode)
} }
void
DrawingEngine::SetDrawingMode(drawing_mode mode, drawing_mode& oldMode)
{
oldMode = fPainter->DrawingMode();
fPainter->SetDrawingMode(mode);
}
void void
DrawingEngine::SetFont(const ServerFont& font) DrawingEngine::SetFont(const ServerFont& font)
{ {
@@ -611,9 +619,8 @@ DrawingEngine::DrawArc(BRect r, const float& angle, const float& span,
} }
} }
// FillArcGradient
void void
DrawingEngine::FillArcGradient(BRect r, const float& angle, const float& span, DrawingEngine::FillArc(BRect r, const float& angle, const float& span,
const BGradient& gradient) const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -639,7 +646,7 @@ DrawingEngine::FillArcGradient(BRect r, const float& angle, const float& span,
} }
} }
// DrawBezier
void void
DrawingEngine::DrawBezier(BPoint* pts, bool filled) DrawingEngine::DrawBezier(BPoint* pts, bool filled)
{ {
@@ -653,9 +660,9 @@ DrawingEngine::DrawBezier(BPoint* pts, bool filled)
_CopyToFront(touched); _CopyToFront(touched);
} }
// FillBezierGradient
void void
DrawingEngine::FillBezierGradient(BPoint* pts, const BGradient& gradient) DrawingEngine::FillBezier(BPoint* pts, const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -667,7 +674,7 @@ DrawingEngine::FillBezierGradient(BPoint* pts, const BGradient& gradient)
_CopyToFront(touched); _CopyToFront(touched);
} }
// DrawEllipse
void void
DrawingEngine::DrawEllipse(BRect r, bool filled) DrawingEngine::DrawEllipse(BRect r, bool filled)
{ {
@@ -696,9 +703,9 @@ DrawingEngine::DrawEllipse(BRect r, bool filled)
} }
} }
// FillEllipseGradient
void void
DrawingEngine::FillEllipseGradient(BRect r, const BGradient& gradient) DrawingEngine::FillEllipse(BRect r, const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -722,7 +729,7 @@ DrawingEngine::FillEllipseGradient(BRect r, const BGradient& gradient)
} }
} }
// DrawPolygon
void void
DrawingEngine::DrawPolygon(BPoint* ptlist, int32 numpts, BRect bounds, DrawingEngine::DrawPolygon(BPoint* ptlist, int32 numpts, BRect bounds,
bool filled, bool closed) bool filled, bool closed)
@@ -742,9 +749,9 @@ DrawingEngine::DrawPolygon(BPoint* ptlist, int32 numpts, BRect bounds,
} }
} }
// FillPolygonGradient
void void
DrawingEngine::FillPolygonGradient(BPoint* ptlist, int32 numpts, BRect bounds, DrawingEngine::FillPolygon(BPoint* ptlist, int32 numpts, BRect bounds,
const BGradient& gradient, bool closed) const BGradient& gradient, bool closed)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -760,8 +767,10 @@ DrawingEngine::FillPolygonGradient(BPoint* ptlist, int32 numpts, BRect bounds,
} }
} }
// #pragma mark - rgb_color // #pragma mark - rgb_color
void void
DrawingEngine::StrokePoint(const BPoint& pt, const rgb_color& color) DrawingEngine::StrokePoint(const BPoint& pt, const rgb_color& color)
{ {
@@ -959,7 +968,7 @@ DrawingEngine::FillRect(BRect r)
void void
DrawingEngine::FillRectGradient(BRect r, const BGradient& gradient) DrawingEngine::FillRect(BRect r, const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -1030,7 +1039,7 @@ DrawingEngine::FillRegion(BRegion& r)
void void
DrawingEngine::FillRegionGradient(BRegion& r, const BGradient& gradient) DrawingEngine::FillRegion(BRegion& r, const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -1077,7 +1086,7 @@ DrawingEngine::DrawRoundRect(BRect r, float xrad, float yrad, bool filled)
void void
DrawingEngine::FillRoundRectGradient(BRect r, float xrad, float yrad, DrawingEngine::FillRoundRect(BRect r, float xrad, float yrad,
const BGradient& gradient) const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
@@ -1121,7 +1130,7 @@ DrawingEngine::DrawShape(const BRect& bounds, int32 opCount,
void void
DrawingEngine::FillShapeGradient(const BRect& bounds, int32 opCount, DrawingEngine::FillShape(const BRect& bounds, int32 opCount,
const uint32* opList, int32 ptCount, const BPoint* ptList, const uint32* opList, int32 ptCount, const BPoint* ptList,
const BGradient& gradient) const BGradient& gradient)
{ {
@@ -1160,7 +1169,7 @@ DrawingEngine::DrawTriangle(BPoint* pts, const BRect& bounds, bool filled)
} }
void void
DrawingEngine::FillTriangleGradient(BPoint* pts, const BRect& bounds, DrawingEngine::FillTriangle(BPoint* pts, const BRect& bounds,
const BGradient& gradient) const BGradient& gradient)
{ {
CRASH_IF_NOT_LOCKED CRASH_IF_NOT_LOCKED
+11 -12
View File
@@ -79,6 +79,8 @@ public:
float miterLimit); float miterLimit);
void SetPattern(const struct pattern& pattern); void SetPattern(const struct pattern& pattern);
void SetDrawingMode(drawing_mode mode); void SetDrawingMode(drawing_mode mode);
void SetDrawingMode(drawing_mode mode,
drawing_mode& oldMode);
void SetBlendingMode(source_alpha srcAlpha, void SetBlendingMode(source_alpha srcAlpha,
alpha_function alphaFunc); alpha_function alphaFunc);
void SetFont(const ServerFont& font); void SetFont(const ServerFont& font);
@@ -100,20 +102,18 @@ public:
void DrawArc(BRect r, const float& angle, void DrawArc(BRect r, const float& angle,
const float& span, bool filled); const float& span, bool filled);
void FillArcGradient(BRect r, const float& angle, void FillArc(BRect r, const float& angle,
const float& span, const BGradient& gradient); const float& span, const BGradient& gradient);
void DrawBezier(BPoint* pts, bool filled); void DrawBezier(BPoint* pts, bool filled);
void FillBezierGradient(BPoint* pts, void FillBezier(BPoint* pts, const BGradient& gradient);
const BGradient& gradient);
void DrawEllipse(BRect r, bool filled); void DrawEllipse(BRect r, bool filled);
void FillEllipseGradient(BRect r, void FillEllipse(BRect r, const BGradient& gradient);
const BGradient& gradient);
void DrawPolygon(BPoint* ptlist, int32 numpts, void DrawPolygon(BPoint* ptlist, int32 numpts,
BRect bounds, bool filled, bool closed); BRect bounds, bool filled, bool closed);
void FillPolygonGradient(BPoint* ptlist, int32 numpts, void FillPolygon(BPoint* ptlist, int32 numpts,
BRect bounds, const BGradient& gradient, BRect bounds, const BGradient& gradient,
bool closed); bool closed);
@@ -126,29 +126,28 @@ public:
void StrokeRect(BRect r); void StrokeRect(BRect r);
void FillRect(BRect r); void FillRect(BRect r);
void FillRectGradient(BRect r, const BGradient& gradient); void FillRect(BRect r, const BGradient& gradient);
void FillRegion(BRegion& r); void FillRegion(BRegion& r);
void FillRegionGradient(BRegion& r, void FillRegion(BRegion& r, const BGradient& gradient);
const BGradient& gradient);
void DrawRoundRect(BRect r, float xrad, void DrawRoundRect(BRect r, float xrad,
float yrad, bool filled); float yrad, bool filled);
void FillRoundRectGradient(BRect r, float xrad, void FillRoundRect(BRect r, float xrad,
float yrad, const BGradient& gradient); float yrad, const BGradient& gradient);
void DrawShape(const BRect& bounds, void DrawShape(const BRect& bounds,
int32 opcount, const uint32* oplist, int32 opcount, const uint32* oplist,
int32 ptcount, const BPoint* ptlist, int32 ptcount, const BPoint* ptlist,
bool filled); bool filled);
void FillShapeGradient(const BRect& bounds, void FillShape(const BRect& bounds,
int32 opcount, const uint32* oplist, int32 opcount, const uint32* oplist,
int32 ptcount, const BPoint* ptlist, int32 ptcount, const BPoint* ptlist,
const BGradient& gradient); const BGradient& gradient);
void DrawTriangle(BPoint* pts, const BRect& bounds, void DrawTriangle(BPoint* pts, const BRect& bounds,
bool filled); bool filled);
void FillTriangleGradient(BPoint* pts, void FillTriangle(BPoint* pts,
const BRect& bounds, const BGradient& gradient); const BRect& bounds, const BGradient& gradient);
// this version used by Decorator // this version used by Decorator