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

Unified Diff: ui/gfx/image/image_skia_operations.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/blit.cc ('k') | ui/gfx/rect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia_operations.cc
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc
index 029304b305ca5a9a954a79d1b3efdabf0a745fa5..a2395da148f767dd5da5d64811446d9fe74a1012 100644
--- a/ui/gfx/image/image_skia_operations.cc
+++ b/ui/gfx/image/image_skia_operations.cc
@@ -288,11 +288,9 @@ class ExtractSubsetImageSource: public gfx::ImageSkiaSource {
// gfx::ImageSkiaSource overrides:
virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE {
ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor);
- gfx::RectF scaled_subset_bounds = subset_bounds_;
- scaled_subset_bounds.Scale(
- ui::GetScaleFactorScale(image_rep.scale_factor()));
- SkIRect subset_bounds_in_pixel = RectToSkIRect(
- ToFlooredRectDeprecated(scaled_subset_bounds));
+ float scale_to_pixel = ui::GetScaleFactorScale(image_rep.scale_factor());
+ SkIRect subset_bounds_in_pixel = RectToSkIRect(ToFlooredRectDeprecated(
+ gfx::ScaleRect(subset_bounds_, scale_to_pixel)));
SkBitmap dst;
bool success = image_rep.sk_bitmap().extractSubset(&dst,
subset_bounds_in_pixel);
@@ -432,8 +430,8 @@ ImageSkia ImageSkiaOperations::CreateButtonBackground(SkColor color,
// static
ImageSkia ImageSkiaOperations::ExtractSubset(const ImageSkia& image,
const Rect& subset_bounds) {
- gfx::Rect clipped_bounds = subset_bounds;
- clipped_bounds.Intersect(gfx::Rect(image.size()));
+ gfx::Rect clipped_bounds =
+ gfx::IntersectRects(subset_bounds, gfx::Rect(image.size()));
if (image.isNull() || clipped_bounds.IsEmpty()) {
return ImageSkia();
}
« no previous file with comments | « ui/gfx/blit.cc ('k') | ui/gfx/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698