summaryrefslogtreecommitdiffstats
path: root/chrome/common/gfx
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/common/gfx
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/common/gfx')
-rw-r--r--chrome/common/gfx/chrome_canvas.cc9
-rw-r--r--chrome/common/gfx/chrome_canvas.h11
2 files changed, 18 insertions, 2 deletions
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);