• halcanary@google.com's avatar
    Add a release procedure to SkMallocPixelRef; remove SkDataPixelRef · 1bed687f
    halcanary@google.com authored
    This works in a way that is similar to SkData.
    
    SkMallocPixelRef::NewWithProc
    
        Motivation: Chrome has a ETC1PixelRef which calls delete[] on the
        pixles on destruction.  There is no reason for them to almost
        duplicate our class, when we can provide them a more flexible
        class.  Example use:
    
          static void delete_uint8_proc(void* ptr, void*) {
            delete[] static_cast<uint8_t>(ptr);
          }
          SkPixelRef* new_delete_pixref(const SkImageInfo& info,
                                        SkColorTable* ctable) {
            size_t rb = info.minRowBytes();
            return SkMallocPixelRef::NewWithProc(
              info, rb, ctable,
              new uint8_t[info.getSafeSize(rb)],
              delete_uint8_proc, NULL);
          }
    
    SkMallocPixelRef::NewWithData
    
    	Motivation:  This allows up to eliminate SkDataPixelRef.  We
        modified SkImage_Raster to use MallocPixelRef rather than
        SkDataPixlRef.
    
    Also:  Unit tests in tests/MallocPixelRefTest.
    
    BUG=
    R=reed@google.com
    
    Review URL: https://codereview.chromium.org/106883006
    
    git-svn-id: http://skia.googlecode.com/svn/trunk@12861 2bbb7eff-a529-9590-31e7-b0007b416f81
    1bed687f
tests.gyp 6.08 KB