summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 20:20:05 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 20:20:05 +0000
commit55a0ffd864ee04c0b76cbed90cb7f00aabed1192 (patch)
tree273b8b46bdd8b2fd7974d6f93802f9fa5fbbd79b
parent4fa172e6dbd06f6e2c09d51ce4c7cfd9bb2def89 (diff)
downloadchromium_src-55a0ffd864ee04c0b76cbed90cb7f00aabed1192.zip
chromium_src-55a0ffd864ee04c0b76cbed90cb7f00aabed1192.tar.gz
chromium_src-55a0ffd864ee04c0b76cbed90cb7f00aabed1192.tar.bz2
Convert FillRect(... SkPaint) to DrawRect() since it doesn't necessarily fill, it just draws with the provided paint.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3165032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56589 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/tabs/tab.cc2
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc3
-rw-r--r--gfx/canvas.h8
-rw-r--r--gfx/canvas_direct2d.cc10
-rw-r--r--gfx/canvas_direct2d.h2
-rw-r--r--gfx/canvas_skia.cc24
-rw-r--r--gfx/canvas_skia.h2
-rw-r--r--gfx/canvas_skia_win.cc5
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc2
9 files changed, 29 insertions, 29 deletions
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 974be4a..7a0ba17 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -418,7 +418,7 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) {
SkShader::kClamp_TileMode);
paint.setShader(shader);
shader->unref();
- hover_canvas.FillRectInt(x - radius, -radius, radius * 2, radius * 2, paint);
+ hover_canvas.DrawRectInt(x - radius, -radius, radius * 2, radius * 2, paint);
// Draw the radial gradient clipped to the background into hover_image.
SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap(
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index b46bbcac..adb1d6a 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -335,8 +335,7 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) {
paint.setColor(SkColorSetARGB(200, 255, 255, 255));
paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
paint.setStyle(SkPaint::kFill_Style);
- canvas->FillRectInt(
- 0, 0, width(),
+ canvas->DrawRectInt(0, 0, width(),
height() - 2, // Visible region that overlaps the toolbar.
paint);
}
diff --git a/gfx/canvas.h b/gfx/canvas.h
index 70892b4..077a8a2 100644
--- a/gfx/canvas.h
+++ b/gfx/canvas.h
@@ -97,10 +97,6 @@ class Canvas {
// See scale() for specifics.
virtual void ScaleInt(int x, int y) = 0;
- // Fills the given rectangle with the given paint's parameters.
- virtual void FillRectInt(int x, int y, int w, int h,
- const SkPaint& paint) = 0;
-
// Fills the specified region with the specified color using a transfer
// mode of SkXfermode::kSrcOver_Mode.
virtual void FillRectInt(const SkColor& color,
@@ -125,6 +121,10 @@ class Canvas {
int x, int y, int w, int h,
SkXfermode::Mode mode) = 0;
+ // Draws the given rectangle with the given paint's parameters.
+ virtual void DrawRectInt(int x, int y, int w, int h,
+ const SkPaint& paint) = 0;
+
// Draws a single pixel line with the specified color.
virtual void DrawLineInt(const SkColor& color,
int x1, int y1,
diff --git a/gfx/canvas_direct2d.cc b/gfx/canvas_direct2d.cc
index 0908802..3dfcc851 100644
--- a/gfx/canvas_direct2d.cc
+++ b/gfx/canvas_direct2d.cc
@@ -202,11 +202,6 @@ void CanvasDirect2D::ScaleInt(int x, int y) {
rt_->SetTransform(transform);
}
-void CanvasDirect2D::FillRectInt(int x, int y, int w, int h,
- const SkPaint& paint) {
- NOTIMPLEMENTED();
-}
-
void CanvasDirect2D::FillRectInt(const SkColor& color,
int x, int y, int w, int h) {
ScopedComPtr<ID2D1SolidColorBrush> solid_brush;
@@ -233,6 +228,11 @@ void CanvasDirect2D::DrawRectInt(const SkColor& color,
NOTIMPLEMENTED();
}
+void CanvasDirect2D::DrawRectInt(int x, int y, int w, int h,
+ const SkPaint& paint) {
+ NOTIMPLEMENTED();
+}
+
void CanvasDirect2D::DrawLineInt(const SkColor& color,
int x1, int y1,
int x2, int y2) {
diff --git a/gfx/canvas_direct2d.h b/gfx/canvas_direct2d.h
index 61025d9..f7f0019 100644
--- a/gfx/canvas_direct2d.h
+++ b/gfx/canvas_direct2d.h
@@ -32,13 +32,13 @@ class CanvasDirect2D : public Canvas {
virtual bool ClipRectInt(int x, int y, int w, int h);
virtual void TranslateInt(int x, int y);
virtual void ScaleInt(int x, int y);
- virtual void FillRectInt(int x, int y, int w, int h, const SkPaint& paint);
virtual void FillRectInt(const SkColor& color, int x, int y, int w, int h);
virtual void FillRectInt(const gfx::Brush* brush, int x, int y, int w, int h);
virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h);
virtual void DrawRectInt(const SkColor& color,
int x, int y, int w, int h,
SkXfermode::Mode mode);
+ virtual void DrawRectInt(int x, int y, int w, int h, const SkPaint& paint);
virtual void DrawLineInt(const SkColor& color,
int x1, int y1,
int x2, int y2);
diff --git a/gfx/canvas_skia.cc b/gfx/canvas_skia.cc
index c15b2e5..dbf5d3a 100644
--- a/gfx/canvas_skia.cc
+++ b/gfx/canvas_skia.cc
@@ -109,7 +109,7 @@ void CanvasSkia::FillRectInt(const SkColor& color, int x, int y, int w, int h) {
paint.setColor(color);
paint.setStyle(SkPaint::kFill_Style);
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
- FillRectInt(x, y, w, h, paint);
+ DrawRectInt(x, y, w, h, paint);
}
void CanvasSkia::FillRectInt(const gfx::Brush* brush,
@@ -118,12 +118,7 @@ void CanvasSkia::FillRectInt(const gfx::Brush* brush,
SkPaint paint;
paint.setShader(shader->shader());
// TODO(beng): set shader transform to match canvas transform.
- FillRectInt(x, y, w, h, paint);
-}
-
-void CanvasSkia::FillRectInt(int x, int y, int w, int h, const SkPaint& paint) {
- SkIRect rc = {x, y, x + w, y + h};
- drawIRect(rc, paint);
+ DrawRectInt(x, y, w, h, paint);
}
void CanvasSkia::DrawRectInt(const SkColor& color, int x, int y, int w, int h) {
@@ -142,7 +137,12 @@ void CanvasSkia::DrawRectInt(const SkColor& color,
paint.setStrokeWidth(SkIntToScalar(0));
paint.setXfermodeMode(mode);
- FillRectInt(x, y, w, h, paint);
+ DrawRectInt(x, y, w, h, paint);
+}
+
+void CanvasSkia::DrawRectInt(int x, int y, int w, int h, const SkPaint& paint) {
+ SkIRect rc = { x, y, x + w, y + h };
+ drawIRect(rc, paint);
}
void CanvasSkia::DrawLineInt(const SkColor& color,
@@ -193,10 +193,10 @@ void CanvasSkia::DrawFocusRect(int x, int y, int width, int height) {
paint.setShader(shader);
shader->unref();
- FillRectInt(x, y, width, 1, paint);
- FillRectInt(x, y + height - 1, width, 1, paint);
- FillRectInt(x, y, 1, height, paint);
- FillRectInt(x + width - 1, y, 1, height, paint);
+ DrawRectInt(x, y, width, 1, paint);
+ DrawRectInt(x, y + height - 1, width, 1, paint);
+ DrawRectInt(x, y, 1, height, paint);
+ DrawRectInt(x + width - 1, y, 1, height, paint);
}
void CanvasSkia::DrawBitmapInt(const SkBitmap& bitmap, int x, int y) {
diff --git a/gfx/canvas_skia.h b/gfx/canvas_skia.h
index 457fa23..27781ff 100644
--- a/gfx/canvas_skia.h
+++ b/gfx/canvas_skia.h
@@ -91,13 +91,13 @@ class CanvasSkia : public skia::PlatformCanvas,
virtual bool ClipRectInt(int x, int y, int w, int h);
virtual void TranslateInt(int x, int y);
virtual void ScaleInt(int x, int y);
- virtual void FillRectInt(int x, int y, int w, int h, const SkPaint& paint);
virtual void FillRectInt(const SkColor& color, int x, int y, int w, int h);
virtual void FillRectInt(const gfx::Brush* brush, int x, int y, int w, int h);
virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h);
virtual void DrawRectInt(const SkColor& color,
int x, int y, int w, int h,
SkXfermode::Mode mode);
+ virtual void DrawRectInt(int x, int y, int w, int h, const SkPaint& paint);
virtual void DrawLineInt(const SkColor& color,
int x1, int y1,
int x2, int y2);
diff --git a/gfx/canvas_skia_win.cc b/gfx/canvas_skia_win.cc
index 46fe2c6..1a65da0 100644
--- a/gfx/canvas_skia_win.cc
+++ b/gfx/canvas_skia_win.cc
@@ -227,7 +227,8 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
// pixel against both the halo color and transparent since DrawStringWithHalo
// will modify the bitmap as it goes, and clears pixels shouldn't count as
// changed.
-static bool pixelShouldGetHalo(const SkBitmap& bitmap, int x, int y,
+static bool pixelShouldGetHalo(const SkBitmap& bitmap,
+ int x, int y,
SkColor halo_color) {
if (x > 0 &&
*bitmap.getAddr32(x - 1, y) != halo_color &&
@@ -263,7 +264,7 @@ void CanvasSkia::DrawStringWithHalo(const std::wstring& text,
CanvasSkia text_canvas(w + 2, h + 2, true);
SkPaint bkgnd_paint;
bkgnd_paint.setColor(halo_color);
- text_canvas.FillRectInt(0, 0, w + 2, h + 2, bkgnd_paint);
+ text_canvas.DrawRectInt(0, 0, w + 2, h + 2, bkgnd_paint);
// Draw the text into the temporary buffer. This will have correct
// ClearType since the background color is the same as the halo color.
diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc
index a88f0a4..ff7ff22 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -217,7 +217,7 @@ void MenuScrollViewContainer::PaintBackground(gfx::Canvas* canvas) {
paint.setStyle(SkPaint::kFill_Style);
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
- canvas->FillRectInt(0, 0, width(), height(), paint);
+ canvas->DrawRectInt(0, 0, width(), height(), paint);
#else
// This is the same as COLOR_TOOLBAR.
canvas->AsCanvasSkia()->drawColor(SkColorSetRGB(210, 225, 246),