| OLD | NEW |
| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 46 #include "ui/base/resource/resource_bundle_android.h" | 46 #include "ui/base/resource/resource_bundle_android.h" |
| 47 #include "ui/gfx/android/device_display_info.h" | 47 #include "ui/gfx/android/device_display_info.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
| 51 #include "ui/gfx/platform_font_linux.h" | 51 #include "ui/gfx/platform_font_linux.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 55 #include "ui/gfx/win/dpi.h" | 55 #include "ui/display/win/dpi.h" |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if defined(OS_MACOSX) && !defined(OS_IOS) | 58 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 59 #include "base/mac/mac_util.h" | 59 #include "base/mac/mac_util.h" |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 namespace ui { | 62 namespace ui { |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 image = delegate_->GetImageNamed(resource_id); | 385 image = delegate_->GetImageNamed(resource_id); |
| 386 | 386 |
| 387 if (image.IsEmpty()) { | 387 if (image.IsEmpty()) { |
| 388 DCHECK(!data_packs_.empty()) << | 388 DCHECK(!data_packs_.empty()) << |
| 389 "Missing call to SetResourcesDataDLL?"; | 389 "Missing call to SetResourcesDataDLL?"; |
| 390 | 390 |
| 391 #if defined(OS_CHROMEOS) | 391 #if defined(OS_CHROMEOS) |
| 392 ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor(); | 392 ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor(); |
| 393 #elif defined(OS_WIN) | 393 #elif defined(OS_WIN) |
| 394 ui::ScaleFactor scale_factor_to_load = | 394 ui::ScaleFactor scale_factor_to_load = |
| 395 gfx::GetDPIScale() > 1.25 ? GetMaxScaleFactor() : ui::SCALE_FACTOR_100P; | 395 display::win::GetDPIScale() > 1.25 |
| 396 ? GetMaxScaleFactor() |
| 397 : ui::SCALE_FACTOR_100P; |
| 396 #else | 398 #else |
| 397 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; | 399 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; |
| 398 #endif | 400 #endif |
| 399 // TODO(oshima): Consider reading the image size from png IHDR chunk and | 401 // TODO(oshima): Consider reading the image size from png IHDR chunk and |
| 400 // skip decoding here and remove #ifdef below. | 402 // skip decoding here and remove #ifdef below. |
| 401 // ResourceBundle::GetSharedInstance() is destroyed after the | 403 // ResourceBundle::GetSharedInstance() is destroyed after the |
| 402 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be | 404 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be |
| 403 // destroyed before the resource bundle is destroyed. | 405 // destroyed before the resource bundle is destroyed. |
| 404 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), | 406 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), |
| 405 GetScaleForScaleFactor(scale_factor_to_load)); | 407 GetScaleForScaleFactor(scale_factor_to_load)); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 // static | 871 // static |
| 870 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 872 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 871 size_t size, | 873 size_t size, |
| 872 SkBitmap* bitmap, | 874 SkBitmap* bitmap, |
| 873 bool* fell_back_to_1x) { | 875 bool* fell_back_to_1x) { |
| 874 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 876 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 875 return gfx::PNGCodec::Decode(buf, size, bitmap); | 877 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 876 } | 878 } |
| 877 | 879 |
| 878 } // namespace ui | 880 } // namespace ui |
| OLD | NEW |