1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef MOZILLA_GFX_SCALE_H_ 8 #define MOZILLA_GFX_SCALE_H_ 9 10 #include "Types.h" 11 12 namespace mozilla { 13 namespace gfx { 14 15 /** 16 * Scale an image using a high-quality filter. 17 * 18 * Synchronously scales an image and writes the output to the destination in 19 * 32-bit format. The destination must be pre-allocated by the caller. 20 * 21 * Returns true if scaling was successful, and false otherwise. Currently, this 22 * function is implemented using Skia. If Skia is not enabled when building, 23 * calling this function will always return false. 24 * 25 * IMPLEMTATION NOTES: 26 * This API is not currently easily hardware acceleratable. A better API might 27 * take a SourceSurface and return a SourceSurface; the Direct2D backend, for 28 * example, could simply set a status bit on a copy of the image, and use 29 * Direct2D's high-quality scaler at draw time. 30 */ 31 GFX2D_API bool Scale(uint8_t* srcData, int32_t srcWidth, int32_t srcHeight, 32 int32_t srcStride, uint8_t* dstData, int32_t dstWidth, 33 int32_t dstHeight, int32_t dstStride, 34 SurfaceFormat format); 35 36 } // namespace gfx 37 } // namespace mozilla 38 39 #endif /* MOZILLA_GFX_BLUR_H_ */ 40