static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[],
                          size_t count, bool changed) {
    SkIRect ir = { 0, 0, 10, 10 };

    for (size_t i = 0; i < count; ++i) {
        SkRect r;
        r.set(ir);

        SkRasterClip rc0(ir);
        SkRasterClip rc1(ir);
        SkRasterClip rc2(ir);

        rc0.op(r, SkRegion::kIntersect_Op, false);
        r.offset(dx[i], 0);
        rc1.op(r, SkRegion::kIntersect_Op, true);
        r.offset(-2*dx[i], 0);
        rc2.op(r, SkRegion::kIntersect_Op, true);

        REPORTER_ASSERT(reporter, changed != (rc0 == rc1));
        REPORTER_ASSERT(reporter, changed != (rc0 == rc2));
    }
}
Ejemplo n.º 2
0
void CChildView::OnPaint() 
{
CPaintDC dcPaint( this );
	CExtPaintManager::stat_ExcludeChildAreas(
		dcPaint.GetSafeHdc(),
		GetSafeHwnd()
		);
CExtMemoryDC dc( &dcPaint );

CGdiObject * pOld0, * pOld1;
CExtWndShadow _shadow;

WORD _PatternBits0[8],_PatternBits1[8];
	for( INT iPatternLine=0; iPatternLine < 8; iPatternLine++ )
	{
		_PatternBits0[iPatternLine] =
			( iPatternLine & 1 )
				? WORD(0xFFFF)
				: WORD( ~ ( 5<<iPatternLine ) )
				;
		_PatternBits1[iPatternLine] =
			( iPatternLine & 1 )
				? WORD(0xFFFF)
				: WORD( ~ ( 1<<(8-iPatternLine) ) )
				;
	}
CBitmap bmpPattern0,bmpPattern1;
CBrush brPattern0,brPattern1;
	VERIFY( bmpPattern0.CreateBitmap(8,8,1,1,_PatternBits0) );
	VERIFY( bmpPattern1.CreateBitmap(8,8,1,1,_PatternBits1) );
	VERIFY( brPattern0.CreatePatternBrush(&bmpPattern0) );
	VERIFY( brPattern1.CreatePatternBrush(&bmpPattern1) );

CRect rcPattern0(10,10,180,150), rcPattern1(40,30,80,200);

	dc.FillRect(rcPattern0,&brPattern0);
	_shadow.Paint(
		dc, rcPattern0, CRect(0,0,0,0), CRect(0,0,0,0),
		CExtWndShadow::DEF_SHADOW_SIZE,
		CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX,
		false
		);
	pOld0 = dc.SelectStockObject( NULL_BRUSH );
	pOld1 = dc.SelectStockObject( BLACK_PEN );
	dc.Rectangle( rcPattern0 );
	if( pOld0 != NULL )
		dc.SelectObject( pOld0 );
	if( pOld1 != NULL )
		dc.SelectObject( pOld1 );
	
	dc.FillRect(rcPattern1,&brPattern1);
	_shadow.Paint(
		dc, rcPattern1, CRect(0,0,0,0), CRect(0,0,0,0),
		CExtWndShadow::DEF_SHADOW_SIZE,
		CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX,
		false
		);
	pOld0 = dc.SelectStockObject( NULL_BRUSH );
	pOld1 = dc.SelectStockObject( BLACK_PEN );
	dc.Rectangle( rcPattern1 );
	if( pOld0 != NULL )
		dc.SelectObject( pOld0 );
	if( pOld1 != NULL )
		dc.SelectObject( pOld1 );

CRect rc0(20,50,160,80);
CRect rc1(160,50,210,80);
CRect rc2(rc0.left,rc0.top,rc1.right,rc1.bottom);
COLORREF clrLeft = RGB(0,255,0);
COLORREF clrMiddle = RGB(255,255,0);
COLORREF clrRight = RGB(255,0,0);
	CExtPaintManager::stat_PaintGradientRect(
		dc, rc0, clrLeft, clrMiddle );
	CExtPaintManager::stat_PaintGradientRect(
		dc, rc1, clrMiddle,clrRight );
	_shadow.Paint(
		dc, rc2, CRect(0,0,0,0), CRect(0,0,0,0),
		CExtWndShadow::DEF_SHADOW_SIZE,
		CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX,
		false
		);
	pOld0 = dc.SelectStockObject( NULL_BRUSH );
	pOld1 = dc.SelectStockObject( BLACK_PEN );
	dc.Rectangle(rc2);
	if( pOld0 != NULL )
		dc.SelectObject( pOld0 );
	if( pOld1 != NULL )
		dc.SelectObject( pOld1 );

CRect rc3(120,40,150,80);
CRect rc4(120,80,150,160);
CRect rc5(rc3.left,rc3.top,rc4.right,rc4.bottom);
COLORREF clrUpper = RGB(255,0,255);
COLORREF clrMiddleV = RGB(255,255,255);
COLORREF clrLower = RGB(0,0,255);
	CExtPaintManager::stat_PaintGradientRect(
		dc, rc3, clrMiddleV, clrUpper, TRUE );
	CExtPaintManager::stat_PaintGradientRect(
		dc, rc4, clrLower, clrMiddleV, TRUE );
	_shadow.Paint(
		dc, rc5, CRect(0,0,0,0), CRect(0,0,0,0),
		CExtWndShadow::DEF_SHADOW_SIZE,
		CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX,
		false
		);
	pOld0 = dc.SelectStockObject( NULL_BRUSH );
	pOld1 = dc.SelectStockObject( BLACK_PEN );
	dc.Rectangle(rc5);
	if( pOld0 != NULL )
		dc.SelectObject( pOld0 );
	if( pOld1 != NULL )
		dc.SelectObject( pOld1 );
}