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

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

Issue 303543004: MacViews: views_examples_with_content_exe working! Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add files Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | ui/gfx/mac/point_utils.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 "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 virtual ~ResizeSource() {} 350 virtual ~ResizeSource() {}
351 351
352 // gfx::ImageSkiaSource overrides: 352 // gfx::ImageSkiaSource overrides:
353 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { 353 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE {
354 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); 354 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale);
355 if (image_rep.GetWidth() == target_dip_size_.width() && 355 if (image_rep.GetWidth() == target_dip_size_.width() &&
356 image_rep.GetHeight() == target_dip_size_.height()) 356 image_rep.GetHeight() == target_dip_size_.height())
357 return image_rep; 357 return image_rep;
358 358
359 const Size target_pixel_size = DIPToPixelSize(target_dip_size_, scale); 359 const Size target_pixel_size = DIPToPixelSize(target_dip_size_, scale);
360 DLOG(INFO) << "scale " << image_rep.GetWidth() << " -> " << target_pixel_siz e.width() << " @" << scale;
360 const SkBitmap resized = skia::ImageOperations::Resize( 361 const SkBitmap resized = skia::ImageOperations::Resize(
361 image_rep.sk_bitmap(), 362 image_rep.sk_bitmap(),
362 resize_method_, 363 resize_method_,
363 target_pixel_size.width(), 364 target_pixel_size.width(),
364 target_pixel_size.height()); 365 target_pixel_size.height());
365 return ImageSkiaRep(resized, scale); 366 return ImageSkiaRep(resized, scale);
366 } 367 }
367 368
368 private: 369 private:
369 const ImageSkia source_; 370 const ImageSkia source_;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return ImageSkia(); 551 return ImageSkia();
551 552
552 return ImageSkia(new RotatedSource(source, rotation), 553 return ImageSkia(new RotatedSource(source, rotation),
553 SkBitmapOperations::ROTATION_180_CW == rotation ? 554 SkBitmapOperations::ROTATION_180_CW == rotation ?
554 source.size() : 555 source.size() :
555 gfx::Size(source.height(), source.width())); 556 gfx::Size(source.height(), source.width()));
556 557
557 } 558 }
558 559
559 } // namespace gfx 560 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | ui/gfx/mac/point_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698