Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright 2014 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkImageGeneratorPriv_DEFINED
      9 #define SkImageGeneratorPriv_DEFINED
     10 
     11 #include "SkImageGenerator.h"
     12 #include "SkDiscardableMemory.h"
     13 
     14 /**
     15  *  Takes ownership of SkImageGenerator.  If this method fails for
     16  *  whatever reason, it will return false and immediatetely delete
     17  *  the generator.  If it succeeds, it will modify destination
     18  *  bitmap.
     19  *
     20  *  If generator is nullptr, will safely return false.
     21  *
     22  *  If this fails or when the SkDiscardablePixelRef that is
     23  *  installed into destination is destroyed, it will call
     24  *  `delete` on the generator.  Therefore, generator should be
     25  *  allocated with `new`.
     26  *
     27  *  @param destination Upon success, this bitmap will be
     28  *  configured and have a pixelref installed.
     29  *
     30  *  @param factory If not nullptr, this object will be used as a
     31  *  source of discardable memory when decoding.  If nullptr, then
     32  *  SkDiscardableMemory::Create() will be called.
     33  *
     34  *  @return true iff successful.
     35  */
     36 bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator*, const SkIRect* subset,
     37                                              SkBitmap* destination,
     38                                              SkDiscardableMemory::Factory* factory);
     39 
     40 #endif
     41