| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/common/resource_bundle.h" | 5 #include "chrome/common/resource_bundle.h" |
| 6 | 6 |
| 7 #include "base/gfx/png_decoder.h" | 7 #include "base/gfx/png_decoder.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
| 10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 if (!success) | 87 if (!success) |
| 88 success = LoadResourceBytes(data_handle, resource_id, &raw_data); | 88 success = LoadResourceBytes(data_handle, resource_id, &raw_data); |
| 89 if (!success) | 89 if (!success) |
| 90 return NULL; | 90 return NULL; |
| 91 | 91 |
| 92 // Decode the PNG. | 92 // Decode the PNG. |
| 93 int image_width; | 93 int image_width; |
| 94 int image_height; | 94 int image_height; |
| 95 if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), | 95 if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), |
| 96 PNGDecoder::FORMAT_BGRA, | 96 PNGDecoder::FORMAT_BGRA, |
| 97 &png_data, &image_width, &image_height)) { | 97 &png_data, &image_width, &image_height)) { |
| 98 NOTREACHED() << "Unable to decode image resource " << resource_id; | 98 NOTREACHED() << "Unable to decode image resource " << resource_id; |
| 99 return NULL; | 99 return NULL; |
| 100 } | 100 } |
| 101 | 101 |
| 102 return PNGDecoder::CreateSkBitmapFromBGRAFormat(png_data, | 102 return PNGDecoder::CreateSkBitmapFromBGRAFormat(png_data, |
| 103 image_width, | 103 image_width, |
| 104 image_height); | 104 image_height); |
| 105 } | 105 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 case MediumBoldFont: | 202 case MediumBoldFont: |
| 203 return *medium_bold_font_; | 203 return *medium_bold_font_; |
| 204 case LargeFont: | 204 case LargeFont: |
| 205 return *large_font_; | 205 return *large_font_; |
| 206 case WebFont: | 206 case WebFont: |
| 207 return *web_font_; | 207 return *web_font_; |
| 208 default: | 208 default: |
| 209 return *base_font_; | 209 return *base_font_; |
| 210 } | 210 } |
| 211 } | 211 } |
| OLD | NEW |