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

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

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 years, 10 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
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle_win.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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 if (image.IsEmpty()) { 326 if (image.IsEmpty()) {
327 DCHECK(!delegate_ && !data_packs_.empty()) << 327 DCHECK(!delegate_ && !data_packs_.empty()) <<
328 "Missing call to SetResourcesDataDLL?"; 328 "Missing call to SetResourcesDataDLL?";
329 329
330 // TODO(oshima): Consider reading the image size from png IHDR chunk and 330 // TODO(oshima): Consider reading the image size from png IHDR chunk and
331 // skip decoding here and remove #ifdef below. 331 // skip decoding here and remove #ifdef below.
332 // ResourceBundle::GetSharedInstance() is destroyed after the 332 // ResourceBundle::GetSharedInstance() is destroyed after the
333 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be 333 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be
334 // destroyed before the resource bundle is destroyed. 334 // destroyed before the resource bundle is destroyed.
335 #if defined(OS_CHROMEOS) 335 #if defined(OS_CHROMEOS) || defined(ENABLE_HIDPI)
336 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); 336 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor();
337 #else 337 #else
338 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; 338 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
339 #endif 339 #endif
340 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), 340 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id),
341 scale_factor_to_load); 341 scale_factor_to_load);
342 if (image_skia.isNull()) { 342 if (image_skia.isNull()) {
343 LOG(WARNING) << "Unable to load image with id " << resource_id; 343 LOG(WARNING) << "Unable to load image with id " << resource_id;
344 NOTREACHED(); // Want to assert in debug mode. 344 NOTREACHED(); // Want to assert in debug mode.
345 // The load failed to retrieve the image; show a debugging red square. 345 // The load failed to retrieve the image; show a debugging red square.
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 // static 710 // static
711 bool ResourceBundle::DecodePNG(const unsigned char* buf, 711 bool ResourceBundle::DecodePNG(const unsigned char* buf,
712 size_t size, 712 size_t size,
713 SkBitmap* bitmap, 713 SkBitmap* bitmap,
714 bool* fell_back_to_1x) { 714 bool* fell_back_to_1x) {
715 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 715 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
716 return gfx::PNGCodec::Decode(buf, size, bitmap); 716 return gfx::PNGCodec::Decode(buf, size, bitmap);
717 } 717 }
718 718
719 } // namespace ui 719 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698