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

Side by Side Diff: chrome/browser/android/thumbnail/thumbnail.cc

Issue 2851253002: Remove legacy SkPixelRef API flag from Chrome (Closed)
Patch Set: More Android fixes Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/android/thumbnail/thumbnail_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "chrome/browser/android/thumbnail/thumbnail.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 scaled_data_size_ = scaled_content_size_; 67 scaled_data_size_ = scaled_content_size_;
68 bitmap_ = cc::UIResourceBitmap(bitmap); 68 bitmap_ = cc::UIResourceBitmap(bitmap);
69 } 69 }
70 70
71 void Thumbnail::SetCompressedBitmap(sk_sp<SkPixelRef> compressed_bitmap, 71 void Thumbnail::SetCompressedBitmap(sk_sp<SkPixelRef> compressed_bitmap,
72 const gfx::Size& content_size) { 72 const gfx::Size& content_size) {
73 DCHECK(compressed_bitmap); 73 DCHECK(compressed_bitmap);
74 DCHECK(!content_size.IsEmpty()); 74 DCHECK(!content_size.IsEmpty());
75 retrieved_ = false; 75 retrieved_ = false;
76 ClearUIResourceId(); 76 ClearUIResourceId();
77 gfx::Size data_size(compressed_bitmap->info().width(), 77 gfx::Size data_size(compressed_bitmap->width(), compressed_bitmap->height());
78 compressed_bitmap->info().height());
79 scaled_content_size_ = gfx::ScaleSize(gfx::SizeF(content_size), 1.f / scale_); 78 scaled_content_size_ = gfx::ScaleSize(gfx::SizeF(content_size), 1.f / scale_);
80 scaled_data_size_ = gfx::ScaleSize(gfx::SizeF(data_size), 1.f / scale_); 79 scaled_data_size_ = gfx::ScaleSize(gfx::SizeF(data_size), 1.f / scale_);
81 bitmap_ = cc::UIResourceBitmap(std::move(compressed_bitmap), data_size); 80 bitmap_ = cc::UIResourceBitmap(std::move(compressed_bitmap), data_size);
82 } 81 }
83 82
84 void Thumbnail::CreateUIResource() { 83 void Thumbnail::CreateUIResource() {
85 DCHECK(ui_resource_provider_); 84 DCHECK(ui_resource_provider_);
86 if (!ui_resource_id_) 85 if (!ui_resource_id_)
87 ui_resource_id_ = ui_resource_provider_->CreateUIResource(this); 86 ui_resource_id_ = ui_resource_provider_->CreateUIResource(this);
88 } 87 }
(...skipping 21 matching lines...) Expand all
110 void Thumbnail::DoInvalidate() { 109 void Thumbnail::DoInvalidate() {
111 if (thumbnail_delegate_) 110 if (thumbnail_delegate_)
112 thumbnail_delegate_->InvalidateCachedThumbnail(this); 111 thumbnail_delegate_->InvalidateCachedThumbnail(this);
113 } 112 }
114 113
115 void Thumbnail::ClearUIResourceId() { 114 void Thumbnail::ClearUIResourceId() {
116 if (ui_resource_id_ && ui_resource_provider_) 115 if (ui_resource_id_ && ui_resource_provider_)
117 ui_resource_provider_->DeleteUIResource(ui_resource_id_); 116 ui_resource_provider_->DeleteUIResource(ui_resource_id_);
118 ui_resource_id_ = 0; 117 ui_resource_id_ = 0;
119 } 118 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/thumbnail/thumbnail_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698