Ignore:
Timestamp:
Jul 19, 2009, 10:37:12 PM (10 years ago)
Author:
Pascal Terjan
Message:
  • When blitting, only add dirty rectangles on changed lines, or on changed chars if we have a mask
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/tests/dirty.cpp

    r3513 r3556  
    2929    CPPUNIT_TEST(test_put_char_not_dirty);
    3030    CPPUNIT_TEST(test_box);
     31    CPPUNIT_TEST(test_blit);
    3132    CPPUNIT_TEST_SUITE_END();
    3233
     
    186187    }
    187188
     189    void test_blit()
     190    {
     191        caca_canvas_t *cv, *cv2;
     192        int i, dx, dy, dw, dh;
     193
     194        cv = caca_create_canvas(WIDTH, HEIGHT);
     195        caca_clear_dirty_rect_list(cv);
     196        cv2 = caca_create_canvas(2, 2);
     197        caca_fill_box(cv2, 0, 0, 2, 1, 'x');
     198
     199        caca_blit(cv, 1, 1, cv2, NULL);
     200        i = caca_get_dirty_rect_count(cv);
     201        CPPUNIT_ASSERT_EQUAL(i, 1);
     202        caca_get_dirty_rect(cv, 0, &dx, &dy, &dw, &dh);
     203
     204        /* Check that blitting a canvas make a dirty rectangle
     205         * only for modified lines */
     206        CPPUNIT_ASSERT(dx == 1);
     207        CPPUNIT_ASSERT(dy == 1);
     208        CPPUNIT_ASSERT(dw >= 2);
     209        CPPUNIT_ASSERT(dh == 1);
     210    }
     211
    188212private:
    189213    static int const WIDTH = 80, HEIGHT = 50;
Note: See TracChangeset for help on using the changeset viewer.