Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a5506803
Kaydet (Commit)
a5506803
authored
Eki 01, 2014
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: SingleTileLayer - less var. trashing (Fennec update)
Change-Id: I8c32f6a43cad6dd3790a3e7dd0b990516a35ebca
üst
7afb0e24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
46 deletions
+58
-46
SingleTileLayer.java
...roid3/src/java/org/mozilla/gecko/gfx/SingleTileLayer.java
+58
-46
No files found.
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SingleTileLayer.java
Dosyayı görüntüle @
a5506803
...
...
@@ -23,14 +23,40 @@ public class SingleTileLayer extends TileLayer {
private
Rect
mMask
;
public
SingleTileLayer
(
CairoImage
image
)
{
this
(
false
,
image
);
}
// To avoid excessive GC, declare some objects here that would otherwise
// be created and destroyed frequently during draw().
private
final
RectF
mBounds
;
private
final
RectF
mTextureBounds
;
private
final
RectF
mViewport
;
private
final
Rect
mIntBounds
;
private
final
Rect
mSubRect
;
private
final
RectF
mSubRectF
;
private
final
Region
mMaskedBounds
;
private
final
Rect
mCropRect
;
private
final
RectF
mObjRectF
;
private
final
float
[]
mCoords
;
public
SingleTileLayer
(
CairoImage
image
)
{
this
(
false
,
image
);
}
public
SingleTileLayer
(
boolean
repeat
,
CairoImage
image
)
{
super
(
image
,
repeat
?
PaintMode
.
REPEAT
:
PaintMode
.
NORMAL
);
this
(
image
,
repeat
?
TileLayer
.
PaintMode
.
REPEAT
:
TileLayer
.
PaintMode
.
NORMAL
);
}
public
SingleTileLayer
(
CairoImage
image
,
TileLayer
.
PaintMode
paintMode
)
{
super
(
image
,
paintMode
);
mBounds
=
new
RectF
();
mTextureBounds
=
new
RectF
();
mViewport
=
new
RectF
();
mIntBounds
=
new
Rect
();
mSubRect
=
new
Rect
();
mSubRectF
=
new
RectF
();
mMaskedBounds
=
new
Region
();
mCropRect
=
new
Rect
();
mObjRectF
=
new
RectF
();
mCoords
=
new
float
[
20
];
}
/**
...
...
@@ -47,83 +73,69 @@ public class SingleTileLayer extends TileLayer {
if
(!
initialized
())
return
;
RectF
bounds
;
RectF
textureBounds
;
RectF
viewport
=
context
.
viewport
;
mViewport
.
set
(
context
.
viewport
);
if
(
repeats
())
{
// If we're repeating, we want to adjust the texture bounds so that
// the texture repeats the correct number of times when drawn at
// the size of the viewport.
bounds
=
getBounds
(
context
);
textureBounds
=
new
RectF
(
0.0f
,
0.0f
,
bounds
.
width
(),
b
ounds
.
height
());
bounds
=
new
RectF
(
0.0f
,
0.0f
,
viewport
.
width
(),
v
iewport
.
height
());
mBounds
.
set
(
getBounds
(
context
)
);
mTextureBounds
.
set
(
0.0f
,
0.0f
,
mBounds
.
width
(),
mB
ounds
.
height
());
mBounds
.
set
(
0.0f
,
0.0f
,
mViewport
.
width
(),
mV
iewport
.
height
());
}
else
if
(
stretches
())
{
// If we're stretching, we just want the bounds and texture bounds
// to fit to the page.
bounds
=
new
RectF
(
context
.
pageRect
);
textureBounds
=
bounds
;
mBounds
.
set
(
context
.
pageRect
);
mTextureBounds
.
set
(
mBounds
)
;
}
else
{
bounds
=
getBounds
(
context
);
textureBounds
=
bounds
;
mBounds
.
set
(
getBounds
(
context
)
);
mTextureBounds
.
set
(
mBounds
)
;
}
Rect
intBounds
=
new
Rect
();
bounds
.
roundOut
(
intBounds
);
Region
maskedBounds
=
new
Region
(
intBounds
);
mBounds
.
roundOut
(
mIntBounds
);
mMaskedBounds
.
set
(
mIntBounds
);
if
(
mMask
!=
null
)
{
maskedBounds
.
op
(
mMask
,
Region
.
Op
.
DIFFERENCE
);
if
(
maskedBounds
.
isEmpty
())
m
M
askedBounds
.
op
(
mMask
,
Region
.
Op
.
DIFFERENCE
);
if
(
m
M
askedBounds
.
isEmpty
())
return
;
}
// XXX Possible optimisation here, form this array so we can draw it in
// a single call.
RegionIterator
i
=
new
RegionIterator
(
maskedBounds
);
for
(
Rect
subRect
=
new
Rect
();
i
.
next
(
subRect
);
)
{
RegionIterator
i
=
new
RegionIterator
(
m
M
askedBounds
);
while
(
i
.
next
(
mSubRect
)
)
{
// Compensate for rounding errors at the edge of the tile caused by
// the roundOut above
RectF
subRectF
=
new
RectF
(
Math
.
max
(
bounds
.
left
,
(
float
)
s
ubRect
.
left
),
Math
.
max
(
bounds
.
top
,
(
float
)
s
ubRect
.
top
),
Math
.
min
(
bounds
.
right
,
(
float
)
s
ubRect
.
right
),
Math
.
min
(
bounds
.
bottom
,
(
float
)
s
ubRect
.
bottom
));
mSubRectF
.
set
(
Math
.
max
(
mBounds
.
left
,
(
float
)
mS
ubRect
.
left
),
Math
.
max
(
mBounds
.
top
,
(
float
)
mS
ubRect
.
top
),
Math
.
min
(
mBounds
.
right
,
(
float
)
mS
ubRect
.
right
),
Math
.
min
(
mBounds
.
bottom
,
(
float
)
mS
ubRect
.
bottom
));
// This is the left/top/right/bottom of the rect, relative to the
// bottom-left of the layer, to use for texture coordinates.
int
[]
cropRect
=
new
int
[]
{
Math
.
round
(
subRectF
.
left
-
bounds
.
left
),
Math
.
round
(
bounds
.
bottom
-
subRectF
.
top
),
Math
.
round
(
subRectF
.
right
-
bounds
.
left
),
Math
.
round
(
bounds
.
bottom
-
subRectF
.
bottom
)
};
float
left
=
subRectF
.
left
-
viewport
.
left
;
float
top
=
viewport
.
bottom
-
subRectF
.
bottom
;
float
right
=
left
+
subRectF
.
width
();
float
bottom
=
top
+
subRectF
.
height
();
float
[]
coords
=
{
//x, y, z, texture_x, texture_y
left
/
viewport
.
width
(),
bottom
/
viewport
.
height
(),
0
,
cropRect
[
0
]/
textureBounds
.
width
(),
cropRect
[
1
]/
textureBounds
.
height
(),
left
/
viewport
.
width
(),
top
/
viewport
.
height
(),
0
,
cropRect
[
0
]/
textureBounds
.
width
(),
cropRect
[
3
]/
textureBounds
.
height
(),
mCropRect
.
set
(
Math
.
round
(
mSubRectF
.
left
-
mBounds
.
left
),
Math
.
round
(
mBounds
.
bottom
-
mSubRectF
.
top
),
Math
.
round
(
mSubRectF
.
right
-
mBounds
.
left
),
Math
.
round
(
mBounds
.
bottom
-
mSubRectF
.
bottom
));
right
/
viewport
.
width
(),
bottom
/
viewport
.
height
(),
0
,
cropRect
[
2
]/
textureBounds
.
width
(),
cropRect
[
1
]/
textureBounds
.
height
(),
mObjRectF
.
set
(
mSubRectF
.
left
-
mViewport
.
left
,
mViewport
.
bottom
-
mSubRectF
.
bottom
,
mSubRectF
.
right
-
mViewport
.
left
,
mViewport
.
bottom
-
mSubRectF
.
top
);
right
/
viewport
.
width
(),
top
/
viewport
.
height
(),
0
,
cropRect
[
2
]/
textureBounds
.
width
(),
cropRect
[
3
]/
textureBounds
.
height
()
};
fillRectCoordBuffer
(
mCoords
,
mObjRectF
,
mViewport
.
width
(),
mViewport
.
height
(),
mCropRect
,
mTextureBounds
.
width
(),
mTextureBounds
.
height
());
FloatBuffer
coordBuffer
=
context
.
coordBuffer
;
int
positionHandle
=
context
.
positionHandle
;
int
textureHandle
=
context
.
textureHandle
;
GLES20
.
glActiveTexture
(
GLES20
.
GL_TEXTURE0
);
GLES20
.
glBindTexture
(
GLES20
.
GL_TEXTURE_2D
,
getTextureID
());
// Make sure we are at position zero in the buffer
coordBuffer
.
position
(
0
);
coordBuffer
.
put
(
c
oords
);
coordBuffer
.
put
(
mC
oords
);
// Unbind any the current array buffer so we can use client side buffers
GLES20
.
glBindBuffer
(
GLES20
.
GL_ARRAY_BUFFER
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment