[Pkg] The Trunk: Graphics-eem.375.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 25 22:37:25 UTC 2017
Eliot Miranda uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-eem.375.mcz
==================== Summary ====================
Name: Graphics-eem.375
Author: eem
Time: 25 May 2017, 3:36:53.966637 pm
UUID: 065e211a-d9da-4f21-9122-3467568da9e6
Ancestors: Graphics-nice.374
Fix a slip in warpBitsSmoothing:sourceMap: and implement a trick in clipRange. Harvested from Terf.
=============== Diff against Graphics-nice.374 ===============
Item was changed:
----- Method: BitBlt>>clipRange (in category 'private') -----
clipRange
"clip and adjust source origin and extent appropriately"
"first in x"
| sx sy dx dy bbW bbH |
"fill in the lazy state if needed"
destX ifNil:[destX := 0].
destY ifNil:[destY := 0].
width ifNil:[width := destForm width].
height ifNil:[height := destForm height].
sourceX ifNil:[sourceX := 0].
sourceY ifNil:[sourceY := 0].
clipX ifNil:[clipX := 0].
clipY ifNil:[clipY := 0].
clipWidth ifNil:[clipWidth := destForm width].
clipHeight ifNil:[clipHeight := destForm height].
destX >= clipX
ifTrue: [sx := sourceX.
dx := destX.
bbW := width]
ifFalse: [sx := sourceX + (clipX - destX).
bbW := width - (clipX - destX).
dx := clipX].
(dx + bbW) > (clipX + clipWidth)
ifTrue: [bbW := bbW - ((dx + bbW) - (clipX + clipWidth))].
"then in y"
destY >= clipY
ifTrue: [sy := sourceY.
dy := destY.
bbH := height]
ifFalse: [sy := sourceY + clipY - destY.
bbH := height - (clipY - destY).
dy := clipY].
(dy + bbH) > (clipY + clipHeight)
ifTrue: [bbH := bbH - ((dy + bbH) - (clipY + clipHeight))].
sourceForm ifNotNil:[
sx < 0
ifTrue: [dx := dx - sx.
bbW := bbW + sx.
sx := 0].
sx + bbW > sourceForm width
ifTrue: [bbW := bbW - (sx + bbW - sourceForm width)].
sy < 0
ifTrue: [dy := dy - sy.
bbH := bbH + sy.
sy := 0].
sy + bbH > sourceForm height
ifTrue: [bbH := bbH - (sy + bbH - sourceForm height)].
].
(bbW <= 0 or:[bbH <= 0]) ifTrue:[
+ sourceX := sourceY := destX := destY := clipX := clipY := width := height := clipWidth := clipHeight := 0.
- sourceX := sourceY := destX := destY := clipX := clipY := width := height := 0.
^true].
(sx = sourceX
and:[sy = sourceY
and:[dx = destX
and:[dy = destY
and:[bbW = width
and:[bbH = height]]]]]) ifTrue:[^false].
sourceX := sx.
sourceY := sy.
destX := dx.
destY := dy.
width := bbW.
height := bbH.
^true!
Item was changed:
----- Method: WarpBlt>>warpBitsSmoothing:sourceMap: (in category 'primitives') -----
warpBitsSmoothing: n sourceMap: sourceMap
| deltaP12 deltaP43 pA pB deltaPAB sp fixedPtOne poker pix nSteps |
<primitive: 'primitiveWarpBits' module: 'BitBltPlugin' error: ec>
"Check for compressed source, destination or halftone forms"
"Check for object movement during a surface callback, compressed source, destination or halftone forms.
Simply retry."
(ec == #'object moved'
or: [(sourceForm isForm and: [sourceForm unhibernate])
or: [(destForm isForm and: [destForm unhibernate])
or: [halftoneForm isForm and: [halftoneForm unhibernate]]]]) ifTrue:
[^self warpBitsSmoothing: n sourceMap: sourceMap].
(width < 1) | (height < 1) ifTrue: [^ self].
fixedPtOne := 16384. "1.0 in fixed-pt representation"
n > 1 ifTrue:
[(destForm depth < 16 and: [colorMap == nil])
ifTrue: ["color map is required to smooth non-RGB dest"
+ ^ self primitiveFailed].
- ^ self primitiveFail].
pix := Array new: n*n].
nSteps := height-1 max: 1.
deltaP12 := (self deltaFrom: p1x to: p2x nSteps: nSteps)
@ (self deltaFrom: p1y to: p2y nSteps: nSteps).
pA := (self startFrom: p1x to: p2x offset: nSteps*deltaP12 x)
@ (self startFrom: p1y to: p2y offset: nSteps*deltaP12 y).
deltaP43 := (self deltaFrom: p4x to: p3x nSteps: nSteps)
@ (self deltaFrom: p4y to: p3y nSteps: nSteps).
pB := (self startFrom: p4x to: p3x offset: nSteps*deltaP43 x)
@ (self startFrom: p4y to: p3y offset: nSteps*deltaP43 y).
poker := BitBlt bitPokerToForm: destForm.
poker clipRect: self clipRect.
nSteps := width-1 max: 1.
destY to: destY+height-1 do:
[:y |
deltaPAB := (self deltaFrom: pA x to: pB x nSteps: nSteps)
@ (self deltaFrom: pA y to: pB y nSteps: nSteps).
sp := (self startFrom: pA x to: pB x offset: nSteps*deltaPAB x)
@ (self startFrom: pA y to: pB y offset: nSteps*deltaPAB x).
destX to: destX+width-1 do:
[:x |
n = 1
ifTrue:
[poker pixelAt: x at y
put: (sourceForm pixelValueAt: sp // fixedPtOne asPoint)]
ifFalse:
[0 to: n-1 do:
[:dx | 0 to: n-1 do:
[:dy |
pix at: dx*n+dy+1 put:
(sourceForm pixelValueAt: sp
+ (deltaPAB*dx//n)
+ (deltaP12*dy//n)
// fixedPtOne asPoint)]].
poker pixelAt: x at y put: (self mixPix: pix
sourceMap: sourceMap
destMap: colorMap)].
sp := sp + deltaPAB].
pA := pA + deltaP12.
pB := pB + deltaP43]!
More information about the Packages
mailing list