Upon the link

Hardware accleration

I found that Canvas now supports hardware acceleration(mostly).

I downloaded the 4.2.2 AOSP(API Level 17) source and checked the code in external/skia/src/core/sKCanvas.cpp

I reached sKCanvas.cpp because this will finally get called via jni from Android Canvas class.

However, say drawPosText(), this function should be using hardware acceleration (open gl)

in the code. But when I checked this function in sKCanvas.cpp, I dont see any code related to open gl.

Did I misunderstand anything? This does confuse me.

Thanks.

void SkCanvas::drawPosText(const void* text, size_t byteLength,
                       const SkPoint pos[], const SkPaint& paint) {
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type)

while (iter.next()) {
    SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
    iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 0, 2,
                              dfp.paint());
}

LOOPER_END

}

有帮助吗?

解决方案

You are looking at the software implementation. The hardware implementation is in frameworks/base/libs/hwui and frameworks/base/core/java/android/view/ (see HardwareRenderer.java, HardwareCanvas.java, GLES20Canvas.java, etc.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top