[Pkg] The Trunk: Graphics-nice.98.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jan 16 17:41:55 UTC 2010


Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.98.mcz

==================== Summary ====================

Name: Graphics-nice.98
Author: nice
Time: 16 January 2010, 6:41:20.376 pm
UUID: 65d4eaeb-a526-4a7b-a637-0efc81c75242
Ancestors: Graphics-nice.97

1) let #slideFrom:to:nSteps: truncate intermediate points just like #slideFrom:to:nStepsdelay: does
2) let some temp assignments migrate to outer blocks

=============== Diff against Graphics-nice.97 ===============

Item was changed:
  ----- Method: JPEGReadWriter>>idctBlockFloat:component: (in category 'dct') -----
  idctBlockFloat: anArray component: aColorComponent
  
  	| t0 t1 t2 t3 t4 t5 t6 t7 t10 t11 t12 t13 z5 z10 z11 z12 z13 qt ws |
  	qt := self qTable at: (aColorComponent qTableIndex).
  	ws := Array new: DCTSize2.
  
  	"Pass 1: process columns from input, store into work array"
  	1 to: DCTSize do: [:i |
  		t0 := (anArray at: i) * (qt at: i).
  		t1 := (anArray at: (DCTSize*2 + i)) * (qt at: (DCTSize*2 + i)).
  		t2 := (anArray at: (DCTSize*4 + i)) * (qt at: (DCTSize*4 + i)).
  		t3 := (anArray at: (DCTSize*6 + i)) * (qt at: (DCTSize*6 + i)).
  		t10 := t0 + t2.
  		t11 := t0 - t2.
  		t13 := t1 + t3.
  		t12 := (t1 - t3) * DCTK1 - t13.
  		t0 := t10 + t13.
  		t3 := t10 - t13.
  		t1 := t11 + t12.
  		t2 := t11 - t12.
  		t4 := (anArray at: (DCTSize + i)) * (qt at: (DCTSize + i)).
  		t5 := (anArray at: (DCTSize*3 + i)) * (qt at: (DCTSize*3 + i)).
  		t6 := (anArray at: (DCTSize*5 + i)) * (qt at: (DCTSize*5 + i)).
  		t7 := (anArray at: (DCTSize*7 + i)) * (qt at: (DCTSize*7 + i)).
  		z13 := t6 + t5.
  		z10 := t6 - t5.
  		z11 := t4 + t7.
  		z12 := t4 - t7.
  		t7 := z11 + z13.
  		t11 := (z11 - z13) * DCTK1.
  		z5 := (z10 + z12) * DCTK2.
  		t10 := DCTK3 * z12 - z5.
  		t12 := DCTK4 * z10 + z5.
  		t6 := t12 - t7.
  		t5 := t11 - t6.
  		t4 := t10 + t5.
  		ws at: i put: t0 + t7.
  		ws at: (DCTSize*7 + i) put: t0 - t7.
  		ws at: (DCTSize + i) put: t1 + t6.
  		ws at: (DCTSize*6 + i) put: t1 - t6.
  		ws at: (DCTSize*2 + i) put: t2 + t5.
  		ws at: (DCTSize*5 + i) put: t2 - t5.
  		ws at: (DCTSize*4 + i) put: t3 + t4.
  		ws at: (DCTSize*3 + i) put: t3 - t4].
  
  		"Pass 2: process rows from the workspace"
+ 	0 to: DCTSize2-DCTSize by: DCTSize do: [:i |
- 	(0 to: DCTSize2-DCTSize by: DCTSize) do: [:i |
  		t10 := (ws at: (i+1)) + (ws at: (i+5)).
  		t11 := (ws at: (i+1)) - (ws at: (i+5)).
  		t13 := (ws at: (i+3)) + (ws at: (i+7)).
  		t12 := ((ws at: (i+3)) - (ws at: (i+7))) * DCTK1 - t13.
  		t0 := t10 + t13.
  		t3 := t10 - t13.
  		t1 := t11 + t12.
  		t2 := t11 - t12.
  		z13 := (ws at: (i+6)) + (ws at: (i+4)).
  		z10 := (ws at: (i+6)) - (ws at: (i+4)).
  		z11 := (ws at: (i+2)) + (ws at: (i+8)).
  		z12 := (ws at: (i+2)) - (ws at: (i+8)).
  		t7 := z11 + z13.
  		t11 := (z11 - z13) * DCTK1.
  		z5 := (z10 + z12) * DCTK2.
  		t10 := DCTK3 * z12 - z5.
  		t12 := DCTK4 * z10 + z5.
  		t6 := t12 - t7.
  		t5 := t11 - t6.
  		t4 := t10 + t5.
  
  		"final output stage: scale down by a factor of 8 and range-limit"
  		anArray at: (i+1) put: (self dctFloatRangeLimit: (t0 + t7)).
  		anArray at: (i+8) put: (self dctFloatRangeLimit: (t0 - t7)).
  		anArray at: (i+2) put: (self dctFloatRangeLimit: (t1 + t6)).
  		anArray at: (i+7) put: (self dctFloatRangeLimit: (t1 - t6)).
  		anArray at: (i+3) put: (self dctFloatRangeLimit: (t2 + t5)).
  		anArray at: (i+6) put: (self dctFloatRangeLimit: (t2 - t5)).
  		anArray at: (i+5) put: (self dctFloatRangeLimit: (t3 + t4)).
  		anArray at: (i+4) put: (self dctFloatRangeLimit: (t3 - t4))]
  
  
  !

Item was changed:
  ----- Method: Form class>>exampleBorder (in category 'examples') -----
  exampleBorder    "Form exampleBorder"
  	"This example demonstrates the border finding algorithm. Start
  	by having the user sketch on the screen (end with option-click) and then select a rectangular
  	area of the screen which includes all of the area to be filled. Finally,
  	(with crosshair cursor), the user points at the interior of the region to be
  	outlined, and the region begins with that place as its seed."
  	| f r interiorPoint |
  	Form exampleSketch.		"sketch a little area with an enclosed region"
  	r := Rectangle fromUser.
  	f := Form fromDisplay: r.
+ 	interiorPoint := Cursor crossHair showWhile:
+ 		[Sensor waitButton - r origin].
- 	Cursor crossHair showWhile:
- 		[interiorPoint := Sensor waitButton - r origin].
  	Cursor execute showWhile:
  		[f shapeBorder: Color blue width: 2 interiorPoint: interiorPoint
  			sharpCorners: false internal: false].
  	f displayOn: Display at: r origin	!

Item was changed:
  ----- Method: DisplayObject>>slideFrom:to:nSteps: (in category 'displaying-Display') -----
  slideFrom: startPoint to: stopPoint nSteps: nSteps 
  	"does not display at the first point, but does at the last"
  	| i p delta |
+ 	i := 0.
+ 	p := startPoint.
+ 	delta := stopPoint - startPoint // nSteps.
+ 	^ self
+ 		follow: [(p := p + delta) truncated]
+ 		while: [(i := i + 1) < nSteps]!
- 	i:=0.  p:= startPoint.
- 	delta := (stopPoint-startPoint) // nSteps.
- 	^ self follow: [p:= p+delta]
- 		while: [(i:=i+1) < nSteps]!

Item was changed:
  ----- Method: TextStyle>>veryDeepCopyWith: (in category 'Disk I/O') -----
  veryDeepCopyWith: deepCopier
  	"All inst vars are meant to be shared"
  
  	self == #veryDeepCopyWith:.	"to satisfy checkVariables"
+ 	^ deepCopier references at: self ifAbsentPut: [self clone].	"remember"!
- 	^ deepCopier references at: self ifAbsent: [
- 		deepCopier references at: self put: self clone].	"remember"!

Item was changed:
+ ----- Method: SegmentScanner>>setFont (in category 'private') -----
- ----- Method: SegmentScanner>>setFont (in category 'as yet unclassified') -----
  setFont
  	super setFont.
  	"Make a local copy of stop conditions so we don't modify the default"
  	stopConditions == DefaultStopConditions 
  		ifTrue:[stopConditions := stopConditions copy].
  	stopConditions at: Space asciiValue + 1 put: nil.!

Item was changed:
  ----- Method: Form>>displayResourceFormOn: (in category 'displaying') -----
  displayResourceFormOn: aForm
  	"a special display method for blowing up resource thumbnails"
  	| engine tx cmap blitter |
  	self extent = aForm extent ifTrue:[^self displayOn: aForm].
+ 	engine := Smalltalk at: #B3DRenderEngine ifPresentAndInMemory:
+ 		[:engineClass | engineClass defaultForPlatformOn: aForm].
- 	Smalltalk at: #B3DRenderEngine ifPresentAndInMemory:
- 		[:engineClass | engine := engineClass defaultForPlatformOn: aForm].
  	engine ifNil:[
  		"We've got no bilinear interpolation. Use WarpBlt instead"
  		(WarpBlt current toForm: aForm)
  			sourceForm: self destRect: aForm boundingBox;
  			combinationRule: 3;
  			cellSize: 2;
  			warpBits.
  		^self
  	].
  	tx := self asTexture.
  	(blitter := BitBlt current toForm: tx)
  		sourceForm: self; destRect: aForm boundingBox;
  		sourceOrigin: 0 at 0;
  		combinationRule: Form paint.
  	"map transparency to current World background color"
  	(World color respondsTo: #pixelWordForDepth:) ifTrue: [
  		cmap := Bitmap new: (self depth <= 8 ifTrue: [1 << self depth] ifFalse: [4096]).
  		cmap at: 1 put: (tx pixelWordFor: World color).
  		blitter colorMap: cmap.
  	].
  	blitter copyBits.
  	engine viewport: aForm boundingBox.
  	engine material: ((Smalltalk at: #B3DMaterial) new emission: Color white).
  	engine texture: tx.
  	engine render: ((Smalltalk at: #B3DIndexedQuadMesh) new plainTextureRect).
  	engine finish.
  	"the above, using bilinear interpolation doesn't leave transparent pixel values intact"
  	(WarpBlt current toForm: aForm)
  		sourceForm: self destRect: aForm boundingBox;
  		combinationRule: Form and;
  		colorMap: (Color maskingMap: self depth);
  		warpBits.!

Item was changed:
  ----- Method: Form class>>exampleSpaceFill (in category 'examples') -----
  exampleSpaceFill    "Form exampleSpaceFill"
  	"This example demonstrates the area filling algorithm. Starts by having
  	the user sketch on the screen (ended by option-click) and then select a rectangular
  	area of the screen which includes all of the area to be filled. Finally,
  	(with crosshair cursor), the user points at the interior of some region to be
  	filled, and the filling begins with that place as its seed."
  	| f r interiorPoint |
  	Form exampleSketch.		"sketch a little area with an enclosed region"
  	r := Rectangle fromUser.
  	f := Form fromDisplay: r.
+ 	interiorPoint := Cursor crossHair showWhile:
+ 		[Sensor waitButton - r origin].
- 	Cursor crossHair showWhile:
- 		[interiorPoint := Sensor waitButton - r origin].
  	Cursor execute showWhile:
  		[f shapeFill: Color gray interiorPoint: interiorPoint].
  	f displayOn: Display at: r origin	!



More information about the Packages mailing list