void trackSaveLayers(const DrawPicture& dp) { // For sub-pictures, we wrap their layer information within the parent // picture's rendering hierarchy const GrAccelData* childData = GPUOptimize(dp.picture); for (int i = 0; i < childData->numSaveLayers(); ++i) { const GrAccelData::SaveLayerInfo& src = childData->saveLayerInfo(i); Bounds newClip(fCurrentClipBounds); if (!newClip.intersect(this->adjustAndMap(src.fBounds, dp.paint))) { continue; } this->updateStackForSaveLayer(); GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo(); // If src.fPicture is NULL the layer is in dp.picture; otherwise // it belongs to a sub-picture. dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPicture*>(dp.picture); dst.fPicture->ref(); dst.fBounds = newClip; dst.fLocalMat = src.fLocalMat; dst.fPreMat = src.fPreMat; dst.fPreMat.postConcat(*fCTM); if (src.fPaint) { dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); } dst.fSaveLayerOpID = src.fSaveLayerOpID; dst.fRestoreOpID = src.fRestoreOpID; dst.fHasNestedLayers = src.fHasNestedLayers; dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; } }
void GuiCustomRowColumnView::drawBackgroundRect(CDrawContext* pContext, const CRect& _updateRect) { if (getDrawBackground()) { CRect oldClip; pContext->getClipRect(oldClip); CRect newClip(_updateRect); newClip.bound(oldClip); pContext->setClipRect(newClip); CRect tr(0, 0, getViewSize().getWidth(), getViewSize().getHeight()); getDrawBackground()->draw(pContext, tr, backgroundOffset); pContext->setClipRect(oldClip); } else if ((backgroundColor.alpha != 255 && getTransparency()) || !getTransparency()) { pContext->setDrawMode(kAliasing); pContext->setLineWidth(1); pContext->setFillColor(backgroundColor); pContext->setFrameColor(backgroundColor); pContext->setLineStyle(kLineSolid); CRect r; if (backgroundColorDrawStyle == kDrawFilled || (backgroundColorDrawStyle == kDrawFilledAndStroked && backgroundColor.alpha == 255)) { r = _updateRect; r.inset(-1, -1); } else { r = getViewSize(); r.offset(-r.left, -r.top); } pContext->drawRect(r, backgroundColorDrawStyle); } // Custom stuff pContext->setFillColor(CColor(0, 0, 0, 0)); pContext->setLineWidth(frameWidth); pContext->setFrameColor(frameColor); CRect rect = getViewSize(); rect.offset(-rect.left, -rect.top); pContext->drawRect(rect); }
//----------------------------------------------------------------------------- void CTextKickButton::draw(CDrawContext* pContext) { // 枠線を描画 CDrawMode oldDrawMode = pContext->getDrawMode(); CCoord oldLineWidth = pContext->getLineWidth(); pContext->setDrawMode(kAntialias); pContext->setLineWidth(1); pContext->setFrameColor(kBlackCColor); pContext->setFillColor(kBlackCColor); if (value > 0) { drawRoundRect(pContext, size, 5, kDrawFilled); } else { drawRoundRect(pContext, size, 5, kDrawStroked); } pContext->setDrawMode(oldDrawMode); pContext->setLineWidth(oldLineWidth); // 文字を描画 CRect newClip(size); pContext->setFont(mLabelFont); if (value > 0) { pContext->setFontColor(kWhiteCColor); } else { pContext->setFontColor(kBlackCColor); } #if WIN32 newClip.offset(0, 2); #endif #if VSTGUI_USES_UTF8 pContext->drawStringUTF8(text, newClip, kCenterText, true); #else pContext->drawString(text, newClip, true, kCenterText); #endif }
//------------------------------------------------------------------------ void CWaveView::draw(CDrawContext *pContext) { if (converting) { pContext->setFrameColor(kBlackCColor); pContext->setFillColor(backColor); pContext->drawRect(getVisibleSize(), kDrawFilledAndStroked); //CRect oldClip; //pContext->getClipRect(oldClip); CRect newClip(size); newClip.offset(10, 16); //newClip.bound(oldClip); //pContext->setClipRect(newClip); pContext->setFont(mMessageFont); pContext->setFontColor(lineColor); #if VSTGUI_USES_UTF8 pContext->drawStringUTF8("Converting to ADPCM...", newClip, kLeftText, true); #else pContext->drawString("Converting to ADPCM...", newClip, true, kLeftText); #endif //pContext->setClipRect(oldClip); } else { if (isWaveLoaded) { m_pDrawBuffer->copyFrom(pContext, size); //ループポイントの位置を描画 if (looppoint > 0) { pContext->setFrameColor(kYellowCColor); CPoint point(size.left + getWidth()*looppoint/datanum, size.top + 2); pContext->moveTo(point); point.offset(0, getHeight() - 3); pContext->lineTo(point); } } else { pContext->setFrameColor(kBlackCColor); pContext->setFillColor(backColor); pContext->drawRect(getVisibleSize(), kDrawFilledAndStroked); //CRect oldClip; //pContext->getClipRect(oldClip); CRect newClip(size); newClip.offset(10, 16); //newClip.bound(oldClip); //pContext->setClipRect(newClip); pContext->setFont(mMessageFont); pContext->setFontColor(lineColor); #if VSTGUI_USES_UTF8 #if MAC pContext->drawStringUTF8("Drop .aif .wav .brr .spc", newClip, kLeftText, true); #else pContext->drawStringUTF8("Drop .wav .brr .spc", newClip, kLeftText, true); #endif #else #if MAC pContext->drawString("Drop .aif .wav .brr .spc", newClip, true, kLeftText); #else pContext->drawString("Drop .wav .brr .spc", newClip, true, kLeftText); #endif #endif //pContext->setClipRect(oldClip); } } }