| 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 "content/browser/android/system_ui_resource_manager_impl.h" | 5 #include "content/browser/android/system_ui_resource_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const float height = arc_width - y; | 38 const float height = arc_width - y; |
| 39 gfx::Size bounds(arc_width, height); | 39 gfx::Size bounds(arc_width, height); |
| 40 SkRect arc_rect = SkRect::MakeXYWH( | 40 SkRect arc_rect = SkRect::MakeXYWH( |
| 41 -arc_width / 2.f, -arc_width - y, arc_width * 2.f, arc_width * 2.f); | 41 -arc_width / 2.f, -arc_width - y, arc_width * 2.f, arc_width * 2.f); |
| 42 SkBitmap glow_bitmap; | 42 SkBitmap glow_bitmap; |
| 43 if (!glow_bitmap.allocPixels( | 43 if (!glow_bitmap.allocPixels( |
| 44 SkImageInfo::MakeA8(bounds.width(), bounds.height()))) { | 44 SkImageInfo::MakeA8(bounds.width(), bounds.height()))) { |
| 45 LOG(FATAL) << " Failed to allocate bitmap of size " << bounds.width() << "x" | 45 LOG(FATAL) << " Failed to allocate bitmap of size " << bounds.width() << "x" |
| 46 << bounds.height(); | 46 << bounds.height(); |
| 47 } | 47 } |
| 48 glow_bitmap.eraseColor(SK_ColorTRANSPARENT); |
| 48 | 49 |
| 49 SkCanvas canvas(glow_bitmap); | 50 SkCanvas canvas(glow_bitmap); |
| 50 canvas.clipRect(SkRect::MakeXYWH(0, 0, bounds.width(), bounds.height())); | 51 canvas.clipRect(SkRect::MakeXYWH(0, 0, bounds.width(), bounds.height())); |
| 51 canvas.drawArc(arc_rect, 45, 90, true, paint); | 52 canvas.drawArc(arc_rect, 45, 90, true, paint); |
| 52 return glow_bitmap; | 53 return glow_bitmap; |
| 53 } | 54 } |
| 54 | 55 |
| 55 void LoadBitmap(ui::SystemUIResourceManager::ResourceType type, | 56 void LoadBitmap(ui::SystemUIResourceManager::ResourceType type, |
| 56 SkBitmap* bitmap_holder, | 57 SkBitmap* bitmap_holder, |
| 57 const gfx::Size& screen_size) { | 58 const gfx::Size& screen_size) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 174 } |
| 174 | 175 |
| 175 void SystemUIResourceManagerImpl::OnFinishedLoadBitmap( | 176 void SystemUIResourceManagerImpl::OnFinishedLoadBitmap( |
| 176 ResourceType type, | 177 ResourceType type, |
| 177 SkBitmap* bitmap_holder) { | 178 SkBitmap* bitmap_holder) { |
| 178 DCHECK(bitmap_holder); | 179 DCHECK(bitmap_holder); |
| 179 GetEntry(type)->SetBitmap(*bitmap_holder); | 180 GetEntry(type)->SetBitmap(*bitmap_holder); |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace content | 183 } // namespace content |
| OLD | NEW |