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

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

Issue 2238173003: Android: Fix Thumbnail CreateSmallHolderBitmap() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | no next file » | 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"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "ui/android/resources/ui_resource_provider.h" 14 #include "ui/android/resources/ui_resource_provider.h"
15 #include "ui/gfx/geometry/size_conversions.h" 15 #include "ui/gfx/geometry/size_conversions.h"
16 16
17 namespace { 17 namespace {
18 18
19 SkBitmap CreateSmallHolderBitmap() { 19 SkBitmap CreateSmallHolderBitmap() {
20 SkBitmap small_bitmap; 20 SkBitmap small_bitmap;
21 SkCanvas canvas(small_bitmap);
22 small_bitmap.allocPixels( 21 small_bitmap.allocPixels(
23 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); 22 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
23 SkCanvas canvas(small_bitmap);
24 canvas.drawColor(SK_ColorWHITE); 24 canvas.drawColor(SK_ColorWHITE);
25 small_bitmap.setImmutable(); 25 small_bitmap.setImmutable();
26 return small_bitmap; 26 return small_bitmap;
27 } 27 }
28 28
29 } // anonymous namespace 29 } // anonymous namespace
30 30
31 std::unique_ptr<Thumbnail> Thumbnail::Create( 31 std::unique_ptr<Thumbnail> Thumbnail::Create(
32 TabId tab_id, 32 TabId tab_id,
33 const base::Time& time_stamp, 33 const base::Time& time_stamp,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void Thumbnail::DoInvalidate() { 110 void Thumbnail::DoInvalidate() {
111 if (thumbnail_delegate_) 111 if (thumbnail_delegate_)
112 thumbnail_delegate_->InvalidateCachedThumbnail(this); 112 thumbnail_delegate_->InvalidateCachedThumbnail(this);
113 } 113 }
114 114
115 void Thumbnail::ClearUIResourceId() { 115 void Thumbnail::ClearUIResourceId() {
116 if (ui_resource_id_ && ui_resource_provider_) 116 if (ui_resource_id_ && ui_resource_provider_)
117 ui_resource_provider_->DeleteUIResource(ui_resource_id_); 117 ui_resource_provider_->DeleteUIResource(ui_resource_id_);
118 ui_resource_id_ = 0; 118 ui_resource_id_ = 0;
119 } 119 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698