Lines Matching refs:canvas
44 SkCanvas canvas(bitmap); in read_pixel() local
48 surface->draw(&canvas, -SkIntToScalar(x), -SkIntToScalar(y), &paint); in read_pixel()
97 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasWritePixelsToSurface() local
108 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasWritePixelsToSurface()
114 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
122 SkAutoTUnref<SkImage> image1(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
128 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasWritePixelsToSurface()
134 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
141 SkAutoTUnref<SkImage> image2(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
148 SkAutoTUnref<SkImage> image3(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
156 SkAutoTUnref<SkImage> image4(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
162 canvas->writePixels(srcBitmap, 0, 0); in TestDeferredCanvasWritePixelsToSurface()
168 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
176 SkAutoTUnref<SkImage> image5(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
182 canvas->writePixels(srcBitmap, 5, 0); in TestDeferredCanvasWritePixelsToSurface()
188 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
196 SkAutoTUnref<SkImage> image6(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
202 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasWritePixelsToSurface()
208 canvas->writePixels(srcBitmap, 0, 0); in TestDeferredCanvasWritePixelsToSurface()
214 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
222 SkAutoTUnref<SkImage> image7(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
228 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasWritePixelsToSurface()
234 canvas->writePixels(srcBitmap, 5, 0); in TestDeferredCanvasWritePixelsToSurface()
240 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
249 SkAutoTUnref<SkImage> image8(canvas->newImageSnapshot()); in TestDeferredCanvasWritePixelsToSurface()
256 canvas->drawRect(SkRect::MakeLTRB(0, 0, 5, 5), paint); in TestDeferredCanvasWritePixelsToSurface()
262 canvas->writePixels(srcBitmap, 5, 0); in TestDeferredCanvasWritePixelsToSurface()
268 canvas->flush(); in TestDeferredCanvasWritePixelsToSurface()
276 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasFlush() local
278 canvas->clear(0x00000000); in TestDeferredCanvasFlush()
283 canvas->flush(); in TestDeferredCanvasFlush()
298 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasFreshFrame() local
301 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
303 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
306 canvas->clear(0x00000000); in TestDeferredCanvasFreshFrame()
307 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
310 canvas->save(); in TestDeferredCanvasFreshFrame()
311 canvas->clear(0x00000000); in TestDeferredCanvasFreshFrame()
312 canvas->restore(); in TestDeferredCanvasFreshFrame()
313 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
316 canvas->saveLayer(NULL, NULL); in TestDeferredCanvasFreshFrame()
317 canvas->clear(0x00000000); in TestDeferredCanvasFreshFrame()
318 canvas->restore(); in TestDeferredCanvasFreshFrame()
319 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
327 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
328 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
335 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
336 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
347 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
348 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
357 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
358 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
373 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
374 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
385 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
386 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
394 canvas->drawRect(partialRect, paint); in TestDeferredCanvasFreshFrame()
395 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
401 canvas->save(); in TestDeferredCanvasFreshFrame()
402 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); in TestDeferredCanvasFreshFrame()
406 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
407 canvas->restore(); in TestDeferredCanvasFreshFrame()
408 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
411 canvas->save(); in TestDeferredCanvasFreshFrame()
417 canvas->clipPath(path, SkRegion::kIntersect_Op, false); in TestDeferredCanvasFreshFrame()
418 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
419 canvas->restore(); in TestDeferredCanvasFreshFrame()
420 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
428 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
429 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
438 canvas->drawRect(fullRect, paint); in TestDeferredCanvasFreshFrame()
439 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); in TestDeferredCanvasFreshFrame()
489 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasMemoryLimit() local
492 canvas->setNotificationClient(¬ificationCounter); in TestDeferredCanvasMemoryLimit()
494 canvas->setMaxRecordingStorage(160000); in TestDeferredCanvasMemoryLimit()
503 canvas->drawBitmap(sourceImage, 0, 0, NULL); in TestDeferredCanvasMemoryLimit()
511 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasSilentFlush() local
514 canvas->setNotificationClient(¬ificationCounter); in TestDeferredCanvasSilentFlush()
516 canvas->silentFlush(); // will skip the initial clear that was recorded in createSurface in TestDeferredCanvasSilentFlush()
524 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasBitmapCaching() local
527 canvas->setNotificationClient(¬ificationCounter); in TestDeferredCanvasBitmapCaching()
538 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
541 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > bitmapSize); in TestDeferredCanvasBitmapCaching()
544 REPORTER_ASSERT(reporter, 0 == canvas->freeMemoryIfPossible(~0U)); in TestDeferredCanvasBitmapCaching()
549 canvas->flush(); in TestDeferredCanvasBitmapCaching()
552 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() >= bitmapSize); in TestDeferredCanvasBitmapCaching()
555 REPORTER_ASSERT(reporter, canvas->freeMemoryIfPossible(~0U) >= bitmapSize); in TestDeferredCanvasBitmapCaching()
558 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
560 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
563 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < 2 * bitmapSize); in TestDeferredCanvasBitmapCaching()
566 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
568 canvas->flush(); in TestDeferredCanvasBitmapCaching()
570 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2 * bitmapSize); in TestDeferredCanvasBitmapCaching()
571 size_t bytesFreed = canvas->freeMemoryIfPossible(1); in TestDeferredCanvasBitmapCaching()
578 canvas->freeMemoryIfPossible(~0U); in TestDeferredCanvasBitmapCaching()
580 canvas->drawBitmap(sourceImages[0], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
581 canvas->flush(); in TestDeferredCanvasBitmapCaching()
582 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
583 bytesFreed = canvas->freeMemoryIfPossible(~0U); in TestDeferredCanvasBitmapCaching()
588 canvas->flush(); in TestDeferredCanvasBitmapCaching()
589 canvas->freeMemoryIfPossible(~0U); in TestDeferredCanvasBitmapCaching()
590 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() < bitmapSize); in TestDeferredCanvasBitmapCaching()
593 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
595 canvas->drawBitmap(sourceImages[1], 0, 0, NULL); in TestDeferredCanvasBitmapCaching()
596 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2*bitmapSize); in TestDeferredCanvasBitmapCaching()
604 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasSkip() local
607 canvas->setNotificationClient(¬ificationCounter); in TestDeferredCanvasSkip()
608 canvas->clear(0x0); in TestDeferredCanvasSkip()
611 canvas->flush(); in TestDeferredCanvasSkip()
623 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasBitmapShaderNoLeak() local
636 canvas->drawPaint(paint); in TestDeferredCanvasBitmapShaderNoLeak()
637 canvas->flush(); in TestDeferredCanvasBitmapShaderNoLeak()
642 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); in TestDeferredCanvasBitmapShaderNoLeak()
652 canvas->freeMemoryIfPossible(~0U); in TestDeferredCanvasBitmapShaderNoLeak()
653 REPORTER_ASSERT(reporter, 0 == canvas->storageAllocatedForRecording()); in TestDeferredCanvasBitmapShaderNoLeak()
666 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasBitmapSizeThreshold() local
667 canvas->setBitmapSizeThreshold(39999); in TestDeferredCanvasBitmapSizeThreshold()
668 canvas->drawBitmap(sourceImage, 0, 0, NULL); in TestDeferredCanvasBitmapSizeThreshold()
669 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); in TestDeferredCanvasBitmapSizeThreshold()
675 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasBitmapSizeThreshold() local
676 canvas->setBitmapSizeThreshold(40000); in TestDeferredCanvasBitmapSizeThreshold()
677 canvas->drawBitmap(sourceImage, 0, 0, NULL); in TestDeferredCanvasBitmapSizeThreshold()
678 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); in TestDeferredCanvasBitmapSizeThreshold()
684 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasBitmapSizeThreshold() local
685 canvas->setBitmapSizeThreshold(40001); in TestDeferredCanvasBitmapSizeThreshold()
686 canvas->drawBitmap(sourceImage, 0, 0, NULL); in TestDeferredCanvasBitmapSizeThreshold()
687 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); in TestDeferredCanvasBitmapSizeThreshold()
744 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface)); in TestDeferredCanvasSurface() local
746 SkImage* image1 = canvas->newImageSnapshot(); in TestDeferredCanvasSurface()
751 canvas->clear(SK_ColorBLACK); in TestDeferredCanvasSurface()
761 SkImage* image3 = canvas->newImageSnapshot(); in TestDeferredCanvasSurface()
771 canvas->drawPaint(paint); in TestDeferredCanvasSurface()
772 SkImage* image4 = canvas->newImageSnapshot(); // implicit flush in TestDeferredCanvasSurface()
780 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasSurface()
781 canvas->flush(); in TestDeferredCanvasSurface()
783 canvas->drawPaint(paint); in TestDeferredCanvasSurface()
784 canvas->flush(); in TestDeferredCanvasSurface()
834 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface)); in TestDeferredCanvasSetSurface() local
835 SkAutoTUnref<SkImage> image1(canvas->newImageSnapshot()); in TestDeferredCanvasSetSurface()
836 canvas->setSurface(alternateSurface); in TestDeferredCanvasSetSurface()
837 SkAutoTUnref<SkImage> image2(canvas->newImageSnapshot()); in TestDeferredCanvasSetSurface()
843 canvas->clear(SK_ColorWHITE); in TestDeferredCanvasSetSurface()
844 canvas->flush(); in TestDeferredCanvasSetSurface()
852 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasCreateCompatibleDevice() local
855 canvas->setNotificationClient(¬ificationCounter); in TestDeferredCanvasCreateCompatibleDevice()
858 SkAutoTUnref<SkSurface> secondarySurface(canvas->newSurface(info)); in TestDeferredCanvasCreateCompatibleDevice()
867 canvas->drawRect(rect, paint); in TestDeferredCanvasCreateCompatibleDevice()
881 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); in TestDeferredCanvasGetCanvasSize() local
887 canvas->setSurface(newSurface); in TestDeferredCanvasGetCanvasSize()
892 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
895 canvas->clear(0x00000000); in TestDeferredCanvasGetCanvasSize()
896 canvas->clipRect(clip, SkRegion::kIntersect_Op, false); in TestDeferredCanvasGetCanvasSize()
897 canvas->drawRect(rect, paint); in TestDeferredCanvasGetCanvasSize()
898 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
901 canvas->flush(); in TestDeferredCanvasGetCanvasSize()
902 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
905 canvas->save(); in TestDeferredCanvasGetCanvasSize()
906 canvas->clear(0xFFFFFFFF); in TestDeferredCanvasGetCanvasSize()
907 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
910 canvas->restore(); in TestDeferredCanvasGetCanvasSize()
911 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
914 canvas->saveLayer(&clip, &paint); in TestDeferredCanvasGetCanvasSize()
915 canvas->clear(0x00000000); in TestDeferredCanvasGetCanvasSize()
916 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()
919 canvas->restore(); in TestDeferredCanvasGetCanvasSize()
920 REPORTER_ASSERT(reporter, size == canvas->getCanvasSize()); in TestDeferredCanvasGetCanvasSize()