Skip to content

Commit

Permalink
[refactoring] reuse parameter dotsPerPixel
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Dec 30, 2023
1 parent b575161 commit 3289eed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ITextUserAgent(ITextOutputDevice outputDevice, int dotsPerPixel) {
_outputDevice = outputDevice;
}

public int getDotsPerPixel() {
int getDotsPerPixel() {
return dotsPerPixel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public ITextRenderer(float dotsPerPoint, int dotsPerPixel, FontResolver fontReso
}

public ITextRenderer(ITextOutputDevice outputDevice, ITextUserAgent userAgent) {
this(outputDevice.getDotsPerPoint(), DEFAULT_DOTS_PER_PIXEL, outputDevice, userAgent, new ITextFontResolver());
this(outputDevice.getDotsPerPoint(), userAgent.getDotsPerPixel(), outputDevice, userAgent, new ITextFontResolver());
}

public ITextRenderer(float dotsPerPoint, int dotsPerPixel, ITextOutputDevice outputDevice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public ITextUserAgent(ITextOutputDevice outputDevice, int dotsPerPixel) {
this.dotsPerPixel = dotsPerPixel;
}

int getDotsPerPixel() {
return dotsPerPixel;
}

@Override
public ImageResource getImageResource(String uriStr) {
String unresolvedUri = uriStr;
Expand All @@ -70,8 +74,8 @@ public ImageResource getImageResource(String uriStr) {
InputStream is = resolveAndOpenStream(uriStr);
if (is != null) {
try {
ContentTypeDetectingInputStreamWrapper cis=new ContentTypeDetectingInputStreamWrapper(is);
is=cis;
ContentTypeDetectingInputStreamWrapper cis = new ContentTypeDetectingInputStreamWrapper(is);
is = cis;
if (cis.isPdf()) {
URI uri = new URI(uriStr);
PdfReader reader = _outputDevice.getReader(uri);
Expand Down

0 comments on commit 3289eed

Please sign in to comment.