diff --git a/.clang-format b/.clang-format index 6d2c9bd44e..82cf4d1275 100644 --- a/.clang-format +++ b/.clang-format @@ -1,26 +1,69 @@ +# Generated from CLion C/C++ Code Style settings Language: Cpp BasedOnStyle: Google ColumnLimit: 100 - -# Only sort headers in each include block -SortIncludes: true -IncludeBlocks: Preserve -DerivePointerAlignment: false -PointerAlignment: Left +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignOperands: true +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: true +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom BraceWrapping: - SplitEmptyFunction: true - ---- -Language: ObjC -BasedOnStyle: Google -ColumnLimit: 100 - -# Only sort headers in each include block -SortIncludes: true -IncludeBlocks: Preserve -DerivePointerAlignment: false + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +CompactNamespaces: false +ContinuationIndentWidth: 4 +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false PointerAlignment: Left -AllowShortFunctionsOnASingleLine: None -BraceWrapping: - SplitEmptyFunction: true +ReflowComments: false +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +IncludeBlocks: Merge +TabWidth: 2 +UseTab: Never diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml new file mode 100644 index 0000000000..f874dc61af --- /dev/null +++ b/.github/workflows/autotest.yml @@ -0,0 +1,115 @@ +# This is a basic workflow to help you get started with Actions + +name: autotest + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ main ] + pull_request: + branches: [ main ] +env: + branch: "main" +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: macos-latest + + steps: + - name: Get environment cache + id: cache-environment + uses: actions/cache@v2 + with: + path: | + /usr/local/Cellar/ninja + /usr/local/bin/ninja + /usr/local/Cellar/node + /usr/local/bin/node + /usr/local/Cellar/emscripten + /usr/local/bin/emscripten + /usr/local/Cellar/yasm + /usr/local/bin/yasm + /usr/local/Cellar/depsync + /usr/local/bin/depsync + key: libpag-environment-20220208 + - if: github.event_name == 'push' + name: Get libpag cache + id: libpag-push + uses: actions/cache@v2 + with: + path: libpag.tar.zst + key: libpag-code-${{ github.sha }} + restore-keys: | + libpag-code-${{ github.event.before }} + libpag-code- + - if: github.event_name == 'pull_request' + name: Get libpag cache + id: libpag-pull + uses: actions/cache@v2 + with: + path: libpag.tar.zst + key: libpag-code-${{ github.event.pull_request.base.sha }} + restore-keys: libpag-code- + - name: Check file existence + id: check_files + uses: andstor/file-existence-action@v1 + with: + files: "libpag.tar.zst" + - name: File exist + if: steps.check_files.outputs.files_exists == 'true' + # Only runs if all of the files exists + run: | + echo "file exist" + tar xvf libpag.tar.zst + rm -rf libpag.tar.zst + - name: File not exist + if: steps.check_files.outputs.files_exists != 'true' + run: | + echo "file not exist" + git clone -b main https://github.com/Tencent/libpag.git + - if: github.event_name == 'pull_request' + name: swith branch + run: | + cd libpag + git pull + git checkout ${{ github.head_ref }} + - if: github.event_name == 'push' + name: swith branch + run: | + cd libpag + git pull + - name: brew link emscripten + if: steps.cache-third_party.outputs.cache-hit == 'true' + run: | + brew link emscripten + + - name: Run autotest script + run: | + cd libpag + chmod +x sync_deps.sh + ./sync_deps.sh + chmod +x autotest.sh + ./autotest.sh + shell: bash + - name: The job has failed + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: result + path: libpag/result + - uses: actions/upload-artifact@v2 + with: + name: result + path: result + - name: Compress libpag + run: | + cd libpag + rm -rf result + git checkout main + cd .. + tar cvfa libpag.tar.zst libpag + diff --git a/.github/workflows/before_merge.yml b/.github/workflows/before_merge.yml new file mode 100644 index 0000000000..63447ee300 --- /dev/null +++ b/.github/workflows/before_merge.yml @@ -0,0 +1,96 @@ +name: before_merge + +on: + pull_request: + branches: [ main ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: macos-latest + + steps: + - name: Get environment cache + id: cache-environment + uses: actions/cache@v2 + with: + path: | + /usr/local/Cellar/ninja + /usr/local/bin/ninja + /usr/local/Cellar/node + /usr/local/bin/node + /usr/local/Cellar/emscripten + /usr/local/bin/emscripten + /usr/local/Cellar/yasm + /usr/local/bin/yasm + /usr/local/Cellar/depsync + /usr/local/bin/depsync + /opt/homebrew/bin/gcovr + key: libpag-environment-1 + + - name: Get libpag cache + id: libpag + uses: actions/cache@v2 + with: + path: libpag.tar.zst + key: libpag-code-${{ github.event.pull_request.base.sha }} + restore-keys: libpag-code- + - name: Check file existence + id: check_files + uses: andstor/file-existence-action@v1 + with: + files: "libpag.tar.zst" + - name: File exists + if: steps.check_files.outputs.files_exists == 'true' + # Only runs if all of the files exists + run: | + echo "file exist" + tar xvf libpag.tar.zst + rm -rf libpag.tar.zst + cd libpag + git fetch + git checkout ${{ github.head_ref }} + - name: File not exists + if: steps.check_files.outputs.files_exists != 'true' + run: | + echo "file not exit" + git clone -b ${{ github.head_ref }} https://github.com/kevingpqi123/libpag.git + - name: brew link emscripten + if: steps.cache-third_party.outputs.cache-hit == 'true' + run: | + brew link emscripten + + - name: Run autotest script + run: | + cd libpag + chmod +x sync_deps.sh + ./sync_deps.sh + chmod +x autotest.sh + ./autotest.sh + shell: bash + - name: The job has failed + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: result + path: libpag/result + - uses: actions/upload-artifact@v2 + with: + name: result + path: libpag/result + - name: codecov + uses: codecov/codecov-action@v2.1.0 + with: + token: 8e38459f-ae9b-48f0-894e-87b9f369e7e9 + file: libpag/result/coverage.xml + + + + + diff --git a/.github/workflows/code-format.yml b/.github/workflows/code-format.yml new file mode 100644 index 0000000000..ef02204e25 --- /dev/null +++ b/.github/workflows/code-format.yml @@ -0,0 +1,30 @@ +name: code-format + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Run codeformat script + run: | + npm install -g clang-format + clang-format --version + chmod +x codeformat.sh + ./codeformat.sh + shell: bash + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: apply code-format changes diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..e6effa9bf3 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,83 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic.0 +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + paths: + - 'src/**' + - 'test/**' + schedule: + - cron: '0 20 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: macos-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp'] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + lfs: true + - name: Install Dependencies + run: | + pip install diff_cover + brew install gcovr + - name: Run sync_deps script + run: ./sync_deps.sh + shell: bash + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/Linux_build.md b/Linux_build.md index 0d3e660e15..25a74de19d 100644 --- a/Linux_build.md +++ b/Linux_build.md @@ -37,5 +37,5 @@ ## Linux demo The library files that the sample project depends on come from the previous step. - + #test \ No newline at end of file diff --git a/autotest.sh b/autotest.sh new file mode 100755 index 0000000000..04de552743 --- /dev/null +++ b/autotest.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +function make_dir() { + rm -rf $1 + mkdir -p $1 +} + +echo "shell log - autotest start begin " +if [[ `uname` == 'Darwin' ]]; then + MAC_REQUIRED_TOOLS="gcovr" + for TOOL in ${MAC_REQUIRED_TOOLS[@]}; do + if [ ! $(which $TOOL) ]; then + if [ ! $(which brew) ]; then + echo "Homebrew not found. Trying to install..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || + exit 1 + fi + echo "$TOOL not found. Trying to install..." + brew install $TOOL || exit 1 + fi + done +fi + +echo `pwd` + +COMPLIE_RESULT=true + +WORKSPACE=$(pwd) + +cd $WORKSPACE + +make_dir result +make_dir build + +cd build + +cmake -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -g -O0" -DSMOKE_TEST=ON -DCMAKE_BUILD_TYPE=Debug ../ +if test $? -eq 0 +then +echo "~~~~~~~~~~~~~~~~~~~CMakeLists OK~~~~~~~~~~~~~~~~~~" +else +echo "~~~~~~~~~~~~~~~~~~~CMakeLists error~~~~~~~~~~~~~~~~~~" +exit +fi + +cmake --build . --target PAGFullTest -- -j 12 +if test $? -eq 0 +then +echo "~~~~~~~~~~~~~~~~~~~PAGFullTest make successed~~~~~~~~~~~~~~~~~~" +else +echo "~~~~~~~~~~~~~~~~~~~PAGFullTest make error~~~~~~~~~~~~~~~~~~" +exit 1 +fi + +cmake --build . --target PAGSmokeTest -- -j 12 +if test $? -eq 0 +then +echo "~~~~~~~~~~~~~~~~~~~PAGSmokeTest make successed~~~~~~~~~~~~~~~~~~" +else +echo "~~~~~~~~~~~~~~~~~~~PAGSmokeTest make error~~~~~~~~~~~~~~~~~~" +exit 1 +fi + +./PAGFullTest --gtest_output=json:PAGFullTest.json + +if test $? -eq 0 +then +echo "~~~~~~~~~~~~~~~~~~~PAGFullTest successed~~~~~~~~~~~~~~~~~~" +else +echo "~~~~~~~~~~~~~~~~~~~PAGFullTest Failed~~~~~~~~~~~~~~~~~~" +COMPLIE_RESULT=false +fi + +./PAGSmokeTest --gtest_output=json:PAGSmokeTest.json +if test $? -eq 0 +then +echo "~~~~~~~~~~~~~~~~~~~PAGSmokeTest successed~~~~~~~~~~~~~~~~~~" +else +echo "~~~~~~~~~~~~~~~~~~~PAGSmokeTest Failed~~~~~~~~~~~~~~~~~~" +COMPLIE_RESULT=false +fi + +cp -a $WORKSPACE/build/*.json $WORKSPACE/result/ + +cd .. + +gcovr -r . -e='test/*.*' -e='vendor/*.*'--html -o ./result/coverage.html +gcovr -r . -e='test/*.*' -e='vendor/*.*' --xml-pretty -o ./result/coverage.xml + +rm -rf build + +if [ "$COMPLIE_RESULT" == false ] +then + cp -a $WORKSPACE/test/out/baseline/**/*.lzma2 $WORKSPACE/result/ + cp -a $WORKSPACE/test/out/compare/*.webp $WORKSPACE/result/ + exit 1 + fi \ No newline at end of file diff --git a/codeformat.sh b/codeformat.sh new file mode 100755 index 0000000000..d3c05bc89e --- /dev/null +++ b/codeformat.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +echo "----begin coding format----" +clang-format --version +find include/ -iname '*.h' -print0 | xargs clang-format -i +find tgfx/include -iname '*.h' -print0 | xargs clang-format -i +# shellcheck disable=SC2038 +find tgfx/src -iname "*.h" -print -o -iname "*.cpp" -print | xargs clang-format -i +# shellcheck disable=SC2038 +find src \( -path src/platform/ios -o -path src/platform/mac -o -path src/platform/cocoa \) -prune -o -name "*.cpp" -print -o -name "*.h" -print | xargs clang-format -i +# shellcheck disable=SC2038 +find test \( -path test/framework/lzma \) -prune -o -name "*.cpp" -print -o -name "*.h" -print | xargs clang-format -i +echo "----end coding format----" + diff --git a/src/base/File.cpp b/src/base/File.cpp index 08aaf4ae4e..1d3d0be5ca 100644 --- a/src/base/File.cpp +++ b/src/base/File.cpp @@ -16,11 +16,10 @@ // ///////////////////////////////////////////////////////////////////////////////////////////////// +#include "pag/file.h" #include #include -#include "pag/file.h" - namespace pag { static std::mutex globalLocker = {}; diff --git a/src/platform/android/GLHardwareTexture.cpp b/src/platform/android/GLHardwareTexture.cpp index 236e347425..133fdab67a 100644 --- a/src/platform/android/GLHardwareTexture.cpp +++ b/src/platform/android/GLHardwareTexture.cpp @@ -68,8 +68,8 @@ std::shared_ptr GLHardwareTexture::MakeFrom( buffer->height); } -std::shared_ptr GLHardwareTexture::MakeFrom( - Context* context, AHardwareBuffer* hardwareBuffer) { +std::shared_ptr GLHardwareTexture::MakeFrom(Context* context, + AHardwareBuffer* hardwareBuffer) { if (!hardwareBuffer) { return nullptr; } @@ -95,9 +95,8 @@ std::shared_ptr GLHardwareTexture::MakeFrom( } std::shared_ptr GLHardwareTexture::MakeFrom( - Context* context, AHardwareBuffer* hardwareBuffer, - android::GraphicBuffer* graphicBuffer, EGLClientBuffer clientBuffer, int width, - int height) { + Context* context, AHardwareBuffer* hardwareBuffer, android::GraphicBuffer* graphicBuffer, + EGLClientBuffer clientBuffer, int width, int height) { static bool init = initGlextProc(); if (!init || !clientBuffer) { return nullptr; @@ -123,12 +122,10 @@ std::shared_ptr GLHardwareTexture::MakeFrom( } GLHardwareTexture::GLHardwareTexture(AHardwareBuffer* hardwareBuffer, - android::GraphicBuffer* graphicBuffer, - EGLImageKHR eglImage, int width, int height) - : GLTexture(width, height, ImageOrigin::TopLeft), - _eglImage(eglImage), - hardwareBuffer(hardwareBuffer), - graphicBuffer(graphicBuffer) { + android::GraphicBuffer* graphicBuffer, EGLImageKHR eglImage, + int width, int height) + : GLTexture(width, height, ImageOrigin::TopLeft), _eglImage(eglImage), + hardwareBuffer(hardwareBuffer), graphicBuffer(graphicBuffer) { if (graphicBuffer) { NativeGraphicBufferInterface::Acquire(graphicBuffer); } diff --git a/src/platform/android/GLHardwareTexture.h b/src/platform/android/GLHardwareTexture.h index 83743f4703..568519f5d3 100644 --- a/src/platform/android/GLHardwareTexture.h +++ b/src/platform/android/GLHardwareTexture.h @@ -17,36 +17,36 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #pragma once -#include "NativeGraphicBufferInterface.h" #include -#include "gpu/opengl/GLTexture.h" #include "EGL/egl.h" #include "EGL/eglext.h" #include "GLES/gl.h" #include "GLES/glext.h" +#include "NativeGraphicBufferInterface.h" #include "NativeHardwareBufferInterface.h" +#include "gpu/opengl/GLTexture.h" namespace pag { class GLHardwareTexture : public GLTexture { public: - static std::shared_ptr MakeFrom( - Context* context, AHardwareBuffer* hardwareBuffer); - static std::shared_ptr MakeFrom( - Context* context, android::GraphicBuffer* graphicBuffer); + static std::shared_ptr MakeFrom(Context* context, + AHardwareBuffer* hardwareBuffer); + static std::shared_ptr MakeFrom(Context* context, + android::GraphicBuffer* graphicBuffer); - static std::shared_ptr MakeFrom( - Context* context, AHardwareBuffer* hardwareBuffer, - android::GraphicBuffer* graphicBuffer, EGLClientBuffer client_buffer, int width, - int height); + static std::shared_ptr MakeFrom(Context* context, + AHardwareBuffer* hardwareBuffer, + android::GraphicBuffer* graphicBuffer, + EGLClientBuffer client_buffer, int width, + int height); size_t memoryUsage() const override { return 0; } private: - explicit GLHardwareTexture(AHardwareBuffer* hardwareBuffer, - android::GraphicBuffer* graphicBuffer, EGLImageKHR eglImage, - int width, int height); + explicit GLHardwareTexture(AHardwareBuffer* hardwareBuffer, android::GraphicBuffer* graphicBuffer, + EGLImageKHR eglImage, int width, int height); EGLImageKHR _eglImage = EGL_NO_IMAGE_KHR; AHardwareBuffer* hardwareBuffer = nullptr; android::GraphicBuffer* graphicBuffer = nullptr; diff --git a/src/platform/android/GPUDecoder.cpp b/src/platform/android/GPUDecoder.cpp index 7b274867af..bba307d090 100644 --- a/src/platform/android/GPUDecoder.cpp +++ b/src/platform/android/GPUDecoder.cpp @@ -57,8 +57,8 @@ void GPUDecoder::InitJNI(JNIEnv* env, const std::string& className) { "(Ljava/lang/String;II)Landroid/media/MediaFormat;"); MediaFormat_setByteBuffer = env->GetMethodID(MediaFormatClass.get(), "setByteBuffer", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V"); - MediaFormat_setFloat = env->GetMethodID(MediaFormatClass.get(), "setFloat", - "(Ljava/lang/String;F)V"); + MediaFormat_setFloat = + env->GetMethodID(MediaFormatClass.get(), "setFloat", "(Ljava/lang/String;F)V"); } GPUDecoder::GPUDecoder(const VideoConfig& config) { diff --git a/src/platform/android/GPUDrawable.h b/src/platform/android/GPUDrawable.h index 8bfc0cc8df..0e7cade712 100644 --- a/src/platform/android/GPUDrawable.h +++ b/src/platform/android/GPUDrawable.h @@ -20,8 +20,8 @@ #include #include -#include "pag/pag.h" #include "gpu/opengl/egl/EGLWindow.h" +#include "pag/pag.h" namespace pag { class GPUDrawable : public Drawable { diff --git a/src/platform/android/Global.h b/src/platform/android/Global.h index 4184572280..bd9d1db413 100644 --- a/src/platform/android/Global.h +++ b/src/platform/android/Global.h @@ -20,7 +20,7 @@ #include "JNIEnvironment.h" -template +template class Global { public: Global() : mEnv(nullptr), mRef(nullptr) { diff --git a/src/platform/android/JNIHelper.cpp b/src/platform/android/JNIHelper.cpp index 9eb3b4a3ae..4299d9c9ad 100644 --- a/src/platform/android/JNIHelper.cpp +++ b/src/platform/android/JNIHelper.cpp @@ -302,8 +302,8 @@ pag::ImageInfo GetImageInfo(JNIEnv* env, jobject bitmap) { return {}; } pag::AlphaType alphaType = (bitmapInfo.flags & BITMAP_FLAGS_ALPHA_UNPREMUL) - ? pag::AlphaType::Unpremultiplied - : pag::AlphaType::Premultiplied; + ? pag::AlphaType::Unpremultiplied + : pag::AlphaType::Premultiplied; pag::ColorType colorType; switch (bitmapInfo.format) { case ANDROID_BITMAP_FORMAT_RGBA_8888: diff --git a/src/platform/android/JPAGImage.cpp b/src/platform/android/JPAGImage.cpp index 0e9ed9d462..08352a93db 100644 --- a/src/platform/android/JPAGImage.cpp +++ b/src/platform/android/JPAGImage.cpp @@ -21,8 +21,8 @@ #include #include #include -#include "NativePlatform.h" #include "JNIHelper.h" +#include "NativePlatform.h" namespace pag { static jfieldID PAGImage_nativeContext; diff --git a/src/platform/android/NativeGraphicBuffer.cpp b/src/platform/android/NativeGraphicBuffer.cpp index ffae4cb3ab..0f119657c9 100644 --- a/src/platform/android/NativeGraphicBuffer.cpp +++ b/src/platform/android/NativeGraphicBuffer.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeGraphicBuffer.h" - #include "GLHardwareTexture.h" namespace pag { diff --git a/src/platform/android/NativeHardwareBuffer.cpp b/src/platform/android/NativeHardwareBuffer.cpp index 48bd330747..234d4a7de7 100644 --- a/src/platform/android/NativeHardwareBuffer.cpp +++ b/src/platform/android/NativeHardwareBuffer.cpp @@ -17,14 +17,11 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeHardwareBuffer.h" - -#include -#include - #include #include +#include +#include #include - #include "GLHardwareTexture.h" #include "NativeHardwareBufferInterface.h" diff --git a/src/platform/android/NativeHardwareBufferInterface.cpp b/src/platform/android/NativeHardwareBufferInterface.cpp index d0d78a8712..86f5d7fc43 100644 --- a/src/platform/android/NativeHardwareBufferInterface.cpp +++ b/src/platform/android/NativeHardwareBufferInterface.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeHardwareBufferInterface.h" - #include #include diff --git a/src/platform/android/NativeImage.cpp b/src/platform/android/NativeImage.cpp index 18b986bbb9..d0a63e9ad6 100644 --- a/src/platform/android/NativeImage.cpp +++ b/src/platform/android/NativeImage.cpp @@ -17,9 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeImage.h" - #include - #include "JNIHelper.h" #include "image/PixelMap.h" diff --git a/src/platform/android/NativeImage.h b/src/platform/android/NativeImage.h index b47946f062..acf8361420 100644 --- a/src/platform/android/NativeImage.h +++ b/src/platform/android/NativeImage.h @@ -37,8 +37,7 @@ class NativeImage : public Image { std::string imagePath; std::shared_ptr imageBytes; - NativeImage(int width, int height, Orientation orientation) : Image(width, height, - orientation) {}; + NativeImage(int width, int height, Orientation orientation) : Image(width, height, orientation){}; static std::shared_ptr Make(JNIEnv* env, jobject sizeObject, int orientation); }; diff --git a/src/platform/android/VideoImage.cpp b/src/platform/android/VideoImage.cpp index 6f641ef2c8..c197b9d32a 100644 --- a/src/platform/android/VideoImage.cpp +++ b/src/platform/android/VideoImage.cpp @@ -31,7 +31,7 @@ std::shared_ptr VideoImage::MakeFrom(std::shared_ptr v VideoImage::VideoImage(std::shared_ptr videoSurface, int width, int height) : VideoBuffer(width, height), videoSurface(std::move(videoSurface)) { - this->videoSurface->markHasNewTextureImage(); + this->videoSurface->markHasNewTextureImage(); } std::shared_ptr VideoImage::makeTexture(Context* context) const { diff --git a/src/platform/android/VideoSurface.cpp b/src/platform/android/VideoSurface.cpp index 100e36e5b1..8194dce0e7 100644 --- a/src/platform/android/VideoSurface.cpp +++ b/src/platform/android/VideoSurface.cpp @@ -105,8 +105,8 @@ std::shared_ptr VideoSurface::Make(int width, int height, bool has if (surface == nullptr) { return nullptr; } - auto videoSurface = std::shared_ptr( - new VideoSurface(env, surface, width, height, hasAlpha)); + auto videoSurface = + std::shared_ptr(new VideoSurface(env, surface, width, height, hasAlpha)); env->DeleteLocalRef(surface); return videoSurface; } diff --git a/src/platform/ios/private/GLNV12Texture.h b/src/platform/ios/private/GLNV12Texture.h index 8183426898..1c7980e28d 100644 --- a/src/platform/ios/private/GLNV12Texture.h +++ b/src/platform/ios/private/GLNV12Texture.h @@ -25,10 +25,10 @@ namespace pag { class GLNV12Texture : public GLYUVTexture { public: static std::shared_ptr MakeFrom(Context* context, CVPixelBufferRef pixelBuffer, - YUVColorSpace colorSpace, YUVColorRange colorRange); + YUVColorSpace colorSpace, + YUVColorRange colorRange); - GLNV12Texture(CVPixelBufferRef pixelBuffer, - YUVColorSpace colorSpace, YUVColorRange colorRange); + GLNV12Texture(CVPixelBufferRef pixelBuffer, YUVColorSpace colorSpace, YUVColorRange colorRange); ~GLNV12Texture() override; diff --git a/src/platform/ios/private/VideoImage.h b/src/platform/ios/private/VideoImage.h index 05b16067fd..a3317a3783 100644 --- a/src/platform/ios/private/VideoImage.h +++ b/src/platform/ios/private/VideoImage.h @@ -25,8 +25,7 @@ namespace pag { class VideoImage : public VideoBuffer { public: static std::shared_ptr MakeFrom(CVPixelBufferRef pixelBuffer, - YUVColorSpace colorSpace, - YUVColorRange colorRange); + YUVColorSpace colorSpace, YUVColorRange colorRange); ~VideoImage() override; diff --git a/src/platform/swiftshader/NativePlatform.h b/src/platform/swiftshader/NativePlatform.h index 66b64452bf..a94232731e 100644 --- a/src/platform/swiftshader/NativePlatform.h +++ b/src/platform/swiftshader/NativePlatform.h @@ -31,6 +31,6 @@ class NativePlatform : public Platform { PAGFont parseFont(const void* data, size_t length, int ttcIndex) const override; - void traceImage(const PixelMap &pixelMap, const std::string &tag) const override; + void traceImage(const PixelMap& pixelMap, const std::string& tag) const override; }; } // namespace pag diff --git a/src/platform/web/GPUDrawable.cpp b/src/platform/web/GPUDrawable.cpp index b0c89f1092..436d7aea99 100644 --- a/src/platform/web/GPUDrawable.cpp +++ b/src/platform/web/GPUDrawable.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "GPUDrawable.h" - #include "gpu/Surface.h" #include "gpu/opengl/GLDefines.h" diff --git a/src/platform/web/NativeGLDevice.cpp b/src/platform/web/NativeGLDevice.cpp index 3875f19870..647d3b9d44 100644 --- a/src/platform/web/NativeGLDevice.cpp +++ b/src/platform/web/NativeGLDevice.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "platform/NativeGLDevice.h" - #include "gpu/opengl/webgl/WEBGLDevice.h" namespace pag { diff --git a/src/platform/web/NativeImage.cpp b/src/platform/web/NativeImage.cpp index 3124031177..d62cb7ff99 100644 --- a/src/platform/web/NativeImage.cpp +++ b/src/platform/web/NativeImage.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeImage.h" - #include "NativeTextureBuffer.h" using namespace emscripten; diff --git a/src/platform/web/NativeImage.h b/src/platform/web/NativeImage.h index d66a125e58..7853c47baa 100644 --- a/src/platform/web/NativeImage.h +++ b/src/platform/web/NativeImage.h @@ -18,9 +18,8 @@ #pragma once -#include "image/Image.h" - #include +#include "image/Image.h" namespace pag { class NativeImage : public Image { diff --git a/src/platform/web/NativePlatform.cpp b/src/platform/web/NativePlatform.cpp index c7d93f8870..3cf6a83db0 100644 --- a/src/platform/web/NativePlatform.cpp +++ b/src/platform/web/NativePlatform.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativePlatform.h" - #include "NativeImage.h" #include "image/PixelMap.h" #include "pag/pag.h" diff --git a/src/platform/web/NativeTextureBuffer.cpp b/src/platform/web/NativeTextureBuffer.cpp index 40042df653..a0e527c54f 100644 --- a/src/platform/web/NativeTextureBuffer.cpp +++ b/src/platform/web/NativeTextureBuffer.cpp @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "NativeTextureBuffer.h" - #include "gpu/opengl/GLTexture.h" using namespace emscripten; diff --git a/src/platform/web/NativeTextureBuffer.h b/src/platform/web/NativeTextureBuffer.h index 8249c55b50..b7a2ba9032 100644 --- a/src/platform/web/NativeTextureBuffer.h +++ b/src/platform/web/NativeTextureBuffer.h @@ -18,9 +18,8 @@ #pragma once -#include "gpu/TextureBuffer.h" - #include +#include "gpu/TextureBuffer.h" namespace pag { class NativeTextureBuffer : public TextureBuffer { diff --git a/src/platform/web/VideoSequenceReader.cpp b/src/platform/web/VideoSequenceReader.cpp index 1194d468f5..1b9deddabd 100644 --- a/src/platform/web/VideoSequenceReader.cpp +++ b/src/platform/web/VideoSequenceReader.cpp @@ -17,15 +17,15 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "VideoSequenceReader.h" - #include "gpu/opengl/GLTexture.h" #include "rendering/caches/RenderCache.h" using namespace emscripten; namespace pag { -std::shared_ptr -SequenceReader::Make(std::shared_ptr file, VideoSequence* sequence, DecodingPolicy policy) { +std::shared_ptr SequenceReader::Make(std::shared_ptr file, + VideoSequence* sequence, + DecodingPolicy policy) { return std::make_shared(std::move(file), sequence, policy); } @@ -43,12 +43,12 @@ VideoSequenceReader::VideoSequenceReader(std::shared_ptr file, VideoSequen auto videoReaderClass = val::module_property("VideoReader"); if (videoReaderClass.as()) { auto headers = val::array(); - for (auto* header: sequence->headers) { + for (auto* header : sequence->headers) { headers.call("push", val(typed_memory_view(header->length(), header->data()))); } auto frames = val::array(); auto ptsList = val::array(); - for (auto* frame: sequence->frames) { + for (auto* frame : sequence->frames) { frames.call( "push", val(typed_memory_view(frame->fileBytes->length(), frame->fileBytes->data()))); ptsList.call("push", static_cast(frame->frame)); diff --git a/src/platform/web/VideoSequenceReader.h b/src/platform/web/VideoSequenceReader.h index c76818a9ba..d48f976a7a 100644 --- a/src/platform/web/VideoSequenceReader.h +++ b/src/platform/web/VideoSequenceReader.h @@ -19,7 +19,6 @@ #pragma once #include - #include "rendering/readers/SequenceReader.h" namespace pag { diff --git a/src/rendering/PAGFont.cpp b/src/rendering/PAGFont.cpp index 15b5aa1347..961fb1fd94 100644 --- a/src/rendering/PAGFont.cpp +++ b/src/rendering/PAGFont.cpp @@ -40,6 +40,6 @@ void PAGFont::SetFallbackFontNames(const std::vector& fontNames) { void PAGFont::SetFallbackFontPaths(const std::vector& fontPaths, const std::vector& ttcIndices) { - FontManager::SetFallbackFontPaths(fontPaths, ttcIndices); + FontManager::SetFallbackFontPaths(fontPaths, ttcIndices); } } // namespace pag \ No newline at end of file diff --git a/src/rendering/caches/TextContentCache.cpp b/src/rendering/caches/TextContentCache.cpp index 3c2abbcdf0..944e96502e 100644 --- a/src/rendering/caches/TextContentCache.cpp +++ b/src/rendering/caches/TextContentCache.cpp @@ -22,21 +22,14 @@ namespace pag { TextContentCache::TextContentCache(TextLayer* layer) - : ContentCache(layer), - sourceText(layer->sourceText), - pathOption(layer->pathOption), - moreOption(layer->moreOption), - animators(&layer->animators) { + : ContentCache(layer), sourceText(layer->sourceText), pathOption(layer->pathOption), + moreOption(layer->moreOption), animators(&layer->animators) { } TextContentCache::TextContentCache(TextLayer* layer, ID cacheID, Property* sourceText) - : ContentCache(layer), - cacheID(cacheID), - sourceText(sourceText), - pathOption(layer->pathOption), - moreOption(layer->moreOption), - animators(&layer->animators) { + : ContentCache(layer), cacheID(cacheID), sourceText(sourceText), pathOption(layer->pathOption), + moreOption(layer->moreOption), animators(&layer->animators) { } void TextContentCache::excludeVaryingRanges(std::vector* timeRanges) const { diff --git a/src/rendering/graphics/Picture.cpp b/src/rendering/graphics/Picture.cpp index 0cd0f273c9..9c9e5fc202 100644 --- a/src/rendering/graphics/Picture.cpp +++ b/src/rendering/graphics/Picture.cpp @@ -417,9 +417,7 @@ class ImageTextureProxy : public TextureProxy { class BackendTextureProxy : public TextureProxy { public: BackendTextureProxy(const BackendTexture& texture, ImageOrigin origin, void* sharedContext) - : TextureProxy(texture.width(), texture.height()), - backendTexture(texture), - origin(origin), + : TextureProxy(texture.width(), texture.height()), backendTexture(texture), origin(origin), sharedContext(sharedContext) { } diff --git a/src/rendering/graphics/Text.cpp b/src/rendering/graphics/Text.cpp index f98a6cbf15..6423992a6f 100644 --- a/src/rendering/graphics/Text.cpp +++ b/src/rendering/graphics/Text.cpp @@ -16,9 +16,8 @@ // ///////////////////////////////////////////////////////////////////////////////////////////////// -#include - #include "Text.h" +#include #include "core/Canvas.h" #include "pag/file.h" #include "raster/PathEffect.h" diff --git a/src/rendering/readers/SequenceReader.h b/src/rendering/readers/SequenceReader.h index f671ad7034..84ce57396a 100644 --- a/src/rendering/readers/SequenceReader.h +++ b/src/rendering/readers/SequenceReader.h @@ -28,8 +28,8 @@ class RenderCache; class SequenceReader { public: - static std::shared_ptr - Make(std::shared_ptr file, VideoSequence* sequence, DecodingPolicy policy); + static std::shared_ptr Make(std::shared_ptr file, VideoSequence* sequence, + DecodingPolicy policy); SequenceReader(std::shared_ptr file, Sequence* sequence); diff --git a/src/rendering/renderers/CompositionRenderer.cpp b/src/rendering/renderers/CompositionRenderer.cpp index da421edf93..0f7c06949a 100644 --- a/src/rendering/renderers/CompositionRenderer.cpp +++ b/src/rendering/renderers/CompositionRenderer.cpp @@ -69,7 +69,7 @@ static std::shared_ptr MakeVideoSequenceGraphic(VideoSequence* sequence RGBAAALayout layout = {sequence->width, sequence->height, sequence->alphaStartX, sequence->alphaStartY}; return Picture::MakeFrom(sequence->composition->uniqueID, std::unique_ptr(proxy), - layout); + layout); } std::shared_ptr RenderVectorComposition(VectorComposition* composition, diff --git a/src/rendering/utils/PathUtil.h b/src/rendering/utils/PathUtil.h index 1a9ac773e0..4c875547e6 100644 --- a/src/rendering/utils/PathUtil.h +++ b/src/rendering/utils/PathUtil.h @@ -18,8 +18,8 @@ #pragma once -#include "raster/Path.h" #include "pag/file.h" +#include "raster/Path.h" namespace pag { diff --git a/src/video/MediaDemuxer.h b/src/video/MediaDemuxer.h index 45fb756dec..2ae9cd1cce 100644 --- a/src/video/MediaDemuxer.h +++ b/src/video/MediaDemuxer.h @@ -46,8 +46,7 @@ class SampleData { class PTSDetail { public: PTSDetail(int64_t duration, std::vector ptsVector, std::vector keyframeIndexVector) - : duration(duration), - ptsVector(std::move(ptsVector)), + : duration(duration), ptsVector(std::move(ptsVector)), keyframeIndexVector(std::move(keyframeIndexVector)) { } int64_t duration = 0; diff --git a/test/PAGBlendTest.cpp b/test/PAGBlendTest.cpp index 1fb05665da..6990a9604e 100644 --- a/test/PAGBlendTest.cpp +++ b/test/PAGBlendTest.cpp @@ -45,7 +45,7 @@ PAG_TEST_F(PAGBlendTest, Blend) { auto found = file.find_last_of("/\\"); auto suffixIndex = file.rfind('.'); auto fileName = file.substr(found + 1, suffixIndex - found - 1); - EXPECT_TRUE(Baseline::Compare(pagSurface, "PAGBlendTest/Blend_"+ fileName)); + EXPECT_TRUE(Baseline::Compare(pagSurface, "PAGBlendTest/Blend_" + fileName)); } } diff --git a/test/PAGCompareFrameTest.cpp b/test/PAGCompareFrameTest.cpp index 0b86a279cf..5f506920d9 100644 --- a/test/PAGCompareFrameTest.cpp +++ b/test/PAGCompareFrameTest.cpp @@ -65,8 +65,8 @@ class CompareFrameTask : public Executor { bool success = false; void execute() override { - success = Baseline::Compare(pixelBuffer, "PAGCompareFrameTest/" + fileName + "/" + - std::to_string(_currentFrame)); + success = Baseline::Compare( + pixelBuffer, "PAGCompareFrameTest/" + fileName + "/" + std::to_string(_currentFrame)); } }; diff --git a/test/PAGCompositionTest.cpp b/test/PAGCompositionTest.cpp index a6a834cfd9..6b56961e16 100644 --- a/test/PAGCompositionTest.cpp +++ b/test/PAGCompositionTest.cpp @@ -58,8 +58,7 @@ PAG_TEST_F(PAGCompositionTest, composition) { pagComposition->setLayerIndex(imageLayer1, 3); TestPAGPlayer->flush(); - EXPECT_TRUE( - Baseline::Compare(TestPAGSurface, "PAGCompositionTest/composition_setLayerIndex")); + EXPECT_TRUE(Baseline::Compare(TestPAGSurface, "PAGCompositionTest/composition_setLayerIndex")); pagComposition->removeLayer(imageLayer1); TestPAGPlayer->flush(); @@ -67,8 +66,7 @@ PAG_TEST_F(PAGCompositionTest, composition) { pagComposition->removeLayerAt(2); TestPAGPlayer->flush(); - EXPECT_TRUE( - Baseline::Compare(TestPAGSurface, "PAGCompositionTest/composition_removeLayerAt")); + EXPECT_TRUE(Baseline::Compare(TestPAGSurface, "PAGCompositionTest/composition_removeLayerAt")); pagComposition->removeAllLayers(); TestPAGPlayer->flush(); diff --git a/test/PAGFontTest.cpp b/test/PAGFontTest.cpp index 37b001a859..609fdc0f47 100644 --- a/test/PAGFontTest.cpp +++ b/test/PAGFontTest.cpp @@ -48,8 +48,8 @@ PAG_TEST(PAGFontTest, TestFont) { pagPlayer->setProgress((currentFrame + 0.1) * 1.0 / totalFrames); pagPlayer->flush(); - bool same = Baseline::Compare(pagSurface, - "PAGFontTest/TestFont_" + std::to_string(currentFrame)); + bool same = + Baseline::Compare(pagSurface, "PAGFontTest/TestFont_" + std::to_string(currentFrame)); if (!same) { errorMsg += (std::to_string(currentFrame) + ";"); } diff --git a/test/PAGTimeUtilsTest.cpp b/test/PAGTimeUtilsTest.cpp index cf8c8770db..d55cb0da4a 100644 --- a/test/PAGTimeUtilsTest.cpp +++ b/test/PAGTimeUtilsTest.cpp @@ -38,13 +38,13 @@ PAG_TEST_F(PAGTimeUtilsTest, ConvertProgressAndFrame) { auto progress = i * 0.5 / totalFrames; pagFile->setProgress(progress); TestPAGPlayer->flush(); - EXPECT_TRUE(Baseline::Compare( - TestPAGSurface, "PAGTimeUtilsTest/ConvertProgressAndFrame_" + std::to_string(i))); + EXPECT_TRUE(Baseline::Compare(TestPAGSurface, + "PAGTimeUtilsTest/ConvertProgressAndFrame_" + std::to_string(i))); progress = pagFile->getProgress(); pagFile->setProgress(progress); TestPAGPlayer->flush(); - EXPECT_TRUE(Baseline::Compare( - TestPAGSurface, "PAGTimeUtilsTest/ConvertProgressAndFrame_" + std::to_string(i))); + EXPECT_TRUE(Baseline::Compare(TestPAGSurface, + "PAGTimeUtilsTest/ConvertProgressAndFrame_" + std::to_string(i))); } } diff --git a/test/framework/PAGCpuTest.cpp b/test/framework/PAGCpuTest.cpp index 6b6b84159d..e97d63fae9 100644 --- a/test/framework/PAGCpuTest.cpp +++ b/test/framework/PAGCpuTest.cpp @@ -21,7 +21,6 @@ #include "gtest/gtest.h" #include "utils/PAGTestUtils.h" - namespace pag { std::shared_ptr PAGCpuTest::TestPAGFile = nullptr; diff --git a/test/framework/PAGTestEnvironment.cpp b/test/framework/PAGTestEnvironment.cpp index 72112aaa15..83ca2d6794 100644 --- a/test/framework/PAGTestEnvironment.cpp +++ b/test/framework/PAGTestEnvironment.cpp @@ -40,7 +40,6 @@ void PAGTestEnvironment::SetUp() { } void PAGTestEnvironment::TearDown() { - } } // namespace pag diff --git a/tgfx/src/gpu/Window.h b/tgfx/src/gpu/Window.h index 67a7fa39c0..269ee657a0 100644 --- a/tgfx/src/gpu/Window.h +++ b/tgfx/src/gpu/Window.h @@ -18,8 +18,8 @@ #pragma once -#include "gpu/Surface.h" #include "gpu/Context.h" +#include "gpu/Surface.h" namespace pag { /** diff --git a/tgfx/src/gpu/YUVTexture.h b/tgfx/src/gpu/YUVTexture.h index 411a9a7c05..86abad4530 100644 --- a/tgfx/src/gpu/YUVTexture.h +++ b/tgfx/src/gpu/YUVTexture.h @@ -85,22 +85,21 @@ class YUVTexture : public Texture { /** * Creates a new texture from I420 buffers. */ - static std::shared_ptr MakeI420(Context* context, - YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height, uint8_t* pixelsPlane[3], - const int lineSize[3]); + static std::shared_ptr MakeI420(Context* context, YUVColorSpace colorSpace, + YUVColorRange colorRange, int width, int height, + uint8_t* pixelsPlane[3], const int lineSize[3]); /** * Creates a new texture from NV12 buffers. */ - static std::shared_ptr MakeNV12(Context* context, - YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height, uint8_t* pixelsPlane[2], - const int lineSize[2]); + static std::shared_ptr MakeNV12(Context* context, YUVColorSpace colorSpace, + YUVColorRange colorRange, int width, int height, + uint8_t* pixelsPlane[2], const int lineSize[2]); YUVTexture(YUVColorSpace colorSpace, YUVColorRange colorRange, int width, int height) : Texture(width, height, ImageOrigin::TopLeft), - _colorSpace(colorSpace), _colorRange(colorRange) { + _colorSpace(colorSpace), + _colorRange(colorRange) { } /** diff --git a/tgfx/src/gpu/opengl/GLYUVTexture.cpp b/tgfx/src/gpu/opengl/GLYUVTexture.cpp index 21da2cecc4..27bac4dd75 100644 --- a/tgfx/src/gpu/opengl/GLYUVTexture.cpp +++ b/tgfx/src/gpu/opengl/GLYUVTexture.cpp @@ -26,10 +26,13 @@ namespace pag { #define NV12_PIXEL_BYTES 1.5 struct YUVConfig { - YUVConfig(YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height, int planeCount) - : colorSpace(colorSpace), colorRange(colorRange), - width(width), height(height), planeCount(planeCount) { + YUVConfig(YUVColorSpace colorSpace, YUVColorRange colorRange, int width, int height, + int planeCount) + : colorSpace(colorSpace), + colorRange(colorRange), + width(width), + height(height), + planeCount(planeCount) { } YUVColorSpace colorSpace; YUVColorRange colorRange; @@ -127,10 +130,9 @@ static void SubmitYUVTexture(const GLInterface* gl, const YUVConfig& yuvConfig, } } -std::shared_ptr YUVTexture::MakeI420(Context* context, - YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height, uint8_t* pixelsPlane[3], - const int lineSize[3]) { +std::shared_ptr YUVTexture::MakeI420(Context* context, YUVColorSpace colorSpace, + YUVColorRange colorRange, int width, int height, + uint8_t* pixelsPlane[3], const int lineSize[3]) { auto gl = GLContext::Unwrap(context); GLStateGuard stateGuard(context); @@ -152,9 +154,9 @@ std::shared_ptr YUVTexture::MakeI420(Context* context, if (texturePlanes.empty()) { return nullptr; } - texture = std::static_pointer_cast(Resource::Wrap( - context, new GLI420Texture(yuvConfig.colorSpace, yuvConfig.colorRange, - yuvConfig.width, yuvConfig.height))); + texture = std::static_pointer_cast( + Resource::Wrap(context, new GLI420Texture(yuvConfig.colorSpace, yuvConfig.colorRange, + yuvConfig.width, yuvConfig.height))); texture->samplers.emplace_back(pixelConfig, texturePlanes[0]); texture->samplers.emplace_back(pixelConfig, texturePlanes[1]); texture->samplers.emplace_back(pixelConfig, texturePlanes[2]); @@ -163,10 +165,9 @@ std::shared_ptr YUVTexture::MakeI420(Context* context, return texture; } -std::shared_ptr YUVTexture::MakeNV12(Context* context, - YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height, uint8_t* pixelsPlane[2], - const int lineSize[2]) { +std::shared_ptr YUVTexture::MakeNV12(Context* context, YUVColorSpace colorSpace, + YUVColorRange colorRange, int width, int height, + uint8_t* pixelsPlane[2], const int lineSize[2]) { auto gl = GLContext::Unwrap(context); GLStateGuard stateGuard(context); @@ -188,9 +189,9 @@ std::shared_ptr YUVTexture::MakeNV12(Context* context, if (texturePlanes.empty()) { return nullptr; } - texture = std::static_pointer_cast(Resource::Wrap( - context, new GLNV12Texture(yuvConfig.colorSpace, yuvConfig.colorRange, - yuvConfig.width, yuvConfig.height))); + texture = std::static_pointer_cast( + Resource::Wrap(context, new GLNV12Texture(yuvConfig.colorSpace, yuvConfig.colorRange, + yuvConfig.width, yuvConfig.height))); texture->samplers.emplace_back(pixelConfig[0], texturePlanes[0]); texture->samplers.emplace_back(pixelConfig[1], texturePlanes[1]); } @@ -198,8 +199,8 @@ std::shared_ptr YUVTexture::MakeNV12(Context* context, return texture; } -GLYUVTexture::GLYUVTexture(YUVColorSpace colorSpace, YUVColorRange colorRange, - int width, int height) +GLYUVTexture::GLYUVTexture(YUVColorSpace colorSpace, YUVColorRange colorRange, int width, + int height) : YUVTexture(colorSpace, colorRange, width, height) { } diff --git a/tgfx/src/gpu/opengl/GLYUVTextureFragmentProcessor.cpp b/tgfx/src/gpu/opengl/GLYUVTextureFragmentProcessor.cpp index 88425c58a1..cf344b6f8e 100644 --- a/tgfx/src/gpu/opengl/GLYUVTextureFragmentProcessor.cpp +++ b/tgfx/src/gpu/opengl/GLYUVTextureFragmentProcessor.cpp @@ -132,8 +132,7 @@ void GLYUVTextureFragmentProcessor::onSetData(const ProgramDataManager& programD } case YUVColorSpace::Rec2020: { if (yuvFP.texture->colorRange() == YUVColorRange::JPEG) { - programDataManager.setMatrix3f(mat3ColorConversionUniform, - kColorConversion2020FullRange); + programDataManager.setMatrix3f(mat3ColorConversionUniform, kColorConversion2020FullRange); } else { programDataManager.setMatrix3f(mat3ColorConversionUniform, kColorConversion2020LimitRange); diff --git a/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.h b/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.h index 6115cd7431..342daa4987 100644 --- a/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.h +++ b/tgfx/src/gpu/opengl/eagl/EAGLProcGetter.h @@ -33,4 +33,3 @@ class EAGLProcGetter : public GLProcGetter { void* fLibrary; }; } // namespace pag - diff --git a/tgfx/src/image/webp/WebpUtility.cpp b/tgfx/src/image/webp/WebpUtility.cpp index 2aa9231d67..84c5097256 100644 --- a/tgfx/src/image/webp/WebpUtility.cpp +++ b/tgfx/src/image/webp/WebpUtility.cpp @@ -19,8 +19,8 @@ #include "image/webp/WebpUtility.h" #include #include -#include "image/utils/OrientationHelper.h" #include "base/utils/Log.h" +#include "image/utils/OrientationHelper.h" #include "webp/decode.h" #include "webp/demux.h" #include "webp/encode.h" diff --git a/tgfx/src/raster/coregraphics/BitmapContextUtil.h b/tgfx/src/raster/coregraphics/BitmapContextUtil.h index 1d90402b79..b904b1928e 100644 --- a/tgfx/src/raster/coregraphics/BitmapContextUtil.h +++ b/tgfx/src/raster/coregraphics/BitmapContextUtil.h @@ -19,8 +19,8 @@ #pragma once #include -#include "pag/types.h" #include "image/ImageInfo.h" +#include "pag/types.h" namespace pag { CGContextRef CreateBitmapContext(const ImageInfo& info, void* pixels); diff --git a/tgfx/src/raster/freetype/FTFontData.h b/tgfx/src/raster/freetype/FTFontData.h index 6a80764cb4..17b07ab6fa 100644 --- a/tgfx/src/raster/freetype/FTFontData.h +++ b/tgfx/src/raster/freetype/FTFontData.h @@ -23,10 +23,12 @@ namespace pag { struct FTFontData { - FTFontData(std::string path, int ttcIndex) : path(std::move(path)), ttcIndex(ttcIndex) {} + FTFontData(std::string path, int ttcIndex) : path(std::move(path)), ttcIndex(ttcIndex) { + } FTFontData(const void* data, size_t length, int ttcIndex) - : data(ByteData::MakeCopy(data, length)), ttcIndex(ttcIndex) {} + : data(ByteData::MakeCopy(data, length)), ttcIndex(ttcIndex) { + } std::string path; std::unique_ptr data; diff --git a/tgfx/src/raster/freetype/FTUtil.h b/tgfx/src/raster/freetype/FTUtil.h index ac8e0146ef..d3b7b1dfd4 100644 --- a/tgfx/src/raster/freetype/FTUtil.h +++ b/tgfx/src/raster/freetype/FTUtil.h @@ -40,8 +40,8 @@ inline FT_F26Dot6 FDot6Ceil(FT_F26Dot6 x) { return ((x) + 63) >> 6; } -inline FT_F26Dot6 FDot6Round(FT_F26Dot6 x) { - return (((x) + 32) >> 6); +inline FT_F26Dot6 FDot6Round(FT_F26Dot6 x) { + return (((x) + 32) >> 6); } class FTLibrary { diff --git a/tgfx/src/raster/web/WebMask.cpp b/tgfx/src/raster/web/WebMask.cpp index 7f95c66f41..b7e336541c 100644 --- a/tgfx/src/raster/web/WebMask.cpp +++ b/tgfx/src/raster/web/WebMask.cpp @@ -18,9 +18,9 @@ #include "WebMask.h" +#include "WebTextBlob.h" #include "WebTypeface.h" #include "gpu/opengl/GLTexture.h" -#include "WebTextBlob.h" using namespace emscripten;