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

Side by Side Diff: chrome/browser/history/thumbnail_database.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/thumbnail_database.h" 5 #include "chrome/browser/history/thumbnail_database.h"
6 6
7 #include "app/gfx/codec/jpeg_codec.h"
7 #include "app/sql/statement.h" 8 #include "app/sql/statement.h"
8 #include "app/sql/transaction.h" 9 #include "app/sql/transaction.h"
9 #include "base/file_util.h" 10 #include "base/file_util.h"
10 #include "base/gfx/jpeg_codec.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/history/history_publisher.h" 13 #include "chrome/browser/history/history_publisher.h"
14 #include "chrome/browser/history/url_database.h" 14 #include "chrome/browser/history/url_database.h"
15 #include "chrome/common/thumbnail_score.h" 15 #include "chrome/common/thumbnail_score.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
17 17
18 namespace history { 18 namespace history {
19 19
20 // Version number of the database. 20 // Version number of the database.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 "(url_id, boring_score, good_clipping, at_top, last_updated, data) " 222 "(url_id, boring_score, good_clipping, at_top, last_updated, data) "
223 "VALUES (?,?,?,?,?,?)")); 223 "VALUES (?,?,?,?,?,?)"));
224 if (!statement) 224 if (!statement)
225 return; 225 return;
226 226
227 // We use 90 quality (out of 100) which is pretty high, because 227 // We use 90 quality (out of 100) which is pretty high, because
228 // we're very sensitive to artifacts for these small sized, 228 // we're very sensitive to artifacts for these small sized,
229 // highly detailed images. 229 // highly detailed images.
230 std::vector<unsigned char> jpeg_data; 230 std::vector<unsigned char> jpeg_data;
231 SkAutoLockPixels thumbnail_lock(thumbnail); 231 SkAutoLockPixels thumbnail_lock(thumbnail);
232 bool encoded = JPEGCodec::Encode( 232 bool encoded = gfx::JPEGCodec::Encode(
233 reinterpret_cast<unsigned char*>(thumbnail.getAddr32(0, 0)), 233 reinterpret_cast<unsigned char*>(thumbnail.getAddr32(0, 0)),
234 JPEGCodec::FORMAT_BGRA, thumbnail.width(), 234 gfx::JPEGCodec::FORMAT_BGRA, thumbnail.width(),
235 thumbnail.height(), 235 thumbnail.height(),
236 static_cast<int>(thumbnail.rowBytes()), 90, 236 static_cast<int>(thumbnail.rowBytes()), 90,
237 &jpeg_data); 237 &jpeg_data);
238 238
239 if (encoded) { 239 if (encoded) {
240 statement.BindInt64(0, id); 240 statement.BindInt64(0, id);
241 statement.BindDouble(1, score.boring_score); 241 statement.BindDouble(1, score.boring_score);
242 statement.BindBool(2, score.good_clipping); 242 statement.BindBool(2, score.good_clipping);
243 statement.BindBool(3, score.at_top); 243 statement.BindBool(3, score.at_top);
244 statement.BindInt64(4, score.time_at_snapshot.ToTimeT()); 244 statement.BindInt64(4, score.time_at_snapshot.ToTimeT());
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // Rename the temporary one. 432 // Rename the temporary one.
433 if (!db_.Execute("ALTER TABLE temp_favicons RENAME TO favicons")) 433 if (!db_.Execute("ALTER TABLE temp_favicons RENAME TO favicons"))
434 return false; 434 return false;
435 435
436 // The renamed table needs the index (the temporary table doesn't have one). 436 // The renamed table needs the index (the temporary table doesn't have one).
437 InitFavIconsIndex(); 437 InitFavIconsIndex();
438 return true; 438 return true;
439 } 439 }
440 440
441 } // namespace history 441 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698