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

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

Issue 18486007: Fix the misalignment on CrOS of the tab background images (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as per sky@ Created 7 years, 5 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
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/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 512 }
513 513
514 // static 514 // static
515 ImageSkia ImageSkiaOperations::ExtractSubset(const ImageSkia& image, 515 ImageSkia ImageSkiaOperations::ExtractSubset(const ImageSkia& image,
516 const Rect& subset_bounds) { 516 const Rect& subset_bounds) {
517 gfx::Rect clipped_bounds = 517 gfx::Rect clipped_bounds =
518 gfx::IntersectRects(subset_bounds, gfx::Rect(image.size())); 518 gfx::IntersectRects(subset_bounds, gfx::Rect(image.size()));
519 if (image.isNull() || clipped_bounds.IsEmpty()) { 519 if (image.isNull() || clipped_bounds.IsEmpty()) {
520 return ImageSkia(); 520 return ImageSkia();
521 } 521 }
522 if (clipped_bounds.size() == image.size())
523 return image;
522 524
523 return ImageSkia(new ExtractSubsetImageSource(image, clipped_bounds), 525 return ImageSkia(new ExtractSubsetImageSource(image, clipped_bounds),
524 clipped_bounds.size()); 526 clipped_bounds.size());
525 } 527 }
526 528
527 // static 529 // static
528 ImageSkia ImageSkiaOperations::CreateResizedImage( 530 ImageSkia ImageSkiaOperations::CreateResizedImage(
529 const ImageSkia& source, 531 const ImageSkia& source,
530 skia::ImageOperations::ResizeMethod method, 532 skia::ImageOperations::ResizeMethod method,
531 const Size& target_dip_size) { 533 const Size& target_dip_size) {
(...skipping 26 matching lines...) Expand all
558 return ImageSkia(); 560 return ImageSkia();
559 561
560 return ImageSkia(new RotatedSource(source, rotation), 562 return ImageSkia(new RotatedSource(source, rotation),
561 SkBitmapOperations::ROTATION_180_CW == rotation ? 563 SkBitmapOperations::ROTATION_180_CW == rotation ?
562 source.size() : 564 source.size() :
563 gfx::Size(source.height(), source.width())); 565 gfx::Size(source.height(), source.width()));
564 566
565 } 567 }
566 568
567 } // namespace gfx 569 } // namespace gfx
OLDNEW
« chrome/browser/ui/views/tabs/tab_paint_util.cc ('K') | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698