12d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org/* 22d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * Copyright 2014 Google Inc. 32d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 42d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be 52d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * found in the LICENSE file. 62d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org */ 72d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org 82d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org#ifndef SkImageGeneratorPriv_DEFINED 92d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org#define SkImageGeneratorPriv_DEFINED 102d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org 112d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org#include "SkImageGenerator.h" 122d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org#include "SkDiscardableMemory.h" 132d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org 142d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org/** 152d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * Takes ownership of SkImageGenerator. If this method fails for 162d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * whatever reason, it will return false and immediatetely delete 172d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * the generator. If it succeeds, it will modify destination 182d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * bitmap. 192d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 202d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * If generator is NULL, will safely return false. 212d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 222d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * If this fails or when the SkDiscardablePixelRef that is 232d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * installed into destination is destroyed, it will call 242d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * SkDELETE() on the generator. Therefore, generator should be 252d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * allocated with SkNEW() or SkNEW_ARGS(). 262d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 272d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * @param destination Upon success, this bitmap will be 282d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * configured and have a pixelref installed. 292d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 302d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * @param factory If not NULL, this object will be used as a 312d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * source of discardable memory when decoding. If NULL, then 322d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * SkDiscardableMemory::Create() will be called. 332d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * 342d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org * @return true iff successful. 352d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org */ 362d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.orgbool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap* destination, 372d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org SkDiscardableMemory::Factory* factory); 382d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org 392d970b5128f7270cd01a93e4ce68d0c3ea67ac71commit-bot@chromium.org#endif 40