summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 14:41:48 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 14:41:48 +0000
commit74eb4ceef0aee9d59839816800016a150a8e446f (patch)
treedb94ce77b2f3b4b4f51afde29b8568eebf98946b /chrome
parent21492d0f5961a2d428156d160280608b04f4a01c (diff)
downloadchromium_src-74eb4ceef0aee9d59839816800016a150a8e446f.zip
chromium_src-74eb4ceef0aee9d59839816800016a150a8e446f.tar.gz
chromium_src-74eb4ceef0aee9d59839816800016a150a8e446f.tar.bz2
Fixes regression in painting info bubble. This is the result of
changes to DrawRectInt. Previously a width/height of 0 was treated as a 1 pixel line, where as now nothing gets drawn. I've special cased this again. BUG=9931 TEST=see bug Review URL: http://codereview.chromium.org/67149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/info_bubble.cc19
-rw-r--r--chrome/common/gfx/chrome_canvas.cc9
-rw-r--r--chrome/common/gfx/chrome_canvas.h11
3 files changed, 28 insertions, 11 deletions
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 9e52842..b7ad3cb 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -360,23 +360,24 @@ void InfoBubble::ContentView::Paint(ChromeCanvas* canvas) {
// Draw the border.
// Top border.
- canvas->DrawRectInt(kBorderColor1,
+ canvas->DrawLineInt(kBorderColor1,
kInfoBubbleCornerWidth, bubble_y,
- border_w,
- 0);
+ kInfoBubbleCornerWidth + border_w, bubble_y);
// Bottom border.
- canvas->DrawRectInt(kBorderColor1,
+ canvas->DrawLineInt(kBorderColor1,
kInfoBubbleCornerWidth, bubble_y + bubble_h - 1,
- border_w, 0);
+ kInfoBubbleCornerWidth + border_w,
+ bubble_y + bubble_h - 1);
// Left border.
- canvas->DrawRectInt(kBorderColor1,
+ canvas->DrawLineInt(kBorderColor1,
bubble_x, bubble_y + kInfoBubbleCornerHeight,
- 0, border_h);
+ bubble_x, bubble_y + kInfoBubbleCornerHeight + border_h);
// Right border.
- canvas->DrawRectInt(kBorderColor1,
+ canvas->DrawLineInt(kBorderColor1,
width() - 1, bubble_y + kInfoBubbleCornerHeight,
- 0, border_h);
+ width() - 1,
+ bubble_y + kInfoBubbleCornerHeight + border_h);
// Draw the corners.
canvas->DrawBitmapInt(*kInfoBubbleCornerTopLeft, 0, bubble_y);
diff --git a/chrome/common/gfx/chrome_canvas.cc b/chrome/common/gfx/chrome_canvas.cc
index ce9354f..23bc1c9 100644
--- a/chrome/common/gfx/chrome_canvas.cc
+++ b/chrome/common/gfx/chrome_canvas.cc
@@ -83,6 +83,15 @@ void ChromeCanvas::DrawRectInt(const SkColor& color,
drawIRect(rc, paint);
}
+void ChromeCanvas::DrawLineInt(const SkColor& color,
+ int x1, int y1, int x2, int y2) {
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setStrokeWidth(SkIntToScalar(1));
+ drawLine(SkIntToScalar(x1), SkIntToScalar(y1), SkIntToScalar(x2),
+ SkIntToScalar(y2), paint);
+}
+
void ChromeCanvas::DrawFocusRect(int x, int y, int width, int height) {
// Create a 2D bitmap containing alternating on/off pixels - we do this
// so that you never get two pixels of the same color around the edges
diff --git a/chrome/common/gfx/chrome_canvas.h b/chrome/common/gfx/chrome_canvas.h
index 84671f1..cfb0c28 100644
--- a/chrome/common/gfx/chrome_canvas.h
+++ b/chrome/common/gfx/chrome_canvas.h
@@ -96,15 +96,22 @@ class ChromeCanvas : public skia::PlatformCanvas {
// mode of SkPorterDuff::kSrcOver_Mode.
void FillRectInt(const SkColor& color, int x, int y, int w, int h);
- // Draws a single pixel line in the specified region with the specified
+ // Draws a single pixel rect in the specified region with the specified
// color, using a transfer mode of SkPorterDuff::kSrcOver_Mode.
+ //
+ // NOTE: if you need a single pixel line, use DraLineInt.
void DrawRectInt(const SkColor& color, int x, int y, int w, int h);
- // Draws a single pixel line in the specified region with the specified
+ // Draws a single pixel rect in the specified region with the specified
// color and transfer mode.
+ //
+ // NOTE: if you need a single pixel line, use DraLineInt.
void DrawRectInt(const SkColor& color, int x, int y, int w, int h,
SkPorterDuff::Mode mode);
+ // Draws a single pixel line with the specified color.
+ void DrawLineInt(const SkColor& color, int x1, int y1, int x2, int y2);
+
// Draws a bitmap with the origin at the specified location. The upper left
// corner of the bitmap is rendered at the specified location.
void DrawBitmapInt(const SkBitmap& bitmap, int x, int y);