use native mac fonthost

add 444 and (fake) 565 support in cg



git-svn-id: http://skia.googlecode.com/svn/trunk@41 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2008-12-19 19:46:15 +00:00
parent aaeab429f9
commit 0680d6c7ca
5 changed files with 669 additions and 655 deletions

View File

@ -263,7 +263,7 @@ protected:
virtual void generatePath(const SkGlyph& glyph, SkPath* path);
virtual void generateLineHeight(SkPoint* ascent, SkPoint* descent);
virtual void generateFontMetrics(SkPaint::FontMetrics* mX, SkPaint::FontMetrics* mY);
virtual SkDeviceContext getDC() { return NULL; } // not implemented on Mac
// virtual SkDeviceContext getDC() { return NULL; } // not implemented on Mac
private:
ATSUTextLayout fLayout;
@ -292,7 +292,7 @@ SkScalerContext_Mac::SkScalerContext_Mac(const SkDescriptor* desc)
err = ::ATSUCreateStyle(&fStyle);
}
uint32_t size = SkFixedFloor(fRec.fTextSize);
uint32_t size = SkScalarFloor(fRec.fTextSize);
Fixed fixedSize = IntToFixed(size);
static const ATSUAttributeTag sizeTag = kATSUSizeTag;
static const ByteCount sizeTagSize = sizeof(Fixed);

View File

@ -38,6 +38,15 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
*info = kCGBitmapByteOrder32Big |
kCGImageAlphaPremultipliedLast;
break;
case SkBitmap::kRGB_565_Config:
// doesn't see quite right. Are they thinking 1555?
*bitsPerComponent = 5;
*info = kCGBitmapByteOrder16Little;
break;
case SkBitmap::kARGB_4444_Config:
*bitsPerComponent = 4;
*info = kCGBitmapByteOrder16Little | kCGImageAlphaPremultipliedLast;
break;
default:
return NULL;
}

View File

@ -5,11 +5,13 @@
<key>IBFramework Version</key>
<string>629</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../../CICarbonSample.xcodeproj</string>
<string>../../SampleApp.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array/>
<array>
<integer>166</integer>
</array>
<key>IBSystem Version</key>
<string>9F33</string>
<key>targetFramework</key>

View File

@ -3,26 +3,55 @@
<object name="rootObject" class="NSCustomObject" id="1">
</object>
<array count="18" name="allObjects">
<object class="IBCarbonWindow" id="166">
<boolean name="receiveUpdates">FALSE</boolean>
<boolean name="hasCloseBox">FALSE</boolean>
<boolean name="liveResize">TRUE</boolean>
<boolean name="compositing">TRUE</boolean>
<boolean name="asyncDrag">TRUE</boolean>
<boolean name="isConstrained">FALSE</boolean>
<boolean name="hideOnFullScreen">TRUE</boolean>
<boolean name="hideOnSuspend">TRUE</boolean>
<boolean name="doesNotCycle">TRUE</boolean>
<int name="windowPosition">1</int>
<int name="scalingMode">1048576</int>
<string name="title">Window</string>
<object name="rootControl" class="IBCarbonRootControl" id="167">
<string name="viewFrame">0 0 480 360 </string>
<string name="bounds">0 0 360 480 </string>
</object>
<string name="windowRect">504 338 864 818 </string>
<string name="ScreenRectAtEncodeTime">0 0 768 1024 </string>
<object class="IBCarbonMenuItem" id="193">
<string name="title">Arrange in Front</string>
<boolean name="dynamic">TRUE</boolean>
<int name="keyEquivalentModifier">1572864</int>
<ostype name="command">frnt</ostype>
</object>
<object class="IBCarbonMenuItem" id="190">
<string name="title">Minimize</string>
<string name="keyEquivalent">m</string>
<boolean name="dynamic">TRUE</boolean>
<ostype name="command">mini</ostype>
</object>
<object class="IBCarbonMenuItem" id="194">
<boolean name="separator">TRUE</boolean>
</object>
<object class="IBCarbonMenu" id="131">
<string name="title">File</string>
<array count="2" name="items">
<object class="IBCarbonMenuItem" id="135">
<string name="title">Page Setup…</string>
<string name="keyEquivalent">P</string>
<ostype name="command">page</ostype>
</object>
<object class="IBCarbonMenuItem" id="136">
<string name="title">Print…</string>
<string name="keyEquivalent">p</string>
<ostype name="command">prnt</ostype>
</object>
</array>
</object>
<object class="IBCarbonMenuItem" id="197">
<string name="title">Zoom</string>
<ostype name="command">zoom</ostype>
</object>
<object class="IBCarbonRootControl" id="167">
<string name="viewFrame">0 0 480 360 </string>
<string name="bounds">0 0 360 480 </string>
</object>
<reference idRef="136"/>
<object class="IBCarbonMenuItem" id="127">
<string name="title">File</string>
<reference name="submenu" idRef="131"/>
</object>
<object class="IBCarbonMenuItem" id="196">
<string name="title">Bring All to Front</string>
<boolean name="dynamic">TRUE</boolean>
<ostype name="command">bfrt</ostype>
</object>
<reference idRef="135"/>
<object class="IBCarbonMenu" id="29">
<string name="title">main</string>
<string name="name">_NSMainMenu</string>
@ -41,36 +70,14 @@
</array>
</object>
</object>
<object class="IBCarbonMenuItem" id="127">
<string name="title">File</string>
<object name="submenu" class="IBCarbonMenu" id="131">
<string name="title">File</string>
<array count="2" name="items">
<object class="IBCarbonMenuItem" id="135">
<string name="title">Page Setup…</string>
<string name="keyEquivalent">P</string>
<ostype name="command">page</ostype>
</object>
<object class="IBCarbonMenuItem" id="136">
<string name="title">Print…</string>
<string name="keyEquivalent">p</string>
<ostype name="command">prnt</ostype>
</object>
</array>
</object>
</object>
<reference idRef="127"/>
<object class="IBCarbonMenuItem" id="192">
<string name="title">Window</string>
<object name="submenu" class="IBCarbonMenu" id="195">
<string name="title">Window</string>
<string name="name">_NSWindowsMenu</string>
<array count="6" name="items">
<object class="IBCarbonMenuItem" id="190">
<string name="title">Minimize</string>
<string name="keyEquivalent">m</string>
<boolean name="dynamic">TRUE</boolean>
<ostype name="command">mini</ostype>
</object>
<reference idRef="190"/>
<object class="IBCarbonMenuItem" id="191">
<string name="title">Minimize All</string>
<string name="keyEquivalent">m</string>
@ -78,65 +85,57 @@
<int name="keyEquivalentModifier">1572864</int>
<ostype name="command">mina</ostype>
</object>
<object class="IBCarbonMenuItem" id="197">
<string name="title">Zoom</string>
<ostype name="command">zoom</ostype>
</object>
<object class="IBCarbonMenuItem" id="194">
<boolean name="separator">TRUE</boolean>
</object>
<object class="IBCarbonMenuItem" id="196">
<string name="title">Bring All to Front</string>
<boolean name="dynamic">TRUE</boolean>
<ostype name="command">bfrt</ostype>
</object>
<object class="IBCarbonMenuItem" id="193">
<string name="title">Arrange in Front</string>
<boolean name="dynamic">TRUE</boolean>
<int name="keyEquivalentModifier">1572864</int>
<ostype name="command">frnt</ostype>
</object>
<reference idRef="197"/>
<reference idRef="194"/>
<reference idRef="196"/>
<reference idRef="193"/>
</array>
</object>
</object>
</array>
</object>
<reference idRef="193"/>
<reference idRef="191"/>
<reference idRef="135"/>
<reference idRef="196"/>
<reference idRef="192"/>
<reference idRef="127"/>
<reference idRef="195"/>
<reference idRef="194"/>
<reference idRef="187"/>
<reference idRef="131"/>
<object class="IBCarbonWindow" id="166">
<boolean name="receiveUpdates">FALSE</boolean>
<boolean name="hasCloseBox">FALSE</boolean>
<boolean name="liveResize">TRUE</boolean>
<boolean name="compositing">TRUE</boolean>
<boolean name="asyncDrag">TRUE</boolean>
<boolean name="isConstrained">FALSE</boolean>
<boolean name="hideOnFullScreen">TRUE</boolean>
<boolean name="doesNotCycle">TRUE</boolean>
<int name="windowPosition">1</int>
<int name="scalingMode">1048576</int>
<string name="title">Window</string>
<reference name="rootControl" idRef="167"/>
<string name="windowRect">504 338 864 818 </string>
<string name="ScreenRectAtEncodeTime">0 0 768 1024 </string>
</object>
<reference idRef="184"/>
<reference idRef="136"/>
<reference idRef="167"/>
<reference idRef="191"/>
<reference idRef="187"/>
<reference idRef="195"/>
<reference idRef="192"/>
<reference idRef="185"/>
<reference idRef="190"/>
<reference idRef="197"/>
</array>
<array count="18" name="allParents">
<reference idRef="1"/>
<reference idRef="1"/>
<reference idRef="195"/>
<reference idRef="195"/>
<reference idRef="195"/>
<reference idRef="127"/>
<reference idRef="195"/>
<reference idRef="166"/>
<reference idRef="131"/>
<reference idRef="29"/>
<reference idRef="195"/>
<reference idRef="131"/>
<reference idRef="195"/>
<reference idRef="29"/>
<reference idRef="29"/>
<reference idRef="192"/>
<reference idRef="1"/>
<reference idRef="1"/>
<reference idRef="185"/>
<reference idRef="195"/>
<reference idRef="184"/>
<reference idRef="127"/>
<reference idRef="185"/>
<reference idRef="131"/>
<reference idRef="166"/>
<reference idRef="192"/>
<reference idRef="29"/>
<reference idRef="29"/>
<reference idRef="195"/>
<reference idRef="195"/>
</array>
<dictionary count="3" name="nameTable">
<string>File&apos;s Owner</string>

View File

@ -29,7 +29,8 @@
00003CA40EFC235F000FF73A /* SkXMLParser_empty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00003CA30EFC235F000FF73A /* SkXMLParser_empty.cpp */; };
0028847B0EFAB46A0083E387 /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 002884510EFAA35C0083E387 /* libcore.a */; };
002884BD0EFAB6A30083E387 /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 002884BC0EFAB69F0083E387 /* libmaccore.a */; };
002884D90EFABFE60083E387 /* SkFontHost_none.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002884D80EFABFE60083E387 /* SkFontHost_none.cpp */; };
00A41E3E0EFC30EC00C9CBEB /* SkFontHost_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A41E3D0EFC30EC00C9CBEB /* SkFontHost_mac.cpp */; };
00A41E4B0EFC312F00C9CBEB /* SampleArc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A41E4A0EFC312F00C9CBEB /* SampleArc.cpp */; };
0156F80407C56A3000C6122B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0156F80307C56A3000C6122B /* Foundation.framework */; };
01FC44D507BD3BB800D228F4 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01FC44D407BD3BB800D228F4 /* Quartz.framework */; };
8D0C4E8D0486CD37000505A6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
@ -105,7 +106,8 @@
00003CA30EFC235F000FF73A /* SkXMLParser_empty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkXMLParser_empty.cpp; path = ../../src/ports/SkXMLParser_empty.cpp; sourceTree = SOURCE_ROOT; };
002884490EFAA35C0083E387 /* core.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = core.xcodeproj; path = ../core/core.xcodeproj; sourceTree = SOURCE_ROOT; };
002884B40EFAB69F0083E387 /* maccore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = maccore.xcodeproj; path = ../maccore/maccore.xcodeproj; sourceTree = SOURCE_ROOT; };
002884D80EFABFE60083E387 /* SkFontHost_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_none.cpp; path = ../../src/ports/SkFontHost_none.cpp; sourceTree = SOURCE_ROOT; };
00A41E3D0EFC30EC00C9CBEB /* SkFontHost_mac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_mac.cpp; path = ../../src/ports/SkFontHost_mac.cpp; sourceTree = SOURCE_ROOT; };
00A41E4A0EFC312F00C9CBEB /* SampleArc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleArc.cpp; path = ../../samplecode/SampleArc.cpp; sourceTree = SOURCE_ROOT; };
0156F80307C56A3000C6122B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
01FC44D407BD3BB800D228F4 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@ -138,6 +140,7 @@
00003C610EFC2287000FF73A /* samples */ = {
isa = PBXGroup;
children = (
00A41E4A0EFC312F00C9CBEB /* SampleArc.cpp */,
00003C620EFC22A8000FF73A /* SampleApp.cpp */,
00003C640EFC22A8000FF73A /* SamplePath.cpp */,
00003C650EFC22A8000FF73A /* SamplePathEffects.cpp */,
@ -204,7 +207,7 @@
children = (
00003C6A0EFC22AD000FF73A /* views */,
00003C610EFC2287000FF73A /* samples */,
002884D80EFABFE60083E387 /* SkFontHost_none.cpp */,
00A41E3D0EFC30EC00C9CBEB /* SkFontHost_mac.cpp */,
00003CA30EFC235F000FF73A /* SkXMLParser_empty.cpp */,
20286C2AFDCF999611CA2CEA /* Sources */,
20286C2CFDCF999611CA2CEA /* Resources */,
@ -343,7 +346,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
002884D90EFABFE60083E387 /* SkFontHost_none.cpp in Sources */,
00003C660EFC22A8000FF73A /* SampleApp.cpp in Sources */,
00003C680EFC22A8000FF73A /* SamplePath.cpp in Sources */,
00003C690EFC22A8000FF73A /* SamplePathEffects.cpp in Sources */,
@ -363,6 +365,8 @@
00003CA00EFC233F000FF73A /* SkParseColor.cpp in Sources */,
00003CA10EFC233F000FF73A /* SkXMLParser.cpp in Sources */,
00003CA40EFC235F000FF73A /* SkXMLParser_empty.cpp in Sources */,
00A41E3E0EFC30EC00C9CBEB /* SkFontHost_mac.cpp in Sources */,
00A41E4B0EFC312F00C9CBEB /* SampleArc.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};