Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/resources/system/SystemResourceLoader.java |
| diff --git a/ui/android/java/src/org/chromium/ui/resources/system/SystemResourceLoader.java b/ui/android/java/src/org/chromium/ui/resources/system/SystemResourceLoader.java |
| index 9039ac232a50b6cd0f4bd66495d3eab283a6455f..78ca81e668e39ec66491246e1c5138ad84818b86 100644 |
| --- a/ui/android/java/src/org/chromium/ui/resources/system/SystemResourceLoader.java |
| +++ b/ui/android/java/src/org/chromium/ui/resources/system/SystemResourceLoader.java |
| @@ -4,7 +4,6 @@ |
| package org.chromium.ui.resources.system; |
| -import android.content.Context; |
| import android.content.res.Resources; |
| import android.graphics.Bitmap; |
| import android.graphics.Canvas; |
| @@ -12,7 +11,6 @@ import android.graphics.Paint; |
| import android.graphics.Paint.Style; |
| import android.graphics.RectF; |
| -import org.chromium.ui.gfx.DeviceDisplayInfo; |
| import org.chromium.ui.resources.Resource; |
| import org.chromium.ui.resources.SystemUIResourceType; |
| import org.chromium.ui.resources.async.AsyncPreloadResourceLoader; |
| @@ -30,19 +28,19 @@ public class SystemResourceLoader extends AsyncPreloadResourceLoader { |
| * @param resourceType The resource type this loader is responsible for loading. |
| * @param callback The {@link ResourceLoaderCallback} to notify when a {@link Resource} is |
| * done loading. |
| - * @param resources A {@link Resources} instance to load assets from. |
| + * @param minScreenSideLength The length of the smallest side of the screen. |
|
Ted C
2015/11/11 00:19:45
I would suffix this with either Dp or Px depending
gsennton
2015/11/13 20:00:05
Done.
|
| */ |
| - public SystemResourceLoader(int resourceType, ResourceLoaderCallback callback, |
| - final Context context) { |
| + public SystemResourceLoader( |
| + int resourceType, ResourceLoaderCallback callback, final int minScreenSideLength) { |
| super(resourceType, callback, new ResourceCreator() { |
| @Override |
| public Resource create(int resId) { |
| - return createResource(context, resId); |
| + return createResource(minScreenSideLength, resId); |
| } |
| }); |
| } |
| - private static Resource createResource(Context context, int resId) { |
| + private static Resource createResource(int minScreenSideLength, int resId) { |
| switch (resId) { |
| case SystemUIResourceType.OVERSCROLL_EDGE: |
| return StaticResource.create(Resources.getSystem(), |
| @@ -51,7 +49,7 @@ public class SystemResourceLoader extends AsyncPreloadResourceLoader { |
| return StaticResource.create(Resources.getSystem(), |
| getResourceId("android:drawable/overscroll_glow"), 128, 64); |
| case SystemUIResourceType.OVERSCROLL_GLOW_L: |
| - return createOverscrollGlowLBitmap(context); |
| + return createOverscrollGlowLBitmap(minScreenSideLength); |
| default: |
| assert false; |
| @@ -59,14 +57,8 @@ public class SystemResourceLoader extends AsyncPreloadResourceLoader { |
| return null; |
| } |
| - private static Resource createOverscrollGlowLBitmap(Context context) { |
| - DeviceDisplayInfo displayInfo = DeviceDisplayInfo.create(context); |
| - int screenWidth = displayInfo.getPhysicalDisplayWidth() != 0 |
| - ? displayInfo.getPhysicalDisplayWidth() : displayInfo.getDisplayWidth(); |
| - int screenHeight = displayInfo.getPhysicalDisplayHeight() != 0 |
| - ? displayInfo.getPhysicalDisplayHeight() : displayInfo.getDisplayHeight(); |
| - |
| - float arcWidth = Math.min(screenWidth, screenHeight) * 0.5f / SIN_PI_OVER_6; |
| + private static Resource createOverscrollGlowLBitmap(int minScreenSideLength) { |
| + float arcWidth = minScreenSideLength * 0.5f / SIN_PI_OVER_6; |
| float y = COS_PI_OVER_6 * arcWidth; |
| float height = arcWidth - y; |