OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "ui/gfx/canvas.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return true; | 182 return true; |
183 } | 183 } |
184 *bounds = gfx::Rect(); | 184 *bounds = gfx::Rect(); |
185 return false; | 185 return false; |
186 } | 186 } |
187 | 187 |
188 void Canvas::Translate(const Vector2d& offset) { | 188 void Canvas::Translate(const Vector2d& offset) { |
189 canvas_->translate(SkIntToScalar(offset.x()), SkIntToScalar(offset.y())); | 189 canvas_->translate(SkIntToScalar(offset.x()), SkIntToScalar(offset.y())); |
190 } | 190 } |
191 | 191 |
192 void Canvas::Scale(int x_scale, int y_scale) { | 192 void Canvas::Scale(float x_scale, float y_scale) { |
193 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale)); | 193 canvas_->scale(SkFloatToScalar(x_scale), SkFloatToScalar(y_scale)); |
194 } | 194 } |
195 | 195 |
196 void Canvas::DrawColor(SkColor color) { | 196 void Canvas::DrawColor(SkColor color) { |
197 DrawColor(color, SkBlendMode::kSrcOver); | 197 DrawColor(color, SkBlendMode::kSrcOver); |
198 } | 198 } |
199 | 199 |
200 void Canvas::DrawColor(SkColor color, SkBlendMode mode) { | 200 void Canvas::DrawColor(SkColor color, SkBlendMode mode) { |
201 canvas_->drawColor(color, mode); | 201 canvas_->drawColor(color, mode); |
202 } | 202 } |
203 | 203 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 bitmap_.emplace(); | 569 bitmap_.emplace(); |
570 bitmap_->allocPixels(info); | 570 bitmap_->allocPixels(info); |
571 // Ensure that the bitmap is zeroed, since the code expects that. | 571 // Ensure that the bitmap is zeroed, since the code expects that. |
572 memset(bitmap_->getPixels(), 0, bitmap_->getSafeSize()); | 572 memset(bitmap_->getPixels(), 0, bitmap_->getSafeSize()); |
573 | 573 |
574 owned_canvas_.emplace(bitmap_.value()); | 574 owned_canvas_.emplace(bitmap_.value()); |
575 return &owned_canvas_.value(); | 575 return &owned_canvas_.value(); |
576 } | 576 } |
577 | 577 |
578 } // namespace gfx | 578 } // namespace gfx |
OLD | NEW |