'From Squeakland 3.8-05 of 7 September 2005 [latest update: #530] on 31 January 2006 at 5:53:48 pm'! "Change Set: NebraskaTextAndImageFix Date: 6 October 2005 Author: Yoshiki Ohshima * DropShadow + Text + Nebraska wasn't working right. * Form depth = 32 wasn't working right. It isn't right or optimal but better in many ways."! !CanvasEncoder methodsFor: 'drawing' stamp: 'yo 10/6/2005 17:00'! image: aForm at: aPoint sourceRect: sourceRect rule: argRule | cacheID cacheNew cacheReply formToSend cacheEntry destRect visRect aFormArea d2 rule | rule _ argRule. "first if we are only going to be able to draw a small part of the form, it may be faster just to send the part of the form that will actually show up" destRect _ aPoint extent: sourceRect extent. d2 _ (lastTransform invertBoundsRect: destRect) expandBy: 1. (d2 intersects: lastClipRect) ifFalse: [ ^NebraskaDebug at: #bigImageSkipped add: {lastClipRect. d2}. ]. aFormArea _ aForm boundingBox area. (aFormArea > 20000 and: [aForm isStatic not and: [lastTransform isPureTranslation]]) ifTrue: [ visRect _ destRect intersect: lastClipRect. visRect area < (aFormArea // 20) ifTrue: [ "NebraskaDebug at: #bigImageReduced add: {lastClipRect. aPoint. sourceRect extent. lastTransform}." formToSend _ aForm copy: (visRect translateBy: sourceRect origin - aPoint). formToSend depth = 32 ifTrue: [formToSend _ formToSend asFormOfDepth: 16. rule = 24 ifTrue: [rule _ 25]]. ^self image: formToSend at: visRect origin sourceRect: formToSend boundingBox rule: rule cacheID: 0 "no point in trying to cache this - it's a one-timer" newToCache: false. ]. ]. cacheID _ 0. cacheNew _ false. formToSend _ aForm. (aFormArea > 1000 and: [(cacheReply _ self testCache: aForm) notNil]) ifTrue: [ cacheID _ cacheReply first. cacheEntry _ cacheReply third. (cacheNew _ cacheReply second) ifFalse: [ formToSend _ aForm isStatic ifTrue: [nil] ifFalse: [aForm depth <= 8 ifTrue: [aForm] ifFalse: [aForm deltaFrom: cacheEntry fourth]]. ]. cacheEntry at: 4 put: (aForm isStatic ifTrue: [aForm] ifFalse: [aForm deepCopy]). ]. (formToSend notNil and: [formToSend depth = 32]) ifTrue: [formToSend _ formToSend asFormOfDepth: 16. rule = 24 ifTrue: [rule _ 25]]. self image: formToSend at: aPoint sourceRect: sourceRect rule: rule cacheID: cacheID newToCache: cacheNew. ! ! !RemoteCanvas methodsFor: 'accessing' stamp: 'yo 10/6/2005 14:44'! isShadowDrawing ^ self shadowColor notNil! ! !RemoteCanvas methodsFor: 'drawing-rectangles' stamp: 'yo 10/6/2005 15:53'! fillRectangle: aRectangle fillStyle: aFillStyle "Fill the given rectangle." | pattern | (self isShadowDrawing not and: [self shadowColor notNil]) ifTrue: [^self fillRectangle: aRectangle color: self shadowColor]. (aFillStyle isKindOf: InfiniteForm) ifTrue: [ ^self infiniteFillRectangle: aRectangle fillStyle: aFillStyle ]. (aFillStyle isSolidFill) ifTrue:[^self fillRectangle: aRectangle color: aFillStyle asColor]. "We have a very special case for filling with infinite forms" (aFillStyle isBitmapFill and:[aFillStyle origin = (0@0)]) ifTrue:[ pattern _ aFillStyle form. (aFillStyle direction = (pattern width @ 0) and:[aFillStyle normal = (0@pattern height)]) ifTrue:[ "Can use an InfiniteForm" ^self fillRectangle: aRectangle color: (InfiniteForm with: pattern)]. ]. "Use a BalloonCanvas instead" self balloonFillRectangle: aRectangle fillStyle: aFillStyle.! ! !RemoteCanvas methodsFor: 'drawing-text' stamp: 'yo 10/6/2005 15:57'! drawString: s from: firstIndex to: lastIndex in: boundsRect font: fontOrNil color: c "Draw the given string in the given font and color clipped to the given rectangle. If the font is nil, the default font is used." "(innerClipRect intersects: (transform transformBoundsRect: boundsRect)) ifFalse: [ ^self ]." "clip rectangles seem to be all screwed up...." s isAllSeparators ifTrue: [ ^self ]. "is this correct?? it sure does speed things up!!" self drawCommand: [ :executor | executor drawString: s from: firstIndex to: lastIndex in: boundsRect font: fontOrNil color: (self isShadowDrawing ifTrue: [self shadowColor] ifFalse: [c])]! !