本文整理汇总了C++中SkClipRectCommand类的典型用法代码示例。如果您正苦于以下问题:C++ SkClipRectCommand类的具体用法?C++ SkClipRectCommand怎么用?C++ SkClipRectCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkClipRectCommand类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply_8
// Fold the clipRect into the drawBitmapRectToRect's src and dest rects
static void apply_8(SkDebugCanvas* canvas, int curCommand) {
SkClipRectCommand* clip =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
SkScalar newSrcLeft, newSrcTop;
if (NULL != dbmr->srcRect()) {
newSrcLeft = dbmr->srcRect()->fLeft + clip->rect().fLeft - dbmr->dstRect().fLeft;
newSrcTop = dbmr->srcRect()->fTop + clip->rect().fTop - dbmr->dstRect().fTop;
} else {
newSrcLeft = clip->rect().fLeft - dbmr->dstRect().fLeft;
newSrcTop = clip->rect().fTop - dbmr->dstRect().fTop;
}
SkRect newSrc = SkRect::MakeXYWH(newSrcLeft, newSrcTop,
clip->rect().width(), clip->rect().height());
dbmr->setSrcRect(newSrc);
dbmr->setDstRect(clip->rect());
// remove everything except the drawbitmaprect
canvas->deleteDrawCommandAt(curCommand+3);
canvas->deleteDrawCommandAt(curCommand+1);
canvas->deleteDrawCommandAt(curCommand);
}
示例2: check_2
// Check for:
// SAVE
// CLIP_RECT
// DRAW_RECT
// RESTORE
// where the rect is entirely within the clip and the clip is an intersect
static bool check_2(SkDebugCanvas* canvas, int curCommand) {
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
canvas->getSize() <= curCommand+4 ||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
DRAW_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
return false;
}
SkClipRectCommand* cr =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawRectCommand* dr =
(SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != cr->op()) {
return false;
}
return cr->rect().contains(dr->rect());
}
示例3: check_4
// Check for:
// SAVE
// CLIP_RECT
// DRAW_BITMAP_RECT_TO_RECT
// RESTORE
// where the rect and drawBitmapRect dst exactly match
static bool check_4(SkDebugCanvas* canvas, int curCommand) {
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
canvas->getSize() <= curCommand+4 ||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
return false;
}
SkClipRectCommand* cr =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != cr->op()) {
return false;
}
return dbmr->dstRect() == cr->rect();
}
示例4: check_4
// Check for:
// SAVE
// CLIP_RECT
// DRAW_BITMAP_RECT_TO_RECT
// RESTORE
// where the rect and drawBitmapRect dst exactly match
static bool check_4(SkDebugCanvas* canvas, int curCommand) {
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
canvas->getSize() <= curCommand+4 ||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
return false;
}
SkClipRectCommand* cr =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != cr->op()) {
return false;
}
return dbmr->dstRect() == cr->rect();
}
示例5: check_8
// Check for:
// SAVE
// CLIP_RECT
// DRAWBITMAPRECTTORECT
// RESTORE
// where:
// the drawBitmapRectToRect is a 1-1 copy from src to dest
// the clip rect is BW and a subset of the drawBitmapRectToRect's dest rect
static bool check_8(SkDebugCanvas* canvas, int curCommand) {
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
canvas->getSize() <= curCommand+4 ||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
return false;
}
SkClipRectCommand* clip =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) {
return false;
}
// The src->dest mapping needs to be 1-to-1
if (NULL == dbmr->srcRect()) {
if (dbmr->bitmap().width() != dbmr->dstRect().width() ||
dbmr->bitmap().height() != dbmr->dstRect().height()) {
return false;
}
} else {
if (dbmr->srcRect()->width() != dbmr->dstRect().width() ||
dbmr->srcRect()->height() != dbmr->dstRect().height()) {
return false;
}
}
if (!dbmr->dstRect().contains(clip->rect())) {
return false;
}
return true;
}