mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
This shouldn't normally happen as conforming drivers are required to support that texture format, but the software driver that we accidentally choose on Poco C40 (see issue #16391) doesn't. That we choose that driver will be fixed separately. This fix on its own at least lets the user comfortably navigate to settings and switch to OpenGL.
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "ppsspp_config.h"
|
|
|
|
#include <map>
|
|
#include "Common/Render/Text/draw_text.h"
|
|
|
|
#if PPSSPP_PLATFORM(ANDROID)
|
|
|
|
#include <jni.h>
|
|
|
|
struct AndroidFontEntry {
|
|
double size;
|
|
};
|
|
|
|
class TextDrawerAndroid : public TextDrawer {
|
|
public:
|
|
TextDrawerAndroid(Draw::DrawContext *draw);
|
|
~TextDrawerAndroid();
|
|
|
|
bool IsReady() const override;
|
|
uint32_t SetFont(const char *fontName, int size, int flags) override;
|
|
void SetFont(uint32_t fontHandle) override; // Shortcut once you've set the font once.
|
|
void MeasureString(const char *str, size_t len, float *w, float *h) override;
|
|
void MeasureStringRect(const char *str, size_t len, const Bounds &bounds, float *w, float *h, int align = ALIGN_TOPLEFT) override;
|
|
void DrawString(DrawBuffer &target, const char *str, float x, float y, uint32_t color, int align = ALIGN_TOPLEFT) override;
|
|
void DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStringEntry &entry, Draw::DataFormat texFormat, const char *str, int align = ALIGN_TOPLEFT) override;
|
|
// Use for housekeeping like throwing out old strings.
|
|
void OncePerFrame() override;
|
|
|
|
protected:
|
|
void ClearCache() override;
|
|
|
|
private:
|
|
std::string NormalizeString(std::string str);
|
|
|
|
// JNI functions
|
|
jclass cls_textRenderer;
|
|
jmethodID method_measureText;
|
|
jmethodID method_renderText;
|
|
|
|
uint32_t fontHash_;
|
|
bool use4444Format_ = false;
|
|
|
|
std::map<uint32_t, AndroidFontEntry> fontMap_;
|
|
|
|
std::map<CacheKey, std::unique_ptr<TextStringEntry>> cache_;
|
|
std::map<CacheKey, std::unique_ptr<TextMeasureEntry>> sizeCache_;
|
|
};
|
|
|
|
#endif
|