Transform2 Transform2::operator*(const Transform2 &next) const { Transform2 result = *this; nvgTransformMultiply(result.m_data, next.m_data); return result; }
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformMultiply__JJ(JNIEnv *__env, jclass clazz, jlong dstAddress, jlong srcAddress) { float *dst = (float *)(intptr_t)dstAddress; const float *src = (const float *)(intptr_t)srcAddress; UNUSED_PARAMS(__env, clazz) nvgTransformMultiply(dst, src); }
static int glnvg__convertPaint(GLNVGcontext* gl, GLNVGfragUniforms* frag, NVGpaint* paint, NVGscissor* scissor, float width, float fringe, float strokeThr) { PROFILER_CPU_TIMESLICE("NVG backend convertPaint"); GLNVGtexture* tex = NULL; float invxform[6]; mem_zero(frag); frag->innerCol = glnvg__premulColor(paint->innerColor); frag->outerCol = glnvg__premulColor(paint->outerColor); if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f) { mem_zero(frag->scissorMat); frag->scissorExt[0] = 1.0f; frag->scissorExt[1] = 1.0f; frag->scissorScale[0] = 1.0f; frag->scissorScale[1] = 1.0f; } else { nvgTransformInverse(invxform, scissor->xform); glnvg__xformToMat3x4(frag->scissorMat, invxform); frag->scissorExt[0] = scissor->extent[0]; frag->scissorExt[1] = scissor->extent[1]; frag->scissorScale[0] = ml::sqrt(scissor->xform[0] * scissor->xform[0] + scissor->xform[2] * scissor->xform[2]) / fringe; frag->scissorScale[1] = ml::sqrt(scissor->xform[1] * scissor->xform[1] + scissor->xform[3] * scissor->xform[3]) / fringe; } mem_copy(frag->extent, paint->extent, sizeof(frag->extent)); frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe; frag->strokeThr = strokeThr; if (paint->image != 0) { tex = glnvg__findTexture(gl, paint->image); if (tex == NULL) return 0; if ((tex->flags & NVGL_TEXTURE_FLIP_Y) != 0) { float flipped[6]; nvgTransformScale(flipped, 1.0f, -1.0f); nvgTransformMultiply(flipped, paint->xform); nvgTransformInverse(invxform, flipped); } else { nvgTransformInverse(invxform, paint->xform); } frag->type = NSVG_SHADER_FILLIMG; if (tex->type == NVG_TEXTURE_RGBA) frag->texType = (tex->flags & NVGL_TEXTURE_PREMULTIPLIED) ? 0 : 1; else frag->texType = 2; // printf("frag->texType = %d\n", frag->texType); } else { frag->type = NSVG_SHADER_FILLGRAD; frag->radius = paint->radius; frag->feather = paint->feather; nvgTransformInverse(invxform, paint->xform); } glnvg__xformToMat3x4(frag->paintMat, invxform); return 1; }