OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/thumbnail/thumbnail_store.h" | 5 #include "chrome/browser/android/thumbnail/thumbnail_store.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 compression_queue_max_size_(compression_queue_max_size), | 121 compression_queue_max_size_(compression_queue_max_size), |
122 write_queue_max_size_(write_queue_max_size), | 122 write_queue_max_size_(write_queue_max_size), |
123 use_approximation_thumbnail_(use_approximation_thumbnail), | 123 use_approximation_thumbnail_(use_approximation_thumbnail), |
124 compression_tasks_count_(0), | 124 compression_tasks_count_(0), |
125 write_tasks_count_(0), | 125 write_tasks_count_(0), |
126 read_in_progress_(false), | 126 read_in_progress_(false), |
127 cache_(default_cache_size), | 127 cache_(default_cache_size), |
128 approximation_cache_(approximation_cache_size), | 128 approximation_cache_(approximation_cache_size), |
129 ui_resource_provider_(NULL), | 129 ui_resource_provider_(NULL), |
130 weak_factory_(this) { | 130 weak_factory_(this) { |
131 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 131 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
132 } | 132 } |
133 | 133 |
134 ThumbnailStore::~ThumbnailStore() { | 134 ThumbnailStore::~ThumbnailStore() { |
135 SetUIResourceProvider(NULL); | 135 SetUIResourceProvider(NULL); |
136 } | 136 } |
137 | 137 |
138 void ThumbnailStore::SetUIResourceProvider( | 138 void ThumbnailStore::SetUIResourceProvider( |
139 ui::UIResourceProvider* ui_resource_provider) { | 139 ui::UIResourceProvider* ui_resource_provider) { |
140 if (ui_resource_provider_ == ui_resource_provider) | 140 if (ui_resource_provider_ == ui_resource_provider) |
141 return; | 141 return; |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 dst_bitmap.eraseColor(0); | 921 dst_bitmap.eraseColor(0); |
922 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); | 922 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); |
923 | 923 |
924 SkCanvas canvas(dst_bitmap); | 924 SkCanvas canvas(dst_bitmap); |
925 canvas.scale(new_scale, new_scale); | 925 canvas.scale(new_scale, new_scale); |
926 canvas.drawBitmap(bitmap, 0, 0, NULL); | 926 canvas.drawBitmap(bitmap, 0, 0, NULL); |
927 dst_bitmap.setImmutable(); | 927 dst_bitmap.setImmutable(); |
928 | 928 |
929 return std::make_pair(dst_bitmap, new_scale * scale); | 929 return std::make_pair(dst_bitmap, new_scale * scale); |
930 } | 930 } |
OLD | NEW |