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

Side by Side Diff: chrome/browser/themes/browser_theme_pack.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
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 "chrome/browser/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 const color_utils::HSL& hsl_shift) { 469 const color_utils::HSL& hsl_shift) {
470 const gfx::ImageSkia* src_image = image.ToImageSkia(); 470 const gfx::ImageSkia* src_image = image.ToImageSkia();
471 return gfx::Image(gfx::ImageSkiaOperations::CreateHSLShiftedImage( 471 return gfx::Image(gfx::ImageSkiaOperations::CreateHSLShiftedImage(
472 *src_image, hsl_shift)); 472 *src_image, hsl_shift));
473 } 473 }
474 474
475 // Computes a bitmap at one scale from a bitmap at a different scale. 475 // Computes a bitmap at one scale from a bitmap at a different scale.
476 SkBitmap CreateLowQualityResizedBitmap(const SkBitmap& source_bitmap, 476 SkBitmap CreateLowQualityResizedBitmap(const SkBitmap& source_bitmap,
477 ui::ScaleFactor source_scale_factor, 477 ui::ScaleFactor source_scale_factor,
478 ui::ScaleFactor desired_scale_factor) { 478 ui::ScaleFactor desired_scale_factor) {
479 gfx::Size scaled_size = gfx::ToCeiledSize( 479 gfx::Size scaled_size = gfx::ScaleToCeiledSize(
480 gfx::ScaleSize(gfx::Size(source_bitmap.width(), 480 gfx::Size(source_bitmap.width(), source_bitmap.height()),
481 source_bitmap.height()), 481 ui::GetScaleForScaleFactor(desired_scale_factor) /
482 ui::GetScaleForScaleFactor(desired_scale_factor) / 482 ui::GetScaleForScaleFactor(source_scale_factor));
483 ui::GetScaleForScaleFactor(source_scale_factor)));
484 SkBitmap scaled_bitmap; 483 SkBitmap scaled_bitmap;
485 scaled_bitmap.allocN32Pixels(scaled_size.width(), scaled_size.height()); 484 scaled_bitmap.allocN32Pixels(scaled_size.width(), scaled_size.height());
486 scaled_bitmap.eraseARGB(0, 0, 0, 0); 485 scaled_bitmap.eraseARGB(0, 0, 0, 0);
487 SkCanvas canvas(scaled_bitmap); 486 SkCanvas canvas(scaled_bitmap);
488 SkRect scaled_bounds = RectToSkRect(gfx::Rect(scaled_size)); 487 SkRect scaled_bounds = RectToSkRect(gfx::Rect(scaled_size));
489 // Note(oshima): The following scaling code doesn't work with 488 // Note(oshima): The following scaling code doesn't work with
490 // a mask image. 489 // a mask image.
491 canvas.drawBitmapRect(source_bitmap, scaled_bounds, NULL); 490 canvas.drawBitmapRect(source_bitmap, scaled_bounds, NULL);
492 return scaled_bitmap; 491 return scaled_bitmap;
493 } 492 }
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 false, 1633 false,
1635 &bitmap_data)) { 1634 &bitmap_data)) {
1636 NOTREACHED() << "Unable to encode theme image for prs_id=" 1635 NOTREACHED() << "Unable to encode theme image for prs_id="
1637 << prs_id << " for scale_factor=" << scale_factors_[i]; 1636 << prs_id << " for scale_factor=" << scale_factors_[i];
1638 break; 1637 break;
1639 } 1638 }
1640 image_memory_[scaled_raw_id] = 1639 image_memory_[scaled_raw_id] =
1641 base::RefCountedBytes::TakeVector(&bitmap_data); 1640 base::RefCountedBytes::TakeVector(&bitmap_data);
1642 } 1641 }
1643 } 1642 }
OLDNEW
« no previous file with comments | « chrome/browser/android/thumbnail/thumbnail_cache.cc ('k') | chrome/browser/thumbnails/simple_thumbnail_crop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698