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

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 10837142: Remove --load-2x-resources flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 4 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/aura/root_window_host_linux.cc ('k') | ui/base/resource/resource_bundle_aurax11.cc » ('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/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 // If 2x resource is missing from |image| or is the incorrect size, 62 // If 2x resource is missing from |image| or is the incorrect size,
63 // logs the resource id and creates a 2x version of the resource. 63 // logs the resource id and creates a 2x version of the resource.
64 // Blends the created resource with red to make it distinguishable from 64 // Blends the created resource with red to make it distinguishable from
65 // bitmaps in the resource pak. 65 // bitmaps in the resource pak.
66 void Create2xResourceIfMissing(gfx::ImageSkia image, int idr) { 66 void Create2xResourceIfMissing(gfx::ImageSkia image, int idr) {
67 CommandLine* command_line = CommandLine::ForCurrentProcess(); 67 CommandLine* command_line = CommandLine::ForCurrentProcess();
68 if (command_line->HasSwitch( 68 if (command_line->HasSwitch(
69 switches::kHighlightMissing2xResources) && 69 switches::kHighlightMissing2xResources) &&
70 command_line->HasSwitch(switches::kLoad2xResources) &&
71 !image.HasRepresentation(ui::SCALE_FACTOR_200P)) { 70 !image.HasRepresentation(ui::SCALE_FACTOR_200P)) {
72 gfx::ImageSkiaRep image_rep = image.GetRepresentation(SCALE_FACTOR_200P); 71 gfx::ImageSkiaRep image_rep = image.GetRepresentation(SCALE_FACTOR_200P);
73 72
74 if (image_rep.scale_factor() == ui::SCALE_FACTOR_100P) 73 if (image_rep.scale_factor() == ui::SCALE_FACTOR_100P)
75 LOG(INFO) << "Missing 2x resource with id " << idr; 74 LOG(INFO) << "Missing 2x resource with id " << idr;
76 else 75 else
77 LOG(INFO) << "Incorrectly sized 2x resource with id " << idr; 76 LOG(INFO) << "Incorrectly sized 2x resource with id " << idr;
78 77
79 SkBitmap bitmap2x = skia::ImageOperations::Resize(image_rep.sk_bitmap(), 78 SkBitmap bitmap2x = skia::ImageOperations::Resize(image_rep.sk_bitmap(),
80 skia::ImageOperations::RESIZE_LANCZOS3, 79 skia::ImageOperations::RESIZE_LANCZOS3,
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 SkBitmap bitmap; 571 SkBitmap bitmap;
573 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32); 572 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32);
574 bitmap.allocPixels(); 573 bitmap.allocPixels();
575 bitmap.eraseARGB(255, 255, 0, 0); 574 bitmap.eraseARGB(255, 255, 0, 0);
576 empty_image_ = gfx::Image(bitmap); 575 empty_image_ = gfx::Image(bitmap);
577 } 576 }
578 return empty_image_; 577 return empty_image_;
579 } 578 }
580 579
581 } // namespace ui 580 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_linux.cc ('k') | ui/base/resource/resource_bundle_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698