diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 19:48:32 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 19:48:32 +0000 |
commit | 0539e6bcb121262b0baebf63628b8968bf893a6d (patch) | |
tree | b579cfe529410604b7b3faadc4390deac02c02df /gfx/canvas_direct2d.cc | |
parent | 1f18184a07252103a8cd9652d64de749f41ef09f (diff) | |
download | chromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.zip chromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.tar.gz chromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.tar.bz2 |
Fix transforms to be preconcat like skia so multiple transforms are accumulated with each call to TranslateInt/ScaleInt.
BUG=none
TEST=see unittest
Review URL: http://codereview.chromium.org/3025010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx/canvas_direct2d.cc')
-rw-r--r-- | gfx/canvas_direct2d.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gfx/canvas_direct2d.cc b/gfx/canvas_direct2d.cc index e69de1d..b187455 100644 --- a/gfx/canvas_direct2d.cc +++ b/gfx/canvas_direct2d.cc @@ -117,13 +117,23 @@ bool CanvasDirect2D::ClipRectInt(int x, int y, int w, int h) { } void CanvasDirect2D::TranslateInt(int x, int y) { - rt_->SetTransform(D2D1::Matrix3x2F::Translation(static_cast<float>(x), - static_cast<float>(y))); + D2D1_MATRIX_3X2_F raw; + rt_->GetTransform(&raw); + D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, + raw._32); + transform = D2D1::Matrix3x2F::Translation(static_cast<float>(x), + static_cast<float>(y)) * transform; + rt_->SetTransform(transform); } void CanvasDirect2D::ScaleInt(int x, int y) { - rt_->SetTransform(D2D1::Matrix3x2F::Scale(static_cast<float>(x), - static_cast<float>(y))); + D2D1_MATRIX_3X2_F raw; + rt_->GetTransform(&raw); + D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, + raw._32); + transform = D2D1::Matrix3x2F::Scale(static_cast<float>(x), + static_cast<float>(y)) * transform; + rt_->SetTransform(transform); } void CanvasDirect2D::FillRectInt(int x, int y, int w, int h, |