author | Josh Aas <joshmoz@gmail.com> |
Wed, 07 Apr 2010 15:31:31 -0400 | |
changeset 40551 | 65e260adaf92bbbcc99127db041f55bdd6973e01 |
parent 40550 | 9d286aa986c83455dc1c9aa88f76ba34a9e6aee1 |
child 40552 | 5f626bbd860a28b05f55e380ea8b3c9b729926e1 |
push id | 12663 |
push user | josh@mozilla.com |
push date | Wed, 07 Apr 2010 19:31:53 +0000 |
treeherder | mozilla-central@65e260adaf92 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bgirard |
bugs | 557521 |
milestone | 1.9.3a5pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
|
--- a/modules/plugin/test/testplugin/nptest_macosx.mm +++ b/modules/plugin/test/testplugin/nptest_macosx.mm @@ -170,17 +170,17 @@ pluginDraw(InstanceData* instanceData) CGContextDrawPath(cgContext, kCGPathFill); // draw a black frame around the plugin CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight)); CGContextSetGrayStrokeColor(cgContext, 0.0, 1.0); CGContextSetLineWidth(cgContext, 6.0); CGContextStrokePath(cgContext); -#ifdef USE_COCOA_NPAPI // draw the UA string using Core Text + // draw the UA string using Core Text CGContextSetTextMatrix(cgContext, CGAffineTransformIdentity); // Initialize a rectangular path. CGMutablePathRef path = CGPathCreateMutable(); CGRect bounds = CGRectMake(10.0, 10.0, windowWidth - 20.0, windowHeight - 20.0); CGPathAddRect(path, NULL, bounds); // Initialize an attributed string. @@ -198,79 +198,16 @@ pluginDraw(InstanceData* instanceData) CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString); CFRelease(attrString); // Create the frame and draw it into the graphics context CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL); CFRelease(framesetter); CTFrameDraw(frame, cgContext); CFRelease(frame); -#else // draw the UA string using ATSUI - CGContextSetGrayFillColor(cgContext, 0.0, 1.0); - ATSUStyle atsuStyle; - ATSUCreateStyle(&atsuStyle); - CFIndex stringLength = CFStringGetLength(uaCFString); - UniChar* unicharBuffer = (UniChar*)malloc((stringLength + 1) * sizeof(UniChar)); - CFStringGetCharacters(uaCFString, CFRangeMake(0, stringLength), unicharBuffer); - UniCharCount runLengths = kATSUToTextEnd; - ATSUTextLayout atsuLayout; - ATSUCreateTextLayoutWithTextPtr(unicharBuffer, - kATSUFromTextBeginning, - kATSUToTextEnd, - stringLength, - 1, - &runLengths, - &atsuStyle, - &atsuLayout); - ATSUAttributeTag contextTag = kATSUCGContextTag; - ByteCount byteSize = sizeof(CGContextRef); - ATSUAttributeValuePtr contextATSUPtr = &cgContext; - ATSUSetLayoutControls(atsuLayout, 1, &contextTag, &byteSize, &contextATSUPtr); - ATSUTextMeasurement lineAscent, lineDescent; - ATSUGetLineControl(atsuLayout, - kATSUFromTextBeginning, - kATSULineAscentTag, - sizeof(ATSUTextMeasurement), - &lineAscent, - &byteSize); - ATSUGetLineControl(atsuLayout, - kATSUFromTextBeginning, - kATSULineDescentTag, - sizeof(ATSUTextMeasurement), - &lineDescent, - &byteSize); - float lineHeight = FixedToFloat(lineAscent) + FixedToFloat(lineDescent); - ItemCount softBreakCount; - ATSUBatchBreakLines(atsuLayout, - kATSUFromTextBeginning, - stringLength, - FloatToFixed(windowWidth - 10.0), - &softBreakCount); - ATSUGetSoftLineBreaks(atsuLayout, - kATSUFromTextBeginning, - kATSUToTextEnd, - 0, NULL, &softBreakCount); - UniCharArrayOffset* softBreaks = (UniCharArrayOffset*)malloc(softBreakCount * sizeof(UniCharArrayOffset)); - ATSUGetSoftLineBreaks(atsuLayout, - kATSUFromTextBeginning, - kATSUToTextEnd, - softBreakCount, softBreaks, &softBreakCount); - UniCharArrayOffset currentDrawOffset = kATSUFromTextBeginning; - unsigned int i = 0; - while (i < softBreakCount) { - ATSUDrawText(atsuLayout, currentDrawOffset, softBreaks[i], FloatToFixed(5.0), - FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0)))); - currentDrawOffset = softBreaks[i]; - i++; - } - ATSUDrawText(atsuLayout, currentDrawOffset, kATSUToTextEnd, FloatToFixed(5.0), - FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0)))); - free(unicharBuffer); - free(softBreaks); -#endif // restore the cgcontext gstate CGContextRestoreGState(cgContext); break; } case DM_SOLID_COLOR: { // save the cgcontext gstate CGContextSaveGState(cgContext);