lib/gdal/transformers/gcp_transformer.rb in ffi-gdal-1.0.0.beta5 vs lib/gdal/transformers/gcp_transformer.rb in ffi-gdal-1.0.0.beta6
- old
+ new
@@ -1,7 +1,5 @@
-require_relative '../../ffi/gdal/alg'
-
module GDAL
module Transformers
class GCPTransformer
# @return [FFI::Function]
def self.function
@@ -12,14 +10,14 @@
attr_reader :c_pointer
# @param gcp_list [Array<FFI::GDAL::GCP>]
# @param requested_polynomial_order [Fixnum] 1, 2, or 3.
# @param reversed [Boolean]
- def initialize(gcp_list, requested_polynomial_order, reversed = false,
- tolerance: nil, minimum_gcps: nil)
+ def initialize(gcp_list, requested_polynomial_order, reversed = false, tolerance: nil, minimum_gcps: nil)
gcp_list_ptr = FFI::MemoryPointer.new(:pointer, gcp_list.size)
+ # TODO: fasterer: each_with_index is slower than loop
gcp_list.each_with_index do |gcp, i|
gcp_list_ptr[i].put_pointer(0, gcp.to_ptr)
end
@c_pointer = if tolerance || minimum_gcps
@@ -33,11 +31,9 @@
gcp_list.size,
gcp_list_ptr,
requested_polynomial_order,
reversed)
end
-
- ObjectSpace.define_finalizer self, -> { destroy! }
end
def destroy!
return unless @c_pointer