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

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

Issue 14322007: Add line height setting to views::Label & use it for notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 months 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
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/gfx/canvas_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 pixel_size.height(), 82 pixel_size.height(),
83 is_opaque)); 83 is_opaque));
84 canvas_ = owned_canvas_.get(); 84 canvas_ = owned_canvas_.get();
85 SkScalar scale = SkFloatToScalar(ui::GetScaleFactorScale(scale_factor_)); 85 SkScalar scale = SkFloatToScalar(ui::GetScaleFactorScale(scale_factor_));
86 canvas_->scale(scale, scale); 86 canvas_->scale(scale, scale);
87 } 87 }
88 88
89 // static 89 // static
90 int Canvas::GetStringWidth(const string16& text, const gfx::Font& font) { 90 int Canvas::GetStringWidth(const string16& text, const gfx::Font& font) {
91 int width = 0, height = 0; 91 int width = 0, height = 0;
92 Canvas::SizeStringInt(text, font, &width, &height, NO_ELLIPSIS); 92 Canvas::SizeStringInt(text, font, &width, &height, 0, NO_ELLIPSIS);
93 return width; 93 return width;
94 } 94 }
95 95
96 // static 96 // static
97 int Canvas::DefaultCanvasTextAlignment() { 97 int Canvas::DefaultCanvasTextAlignment() {
98 return base::i18n::IsRTL() ? TEXT_ALIGN_RIGHT : TEXT_ALIGN_LEFT; 98 return base::i18n::IsRTL() ? TEXT_ALIGN_RIGHT : TEXT_ALIGN_LEFT;
99 } 99 }
100 100
101 gfx::ImageSkiaRep Canvas::ExtractImageRep() const { 101 gfx::ImageSkiaRep Canvas::ExtractImageRep() const {
102 const SkBitmap& device_bitmap = canvas_->getDevice()->accessBitmap(false); 102 const SkBitmap& device_bitmap = canvas_->getDevice()->accessBitmap(false);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 void Canvas::DrawStringInt(const string16& text, 427 void Canvas::DrawStringInt(const string16& text,
428 const gfx::Font& font, 428 const gfx::Font& font,
429 SkColor color, 429 SkColor color,
430 int x, int y, int w, int h, 430 int x, int y, int w, int h,
431 int flags) { 431 int flags) {
432 DrawStringWithShadows(text, 432 DrawStringWithShadows(text,
433 font, 433 font,
434 color, 434 color,
435 gfx::Rect(x, y, w, h), 435 gfx::Rect(x, y, w, h),
436 0,
436 flags, 437 flags,
437 ShadowValues()); 438 ShadowValues());
438 } 439 }
439 440
440 void Canvas::TileImageInt(const gfx::ImageSkia& image, 441 void Canvas::TileImageInt(const gfx::ImageSkia& image,
441 int x, int y, int w, int h) { 442 int x, int y, int w, int h) {
442 TileImageInt(image, 0, 0, x, y, w, h); 443 TileImageInt(image, 0, 0, x, y, w, h);
443 } 444 }
444 445
445 void Canvas::TileImageInt(const gfx::ImageSkia& image, 446 void Canvas::TileImageInt(const gfx::ImageSkia& image,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 534
534 float bitmap_scale = image_rep.GetScale(); 535 float bitmap_scale = image_rep.GetScale();
535 if (scale_x < bitmap_scale || scale_y < bitmap_scale) 536 if (scale_x < bitmap_scale || scale_y < bitmap_scale)
536 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap(); 537 const_cast<SkBitmap&>(image_rep.sk_bitmap()).buildMipMap();
537 } 538 }
538 539
539 return image_rep; 540 return image_rep;
540 } 541 }
541 542
542 } // namespace gfx 543 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/gfx/canvas_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698