[layers] Replace homebrew classes with Android ones

RESOLVED FIXED

Status

()

Firefox for Android
General
P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: kats, Assigned: kats)

Tracking

unspecified
All
Android
Points:
---

Firefox Tracking Flags

(firefox11 fixed, fennec11+)

Details

Attachments

(4 attachments)

The IntPoint, FloatPoint, IntRect, and FloatRect classes should be replaced with the Android-provided Point, PointF, Rect, and RectF ones respectively.
Created attachment 574397 [details] [diff] [review]
(1/4) Replace intpoint
Attachment #574397 - Flags: review?(pwalton)
Created attachment 574398 [details] [diff] [review]
(2/4) Replace floatpoint
Attachment #574398 - Flags: review?(pwalton)
Created attachment 574399 [details] [diff] [review]
(3/4) Replace IntRect
Attachment #574399 - Flags: review?(pwalton)
Created attachment 574400 [details] [diff] [review]
(4/4) Replace FloatRect
Attachment #574400 - Flags: review?(pwalton)
Comment on attachment 574397 [details] [diff] [review]
(1/4) Replace intpoint

Review of attachment 574397 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #574397 - Flags: review?(pwalton) → review+
Comment on attachment 574398 [details] [diff] [review]
(2/4) Replace floatpoint

Review of attachment 574398 [details] [diff] [review]:
-----------------------------------------------------------------

r+
Attachment #574398 - Flags: review?(pwalton) → review+
Comment on attachment 574399 [details] [diff] [review]
(3/4) Replace IntRect

Review of attachment 574399 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with comment

::: embedding/android/GeckoApp.java
@@ -748,4 +748,4 @@
> >                  });
> >                  connectGeckoLayerClient();
> >              } else if (event.equals("PanZoom:Ack")) {
> > -                final IntRect rect = new IntRect(message.getJSONObject("rect"));
> > +                Rect rect = RectUtils.create(message.getJSONObject("rect"));

Standard Java style prefers "createInstance", but that's gratuitously long, so let's leave it as create.

::: embedding/android/gfx/TileLayer.java
@@ +58,5 @@
>      private boolean mRepeat;
>      private IntSize mSize;
>      private int[] mTextureIDs;
>  
> +    private Rect mTextureUploadRect;

I'd add a comment here saying that it's not safe to hand this rect out, since it may be mutated (via the union line below) and that would surprise callers.
Attachment #574399 - Flags: review?(pwalton) → review+
Comment on attachment 574400 [details] [diff] [review]
(4/4) Replace FloatRect

Review of attachment 574400 [details] [diff] [review]:
-----------------------------------------------------------------

r=me

::: embedding/android/ui/ViewportController.java
@@ +92,2 @@
>          float zoomFactor = (float)layerPageSize.width / (float)mPageSize.width;
> +        return RectUtils.scale(layerVisibleRect, 1.0f / zoomFactor);

scaleAll() adjusts X and Y as well as width and height. (Note that I'm going to be throwing a lot of this code away, so this doesn't really matter.)
Attachment #574400 - Flags: review?(pwalton) → review+

Updated

6 years ago
Priority: -- → P2
http://hg.mozilla.org/projects/birch/rev/8d005019346d
http://hg.mozilla.org/projects/birch/rev/f713a9e71b50
http://hg.mozilla.org/projects/birch/rev/22f3cf68358c
http://hg.mozilla.org/projects/birch/rev/c2d1751fe274
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
tracking-fennec: --- → 11+
status-firefox11: --- → fixed
You need to log in before you can comment on or make changes to this bug.