summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-03-16 19:28:25 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-03-16 19:28:25 -0700
commit2c74ad9aae29cc64fece926f353825a7925792c2 (patch)
treed06f79b21c098e448d1370f4ec80309f232a3a28 /libs/rs
parentc2b91a6113c30d3b994ef081fbd5b941200d55a4 (diff)
downloadframeworks_base-2c74ad9aae29cc64fece926f353825a7925792c2.zip
frameworks_base-2c74ad9aae29cc64fece926f353825a7925792c2.tar.gz
frameworks_base-2c74ad9aae29cc64fece926f353825a7925792c2.tar.bz2
Fix for bug 3434228
Change-Id: I57973faf782b487e7913a096f0ab6012dc1c9415
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/RenderScript.h3
-rw-r--r--libs/rs/rsContext.cpp5
-rw-r--r--libs/rs/rsContext.h3
-rw-r--r--libs/rs/rsFont.cpp2
4 files changed, 10 insertions, 3 deletions
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index bb5e4aa..ffa9a8c 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -76,7 +76,8 @@ void rsDeviceDestroy(RsDevice);
void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value);
RsContext rsContextCreate(RsDevice, uint32_t version);
-RsContext rsContextCreateGL(RsDevice, uint32_t version, RsSurfaceConfig sc);
+RsContext rsContextCreateGL(RsDevice, uint32_t version,
+ RsSurfaceConfig sc, uint32_t dpi);
void rsContextDestroy(RsContext);
enum RsMessageToClientType {
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index f9e29f1..c63d183 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -630,6 +630,7 @@ Context::Context() {
mPaused = false;
mObjHead = NULL;
mError = RS_ERROR_NONE;
+ mDPI = 96;
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
@@ -1078,10 +1079,12 @@ RsContext rsContextCreate(RsDevice vdev, uint32_t version) {
return rsc;
}
-RsContext rsContextCreateGL(RsDevice vdev, uint32_t version, RsSurfaceConfig sc) {
+RsContext rsContextCreateGL(RsDevice vdev, uint32_t version,
+ RsSurfaceConfig sc, uint32_t dpi) {
LOGV("rsContextCreateGL %p", vdev);
Device * dev = static_cast<Device *>(vdev);
Context *rsc = Context::createContext(dev, &sc);
+ rsc->setDPI(dpi);
LOGV("rsContextCreateGL ret %p ", rsc);
return rsc;
}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index c5e32a6..50f63df 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -218,6 +218,8 @@ public:
void launchThreads(WorkerCallback_t cbk, void *data);
uint32_t getWorkerPoolSize() const {return (uint32_t)mWorkers.mCount;}
+ uint32_t getDPI() const {return mDPI;}
+ void setDPI(uint32_t dpi) {mDPI = dpi;}
protected:
Device *mDev;
@@ -258,6 +260,7 @@ protected:
float EXT_texture_max_aniso;
} mGL;
+ uint32_t mDPI;
uint32_t mWidth;
uint32_t mHeight;
int32_t mThreadPriority;
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 1c1bc98..01dbab8 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -733,7 +733,7 @@ void FontState::renderText(const char *text, uint32_t len, int32_t x, int32_t y,
String8 fullPath(getenv("ANDROID_ROOT"));
fullPath += fontsDir;
- mDefault.set(Font::create(mRSC, fullPath.string(), 16, 96));
+ mDefault.set(Font::create(mRSC, fullPath.string(), 8, mRSC->getDPI()));
}
currentFont = mDefault.get();
}