Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: ui/gfx/canvas.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <limits> 7 #include <limits>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return canvas_->clipPath(path); 183 return canvas_->clipPath(path);
184 } 184 }
185 185
186 bool Canvas::GetClipBounds(gfx::Rect* bounds) { 186 bool Canvas::GetClipBounds(gfx::Rect* bounds) {
187 SkRect out; 187 SkRect out;
188 bool has_non_empty_clip = canvas_->getClipBounds(&out); 188 bool has_non_empty_clip = canvas_->getClipBounds(&out);
189 bounds->SetRect(out.left(), out.top(), out.width(), out.height()); 189 bounds->SetRect(out.left(), out.top(), out.width(), out.height());
190 return has_non_empty_clip; 190 return has_non_empty_clip;
191 } 191 }
192 192
193 void Canvas::Translate(const gfx::Point& point) { 193 void Canvas::Translate(const gfx::Vector2d& offset) {
194 canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y())); 194 canvas_->translate(SkIntToScalar(offset.x()), SkIntToScalar(offset.y()));
195 } 195 }
196 196
197 void Canvas::Scale(int x_scale, int y_scale) { 197 void Canvas::Scale(int x_scale, int y_scale) {
198 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale)); 198 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale));
199 } 199 }
200 200
201 void Canvas::DrawColor(SkColor color) { 201 void Canvas::DrawColor(SkColor color) {
202 DrawColor(color, SkXfermode::kSrcOver_Mode); 202 DrawColor(color, SkXfermode::kSrcOver_Mode);
203 } 203 }
204 204
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 float bitmap_scale = image_rep.GetScale(); 533 float bitmap_scale = image_rep.GetScale();
534 if (scale_x < bitmap_scale || scale_y < bitmap_scale) 534 if (scale_x < bitmap_scale || scale_y < bitmap_scale)
535 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap(); 535 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap();
536 } 536 }
537 537
538 return image_rep; 538 return image_rep;
539 } 539 }
540 540
541 } // namespace gfx 541 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698