'Skia jni SkCanvas::drawString() not rendering while shapes works
I've built Skia for Android api 24 Passing a bitmap created from java to jni, this code draws everything fine except strings:
void draw(JNIEnv *env, jobject bmp) {
AndroidBitmapInfo dstInfo;
void *dstPixels;
AndroidBitmap_getInfo(env, bmp, &dstInfo);
AndroidBitmap_lockPixels(env, bmp, &dstPixels);
SkImageInfo info = SkImageInfo::MakeN32Premul(dstInfo.width, dstInfo.height);
sk_sp<SkSurface> surface(SkSurface::MakeRasterDirect(info, dstPixels, dstInfo.stride));
SkCanvas *canvas = surface->getCanvas();
canvas->drawColor(0xFFcccccc);
SkFont font;
SkPaint paint;
paint.setColor(SK_ColorGREEN);
paint.setStrokeWidth(30.f);
paint.setAntiAlias(true);
canvas->drawString("Skia is Best!", 99, 99, font, paint);
cvs->drawLine(100, 100, 300, 300, paint);
cvs->drawRoundRect(r, 11.f, 11.f, paint);
cvs->drawCircle(500, 600, 99.f, point);
AndroidBitmap_unlockPixels(env, bmp);
}
No crashes or errors generated, any idea what may be causing that?
Tested on: Xiaomi Mi10t Android 10
Solution 1:[1]
I've fixed the issue, if anyone having the same problem,
I was compiling Skia without expat (skia_use_expat=false) because it had some errors while compiling, after fixing the errors, and recompiling Skia with expat, it worked like just fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | xYuri |
