| Leon Scroggins III | 8fcfa66 | 2021-10-12 11:33:30 -0400 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright 2021 The Android Open Source Project | 
 | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *      http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #include <ui/GraphicBuffer.h> | 
 | 18 |  | 
 | 19 | using namespace android; | 
 | 20 |  | 
 | 21 | /** | 
 | 22 |  * Utilities for running benchmarks. | 
 | 23 |  */ | 
 | 24 | namespace renderenginebench { | 
 | 25 | /** | 
 | 26 |  * Parse RenderEngineBench-specific flags from the command line. | 
 | 27 |  * | 
 | 28 |  * --save Save the output buffer to a file to verify that it drew as | 
 | 29 |  *  expected. | 
 | 30 |  */ | 
 | 31 | void parseFlags(int argc, char** argv); | 
 | 32 |  | 
 | 33 | /** | 
 | 34 |  * Parse flags for '--help' | 
 | 35 |  */ | 
 | 36 | void parseFlagsForHelp(int argc, char** argv); | 
 | 37 |  | 
 | 38 | /** | 
 | 39 |  * Whether to save the drawing result to a file. | 
 | 40 |  * | 
 | 41 |  * True if --save was used on the command line. | 
 | 42 |  */ | 
 | 43 | bool save(); | 
 | 44 |  | 
 | 45 | /** | 
 | 46 |  * Decode the image at 'path' into 'buffer'. | 
 | 47 |  * | 
 | 48 |  * Currently only used for debugging. The image will be scaled to fit the | 
 | 49 |  * buffer if necessary. | 
 | 50 |  * | 
 | 51 |  * This assumes the buffer matches ANDROID_BITMAP_FORMAT_RGBA_8888. | 
 | 52 |  * | 
 | 53 |  * @param path Relative to the directory holding the executable. | 
 | 54 |  */ | 
 | 55 | void decode(const char* path, const sp<GraphicBuffer>& buffer); | 
 | 56 |  | 
 | 57 | /** | 
 | 58 |  * Encode the buffer to a jpeg. | 
 | 59 |  * | 
 | 60 |  * This assumes the buffer matches ANDROID_BITMAP_FORMAT_RGBA_8888. | 
 | 61 |  * | 
 | 62 |  * @param path Relative to the directory holding the executable. | 
 | 63 |  */ | 
 | 64 | void encodeToJpeg(const char* path, const sp<GraphicBuffer>& buffer); | 
 | 65 | } // namespace renderenginebench |