Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the drawing #21

Merged
merged 16 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename CanvasBezierCurvePoints to BezierCurvePoints
  • Loading branch information
eisukekusachi committed Oct 1, 2024
commit e4b65c4bb1f44d4fed801112e3e33830b5eaaef8
20 changes: 14 additions & 6 deletions SimpleApplePencilDrawing.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
D4B17E372C0ABCB40056C270 /* SimpleApplePencilDrawingUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B17E362C0ABCB40056C270 /* SimpleApplePencilDrawingUITests.swift */; };
D4B17E392C0ABCB40056C270 /* SimpleApplePencilDrawingUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B17E382C0ABCB40056C270 /* SimpleApplePencilDrawingUITestsLaunchTests.swift */; };
D4C3C7A52CA8DB8A003E417C /* IteratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C3C7A42CA8DB8A003E417C /* IteratorTests.swift */; };
D4C3C7AF2CA93036003E417C /* CanvasGrayscaleTexturePoints.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C3C7AE2CA93036003E417C /* CanvasGrayscaleTexturePoints.swift */; };
D4C3C7AF2CA93036003E417C /* BezierCurvePoints.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C3C7AE2CA93036003E417C /* BezierCurvePoints.swift */; };
D4C3C7B12CA943A8003E417C /* CanvasGrayscaleCurveIteratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C3C7B02CA943A8003E417C /* CanvasGrayscaleCurveIteratorTests.swift */; };
D4C3C7B32CA94437003E417C /* CanvasGrayscaleDotPointDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C3C7B22CA94437003E417C /* CanvasGrayscaleDotPointDummy.swift */; };
D4D0FDD52C82D4B900E91B4B /* ArrayExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4D0FDD42C82D4B900E91B4B /* ArrayExtensions.swift */; };
Expand Down Expand Up @@ -120,7 +120,7 @@
D4B17E362C0ABCB40056C270 /* SimpleApplePencilDrawingUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleApplePencilDrawingUITests.swift; sourceTree = "<group>"; };
D4B17E382C0ABCB40056C270 /* SimpleApplePencilDrawingUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleApplePencilDrawingUITestsLaunchTests.swift; sourceTree = "<group>"; };
D4C3C7A42CA8DB8A003E417C /* IteratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IteratorTests.swift; sourceTree = "<group>"; };
D4C3C7AE2CA93036003E417C /* CanvasGrayscaleTexturePoints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanvasGrayscaleTexturePoints.swift; sourceTree = "<group>"; };
D4C3C7AE2CA93036003E417C /* BezierCurvePoints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BezierCurvePoints.swift; sourceTree = "<group>"; };
D4C3C7B02CA943A8003E417C /* CanvasGrayscaleCurveIteratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanvasGrayscaleCurveIteratorTests.swift; sourceTree = "<group>"; };
D4C3C7B22CA94437003E417C /* CanvasGrayscaleDotPointDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanvasGrayscaleDotPointDummy.swift; sourceTree = "<group>"; };
D4D0FDD42C82D4B900E91B4B /* ArrayExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -223,8 +223,6 @@
D462E1812C0C56E000E0503E /* Utils */ = {
isa = PBXGroup;
children = (
D42930452CA599DD00983863 /* BezierCurveHandlePoints.swift */,
D42930432CA5938A00983863 /* BezierCurve.swift */,
D462E1A32C0C680400E0503E /* Interpolator.swift */,
D462E1A12C0C67DC00E0503E /* Iterator.swift */,
D462E1822C0C580600E0503E /* ViewSize.swift */,
Expand Down Expand Up @@ -280,6 +278,7 @@
children = (
D4B17E152C0ABCB30056C270 /* AppDelegate.swift */,
D4B17E172C0ABCB30056C270 /* SceneDelegate.swift */,
D4F159B22CAC208800BF9FE2 /* Drawing */,
D462E17C2C0C566900E0503E /* Extensions */,
D462E1812C0C56E000E0503E /* Utils */,
D462E16C2C0C554900E0503E /* MetalKit */,
Expand Down Expand Up @@ -326,7 +325,6 @@
D462E18E2C0C620500E0503E /* CanvasTouchPoint.swift */,
D462E1972C0C651B00E0503E /* CanvasGrayscaleDotPoint.swift */,
D462E19F2C0C67C000E0503E /* CanvasGrayscaleTexturePointIterator.swift */,
D4C3C7AE2CA93036003E417C /* CanvasGrayscaleTexturePoints.swift */,
D4D0FDDC2C82D6C500E91B4B /* CanvasPencilScreenTouchPoints.swift */,
);
path = Drawing;
Expand Down Expand Up @@ -375,6 +373,16 @@
path = Models;
sourceTree = "<group>";
};
D4F159B22CAC208800BF9FE2 /* Drawing */ = {
isa = PBXGroup;
children = (
D42930432CA5938A00983863 /* BezierCurve.swift */,
D42930452CA599DD00983863 /* BezierCurveHandlePoints.swift */,
D4C3C7AE2CA93036003E417C /* BezierCurvePoints.swift */,
);
path = Drawing;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -536,7 +544,7 @@
D462E1A02C0C67C000E0503E /* CanvasGrayscaleTexturePointIterator.swift in Sources */,
D4D0FDD92C82D56E00E91B4B /* TimeIntervalExtensions.swift in Sources */,
D478DD9D2C7978CA0031521D /* SetExtensions.swift in Sources */,
D4C3C7AF2CA93036003E417C /* CanvasGrayscaleTexturePoints.swift in Sources */,
D4C3C7AF2CA93036003E417C /* BezierCurvePoints.swift in Sources */,
D462E1722C0C55B000E0503E /* MTLRenderer.swift in Sources */,
D4D0FDDD2C82D6C500E91B4B /* CanvasPencilScreenTouchPoints.swift in Sources */,
D4B17E182C0ABCB30056C270 /* SceneDelegate.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// CanvasGrayscaleTexturePoints.swift
// BezierCurvePoints.swift
// SimpleApplePencilDrawing
//
// Created by Eisuke Kusachi on 2024/09/29.
Expand All @@ -15,7 +15,7 @@ struct CanvasFirstBezierCurvePoints {
}

/// A struct that defines the points needed to create a Bézier curve
struct CanvasBezierCurvePoints {
struct BezierCurvePoints {
let previousPoint: CanvasGrayscaleDotPoint
let startPoint: CanvasGrayscaleDotPoint
let endPoint: CanvasGrayscaleDotPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ extension CanvasGrayscaleCurveIterator {
)
}

func makeBezierCurvePoints() -> [CanvasBezierCurvePoints] {
var array: [CanvasBezierCurvePoints] = []
func makeBezierCurvePoints() -> [BezierCurvePoints] {
var array: [BezierCurvePoints] = []
while let subsequence = next(range: range) {
array.append(
.init(
Expand Down Expand Up @@ -114,7 +114,7 @@ extension CanvasGrayscaleCurveIterator {
return curve
}

private func makeCurvePoints(_ points: CanvasBezierCurvePoints) -> [T] {
private func makeCurvePoints(_ points: BezierCurvePoints) -> [T] {
var curve: [T] = []

let locations = BezierCurve.getCurvePoints(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class CanvasGrayscaleCurveIteratorTests: XCTestCase {
let array: [T]
}
struct Expectation {
let result: [CanvasBezierCurvePoints]
let result: [BezierCurvePoints]
}

let testCases: [(condition: Condition, expectation: Expectation)] = [
Expand Down