Cleanup pointer access in adapter and font.
Change-Id: Ie500574adebb9bdb38c138f78582af2cd7610f76
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 995cef2..6a897a3 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -285,9 +285,10 @@
}
void rsrDrawTextAlloc(Context *rsc, Script *sc, Allocation *a, int x, int y) {
- const char *text = (const char *)a->getPtr();
+ const char *text = (const char *)rsc->mHal.funcs.allocation.lock1D(rsc, a);
size_t allocSize = a->getType()->getSizeBytes();
rsc->mStateFont.renderText(text, allocSize, x, y);
+ rsc->mHal.funcs.allocation.unlock1D(rsc, a);
}
void rsrDrawText(Context *rsc, Script *sc, const char *text, int x, int y) {
@@ -314,11 +315,12 @@
void rsrMeasureTextAlloc(Context *rsc, Script *sc, Allocation *a,
int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
CHECK_OBJ(a);
- const char *text = (const char *)a->getPtr();
+ const char *text = (const char *)rsc->mHal.funcs.allocation.lock1D(rsc, a);
size_t textLen = a->getType()->getSizeBytes();
Font::Rect metrics;
rsc->mStateFont.measureText(text, textLen, &metrics);
SetMetrics(&metrics, left, right, top, bottom);
+ rsc->mHal.funcs.allocation.unlock1D(rsc, a);
}
void rsrMeasureText(Context *rsc, Script *sc, const char *text,