Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f1d727e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix up issues in PdfRenderer found by test."

parents 38bf9feb c859cd06
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -163,7 +163,12 @@ public final class PdfRenderer implements AutoCloseable {

        synchronized (sPdfiumLock) {
            mNativeDocument = nativeCreate(mInput.getFd(), size);
            try {
                mPageCount = nativeGetPageCount(mNativeDocument);
            } catch (Throwable t) {
                nativeClose(mNativeDocument);
                throw t;
            }
        }

        mCloseGuard.open("close");
@@ -368,6 +373,8 @@ public final class PdfRenderer implements AutoCloseable {
         */
        public void render(@NonNull Bitmap destination, @Nullable Rect destClip,
                           @Nullable Matrix transform, @RenderMode int renderMode) {
            throwIfClosed();

            if (destination.getConfig() != Config.ARGB_8888) {
                throw new IllegalArgumentException("Unsupported pixel format");
            }