Changeset View
Changeset View
Standalone View
Standalone View
plugins/paintops/libpaintop/kis_brush_based_paintop.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | |||||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | bool KisBrushBasedPaintOp::checkSizeTooSmall(qreal scale) | 113 | bool KisBrushBasedPaintOp::checkSizeTooSmall(qreal scale) | ||
114 | { | 114 | { | ||
115 | scale *= m_brush->scale(); | 115 | scale *= m_brush->scale(); | ||
116 | return KisPaintOpUtils::checkSizeTooSmall(scale, m_brush->width(), m_brush->height()); | 116 | return KisPaintOpUtils::checkSizeTooSmall(scale, m_brush->width(), m_brush->height()); | ||
117 | } | 117 | } | ||
118 | 118 | | |||
119 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal scale, qreal rotation) const | 119 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal scale) const | ||
120 | { | 120 | { | ||
121 | // we parse dab rotation separately, so don't count it | 121 | // we parse dab rotation separately, so don't count it | ||
122 | QSizeF metric = m_brush->characteristicSize(KisDabShape(scale, 1.0, 0)); | 122 | QSizeF metric = m_brush->characteristicSize(KisDabShape(scale, 1.0, 0)); | ||
123 | return effectiveSpacing(metric.width(), metric.height(), 1.0, false, rotation); | 123 | return effectiveSpacing(metric.width(), metric.height(), 1.0, false, 0.0, false); | ||
124 | } | ||||
125 | | ||||
126 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal scale, qreal rotation, const KisPaintInformation &pi) const | ||||
127 | { | ||||
128 | MirrorProperties prop = m_mirrorOption.apply(pi); | ||||
129 | const bool implicitFlipped = prop.horizontalMirror != prop.verticalMirror; | ||||
130 | | ||||
131 | // we parse dab rotation separately, so don't count it | ||||
132 | QSizeF metric = m_brush->characteristicSize(KisDabShape(scale, 1.0, 0)); | ||||
133 | return effectiveSpacing(metric.width(), metric.height(), 1.0, false, rotation, implicitFlipped); | ||||
124 | } | 134 | } | ||
125 | 135 | | |||
126 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal scale, qreal rotation, const KisPressureSpacingOption &spacingOption, const KisPaintInformation &pi) const { | 136 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal scale, qreal rotation, const KisPressureSpacingOption &spacingOption, const KisPaintInformation &pi) const { | ||
127 | qreal extraSpacingScale = 1.0; | 137 | qreal extraSpacingScale = 1.0; | ||
128 | if (spacingOption.isChecked()) { | 138 | if (spacingOption.isChecked()) { | ||
129 | extraSpacingScale = spacingOption.apply(pi); | 139 | extraSpacingScale = spacingOption.apply(pi); | ||
130 | } | 140 | } | ||
131 | 141 | | |||
142 | MirrorProperties prop = m_mirrorOption.apply(pi); | ||||
143 | const bool implicitFlipped = prop.horizontalMirror != prop.verticalMirror; | ||||
144 | | ||||
132 | // we parse dab rotation separately, so don't count it | 145 | // we parse dab rotation separately, so don't count it | ||
133 | QSizeF metric = m_brush->characteristicSize(KisDabShape(scale, 1.0, 0)); | 146 | QSizeF metric = m_brush->characteristicSize(KisDabShape(scale, 1.0, 0)); | ||
134 | return effectiveSpacing(metric.width(), metric.height(), extraSpacingScale, spacingOption.isotropicSpacing(), rotation); | 147 | return effectiveSpacing(metric.width(), metric.height(), extraSpacingScale, spacingOption.isotropicSpacing(), rotation, implicitFlipped); | ||
135 | } | 148 | } | ||
136 | 149 | | |||
137 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal dabWidth, qreal dabHeight, qreal extraScale, bool isotropicSpacing, qreal rotation) const | 150 | KisSpacingInformation KisBrushBasedPaintOp::effectiveSpacing(qreal dabWidth, qreal dabHeight, qreal extraScale, bool isotropicSpacing, qreal rotation, bool axesFlipped) const | ||
138 | { | 151 | { | ||
139 | return KisPaintOpUtils::effectiveSpacing(dabWidth, dabHeight, | 152 | return KisPaintOpUtils::effectiveSpacing(dabWidth, dabHeight, | ||
140 | extraScale, | 153 | extraScale, | ||
141 | isotropicSpacing, | 154 | isotropicSpacing, | ||
142 | rotation, | 155 | rotation, | ||
156 | axesFlipped, | ||||
143 | m_brush->spacing(), | 157 | m_brush->spacing(), | ||
144 | m_brush->autoSpacingActive(), | 158 | m_brush->autoSpacingActive(), | ||
145 | m_brush->autoSpacingCoeff(), | 159 | m_brush->autoSpacingCoeff(), | ||
146 | KisLodTransform::lodToScale(painter()->device())); | 160 | KisLodTransform::lodToScale(painter()->device())); | ||
147 | } | 161 | } | ||
148 | 162 | | |||
149 | bool KisBrushBasedPaintOp::canPaint() const | 163 | bool KisBrushBasedPaintOp::canPaint() const | ||
150 | { | 164 | { | ||
151 | return m_brush != 0; | 165 | return m_brush != 0; | ||
152 | } | 166 | } |