From ae760dca3c69caf48418c00d042df9969db3581c Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Wed, 21 Jan 2009 01:05:25 +0000 Subject: Fix some problems with scaled icons. This allows the TabIconView to automatically scale the throbber and favicon to whatever size the View itself is. Notably, this does NOT change tab_renderer.cc, which _also_ draws favicons -- the former is used by app windows and the latter by standard tabs. Argh! I'm not going to bother unifying these for now even though it'd be nice, since we never scale up our tabs, just our app titlebars. BUG=5054 Review URL: http://codereview.chromium.org/18392 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8348 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/gfx/chrome_canvas.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'chrome/common/gfx') diff --git a/chrome/common/gfx/chrome_canvas.cc b/chrome/common/gfx/chrome_canvas.cc index 6734fda..66c9c66 100644 --- a/chrome/common/gfx/chrome_canvas.cc +++ b/chrome/common/gfx/chrome_canvas.cc @@ -189,11 +189,10 @@ void ChromeCanvas::DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); SkMatrix shader_scale; - shader_scale.setScale( - SkFloatToScalar(static_cast(dest_w) / src_w), - SkFloatToScalar(static_cast(dest_h) / src_h)); - shader_scale.postTranslate(SkIntToScalar(dest_x - src_x), - SkIntToScalar(dest_y - src_y)); + shader_scale.setScale(SkFloatToScalar(static_cast(dest_w) / src_w), + SkFloatToScalar(static_cast(dest_h) / src_h)); + shader_scale.preTranslate(SkIntToScalar(-src_x), SkIntToScalar(-src_y)); + shader_scale.postTranslate(SkIntToScalar(dest_x), SkIntToScalar(dest_y)); shader->setLocalMatrix(shader_scale); // Set up our paint to use the shader & release our reference (now just owned -- cgit v1.1