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

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

Issue 11235017: Revert to old rect conversion behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing 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
« no previous file with comments | « content/renderer/render_widget.cc ('k') | ui/gfx/rect_conversions.h » ('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_operations.h" 5 #include "ui/gfx/image/image_skia_operations.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "skia/ext/image_operations.h" 9 #include "skia/ext/image_operations.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 virtual ~ExtractSubsetImageSource() { 285 virtual ~ExtractSubsetImageSource() {
286 } 286 }
287 287
288 // gfx::ImageSkiaSource overrides: 288 // gfx::ImageSkiaSource overrides:
289 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { 289 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE {
290 ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor); 290 ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor);
291 gfx::RectF scaled_subset_bounds = subset_bounds_; 291 gfx::RectF scaled_subset_bounds = subset_bounds_;
292 scaled_subset_bounds.Scale( 292 scaled_subset_bounds.Scale(
293 ui::GetScaleFactorScale(image_rep.scale_factor())); 293 ui::GetScaleFactorScale(image_rep.scale_factor()));
294 SkIRect subset_bounds_in_pixel = RectToSkIRect( 294 SkIRect subset_bounds_in_pixel = RectToSkIRect(
295 ToEnclosingRect(scaled_subset_bounds)); 295 ToFlooredRectDeprecated(scaled_subset_bounds));
296 SkBitmap dst; 296 SkBitmap dst;
297 bool success = image_rep.sk_bitmap().extractSubset(&dst, 297 bool success = image_rep.sk_bitmap().extractSubset(&dst,
298 subset_bounds_in_pixel); 298 subset_bounds_in_pixel);
299 DCHECK(success); 299 DCHECK(success);
300 return gfx::ImageSkiaRep(dst, image_rep.scale_factor()); 300 return gfx::ImageSkiaRep(dst, image_rep.scale_factor());
301 } 301 }
302 302
303 private: 303 private:
304 const gfx::ImageSkia image_; 304 const gfx::ImageSkia image_;
305 const gfx::Rect subset_bounds_; 305 const gfx::Rect subset_bounds_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 const ImageSkia& source, 456 const ImageSkia& source,
457 const ShadowValues& shadows) { 457 const ShadowValues& shadows) {
458 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); 458 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows);
459 gfx::Size shadow_image_size = source.size(); 459 gfx::Size shadow_image_size = source.size();
460 shadow_image_size.Enlarge(shadow_padding.width(), 460 shadow_image_size.Enlarge(shadow_padding.width(),
461 shadow_padding.height()); 461 shadow_padding.height());
462 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size); 462 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size);
463 } 463 }
464 464
465 } // namespace gfx 465 } // namespace gfx
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | ui/gfx/rect_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698