summaryrefslogtreecommitdiffstats
path: root/chrome/views/image_view.cc
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 18:02:30 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-15 18:02:30 +0000
commit154f8bcac65142d7ae6733204c15ae52cfa320c6 (patch)
treed7375c1119946c2914ee79ef2c0e8aa195b1fbe9 /chrome/views/image_view.cc
parent8144d0cea4e142ff7d7a75c84240a4bb8a7fb3a4 (diff)
downloadchromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.zip
chromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.tar.gz
chromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.tar.bz2
Convert GetPreferredSize from:
void GetPreferredSize(CSize* out); to: gfx::Size GetPreferredSize(); .. and update some other places to use gfx::Size as well. http://crbug.com/2186 Review URL: http://codereview.chromium.org/7344 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/image_view.cc')
-rw-r--r--chrome/views/image_view.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/chrome/views/image_view.cc b/chrome/views/image_view.cc
index 00c771d..640541c 100644
--- a/chrome/views/image_view.cc
+++ b/chrome/views/image_view.cc
@@ -35,12 +35,12 @@ const SkBitmap& ImageView::GetImage() {
return image_;
}
-void ImageView::SetImageSize(const CSize& image_size) {
+void ImageView::SetImageSize(const gfx::Size& image_size) {
image_size_set_ = true;
image_size_ = image_size;
}
-bool ImageView::GetImageSize(CSize* image_size) {
+bool ImageView::GetImageSize(gfx::Size* image_size) {
DCHECK(image_size);
if (image_size_set_)
*image_size = image_size_;
@@ -51,14 +51,13 @@ void ImageView::ResetImageSize() {
image_size_set_ = false;
}
-void ImageView::GetPreferredSize(CSize* out) {
- DCHECK(out);
+gfx::Size ImageView::GetPreferredSize() {
if (image_size_set_) {
- GetImageSize(out);
- } else {
- out->cx = image_.width();
- out->cy = image_.height();
+ gfx::Size image_size;
+ GetImageSize(&image_size);
+ return image_size;
}
+ return gfx::Size(image_.width(), image_.height());
}
void ImageView::ComputeImageOrigin(int image_width, int image_height,
@@ -114,12 +113,13 @@ void ImageView::Paint(ChromeCanvas* canvas) {
int x, y;
if (image_size_set_ &&
- (image_size_.cx != image_width || image_size_.cy != image_height)) {
+ (image_size_.width() != image_width ||
+ image_size_.width() != image_height)) {
// Resize case
image_.buildMipMap(false);
- ComputeImageOrigin(image_size_.cx, image_size_.cy, &x, &y);
+ ComputeImageOrigin(image_size_.width(), image_size_.height(), &x, &y);
canvas->DrawBitmapInt(image_, 0, 0, image_width, image_height,
- x, y, image_size_.cx, image_size_.cy,
+ x, y, image_size_.width(), image_size_.height(),
true);
} else {
ComputeImageOrigin(image_width, image_height, &x, &y);