Skip to content

Commit

Permalink
Texel distances should be set properly for rotated images in a couple…
Browse files Browse the repository at this point in the history
… of filters now.
  • Loading branch information
BradLarson committed Jul 1, 2012
1 parent 7fd9996 commit 94f54eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
13 changes: 11 additions & 2 deletions framework/Source/GPUImage3x3TextureSamplingFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ - (void)setupFilterForSize:(CGSize)filterFrameSize;

[GPUImageOpenGLESContext useImageProcessingContext];
[filterProgram use];
glUniform1f(texelWidthUniform, _texelWidth);
glUniform1f(texelHeightUniform, _texelHeight);
if (GPUImageRotationSwapsWidthAndHeight(inputRotation))
{
glUniform1f(texelWidthUniform, _texelHeight);
glUniform1f(texelHeightUniform, _texelWidth);
}
else
{
glUniform1f(texelWidthUniform, _texelWidth);
glUniform1f(texelHeightUniform, _texelHeight);
}

}
}

Expand Down
3 changes: 2 additions & 1 deletion framework/Source/GPUImageOutput.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ - (void)setInputTextureForTarget:(id<GPUImageInput>)target atIndex:(NSInteger)in
[target setInputTexture:outputTexture atIndex:inputTextureIndex];
}

- (NSArray*)targets {
- (NSArray*)targets;
{
return [NSArray arrayWithArray:targets];
}

Expand Down
13 changes: 11 additions & 2 deletions framework/Source/GPUImageSharpenFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,17 @@ - (void)setupFilterForSize:(CGSize)filterFrameSize;
{
[GPUImageOpenGLESContext useImageProcessingContext];
[filterProgram use];
glUniform1f(imageWidthFactorUniform, 1.0 / filterFrameSize.width);
glUniform1f(imageHeightFactorUniform, 1.0 / filterFrameSize.height);

if (GPUImageRotationSwapsWidthAndHeight(inputRotation))
{
glUniform1f(imageWidthFactorUniform, 1.0 / filterFrameSize.height);
glUniform1f(imageHeightFactorUniform, 1.0 / filterFrameSize.width);
}
else
{
glUniform1f(imageWidthFactorUniform, 1.0 / filterFrameSize.width);
glUniform1f(imageHeightFactorUniform, 1.0 / filterFrameSize.height);
}
}

#pragma mark -
Expand Down

0 comments on commit 94f54eb

Please sign in to comment.