Skip to content

Commit

Permalink
Merge pull request #24 from wordpress-mobile/fix/drawing-memory-usage
Browse files Browse the repository at this point in the history
Drawing: Limit scale of rendered annotationview image
  • Loading branch information
frosty authored Sep 3, 2020
2 parents 4e066b1 + 8abe0ed commit 8942cb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MediaEditor.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MediaEditor'
s.version = '1.2.0'
s.version = '1.2.1'
s.summary = 'An extensible Media Editor for iOS.'

s.description = <<-DESC
Expand Down
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.2.1
-----
* Improve memory usage of AnnotationView when rendering drawings

1.2.0
-----
* Replace TOCropViewController with CropViewController
Expand Down
5 changes: 4 additions & 1 deletion Sources/Capabilities/Drawing/MediaEditorAnnotationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ class MediaEditorAnnotationView: UIView {

let canvasViewImage = canvasView.drawing.image(from: canvasView.bounds, scale: UIScreen.main.scale)

let renderer = UIGraphicsImageRenderer(size: targetSize, format: .default())
let format = UIGraphicsImageRendererFormat()
format.scale = 1

let renderer = UIGraphicsImageRenderer(size: targetSize, format: format)
let renderedImage = renderer.image { context in
imageViewImage.draw(at: .zero)
canvasViewImage.draw(in: CGRect(origin: .zero, size: targetSize))
Expand Down

0 comments on commit 8942cb9

Please sign in to comment.