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 "chrome/browser/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 // ImageSkia takes ownership of |source|. | 1444 // ImageSkia takes ownership of |source|. |
1445 temp_output[prs_id] = gfx::Image(gfx::ImageSkia(source, | 1445 temp_output[prs_id] = gfx::Image(gfx::ImageSkia(source, |
1446 image_to_tint.size())); | 1446 image_to_tint.size())); |
1447 } | 1447 } |
1448 } | 1448 } |
1449 MergeImageCaches(temp_output, images); | 1449 MergeImageCaches(temp_output, images); |
1450 } | 1450 } |
1451 | 1451 |
1452 void BrowserThemePack::RepackImages(const ImageCache& images, | 1452 void BrowserThemePack::RepackImages(const ImageCache& images, |
1453 RawImages* reencoded_images) const { | 1453 RawImages* reencoded_images) const { |
1454 typedef std::vector<ui::ScaleFactor> ScaleFactors; | |
1455 for (ImageCache::const_iterator it = images.begin(); | 1454 for (ImageCache::const_iterator it = images.begin(); |
1456 it != images.end(); ++it) { | 1455 it != images.end(); ++it) { |
1457 gfx::ImageSkia image_skia = *it->second.ToImageSkia(); | 1456 gfx::ImageSkia image_skia = *it->second.ToImageSkia(); |
1458 | 1457 |
1459 typedef std::vector<gfx::ImageSkiaRep> ImageSkiaReps; | 1458 typedef std::vector<gfx::ImageSkiaRep> ImageSkiaReps; |
1460 ImageSkiaReps image_reps = image_skia.image_reps(); | 1459 ImageSkiaReps image_reps = image_skia.image_reps(); |
1461 if (image_reps.empty()) { | 1460 if (image_reps.empty()) { |
1462 NOTREACHED() << "No image reps for resource " << it->first << "."; | 1461 NOTREACHED() << "No image reps for resource " << it->first << "."; |
1463 } | 1462 } |
1464 for (ImageSkiaReps::iterator rep_it = image_reps.begin(); | 1463 for (ImageSkiaReps::iterator rep_it = image_reps.begin(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 false, | 1603 false, |
1605 &bitmap_data)) { | 1604 &bitmap_data)) { |
1606 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1605 NOTREACHED() << "Unable to encode theme image for prs_id=" |
1607 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1606 << prs_id << " for scale_factor=" << scale_factors_[i]; |
1608 break; | 1607 break; |
1609 } | 1608 } |
1610 image_memory_[scaled_raw_id] = | 1609 image_memory_[scaled_raw_id] = |
1611 base::RefCountedBytes::TakeVector(&bitmap_data); | 1610 base::RefCountedBytes::TakeVector(&bitmap_data); |
1612 } | 1611 } |
1613 } | 1612 } |
OLD | NEW |