Lines Matching full:context
50 static void drawNativeRect(GraphicsContext* context,
53 SkCanvas* canvas = context->platformContext()->canvas();
67 static Color getPixelAt(GraphicsContext* context, int x, int y)
69 const SkBitmap& bitmap = context->platformContext()->canvas()->getTopDevice()->accessBitmap(false);
75 static void clearTopLayerAlphaChannel(GraphicsContext* context)
77 SkBitmap& bitmap = const_cast<SkBitmap&>(context->platformContext()->canvas()->getTopDevice()->accessBitmap(false));
86 static void clearTopLayerAlphaPixel(GraphicsContext* context, int x, int y)
88 SkBitmap& bitmap = const_cast<SkBitmap&>(context->platformContext()->canvas()->getTopDevice()->accessBitmap(false));
108 helper.init(src->context(),
113 EXPECT_TRUE(src->context() == helper.context());
121 src->context()->save();
122 src->context()->scale(FloatSize(2.0, 0.5));
125 helper.init(src->context(),
133 EXPECT_TRUE(src->context() == helper.context());
137 src->context()->restore();
147 helper.init(src->context(),
153 EXPECT_TRUE(src->context() != helper.context());
161 helper.init(src->context(),
167 EXPECT_TRUE(src->context() != helper.context());
173 src->context()->save();
174 src->context()->scale(FloatSize(2.0, 0.5));
177 helper.init(src->context(),
185 EXPECT_TRUE(src->context() != helper.context());
189 src->context()->restore();
199 helper.init(src->context(),
205 EXPECT_TRUE(src->context() != helper.context());
218 helper.init(src->context(),
224 EXPECT_TRUE(src->context() != helper.context());
230 src->context()->save();
231 src->context()->translate(0, -1);
234 helper.init(src->context(),
240 EXPECT_TRUE(src->context() != helper.context());
244 src->context()->restore();
249 helper.init(src->context(),
255 EXPECT_TRUE(src->context() != helper.context());
261 src->context()->save();
262 src->context()->scale(FloatSize(2.0, 0.5));
265 helper.init(src->context(),
273 EXPECT_TRUE(src->context() != helper.context());
277 src->context()->restore();
287 helper.init(src->context(),
293 drawNativeRect(helper.context(), 3, 3, 1, 1);
294 clearTopLayerAlphaChannel(helper.context());
300 EXPECT_EQ(Color(Color::transparent), getPixelAt(src->context(), 0, 0));
301 EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 2, 2));
302 EXPECT_EQ(Color(Color::black), getPixelAt(src->context(), 3, 3));
303 EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 4, 4));
315 src->context()->fillRect(fullRect, red, ColorSpaceDeviceRGB);
316 src->context()->beginTransparencyLayer(0.5);
318 src->context()->fillRect(rightHalf, green, ColorSpaceDeviceRGB);
324 helper.init(src->context(),
330 helper.context()->fillRect(inner, Color(0x7f000000), ColorSpaceDeviceRGB);
335 clearTopLayerAlphaPixel(helper.context(), 1, 1);
336 clearTopLayerAlphaPixel(helper.context(), 12, 12);
341 src->context()->endTransparencyLayer();
345 EXPECT_EQ(red, getPixelAt(src->context(), 0, 0));
346 EXPECT_EQ(red, getPixelAt(src->context(), 1, 1));
347 EXPECT_EQ(darkRed, getPixelAt(src->context(), 2, 2));
353 EXPECT_EQ(darkGreenRed, getPixelAt(src->context(), 13, 13));
357 EXPECT_EQ(greenRed, getPixelAt(src->context(), 14, 14));
358 EXPECT_EQ(greenRed, getPixelAt(src->context(), 15, 15));
368 src->context()->fillRect(fullRect, white, ColorSpaceDeviceRGB);
371 src->context()->save();
372 src->context()->translate(0, -8);
380 helper.init(src->context(),
388 helper.context()->fillRect(bottomRight, green, ColorSpaceDeviceRGB);
392 src->context()->restore();
395 EXPECT_EQ(green, getPixelAt(src->context(), 15, 7));
407 src->context()->fillRect(fullRect, white, ColorSpaceDeviceRGB);
415 src->context()->save();
417 src->context()->concatCTM(cw90);
422 src->context()->beginTransparencyLayer(0.5);
425 src->context()->fillRect(blackRect, black, ColorSpaceDeviceRGB);
433 helper.init(src->context(),
439 helper.context()->fillRect(helper.drawRect(), Color(0x7f7f0000), ColorSpaceDeviceRGB);
440 context());
445 src->context()->endTransparencyLayer();
448 EXPECT_EQ(white, getPixelAt(src->context(), 0, 0));
452 EXPECT_EQ(white, getPixelAt(src->context(), 6, 0));
453 EXPECT_EQ(gray, getPixelAt(src->context(), 7, 0));
454 EXPECT_EQ(gray, getPixelAt(src->context(), 8, 0));
455 EXPECT_EQ(white, getPixelAt(src->context(), 9, 0));
458 EXPECT_EQ(white, getPixelAt(src->context(), 6, 15));
459 EXPECT_EQ(gray, getPixelAt(src->context(), 7, 15));
460 EXPECT_EQ(gray, getPixelAt(src->context(), 8, 15));
461 EXPECT_EQ(white, getPixelAt(src->context(), 9, 15));
466 EXPECT_EQ(white, getPixelAt(src->context(), 0, 1));
467 EXPECT_EQ(redwhite, getPixelAt(src->context(), 1, 1));
468 EXPECT_EQ(redwhite, getPixelAt(src->context(), 6, 1));
469 EXPECT_EQ(redgray, getPixelAt(src->context(), 7, 1));
470 EXPECT_EQ(redgray, getPixelAt(src->context(), 8, 1));
471 EXPECT_EQ(redwhite, getPixelAt(src->context(), 9, 1));
472 EXPECT_EQ(redwhite, getPixelAt(src->context(), 14, 1));
473 EXPECT_EQ(white, getPixelAt(src->context(), 15, 1));
476 src->context()->restore();
486 src->context()->fillRect(topRect, white, ColorSpaceDeviceRGB);
489 src->context()->fillRect(bottomRect, red, ColorSpaceDeviceRGB);
491 src->context()->save();
500 src->context()->concatCTM(scale);
505 src->context()->concatCTM(up);
513 helper.init(src->context(),
519 helper.context()->fillRect(helper.drawRect(), Color(0x7f7f0000), ColorSpaceDeviceRGB);
520 clearTopLayerAlphaChannel(helper.context());
531 src->context()->fillRect(fullBuffer, Color::white, ColorSpaceDeviceRGB);
534 src->context()->save();
537 src->context()->concatCTM(scale);
542 helper.init(src->context(),
547 // The context should now have the identity transform and the returned
549 EXPECT_TRUE(helper.context()->getCTM().isIdentity());
559 SkBitmap& bitmap = const_cast<SkBitmap&>(helper.context()->platformContext()->canvas()->getTopDevice()->accessBitmap(false));
564 src->context()->restore();
572 // EXPECT_EQ(Color(Color::white), getPixelAt(src->context(), 2, 2));
584 src->context()->fillRect(fullBuffer, Color::white, ColorSpaceDeviceRGB);
588 src->context()->beginTransparencyLayer(0.5);
590 src->context()->fillRect(topHalf, Color(0xFFFF0000), ColorSpaceDeviceRGB);
593 src->context()->save();
596 src->context()->concatCTM(scale);
602 helper.init(src->context(),
607 helper.context()->fillRect(helper.drawRect(), Color(0x7f000000), ColorSpaceDeviceRGB);
608 clearTopLayerAlphaChannel(helper.context());
613 src->context()->restore();
614 src->context()->endTransparencyLayer();
617 EXPECT_EQ(redBackground, getPixelAt(src->context(), 0, 0));
618 EXPECT_EQ(redBackground, getPixelAt(src->context(), 1, 1));
624 EXPECT_EQ(darkRed, getPixelAt(src->context(), 2, 2));
625 EXPECT_EQ(darkRed, getPixelAt(src->context(), 7, 7));
630 EXPECT_EQ(darkWhite, getPixelAt(src->context(), 8, 8));
631 EXPECT_EQ(darkWhite, getPixelAt(src->context(), 13, 13));
634 EXPECT_EQ(white, getPixelAt(src->context(), 14, 14));
635 EXPECT_EQ(white, getPixelAt(src->context(), 15, 15));
647 helper.init(src->context(),
656 helper.context()->fillRect(pixel, 0xFFFF0000, ColorSpaceDeviceRGB);
658 helper.context()->fillRect(pixel, 0xFF00FF00, ColorSpaceDeviceRGB);
660 helper.context()->fillRect(pixel, 0xFF0000FF, ColorSpaceDeviceRGB);
662 helper.context()->fillRect(pixel, 0xFF008080, ColorSpaceDeviceRGB);
664 helper.context()->fillRect(pixel, 0xFF800080, ColorSpaceDeviceRGB);
666 helper.context()->fillRect(pixel, 0xFF808000, ColorSpaceDeviceRGB);
670 helper.context()->fillRect(pixel, 0xFF000000, ColorSpaceDeviceRGB);
673 clearTopLayerAlphaChannel(helper.context());
678 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 0, 0));
679 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 1, 0));
680 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 2, 0));
681 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 3, 0));
682 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 4, 0));
683 EXPECT_EQ(oneThirdResult, getPixelAt(src->context(), 5, 0));
684 EXPECT_EQ(fullResult, getPixelAt(src->context(), 6, 0));
685 EXPECT_EQ(Color::transparent, getPixelAt(src->context(), 7, 0));