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

Side by Side Diff: chrome/browser/history/top_sites.cc

Issue 243076: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/history/top_sites.h" 5 #include "chrome/browser/history/top_sites.h"
6 6
7 #include "base/gfx/jpeg_codec.h" 7 #include "app/gfx/codec/jpeg_codec.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 10
11 namespace history { 11 namespace history {
12 12
13 TopSites::TopSites() { 13 TopSites::TopSites() {
14 } 14 }
15 15
16 TopSites::~TopSites() { 16 TopSites::~TopSites() {
17 } 17 }
(...skipping 20 matching lines...) Expand all
38 ThumbnailScore new_score_with_redirects(score); 38 ThumbnailScore new_score_with_redirects(score);
39 new_score_with_redirects.redirect_hops_from_dest = 39 new_score_with_redirects.redirect_hops_from_dest =
40 GetRedirectDistanceForURL(most_visited, url); 40 GetRedirectDistanceForURL(most_visited, url);
41 41
42 if (!ShouldReplaceThumbnailWith(image.thumbnail_score, 42 if (!ShouldReplaceThumbnailWith(image.thumbnail_score,
43 new_score_with_redirects)) 43 new_score_with_redirects))
44 return false; // The one we already have is better. 44 return false; // The one we already have is better.
45 45
46 image.thumbnail = new RefCountedBytes; 46 image.thumbnail = new RefCountedBytes;
47 SkAutoLockPixels thumbnail_lock(thumbnail); 47 SkAutoLockPixels thumbnail_lock(thumbnail);
48 bool encoded = JPEGCodec::Encode( 48 bool encoded = gfx::JPEGCodec::Encode(
49 reinterpret_cast<unsigned char*>(thumbnail.getAddr32(0, 0)), 49 reinterpret_cast<unsigned char*>(thumbnail.getAddr32(0, 0)),
50 JPEGCodec::FORMAT_BGRA, thumbnail.width(), 50 gfx::JPEGCodec::FORMAT_BGRA, thumbnail.width(),
51 thumbnail.height(), 51 thumbnail.height(),
52 static_cast<int>(thumbnail.rowBytes()), 90, 52 static_cast<int>(thumbnail.rowBytes()), 90,
53 &image.thumbnail->data); 53 &image.thumbnail->data);
54 if (!encoded) 54 if (!encoded)
55 return false; 55 return false;
56 image.thumbnail_score = new_score_with_redirects; 56 image.thumbnail_score = new_score_with_redirects;
57 57
58 return true; 58 return true;
59 } 59 }
60 60
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Any member without the special marker in the all_old_urls list means that 161 // Any member without the special marker in the all_old_urls list means that
162 // there wasn't a "new" URL that mapped to it, so it was deleted. 162 // there wasn't a "new" URL that mapped to it, so it was deleted.
163 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin(); 163 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin();
164 i != all_old_urls.end(); ++i) { 164 i != all_old_urls.end(); ++i) {
165 if (i->second != kAlreadyFoundMarker) 165 if (i->second != kAlreadyFoundMarker)
166 deleted_urls->push_back(i->second); 166 deleted_urls->push_back(i->second);
167 } 167 }
168 } 168 }
169 169
170 } // namespace history 170 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698