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

Side by Side Diff: ui/gfx/image/image_skia.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 2 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
« no previous file with comments | « ui/gfx/geometry/size_unittest.cc ('k') | ui/gfx/image/image_skia_operations.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/image/image_skia.h" 5 #include "ui/gfx/image/image_skia.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 private: 54 private:
55 float scale_; 55 float scale_;
56 }; 56 };
57 57
58 ImageSkiaRep ScaleImageSkiaRep(const ImageSkiaRep& rep, float target_scale) { 58 ImageSkiaRep ScaleImageSkiaRep(const ImageSkiaRep& rep, float target_scale) {
59 if (rep.is_null() || rep.scale() == target_scale) 59 if (rep.is_null() || rep.scale() == target_scale)
60 return rep; 60 return rep;
61 61
62 gfx::Size scaled_size = ToCeiledSize( 62 gfx::Size scaled_size =
63 gfx::ScaleSize(rep.pixel_size(), target_scale / rep.scale())); 63 gfx::ScaleToCeiledSize(rep.pixel_size(), target_scale / rep.scale());
64 return ImageSkiaRep(skia::ImageOperations::Resize( 64 return ImageSkiaRep(skia::ImageOperations::Resize(
65 rep.sk_bitmap(), 65 rep.sk_bitmap(),
66 skia::ImageOperations::RESIZE_LANCZOS3, 66 skia::ImageOperations::RESIZE_LANCZOS3,
67 scaled_size.width(), 67 scaled_size.width(),
68 scaled_size.height()), target_scale); 68 scaled_size.height()), target_scale);
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 // A helper class such that ImageSkia can be cheaply copied. ImageSkia holds a 73 // A helper class such that ImageSkia can be cheaply copied. ImageSkia holds a
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 bool ImageSkia::CanModify() const { 492 bool ImageSkia::CanModify() const {
493 return !storage_.get() || storage_->CanModify(); 493 return !storage_.get() || storage_->CanModify();
494 } 494 }
495 495
496 void ImageSkia::DetachStorageFromThread() { 496 void ImageSkia::DetachStorageFromThread() {
497 if (storage_.get()) 497 if (storage_.get())
498 storage_->DetachFromThread(); 498 storage_->DetachFromThread();
499 } 499 }
500 500
501 } // namespace gfx 501 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/size_unittest.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698