--- /dev/null
+/* libs/graphics/animator/SkSVGPath.cpp
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include <ctype.h>
+#include "SkDrawPath.h"
+#include "SkParse.h"
+#include "SkPoint.h"
+#include "SkUtils.h"
+#define QUADRATIC_APPROXIMATION 1
+
+#if QUADRATIC_APPROXIMATION
+////////////////////////////////////////////////////////////////////////////////////
+//functions to approximate a cubic using two quadratics
+
+// midPt sets the first argument to be the midpoint of the other two
+// it is used by quadApprox
+static inline void midPt(SkPoint& dest,const SkPoint& a,const SkPoint& b)
+{
+ dest.set(SkScalarAve(a.fX, b.fX),SkScalarAve(a.fY, b.fY));
+}
+// quadApprox - makes an approximation, which we hope is faster
+static void quadApprox(SkPath &fPath, const SkPoint &p0, const SkPoint &p1, const SkPoint &p2)
+{
+ //divide the cubic up into two cubics, then convert them into quadratics
+ //define our points
+ SkPoint c,j,k,l,m,n,o,p,q, mid;
+ fPath.getLastPt(&c);
+ midPt(j, p0, c);
+ midPt(k, p0, p1);
+ midPt(l, p1, p2);
+ midPt(o, j, k);
+ midPt(p, k, l);
+ midPt(q, o, p);
+ //compute the first half
+ m.set(SkScalarHalf(3*j.fX - c.fX), SkScalarHalf(3*j.fY - c.fY));
+ n.set(SkScalarHalf(3*o.fX -q.fX), SkScalarHalf(3*o.fY - q.fY));
+ midPt(mid,m,n);
+ fPath.quadTo(mid,q);
+ c = q;
+ //compute the second half
+ m.set(SkScalarHalf(3*p.fX - c.fX), SkScalarHalf(3*p.fY - c.fY));
+ n.set(SkScalarHalf(3*l.fX -p2.fX),SkScalarHalf(3*l.fY -p2.fY));
+ midPt(mid,m,n);
+ fPath.quadTo(mid,p2);
+}
+#endif
+
+
+static inline bool is_between(int c, int min, int max)
+{
+ return (unsigned)(c - min) <= (unsigned)(max - min);
+}
+
+static inline bool is_ws(int c)
+{
+ return is_between(c, 1, 32);
+}
+
+static inline bool is_digit(int c)
+{
+ return is_between(c, '0', '9');
+}
+
+static inline bool is_sep(int c)
+{
+ return is_ws(c) || c == ',';
+}
+
+static const char* skip_ws(const char str[])
+{
+ SkASSERT(str);
+ while (is_ws(*str))
+ str++;
+ return str;
+}
+
+static const char* skip_sep(const char str[])
+{
+ SkASSERT(str);
+ while (is_sep(*str))
+ str++;
+ return str;
+}
+
+static const char* find_points(const char str[], SkPoint value[], int count,
+ bool isRelative, SkPoint* relative)
+{
+ str = SkParse::FindScalars(str, &value[0].fX, count * 2);
+ if (isRelative) {
+ for (int index = 0; index < count; index++) {
+ value[index].fX += relative->fX;
+ value[index].fY += relative->fY;
+ }
+ }
+ return str;
+}
+
+static const char* find_scalar(const char str[], SkScalar* value,
+ bool isRelative, SkScalar relative)
+{
+ str = SkParse::FindScalar(str, value);
+ if (isRelative)
+ *value += relative;
+ return str;
+}
+
+void SkDrawPath::parseSVG() {
+ fPath.reset();
+ const char* data = d.c_str();
+ SkPoint f = {0, 0};
+ SkPoint c = {0, 0};
+ SkPoint lastc = {0, 0};
+ SkPoint points[3];
+ char op = '\0';
+ char previousOp = '\0';
+ bool relative = false;
+ do {
+ data = skip_ws(data);
+ if (data[0] == '\0')
+ break;
+ char ch = data[0];
+ if (is_digit(ch) || ch == '-' || ch == '+') {
+ if (op == '\0')
+ return;
+ }
+ else {
+ op = ch;
+ relative = false;
+ if (islower(op)) {
+ op = (char) toupper(op);
+ relative = true;
+ }
+ data++;
+ data = skip_sep(data);
+ }
+ switch (op) {
+ case 'M':
+ data = find_points(data, points, 1, relative, &c);
+ fPath.moveTo(points[0]);
+ op = 'L';
+ c = points[0];
+ break;
+ case 'L':
+ data = find_points(data, points, 1, relative, &c);
+ fPath.lineTo(points[0]);
+ c = points[0];
+ break;
+ case 'H': {
+ SkScalar x;
+ data = find_scalar(data, &x, relative, c.fX);
+ fPath.lineTo(x, c.fY);
+ c.fX = x;
+ }
+ break;
+ case 'V': {
+ SkScalar y;
+ data = find_scalar(data, &y, relative, c.fY);
+ fPath.lineTo(c.fX, y);
+ c.fY = y;
+ }
+ break;
+ case 'C':
+ data = find_points(data, points, 3, relative, &c);
+ goto cubicCommon;
+ case 'S':
+ data = find_points(data, &points[1], 2, relative, &c);
+ points[0] = c;
+ if (previousOp == 'C' || previousOp == 'S') {
+ points[0].fX -= lastc.fX - c.fX;
+ points[0].fY -= lastc.fY - c.fY;
+ }
+ cubicCommon:
+ // if (data[0] == '\0')
+ // return;
+#if QUADRATIC_APPROXIMATION
+ quadApprox(fPath, points[0], points[1], points[2]);
+#else //this way just does a boring, slow old cubic
+ fPath.cubicTo(points[0], points[1], points[2]);
+#endif
+ //if we are using the quadApprox, lastc is what it would have been if we had used
+ //cubicTo
+ lastc = points[1];
+ c = points[2];
+ break;
+ case 'Q': // Quadratic Bezier Curve
+ data = find_points(data, points, 2, relative, &c);
+ goto quadraticCommon;
+ case 'T':
+ data = find_points(data, &points[1], 1, relative, &c);
+ points[0] = points[1];
+ if (previousOp == 'Q' || previousOp == 'T') {
+ points[0].fX = c.fX * 2 - lastc.fX;
+ points[0].fY = c.fY * 2 - lastc.fY;
+ }
+ quadraticCommon:
+ fPath.quadTo(points[0], points[1]);
+ lastc = points[0];
+ c = points[1];
+ break;
+ case 'Z':
+ fPath.close();
+#if 0 // !!! still a bug?
+ if (fPath.isEmpty() && (f.fX != 0 || f.fY != 0)) {
+ c.fX -= SkScalar.Epsilon; // !!! enough?
+ fPath.moveTo(c);
+ fPath.lineTo(f);
+ fPath.close();
+ }
+#endif
+ c = f;
+ op = '\0';
+ break;
+ case '~': {
+ SkPoint args[2];
+ data = find_points(data, args, 2, false, NULL);
+ fPath.moveTo(args[0].fX, args[0].fY);
+ fPath.lineTo(args[1].fX, args[1].fY);
+ }
+ break;
+ default:
+ SkASSERT(0);
+ return;
+ }
+ if (previousOp == 0)
+ f = c;
+ previousOp = op;
+ } while (data[0] > 0);
+}
+
+++ /dev/null
-/* libs/graphics/animator/SkSVGPath.cpp
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#include <ctype.h>
-#include "SkDrawPath.h"
-#include "SkParse.h"
-#include "SkPoint.h"
-#include "SkUtils.h"
-#define QUADRATIC_APPROXIMATION 1
-
-#if QUADRATIC_APPROXIMATION
-////////////////////////////////////////////////////////////////////////////////////
-//functions to approximate a cubic using two quadratics
-
-// midPt sets the first argument to be the midpoint of the other two
-// it is used by quadApprox
-static inline void midPt(SkPoint& dest,const SkPoint& a,const SkPoint& b)
-{
- dest.set(SkScalarAve(a.fX, b.fX),SkScalarAve(a.fY, b.fY));
-}
-// quadApprox - makes an approximation, which we hope is faster
-static void quadApprox(SkPath &fPath, const SkPoint &p0, const SkPoint &p1, const SkPoint &p2)
-{
- //divide the cubic up into two cubics, then convert them into quadratics
- //define our points
- SkPoint c,j,k,l,m,n,o,p,q, mid;
- fPath.getLastPt(&c);
- midPt(j, p0, c);
- midPt(k, p0, p1);
- midPt(l, p1, p2);
- midPt(o, j, k);
- midPt(p, k, l);
- midPt(q, o, p);
- //compute the first half
- m.set(SkScalarHalf(3*j.fX - c.fX), SkScalarHalf(3*j.fY - c.fY));
- n.set(SkScalarHalf(3*o.fX -q.fX), SkScalarHalf(3*o.fY - q.fY));
- midPt(mid,m,n);
- fPath.quadTo(mid,q);
- c = q;
- //compute the second half
- m.set(SkScalarHalf(3*p.fX - c.fX), SkScalarHalf(3*p.fY - c.fY));
- n.set(SkScalarHalf(3*l.fX -p2.fX),SkScalarHalf(3*l.fY -p2.fY));
- midPt(mid,m,n);
- fPath.quadTo(mid,p2);
-}
-#endif
-
-
-static inline bool is_between(int c, int min, int max)
-{
- return (unsigned)(c - min) <= (unsigned)(max - min);
-}
-
-static inline bool is_ws(int c)
-{
- return is_between(c, 1, 32);
-}
-
-static inline bool is_digit(int c)
-{
- return is_between(c, '0', '9');
-}
-
-static inline bool is_sep(int c)
-{
- return is_ws(c) || c == ',';
-}
-
-static const char* skip_ws(const char str[])
-{
- SkASSERT(str);
- while (is_ws(*str))
- str++;
- return str;
-}
-
-static const char* skip_sep(const char str[])
-{
- SkASSERT(str);
- while (is_sep(*str))
- str++;
- return str;
-}
-
-static const char* find_points(const char str[], SkPoint value[], int count,
- bool isRelative, SkPoint* relative)
-{
- str = SkParse::FindScalars(str, &value[0].fX, count * 2);
- if (isRelative) {
- for (int index = 0; index < count; index++) {
- value[index].fX += relative->fX;
- value[index].fY += relative->fY;
- }
- }
- return str;
-}
-
-static const char* find_scalar(const char str[], SkScalar* value,
- bool isRelative, SkScalar relative)
-{
- str = SkParse::FindScalar(str, value);
- if (isRelative)
- *value += relative;
- return str;
-}
-
-void SkDrawPath::parseSVG() {
- fPath.reset();
- const char* data = d.c_str();
- SkPoint f = {0, 0};
- SkPoint c = {0, 0};
- SkPoint lastc = {0, 0};
- SkPoint points[3];
- char op = '\0';
- char previousOp = '\0';
- bool relative = false;
- do {
- data = skip_ws(data);
- if (data[0] == '\0')
- break;
- char ch = data[0];
- if (is_digit(ch) || ch == '-' || ch == '+') {
- if (op == '\0')
- return;
- }
- else {
- op = ch;
- relative = false;
- if (islower(op)) {
- op = (char) toupper(op);
- relative = true;
- }
- data++;
- data = skip_sep(data);
- }
- switch (op) {
- case 'M':
- data = find_points(data, points, 1, relative, &c);
- fPath.moveTo(points[0]);
- op = 'L';
- c = points[0];
- break;
- case 'L':
- data = find_points(data, points, 1, relative, &c);
- fPath.lineTo(points[0]);
- c = points[0];
- break;
- case 'H': {
- SkScalar x;
- data = find_scalar(data, &x, relative, c.fX);
- fPath.lineTo(x, c.fY);
- c.fX = x;
- }
- break;
- case 'V': {
- SkScalar y;
- data = find_scalar(data, &y, relative, c.fY);
- fPath.lineTo(c.fX, y);
- c.fY = y;
- }
- break;
- case 'C':
- data = find_points(data, points, 3, relative, &c);
- goto cubicCommon;
- case 'S':
- data = find_points(data, &points[1], 2, relative, &c);
- points[0] = c;
- if (previousOp == 'C' || previousOp == 'S') {
- points[0].fX -= lastc.fX - c.fX;
- points[0].fY -= lastc.fY - c.fY;
- }
- cubicCommon:
- // if (data[0] == '\0')
- // return;
-#if QUADRATIC_APPROXIMATION
- quadApprox(fPath, points[0], points[1], points[2]);
-#else //this way just does a boring, slow old cubic
- fPath.cubicTo(points[0], points[1], points[2]);
-#endif
- //if we are using the quadApprox, lastc is what it would have been if we had used
- //cubicTo
- lastc = points[1];
- c = points[2];
- break;
- case 'Q': // Quadratic Bezier Curve
- data = find_points(data, points, 2, relative, &c);
- goto quadraticCommon;
- case 'T':
- data = find_points(data, &points[1], 1, relative, &c);
- points[0] = points[1];
- if (previousOp == 'Q' || previousOp == 'T') {
- points[0].fX = c.fX * 2 - lastc.fX;
- points[0].fY = c.fY * 2 - lastc.fY;
- }
- quadraticCommon:
- fPath.quadTo(points[0], points[1]);
- lastc = points[0];
- c = points[1];
- break;
- case 'Z':
- fPath.close();
-#if 0 // !!! still a bug?
- if (fPath.isEmpty() && (f.fX != 0 || f.fY != 0)) {
- c.fX -= SkScalar.Epsilon; // !!! enough?
- fPath.moveTo(c);
- fPath.lineTo(f);
- fPath.close();
- }
-#endif
- c = f;
- op = '\0';
- break;
- case '~': {
- SkPoint args[2];
- data = find_points(data, args, 2, false, NULL);
- fPath.moveTo(args[0].fX, args[0].fY);
- fPath.lineTo(args[1].fX, args[1].fY);
- }
- break;
- default:
- SkASSERT(0);
- return;
- }
- if (previousOp == 0)
- f = c;
- previousOp = op;
- } while (data[0] > 0);
-}
-
private:
ATSUTextLayout fLayout;
ATSUStyle fStyle;
+ CGColorSpaceRef fGrayColorSpace;
static OSStatus MoveTo(const Float32Point *pt, void *cb);
static OSStatus Line(const Float32Point *pt, void *cb);
err = ::ATSUSetAttributes(fStyle,1,&sizeTag,&sizeTagSize,values);
err = ::ATSUCreateTextLayout(&fLayout);
+
+ fGrayColorSpace = ::CGColorSpaceCreateDeviceGray();
}
SkScalerContext_Mac::~SkScalerContext_Mac()
{
+ ::CGColorSpaceRelease(fGrayColorSpace);
+
unref_ft_face(fRec.fFontID);
::ATSUDisposeTextLayout(fLayout);
return glyph;
}
+static void set_glyph_metrics_on_error(SkGlyph* glyph) {
+ glyph->fRsbDelta = 0;
+ glyph->fLsbDelta = 0;
+ glyph->fWidth = 0;
+ glyph->fHeight = 0;
+ glyph->fTop = 0;
+ glyph->fLeft = 0;
+ glyph->fAdvanceX = 0;
+ glyph->fAdvanceY = 0;
+}
+
void SkScalerContext_Mac::generateAdvance(SkGlyph* glyph) {
this->generateMetrics(glyph);
}
-void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph)
-{
- GlyphID glyphID = glyph->fID;
-
+void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
+ GlyphID glyphID = glyph->getGlyphID(fBaseGlyphCount);
ATSGlyphScreenMetrics metrics;
-
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
-
- OSStatus err = ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
- if (err == noErr) {
+
+ OSStatus err = ATSUGlyphGetScreenMetrics(fStyle, 1, &glyphID, 0, true, true,
+ &metrics);
+ if (noErr != err) {
+ set_glyph_metrics_on_error(glyph);
+ } else {
glyph->fAdvanceX = SkFloatToFixed(metrics.deviceAdvance.x);
glyph->fAdvanceY = -SkFloatToFixed(metrics.deviceAdvance.y);
glyph->fWidth = metrics.width;
glyph->fHeight = metrics.height;
- glyph->fTop = -sk_float_round2int(metrics.topLeft.y);
glyph->fLeft = sk_float_round2int(metrics.topLeft.x);
+ glyph->fTop = -sk_float_round2int(metrics.topLeft.y);
}
}
-void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my) {
+void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx,
+ SkPaint::FontMetrics* my) {
#if 0
OSStatus ATSFontGetVerticalMetrics (
ATSFontRef iFont,
void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
{
SkAutoMutexAcquire ac(gFTMutex);
-
- GlyphID glyphID = glyph.fID;
- ATSGlyphScreenMetrics metrics= { 0 };
-
SkASSERT(fLayout);
- OSStatus err = ::ATSUGlyphGetScreenMetrics(fStyle,1,&glyphID,0,true,true,&metrics);
-
-// uint32_t w = metrics.width;
-// uint32_t h = metrics.height;
-// uint32_t pitch = (w + 3) & ~0x3;
-// if (pitch != glyph.rowBytes()) {
-// SkASSERT(false); // it's different from previously cacluated in generateMetrics(), so the size of glyph.fImage buffer is incorrect!
-// }
-
- CGColorSpaceRef greyColorSpace = ::CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
- CGContextRef contextRef = ::CGBitmapContextCreate((uint8_t*)glyph.fImage, glyph.fWidth, glyph.fHeight, 8, glyph.rowBytes(), greyColorSpace, kCGImageAlphaNone);
+ OSStatus err;
+
+ bzero(glyph.fImage, glyph.fHeight * glyph.rowBytes());
+ CGContextRef contextRef = ::CGBitmapContextCreate(glyph.fImage,
+ glyph.fWidth, glyph.fHeight, 8,
+ glyph.rowBytes(), fGrayColorSpace,
+ kCGImageAlphaNone);
if (!contextRef) {
SkASSERT(false);
return;
}
-
- ::CGContextSetFillColorSpace(contextRef, greyColorSpace);
- ::CGContextSetStrokeColorSpace(contextRef, greyColorSpace);
-
- ::CGContextSetGrayFillColor(contextRef, 0.0, 1.0);
- ::CGContextFillRect(contextRef, ::CGRectMake(0, 0, glyph.fWidth, glyph.fHeight));
-
+
::CGContextSetGrayFillColor(contextRef, 1.0, 1.0);
- ::CGContextSetGrayStrokeColor(contextRef, 1.0, 1.0);
::CGContextSetTextDrawingMode(contextRef, kCGTextFill);
ATSUAttributeTag tag = kATSUCGContextTag;
ByteCount size = sizeof(CGContextRef);
ATSUAttributeValuePtr value = &contextRef;
- err = ::ATSUSetLayoutControls(fLayout,1,&tag,&size,&value);
- err = ::ATSUDrawText(fLayout,kATSUFromTextBeginning,kATSUToTextEnd,FloatToFixed(-metrics.topLeft.x),FloatToFixed(glyph.fHeight-metrics.topLeft.y));
+ err = ::ATSUSetLayoutControls(fLayout, 1, &tag, &size, &value);
+ SkASSERT(!err);
+ err = ::ATSUDrawText(fLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+ SkIntToFixed(-glyph.fLeft),
+ SkIntToFixed(glyph.fTop + glyph.fHeight));
+ SkASSERT(!err);
::CGContextRelease(contextRef);
}
002884150EFA97F80083E387 /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002884140EFA97F80083E387 /* test.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 */; };
004447A20EFC1DB400116F7C /* SkCreateCGImageRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */; };
+ 008D39120F0043260032662A /* SkFontHost_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 008D39110F0043260032662A /* SkFontHost_mac.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 */; };
002884140EFA97F80083E387 /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test.cpp; sourceTree = "<group>"; };
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; };
004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkCreateCGImageRef.cpp; path = ../../src/utils/mac/SkCreateCGImageRef.cpp; sourceTree = SOURCE_ROOT; };
+ 008D39110F0043260032662A /* SkFontHost_mac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkFontHost_mac.cpp; path = ../../src/ports/SkFontHost_mac.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>"; };
20286C29FDCF999611CA2CEA /* CICarbonSample */ = {
isa = PBXGroup;
children = (
+ 008D39110F0043260032662A /* SkFontHost_mac.cpp */,
004447A10EFC1DB400116F7C /* SkCreateCGImageRef.cpp */,
- 002884D80EFABFE60083E387 /* SkFontHost_none.cpp */,
20286C2AFDCF999611CA2CEA /* Sources */,
20286C2CFDCF999611CA2CEA /* Resources */,
20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
files = (
8D0C4E900486CD37000505A6 /* main.c in Sources */,
002884150EFA97F80083E387 /* test.cpp in Sources */,
- 002884D90EFABFE60083E387 /* SkFontHost_none.cpp in Sources */,
004447A20EFC1DB400116F7C /* SkCreateCGImageRef.cpp in Sources */,
+ 008D39120F0043260032662A /* SkFontHost_mac.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
01E2163E09EDAC6600E66AF8 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
+ GCC_ENABLE_CPP_RTTI = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
SK_BUILD_FOR_MAC,
SK_DEBUG,
01E2163F09EDAC6600E66AF8 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
+ GCC_ENABLE_CPP_RTTI = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
SK_BUILD_FOR_MAC,
SK_RELEASE,
-{
-IBClasses = ();
-IBVersion = 1;
-}
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>IBDocumentLocation</key>
- <string>117 84 356 240 0 0 1920 1178 </string>
- <key>IBEditorPositions</key>
- <dict>
- <key>29</key>
- <string>110 302 204 44 0 0 1920 1178 </string>
- </dict>
<key>IBFramework Version</key>
- <string>430.0</string>
+ <string>629</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../../CICarbonSample.xcodeproj</string>
<key>IBOldestOS</key>
- <integer>3</integer>
+ <integer>5</integer>
<key>IBOpenObjects</key>
- <array>
- <integer>166</integer>
- </array>
+ <array/>
<key>IBSystem Version</key>
- <string>8A376</string>
+ <string>9F33</string>
<key>targetFramework</key>
<string>IBCarbonFramework</string>
</dict>
<?xml version="1.0" standalone="yes"?>
<object class="NSIBObjectData">
- <string name="targetFramework">IBCarbonFramework</string>
<object name="rootObject" class="NSCustomObject" id="1">
- <string name="customClass">NSApplication</string>
</object>
- <array count="20" name="allObjects">
+ <array count="19" name="allObjects">
+ <object class="IBCarbonMenuItem" id="136">
+ <string name="title">Print…</string>
+ <string name="keyEquivalent">p</string>
+ <ostype name="command">prnt</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="187">
+ <string name="title">About Foo</string>
+ <int name="keyEquivalentModifier">0</int>
+ <ostype name="command">abou</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="197">
+ <string name="title">Zoom</string>
+ <ostype name="command">zoom</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="191">
+ <string name="title">Minimize All</string>
+ <string name="keyEquivalent">m</string>
+ <boolean name="dynamic">TRUE</boolean>
+ <int name="keyEquivalentModifier">1572864</int>
+ <ostype name="command">mina</ostype>
+ </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>
+ <reference idRef="136"/>
+ </array>
+ </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="196">
+ <string name="title">Bring All to Front</string>
+ <boolean name="dynamic">TRUE</boolean>
+ <ostype name="command">bfrt</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="194">
+ <boolean name="separator">TRUE</boolean>
+ </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>
+ <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>
+ <object name="rootControl" class="IBCarbonRootControl" id="167">
+ <string name="viewFrame">0 0 480 360 </string>
+ <array count="1" name="subviews">
+ <object class="IBCarbonHIView" id="200">
+ <ostype name="controlSignature">ciHV</ostype>
+ <int name="controlID">128</int>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingTopKind">1</int>
+ <int name="bindingLeftKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ <int name="bindingRightKind">2</int>
+ </object>
+ <string name="viewFrame">0 0 480 360 </string>
+ <string name="bounds">0 0 360 480 </string>
+ </object>
+ </array>
+ <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>
<object class="IBCarbonMenu" id="29">
<string name="title">main</string>
+ <string name="name">_NSMainMenu</string>
<array count="3" name="items">
<object class="IBCarbonMenuItem" id="185">
<string name="title">Foo</string>
<object name="submenu" class="IBCarbonMenu" id="184">
<string name="title">Foo</string>
+ <string name="name">_NSAppleMenu</string>
<array count="1" name="items">
- <object class="IBCarbonMenuItem" id="187">
- <string name="title">About Foo</string>
- <int name="keyEquivalentModifier">0</int>
- <ostype name="command">abou</ostype>
- </object>
+ <reference idRef="187"/>
</array>
- <string name="name">_NSAppleMenu</string>
</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>
+ <reference name="submenu" idRef="131"/>
</object>
<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">
- <boolean name="dynamic">TRUE</boolean>
- <string name="title">Minimize</string>
- <string name="keyEquivalent">m</string>
- <ostype name="command">mini</ostype>
- </object>
- <object class="IBCarbonMenuItem" id="191">
- <boolean name="dynamic">TRUE</boolean>
- <string name="title">Minimize All</string>
- <string name="keyEquivalent">m</string>
- <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">
- <boolean name="dynamic">TRUE</boolean>
- <string name="title">Bring All to Front</string>
- <ostype name="command">bfrt</ostype>
- </object>
- <object class="IBCarbonMenuItem" id="193">
- <boolean name="dynamic">TRUE</boolean>
- <string name="title">Arrange in Front</string>
- <int name="keyEquivalentModifier">1572864</int>
- <ostype name="command">frnt</ostype>
- </object>
+ <reference idRef="190"/>
+ <reference idRef="191"/>
+ <reference idRef="197"/>
+ <reference idRef="194"/>
+ <reference idRef="196"/>
+ <reference idRef="193"/>
</array>
- <string name="name">_NSWindowsMenu</string>
</object>
</object>
</array>
- <string name="name">_NSMainMenu</string>
</object>
+ <reference idRef="195"/>
+ <reference idRef="200"/>
<reference idRef="127"/>
- <reference idRef="131"/>
- <reference idRef="135"/>
- <reference idRef="136"/>
- <object class="IBCarbonWindow" id="166">
- <string name="windowRect">504 338 864 818 </string>
- <string name="title">Window</string>
- <object name="rootControl" class="IBCarbonRootControl" id="167">
- <string name="bounds">0 0 360 480 </string>
- <string name="viewFrame">0 0 480 360 </string>
- <array count="2" name="subviews">
- <object class="IBCarbonHIView" id="200">
- <string name="bounds">0 0 360 480 </string>
- <string name="viewFrame">0 0 480 360 </string>
- <ostype name="controlSignature">ciHV</ostype>
- <int name="controlID">128</int>
- <object name="layoutInfo" class="IBCarbonHILayoutInfo">
- <int name="bindingTopKind">1</int>
- <int name="bindingLeftKind">1</int>
- <int name="bindingBottomKind">2</int>
- <int name="bindingRightKind">2</int>
- </object>
- </object>
- <object class="IBCarbonSlider" id="201">
- <string name="bounds">329 16 341 460 </string>
- <string name="viewFrame">16 329 444 12 </string>
- <ostype name="controlSignature">gSLD</ostype>
- <int name="controlID">128</int>
- <boolean name="small">TRUE</boolean>
- <int name="controlSize">1</int>
- <ostype name="command">gama</ostype>
- <string name="helpTagText">Set the gamma of the background image</string>
- <object name="layoutInfo" class="IBCarbonHILayoutInfo">
- <int name="bindingLeftKind">1</int>
- <int name="bindingBottomKind">2</int>
- <int name="bindingRightKind">2</int>
- </object>
- <boolean name="isLive">TRUE</boolean>
- <int name="numTickMarks">100</int>
- <int name="orientation">2</int>
- <int name="initialValue">75</int>
- <int name="minimumValue">10</int>
- </object>
- </array>
- </object>
- <boolean name="receiveUpdates">FALSE</boolean>
- <boolean name="hasCloseBox">FALSE</boolean>
- <boolean name="liveResize">TRUE</boolean>
- <boolean name="compositing">TRUE</boolean>
- <int name="windowPosition">1</int>
- <boolean name="asyncDrag">TRUE</boolean>
- <boolean name="isConstrained">FALSE</boolean>
- <boolean name="hideOnFullScreen">TRUE</boolean>
- <boolean name="hideOnSuspend">TRUE</boolean>
- <boolean name="hasShadow">TRUE</boolean>
- <int name="scalingMode">1048576</int>
- <boolean name="doesNotCycle">TRUE</boolean>
- <boolean name="inWindowMenu">TRUE</boolean>
- </object>
<reference idRef="167"/>
- <reference idRef="184"/>
- <reference idRef="185"/>
- <reference idRef="187"/>
- <reference idRef="190"/>
- <reference idRef="191"/>
+ <reference idRef="135"/>
<reference idRef="192"/>
- <reference idRef="193"/>
- <reference idRef="194"/>
- <reference idRef="195"/>
- <reference idRef="196"/>
- <reference idRef="197"/>
- <reference idRef="200"/>
- <reference idRef="201"/>
+ <reference idRef="185"/>
+ <reference idRef="184"/>
</array>
- <array count="20" name="allParents">
- <reference idRef="1"/>
- <reference idRef="29"/>
- <reference idRef="127"/>
+ <array count="19" name="allParents">
<reference idRef="131"/>
- <reference idRef="131"/>
- <reference idRef="1"/>
- <reference idRef="166"/>
- <reference idRef="185"/>
- <reference idRef="29"/>
<reference idRef="184"/>
<reference idRef="195"/>
<reference idRef="195"/>
- <reference idRef="29"/>
+ <reference idRef="127"/>
<reference idRef="195"/>
<reference idRef="195"/>
- <reference idRef="192"/>
<reference idRef="195"/>
<reference idRef="195"/>
+ <reference idRef="1"/>
+ <reference idRef="1"/>
+ <reference idRef="192"/>
<reference idRef="167"/>
- <reference idRef="167"/>
+ <reference idRef="29"/>
+ <reference idRef="166"/>
+ <reference idRef="131"/>
+ <reference idRef="29"/>
+ <reference idRef="29"/>
+ <reference idRef="185"/>
</array>
- <dictionary count="4" name="nameTable">
- <string>Files Owner</string>
+ <dictionary count="3" name="nameTable">
+ <string>File's Owner</string>
<reference idRef="1"/>
<string>MainWindow</string>
<reference idRef="166"/>
<string>MenuBar</string>
<reference idRef="29"/>
- <string>View1</string>
- <reference idRef="200"/>
</dictionary>
- <unsigned_int name="nextObjectID">202</unsigned_int>
+ <string name="targetFramework">IBCarbonFramework</string>
+ <unsigned_int name="nextObjectID">204</unsigned_int>
</object>
canvas->drawCircle(SkIntToScalar(100), SkIntToScalar(100),
SkIntToScalar(90), paint);
+
+ const char text[] = "fry42";
+ const size_t len = strlen(text);
+
+ paint.setColor(SK_ColorWHITE);
+ paint.setTextSize(SkIntToScalar(50));
+ canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(50), paint);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(100), paint);
+ paint.setTextAlign(SkPaint::kRight_Align);
+ canvas->drawText(text, len, SkIntToScalar(100), SkIntToScalar(150), paint);
}
static CGImageRef gImage;