OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/canvas_direct2d.h" | 5 #include "ui/gfx/canvas_direct2d.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ui/gfx/brush.h" | 8 #include "ui/gfx/brush.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void CanvasDirect2D::Translate(const gfx::Point& point) { | 185 void CanvasDirect2D::Translate(const gfx::Point& point) { |
186 D2D1_MATRIX_3X2_F raw; | 186 D2D1_MATRIX_3X2_F raw; |
187 rt_->GetTransform(&raw); | 187 rt_->GetTransform(&raw); |
188 D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, | 188 D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, |
189 raw._32); | 189 raw._32); |
190 transform = D2D1::Matrix3x2F::Translation( | 190 transform = D2D1::Matrix3x2F::Translation( |
191 static_cast<float>(point.x()), static_cast<float>(point.y())) * transform; | 191 static_cast<float>(point.x()), static_cast<float>(point.y())) * transform; |
192 rt_->SetTransform(transform); | 192 rt_->SetTransform(transform); |
193 } | 193 } |
194 | 194 |
195 void CanvasDirect2D::ScaleInt(int x, int y) { | 195 void CanvasDirect2D::Scale(int x_scale, int y_scale) { |
196 D2D1_MATRIX_3X2_F raw; | 196 D2D1_MATRIX_3X2_F raw; |
197 rt_->GetTransform(&raw); | 197 rt_->GetTransform(&raw); |
198 D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, | 198 D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, |
199 raw._32); | 199 raw._32); |
200 transform = D2D1::Matrix3x2F::Scale(static_cast<float>(x), | 200 transform = D2D1::Matrix3x2F::Scale(static_cast<float>(x_scale), |
201 static_cast<float>(y)) * transform; | 201 static_cast<float>(y_scale)) * transform; |
202 rt_->SetTransform(transform); | 202 rt_->SetTransform(transform); |
203 } | 203 } |
204 | 204 |
205 void CanvasDirect2D::FillRectInt(const SkColor& color, | 205 void CanvasDirect2D::FillRectInt(const SkColor& color, |
206 int x, int y, int w, int h) { | 206 int x, int y, int w, int h) { |
207 base::win::ScopedComPtr<ID2D1SolidColorBrush> solid_brush; | 207 base::win::ScopedComPtr<ID2D1SolidColorBrush> solid_brush; |
208 rt_->CreateSolidColorBrush(SkColorToColorF(color), solid_brush.Receive()); | 208 rt_->CreateSolidColorBrush(SkColorToColorF(color), solid_brush.Receive()); |
209 rt_->FillRectangle(RectToRectF(x, y, w, h), solid_brush); | 209 rt_->FillRectangle(RectToRectF(x, y, w, h), solid_brush); |
210 } | 210 } |
211 | 211 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // CanvasDirect2D, private: | 362 // CanvasDirect2D, private: |
363 | 363 |
364 void CanvasDirect2D::SaveInternal(ID2D1Layer* layer) { | 364 void CanvasDirect2D::SaveInternal(ID2D1Layer* layer) { |
365 if (!drawing_state_block_) | 365 if (!drawing_state_block_) |
366 GetD2D1Factory()->CreateDrawingStateBlock(drawing_state_block_.Receive()); | 366 GetD2D1Factory()->CreateDrawingStateBlock(drawing_state_block_.Receive()); |
367 rt_->SaveDrawingState(drawing_state_block_.get()); | 367 rt_->SaveDrawingState(drawing_state_block_.get()); |
368 state_.push(RenderState(layer)); | 368 state_.push(RenderState(layer)); |
369 } | 369 } |
370 | 370 |
371 } // namespace gfx | 371 } // namespace gfx |
OLD | NEW |