Lines Matching refs:surface
200 Surface* surface = Surface::CreateSurface(); variable
201 if (surface == nullptr) {
206 surface->RegisterConsumerListener(*consumerListener);
208 EXPECT_EQ(1, surface->GetQueueSize());
209 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
210 EXPECT_EQ(0, surface->GetSize());
211 EXPECT_EQ(0, surface->GetWidth());
212 EXPECT_EQ(0, surface->GetHeight());
213 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
214 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
217 surface->SetWidthAndHeight(0, 1080);
218 EXPECT_EQ(0, surface->GetWidth());
219 EXPECT_EQ(0, surface->GetHeight());
222 surface->SetWidthAndHeight(7681, 1080);
223 EXPECT_EQ(0, surface->GetWidth());
224 EXPECT_EQ(0, surface->GetHeight());
227 surface->SetWidthAndHeight(7680, 1080);
228 EXPECT_EQ(7680, surface->GetWidth());
229 EXPECT_EQ(1080, surface->GetHeight());
232 surface->SetWidthAndHeight(1920, 1080);
233 EXPECT_EQ(1920, surface->GetWidth());
234 EXPECT_EQ(1080, surface->GetHeight());
237 surface->SetWidthAndHeight(1920, 0);
238 EXPECT_EQ(1920, surface->GetWidth());
239 EXPECT_EQ(1080, surface->GetHeight());
242 surface->SetWidthAndHeight(1920, 7681);
243 EXPECT_EQ(1920, surface->GetWidth());
244 EXPECT_EQ(1080, surface->GetHeight());
247 surface->SetWidthAndHeight(1920, 7680);
248 EXPECT_EQ(1920, surface->GetWidth());
249 EXPECT_EQ(7680, surface->GetHeight());
252 surface->SetWidthAndHeight(1280, 720);
253 EXPECT_EQ(1280, surface->GetWidth());
254 EXPECT_EQ(720, surface->GetHeight());
256 surface->UnregisterConsumerListener();
257 delete surface;
275 Surface* surface = Surface::CreateSurface(); variable
276 if (surface == nullptr) {
281 surface->RegisterConsumerListener(*consumerListener);
283 EXPECT_EQ(1, surface->GetQueueSize());
284 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
285 EXPECT_EQ(0, surface->GetSize());
286 EXPECT_EQ(0, surface->GetWidth());
287 EXPECT_EQ(0, surface->GetHeight());
288 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
289 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
292 surface->SetFormat(0);
293 EXPECT_EQ(101, surface->GetFormat());
296 surface->SetFormat(102);
297 EXPECT_EQ(102, surface->GetFormat());
299 surface->UnregisterConsumerListener();
300 delete surface;
318 Surface* surface = Surface::CreateSurface(); variable
319 if (surface == nullptr) {
324 surface->RegisterConsumerListener(*consumerListener);
326 EXPECT_EQ(1, surface->GetQueueSize());
327 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
328 EXPECT_EQ(0, surface->GetSize());
329 EXPECT_EQ(0, surface->GetWidth());
330 EXPECT_EQ(0, surface->GetHeight());
331 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
332 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
334 surface->SetWidthAndHeight(99, 90);
335 SurfaceBuffer* bufferFirst = surface->RequestBuffer();
336 EXPECT_EQ(208, surface->GetStride());
337 surface->CancelBuffer(bufferFirst);
340 surface->SetStrideAlignment(3);
341 EXPECT_EQ(4, surface->GetStrideAlignment());
344 surface->SetStrideAlignment(33);
345 EXPECT_EQ(4, surface->GetStrideAlignment());
348 surface->SetStrideAlignment(32);
349 EXPECT_EQ(32, surface->GetStrideAlignment());
351 surface->UnregisterConsumerListener();
352 delete surface;
370 Surface* surface = Surface::CreateSurface(); variable
371 if (surface == nullptr) {
376 surface->RegisterConsumerListener(*consumerListener);
378 EXPECT_EQ(1, surface->GetQueueSize());
379 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
380 EXPECT_EQ(0, surface->GetSize());
381 EXPECT_EQ(0, surface->GetWidth());
382 EXPECT_EQ(0, surface->GetHeight());
383 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
384 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
387 surface->SetSize(0);
388 EXPECT_EQ(0, surface->GetSize());
391 surface->SetSize(58982400);
392 EXPECT_EQ(0, surface->GetSize());
395 surface->SetSize(1024);
396 EXPECT_EQ(1024, surface->GetSize());
398 surface->UnregisterConsumerListener();
399 delete surface;
417 Surface* surface = Surface::CreateSurface(); variable
418 if (surface == nullptr) {
423 surface->RegisterConsumerListener(*consumerListener);
425 EXPECT_EQ(1, surface->GetQueueSize());
426 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
427 EXPECT_EQ(0, surface->GetSize());
428 EXPECT_EQ(0, surface->GetWidth());
429 EXPECT_EQ(0, surface->GetHeight());
430 EXPECT_EQ(0, surface->GetHeight());
431 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
432 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
435 surface->SetUsage(4);
436 EXPECT_EQ(0, surface->GetUsage());
439 surface->SetUsage(3);
440 EXPECT_EQ(3, surface->GetUsage());
442 surface->UnregisterConsumerListener();
443 delete surface;
461 Surface* surface = Surface::CreateSurface(); variable
462 if (surface == nullptr) {
467 surface->RegisterConsumerListener(*consumerListener);
469 EXPECT_EQ(1, surface->GetQueueSize());
470 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
471 EXPECT_EQ(0, surface->GetSize());
472 EXPECT_EQ(0, surface->GetWidth());
473 EXPECT_EQ(0, surface->GetHeight());
474 EXPECT_EQ(0, surface->GetHeight());
475 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
476 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
479 surface->SetQueueSize(0);
480 EXPECT_EQ(1, surface->GetQueueSize());
483 surface->SetQueueSize(11);
484 EXPECT_EQ(1, surface->GetQueueSize());
487 surface->SetQueueSize(10);
488 EXPECT_EQ(10, surface->GetQueueSize());
491 surface->SetQueueSize(5);
492 EXPECT_EQ(5, surface->GetQueueSize());
494 surface->UnregisterConsumerListener();
495 delete surface;
513 Surface* surface = Surface::CreateSurface(); variable
514 if (surface == nullptr) {
519 surface->RegisterConsumerListener(*consumerListener);
521 EXPECT_EQ(1, surface->GetQueueSize());
522 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
523 EXPECT_EQ(0, surface->GetSize());
524 EXPECT_EQ(0, surface->GetWidth());
525 EXPECT_EQ(0, surface->GetHeight());
526 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
527 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
529 surface->SetUserData("testkey", "testvalue");
530 EXPECT_EQ("testvalue", surface->GetUserData("testkey"));
532 surface->UnregisterConsumerListener();
533 delete surface;
551 Surface* surface = Surface::CreateSurface(); variable
552 if (surface == nullptr) {
557 surface->RegisterConsumerListener(*consumerListener);
559 EXPECT_EQ(1, surface->GetQueueSize());
560 EXPECT_EQ(0, surface->GetUsage()); // default usage is BUFFER_CONSUMER_USAGE_SORTWARE(0)
561 EXPECT_EQ(0, surface->GetSize());
562 EXPECT_EQ(0, surface->GetWidth());
563 EXPECT_EQ(0, surface->GetHeight());
564 EXPECT_EQ(0, surface->GetHeight());
565 EXPECT_EQ(101, surface->GetFormat()); // default format is IMAGE_PIXEL_FORMAT_RGB565(101)
566 EXPECT_EQ(4, surface->GetStrideAlignment()); // default format stride alignment is 4
568 surface->SetSize(1024); // Set alloc 1024B SHM
569 EXPECT_EQ(1024, surface->GetSize());
571 surface->SetWidthAndHeight(101, 202); // set width(101), height(202)
572 surface->SetFormat(102); // set format IMAGE_PIXEL_FORMAT_ARGB1555(102)
573 surface->SetStrideAlignment(8); // set format stride alignment is 8
575 EXPECT_EQ(101, surface->GetWidth());
576 EXPECT_EQ(202, surface->GetHeight());
577 EXPECT_EQ(102, surface->GetFormat());
578 EXPECT_EQ(8, surface->GetStrideAlignment());
579 SurfaceBuffer* bufferFirst = surface->RequestBuffer();
580 EXPECT_EQ(208, surface->GetStride()); // calculate by width, height, format.
581 EXPECT_EQ(42016, surface->GetSize()); // calculate by width, height, format.
582 surface->CancelBuffer(bufferFirst);
584 surface->UnregisterConsumerListener();
585 delete surface;
599 Surface* surface = Surface::CreateSurface(); variable
600 if (surface == nullptr) {
604 SurfaceBuffer* bufferFirst = surface->RequestBuffer(); // no size, return null pointer
607 surface->SetSize(1024); // Set alloc 1024B SHM
608 bufferFirst = surface->RequestBuffer();
611 …SurfaceBuffer* bufferSecond = surface->RequestBuffer(); // default queue size = 1, second return n…
614 surface->CancelBuffer(bufferFirst);
615 EXPECT_TRUE(surface->RequestBuffer());
617 delete surface;
630 Surface* surface = Surface::CreateSurface(); variable
631 ASSERT_TRUE(surface);
633 SurfaceBuffer* requestBuffer = surface->RequestBuffer(); // no size, return null pointer
636 surface->SetWidthAndHeight(454, 454); // 454 : surface width and height
637 requestBuffer = surface->RequestBuffer();
641 EXPECT_TRUE(surface->FlushBuffer(buffer) != 0); // Not allocated by surface, could not flush.
642 EXPECT_EQ(0, surface->FlushBuffer(requestBuffer)); // allocated by surface, could flush.
645 delete surface;
658 Surface* surface = Surface::CreateSurface(); variable
659 ASSERT_TRUE(surface);
661 SurfaceBuffer* acquireBuffer = surface->AcquireBuffer(); // no size, return null pointer
664 surface->SetSize(1024); // Set alloc 1024B SHM
665 SurfaceBuffer* requestBuffer = surface->RequestBuffer();
667 delete surface;
672 EXPECT_EQ(0, surface->FlushBuffer(requestBuffer)); // allocated by surface, could flush.
674 acquireBuffer = surface->AcquireBuffer();
680 delete surface;
693 Surface* surface = Surface::CreateSurface(); variable
694 ASSERT_TRUE(surface);
697 EXPECT_FALSE(surface->ReleaseBuffer(buffer)); // Not allocated by surface, could not release
699 SurfaceBuffer* acquireBuffer = surface->AcquireBuffer(); // no size, return null pointer
702 surface->SetSize(1024); // Set alloc 1024B SHM
703 SurfaceBuffer* requestBuffer = surface->RequestBuffer();
706 delete surface;
711 EXPECT_EQ(0, surface->FlushBuffer(requestBuffer)); // allocated by surface, could flush.
713 acquireBuffer = surface->AcquireBuffer();
716 delete surface;
723 EXPECT_TRUE(surface->ReleaseBuffer(acquireBuffer));
727 delete surface;
744 Surface* surface = Surface::CreateSurface(); variable
745 if (surface == nullptr) {
750 surface->RegisterConsumerListener(*consumerListener);
753 EXPECT_FALSE(surface->ReleaseBuffer(buffer)); // Not allocated by surface, could not release
755 SurfaceBuffer* acquireBuffer = surface->AcquireBuffer(); // no size, return null pointer
758 surface->SetSize(1024); // Set alloc 1024B SHM
759 SurfaceBuffer* requestBuffer = surface->RequestBuffer();
763 delete surface;
764 surface = nullptr;
772 EXPECT_EQ(0, surface->FlushBuffer(requestBuffer)); // allocated by surface, could flush.
774 acquireBuffer = surface->AcquireBuffer();
778 delete surface;
779 surface = nullptr;
789 EXPECT_TRUE(surface->ReleaseBuffer(acquireBuffer));
793 delete surface;