本文整理汇总了C++中DisplayListRenderer::drawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ DisplayListRenderer::drawRect方法的具体用法?C++ DisplayListRenderer::drawRect怎么用?C++ DisplayListRenderer::drawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisplayListRenderer
的用法示例。
在下文中一共展示了DisplayListRenderer::drawRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
static void android_view_GLES20Canvas_drawRegionAsRects(JNIEnv* env, jobject clazz,
jlong rendererPtr, jlong regionPtr, jlong paintPtr) {
DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
SkRegion* region = reinterpret_cast<SkRegion*>(regionPtr);
Paint* paint = reinterpret_cast<Paint*>(paintPtr);
if (paint->getStyle() != Paint::kFill_Style ||
(paint->isAntiAlias() && !renderer->isCurrentTransformSimple())) {
SkRegion::Iterator it(*region);
while (!it.done()) {
const SkIRect& r = it.rect();
renderer->drawRect(r.fLeft, r.fTop, r.fRight, r.fBottom, paint);
it.next();
}
} else {
int count = 0;
Vector<float> rects;
SkRegion::Iterator it(*region);
while (!it.done()) {
const SkIRect& r = it.rect();
rects.push(r.fLeft);
rects.push(r.fTop);
rects.push(r.fRight);
rects.push(r.fBottom);
count += 4;
it.next();
}
renderer->drawRects(rects.array(), count, paint);
}
}
示例2:
static void android_view_GLES20Canvas_drawRect(JNIEnv* env, jobject clazz,
jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
jlong paintPtr) {
DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
Paint* paint = reinterpret_cast<Paint*>(paintPtr);
renderer->drawRect(left, top, right, bottom, paint);
}