OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/overscroll_glow.h" | 5 #include "content/browser/android/overscroll_glow.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "cc/layers/image_layer.h" | 9 #include "cc/layers/picture_image_layer.h" |
10 #include "content/browser/android/edge_effect.h" | 10 #include "content/browser/android/edge_effect.h" |
11 #include "ui/gfx/android/java_bitmap.h" | 11 #include "ui/gfx/android/java_bitmap.h" |
12 | 12 |
13 using std::max; | 13 using std::max; |
14 using std::min; | 14 using std::min; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
(...skipping 19 matching lines...) Expand all Loading... | |
39 SkBitmap glow_bitmap_; | 39 SkBitmap glow_bitmap_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(OverscrollResources); | 41 DISALLOW_COPY_AND_ASSIGN(OverscrollResources); |
42 }; | 42 }; |
43 | 43 |
44 // Leaky to allow access from a worker thread. | 44 // Leaky to allow access from a worker thread. |
45 base::LazyInstance<OverscrollResources>::Leaky g_overscroll_resources = | 45 base::LazyInstance<OverscrollResources>::Leaky g_overscroll_resources = |
46 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
47 | 47 |
48 scoped_refptr<cc::Layer> CreateImageLayer(const SkBitmap& bitmap) { | 48 scoped_refptr<cc::Layer> CreateImageLayer(const SkBitmap& bitmap) { |
49 scoped_refptr<cc::ImageLayer> layer = cc::ImageLayer::Create(); | 49 scoped_refptr<cc::PictureImageLayer> layer = cc::PictureImageLayer::Create(); |
enne (OOO)
2013/09/05 02:01:19
This seems like the right change to make so that A
kaanb
2013/09/06 02:05:54
Probably bitmap_16 being on stack that Sami pointe
| |
50 layer->SetBitmap(bitmap); | 50 layer->SetBitmap(bitmap); |
51 return layer; | 51 return layer; |
52 } | 52 } |
53 | 53 |
54 bool IsApproxZero(float value) { | 54 bool IsApproxZero(float value) { |
55 return std::abs(value) < kEpsilon; | 55 return std::abs(value) < kEpsilon; |
56 } | 56 } |
57 | 57 |
58 gfx::Vector2dF ZeroSmallComponents(gfx::Vector2dF vector) { | 58 gfx::Vector2dF ZeroSmallComponents(gfx::Vector2dF vector) { |
59 if (IsApproxZero(vector.x())) | 59 if (IsApproxZero(vector.x())) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 break; | 262 break; |
263 }; | 263 }; |
264 } | 264 } |
265 | 265 |
266 EdgeEffect* OverscrollGlow::GetOppositeEdge(int edge_index) { | 266 EdgeEffect* OverscrollGlow::GetOppositeEdge(int edge_index) { |
267 return edge_effects_[(edge_index + 2) % EdgeEffect::EDGE_COUNT].get(); | 267 return edge_effects_[(edge_index + 2) % EdgeEffect::EDGE_COUNT].get(); |
268 } | 268 } |
269 | 269 |
270 } // namespace content | 270 } // namespace content |
271 | 271 |
OLD | NEW |