Added Debugger to Sample App, off by default

Removed CocoaDebugger from experimental
Slight changes to SkOSMenu
Bug fixes for NetPipeReader and DrawingBoard


git-svn-id: http://skia.googlecode.com/svn/trunk@2102 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
yangsu@google.com 2011-08-12 14:27:47 +00:00
parent 16edff2b1c
commit ef7bdfac61
45 changed files with 971 additions and 6158 deletions

View File

@ -1,32 +0,0 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -1,15 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#import <Cocoa/Cocoa.h>
#import "SkNSWindow.h"
@interface CocoaDebuggerAppDelegate : NSObject <NSApplicationDelegate> {
SkNSWindow *window;
}
@property (assign) IBOutlet SkNSWindow *window;
@end

View File

@ -1,10 +0,0 @@
#import "CocoaDebuggerAppDelegate.h"
@implementation CocoaDebuggerAppDelegate
@synthesize window;
-(void) applicationDidFinishLaunching:(NSNotification *)aNotification {
//Load specified skia views after launching
[window installSkViews];
}
@end

View File

@ -1,7 +0,0 @@
//
// Prefix header for all source files of the 'CocoaSampleApp' target in the 'CocoaSampleApp' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkDebuggerViews.h"
#include <stdio.h>
SkContentView::SkContentView(SkEventSinkID clID, SkEventSinkID ipID) :
fDumper(this->getSinkID(), clID, ipID) {
fBGColor = 0xFFDDDDDD;
fAtomsToRead = 0;
fDisplayClip = false;
}
SkContentView::~SkContentView() {
fAtomBounds.clear();
fFrameBounds.clear();
}
void SkContentView::reinit(const char* filename) {
fFilePath.set(filename);
fAtomsToRead = 0;
this->init();
}
bool SkContentView::onEvent(const SkEvent& evt) {
return this->INHERITED::onEvent(evt);
}
//Read file atom by atom and record attom bounds
void SkContentView::init() {
fDumper.unload();
fAtomBounds.clear();
fFrameBounds.clear();
SkDumpCanvasM* dumpCanvas = new SkDumpCanvasM(&fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
FILE* f = fopen(fFilePath.c_str(), "rb");
SkASSERT(f != NULL);
fseek(f, 0, SEEK_END);
int fileSize = ftell(f) * sizeof(char);
fseek(f, 0, SEEK_SET);
if (fileSize > 0) {
char* block = (char*)sk_malloc_throw(fileSize);
fread(block, 1, fileSize, f);
int offset = 0;
int frameBound = 0;
size_t bytesRead;
while (offset < fileSize) {
SkGPipeReader::Status s = dumpReader->playback(block + offset,
fileSize - offset,
&bytesRead, true);
SkASSERT(SkGPipeReader::kError_Status != s);
offset += bytesRead;
if (SkGPipeReader::kDone_Status == s) {
fDumper.dump(dumpCanvas,SkDumpCanvasM::kNULL_Verb,
"End of Frame", NULL);
delete dumpReader;
delete dumpCanvas;
dumpCanvas = new SkDumpCanvasM(&fDumper);
dumpReader = new SkGPipeReader(dumpCanvas);
frameBound = offset;
}
fAtomBounds.push_back(offset);
fFrameBounds.push_back(frameBound);
}
sk_free(block);
}
fclose(f);
delete dumpReader;
delete dumpCanvas;
fDumper.load();
}
void SkContentView::goToAtom(int atom) {
if (atom != fAtomsToRead) {
fAtomsToRead = atom;
this->inval(NULL);
}
}
void SkContentView::toggleClip() {
fDisplayClip = !fDisplayClip;
this->inval(NULL);
}
void SkContentView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
SkAutoCanvasRestore acr(canvas, true);
int lastFrameBound = fFrameBounds[fAtomsToRead];
int toBeRead = fAtomBounds[fAtomsToRead] - lastFrameBound;
int firstChunk = (fAtomsToRead > 0) ? fAtomBounds[fAtomsToRead - 1] -
lastFrameBound: 0;
if (toBeRead > 0) {
SkDumpCanvasM* dumpCanvas = new SkDumpCanvasM(&fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
SkGPipeReader* reader = new SkGPipeReader(canvas);
fDumper.disable();
FILE* f = fopen(fFilePath.c_str(), "rb");
SkASSERT(f != NULL);
fseek(f, lastFrameBound, SEEK_SET);
char* block = (char*)sk_malloc_throw(toBeRead);
fread(block, 1, toBeRead, f);
int offset = 0;
size_t bytesRead;
SkGPipeReader::Status s;
//Read the first chunk
if (offset < firstChunk && firstChunk < toBeRead) {
s = dumpReader->playback(block + offset, firstChunk - offset, NULL, false);
SkASSERT(SkGPipeReader::kError_Status != s);
s = reader->playback(block + offset, firstChunk - offset, &bytesRead, false);
SkASSERT(SkGPipeReader::kError_Status != s);
if (SkGPipeReader::kDone_Status == s){
delete dumpReader;
delete dumpCanvas;
dumpCanvas = new SkDumpCanvasM(&fDumper);
dumpReader = new SkGPipeReader(dumpCanvas);
delete reader;
reader = new SkGPipeReader(canvas);
}
offset += bytesRead;
}
SkASSERT(offset == firstChunk);
//Then read the current atom
fDumper.enable();
s = dumpReader->playback(block + offset, toBeRead - offset, NULL, true);
SkASSERT(SkGPipeReader::kError_Status != s);
s = reader->playback(block + offset, toBeRead - offset, &bytesRead, true);
SkASSERT(SkGPipeReader::kError_Status != s);
sk_free(block);
fclose(f);
delete reader;
delete dumpReader;
delete dumpCanvas;
if (fDisplayClip) {
SkPaint p;
p.setColor(0x440000AA);
SkPath path;
canvas->getTotalClip().getBoundaryPath(&path);
canvas->drawPath(path, p);
}
}
this->INHERITED::onDraw(canvas);
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#import "SkNSWindow.h"
#import "SkDebuggerViews.h"
@interface SkDebugger : SkNSWindow {
IBOutlet SkNSView* fCommandView;
IBOutlet SkNSView* fContentView;
IBOutlet SkNSView* fInfoView;
SkCommandListView* fCommand;
SkContentView* fContent;
SkInfoPanelView* fInfo;
}
- (void)loadFile:(NSString *)filename;
@end

View File

@ -1,156 +0,0 @@
#import "SkDebugger.h"
@implementation SkDebugger
-(void) installSkViews {
float width = [self frame].size.width;
float height = [self frame].size.height;
float commandListW = 200;
float infoPanelH = 150.0;
fCommand = new SkCommandListView;
fCommand->setSize(commandListW, height);
fCommand->setVisibleP(true);
fInfo = new SkInfoPanelView;
fInfo->setSize(width - commandListW, infoPanelH);
fInfo->setVisibleP(true);
fContent = new SkContentView(fCommand->getSinkID(),
fInfo->getSinkID());
fContent->setSize(width - commandListW, height - infoPanelH);
fContent->setVisibleP(true);
[fInfoView addSkView:fInfo];
[fCommandView addSkView:fCommand];
[fContentView addSkView:fContent];
fInfo->unref();
fCommand->unref();
fContent->unref();
}
- (void)loadFile:(NSString *)filename {
fCommand->reinit();
fContent->reinit([filename UTF8String]);
}
- (void)keyDown:(NSEvent *)event {
// arrow keys have this mask
if ([event modifierFlags] & NSNumericPadKeyMask) {
NSString *theArrow = [event charactersIgnoringModifiers];
if ( [theArrow length] == 0 )
return; // reject dead keys
if ( [theArrow length] == 1 ) {
switch ([theArrow characterAtIndex:0]) {
case NSLeftArrowFunctionKey:
fContent->goToAtom(fCommand->prevItem());
break;
case NSRightArrowFunctionKey:
fContent->goToAtom(fCommand->nextItem());
break;
case NSUpArrowFunctionKey:
fContent->goToAtom(fCommand->scrollUp());
break;
case NSDownArrowFunctionKey:
fContent->goToAtom(fCommand->scrollDown());
break;
default:
[super keyDown:event];
}
return;
}
}
else {//normal keys
switch ([[event characters] characterAtIndex:0]) {
case 'c':
fContent->toggleClip();
break;
case 'e':
fCommand->toggleCentered();
break;
default:
[super keyDown:event];
}
return;
}
[super keyDown:event];
}
- (void)mouseDown:(NSEvent *)event {
if ([event clickCount] > 1) {
[fContentView resetTransformations];
[fContentView setNeedsDisplay:YES];
}
else {
NSPoint p = [event locationInWindow];
NSRect commandRect = [fCommandView convertRectToBase:[fCommandView bounds]];
if ([fCommandView mouse:p inRect:commandRect]) {
NSPoint mouseLocInView = [fCommandView convertPoint:p fromView:nil];
fContent->goToAtom(fCommand->selectHighlight(mouseLocInView.y));
}
}
[super mouseDown:event];
}
- (void)mouseDragged:(NSEvent *)event {
NSPoint p = [event locationInWindow];
NSRect contentRect = [fContentView convertRectToBase:[fContentView bounds]];
NSRect commandRect = [fCommandView convertRectToBase:[fCommandView bounds]];
if ([fContentView mouse:p inRect:contentRect]) {
fContentView.fOffset = NSMakePoint(fContentView.fOffset.x + [event deltaX],
fContentView.fOffset.y + [event deltaY]);
fContentView.fCenter = NSMakePoint(fContentView.fCenter.x - [event deltaX],
fContentView.fCenter.y - [event deltaY]);
[fContentView setNeedsDisplay:YES];
}
[super mouseDragged:event];
}
- (void)magnifyWithEvent:(NSEvent *)event {
if ([fContentView mouse:[event locationInWindow]
inRect:[fContentView convertRectToBase:[fContentView bounds]]]) {
// fContentView.fCenter = [fContentView convertPoint:[event locationInWindow]
// fromView:nil];
fContentView.fScale = fContentView.fScale * ([event magnification] + 1.0);
[fContentView setNeedsDisplay:YES];
}
[super magnifyWithEvent:event];
}
- (void)rotateWithEvent:(NSEvent *)event {
if ([fContentView mouse:[event locationInWindow]
inRect:[fContentView convertRectToBase:[fContentView bounds]]]) {
// fContentView.fCenter = [fContentView convertPoint:[event locationInWindow]
// fromView:nil];
fContentView.fRotation = fContentView.fRotation - [event rotation];
[fContentView setNeedsDisplay:YES];
}
[super rotateWithEvent:event];
}
- (void)scrollWheel:(NSEvent *)event {
NSPoint p = [event locationInWindow];
NSRect contentRect = [fContentView convertRectToBase:[fContentView bounds]];
NSRect commandRect = [fCommandView convertRectToBase:[fCommandView bounds]];
if ([fContentView mouse:p inRect:contentRect]) {
// fContentView.fCenter = [fContentView convertPoint:[event locationInWindow]
// fromView:nil];
if ([event deltaY] > 0) {
fContentView.fScale = fContentView.fScale * (1.05);
}
if ([event deltaY] < 0) {
fContentView.fScale = fContentView.fScale * (0.95);
}
[fContentView setNeedsDisplay:YES];
}
if ([fCommandView mouse:p inRect:commandRect]) {
if ([event deltaY] > 0) {
fContent->goToAtom(fCommand->scrollUp());
}
if ([event deltaY] < 0) {
fContent->goToAtom(fCommand->scrollDown());
}
}
[super scrollWheel:event];
}
@end

View File

@ -1,385 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkDumpCanvasM.h"
#include "SkPicture.h"
#include "SkPixelRef.h"
#include "SkString.h"
#include <stdarg.h>
// needed just to know that these are all subclassed from SkFlattenable
#include "SkShader.h"
#include "SkPathEffect.h"
#include "SkXfermode.h"
#include "SkColorFilter.h"
#include "SkPathEffect.h"
#include "SkMaskFilter.h"
#include "SkEvent.h"
static void toString(const SkRect& r, SkString* str) {
str->printf("[%g,%g %g:%g]",
SkScalarToFloat(r.fLeft), SkScalarToFloat(r.fTop),
SkScalarToFloat(r.width()), SkScalarToFloat(r.height()));
}
static void toString(const SkIRect& r, SkString* str) {
str->printf("[%d,%d %d:%d]", r.fLeft, r.fTop, r.width(), r.height());
}
static void dumpVerbs(const SkPath& path, SkString* str) {
SkPath::Iter iter(path, false);
SkPoint pts[4];
for (;;) {
switch (iter.next(pts)) {
case SkPath::kMove_Verb:
str->appendf(" M%g,%g", pts[0].fX, pts[0].fY);
break;
case SkPath::kLine_Verb:
str->appendf(" L%g,%g", pts[0].fX, pts[0].fY);
break;
case SkPath::kQuad_Verb:
str->appendf(" Q%g,%g,%g,%g", pts[1].fX, pts[1].fY,
pts[2].fX, pts[2].fY);
break;
case SkPath::kCubic_Verb:
str->appendf(" C%g,%g,%g,%g,%g,%g", pts[1].fX, pts[1].fY,
pts[2].fX, pts[2].fY, pts[3].fX, pts[3].fY);
break;
case SkPath::kClose_Verb:
str->appendf("X");
break;
case SkPath::kDone_Verb:
return;
}
}
}
static void toString(const SkPath& path, SkString* str) {
if (path.isEmpty()) {
str->set("path:empty");
} else {
toString(path.getBounds(), str);
#if 1
SkString s;
dumpVerbs(path, &s);
str->append(s.c_str());
#endif
str->append("]");
str->prepend("path:[");
}
}
static const char* toString(SkRegion::Op op) {
static const char* gOpNames[] = {
"DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE"
};
return gOpNames[op];
}
static void toString(const SkRegion& rgn, SkString* str) {
toString(rgn.getBounds(), str);
str->prepend("Region:[");
str->append("]");
if (rgn.isComplex()) {
str->append(".complex");
}
}
static const char* toString(SkCanvas::VertexMode vm) {
static const char* gVMNames[] = {
"TRIANGLES", "STRIP", "FAN"
};
return gVMNames[vm];
}
static const char* toString(SkCanvas::PointMode pm) {
static const char* gPMNames[] = {
"POINTS", "LINES", "POLYGON"
};
return gPMNames[pm];
}
static const char* toString(SkBitmap::Config config) {
static const char* gConfigNames[] = {
"NONE", "A1", "A8", "INDEX8", "565", "4444", "8888", "RLE"
};
return gConfigNames[config];
}
static void toString(const SkBitmap& bm, SkString* str) {
str->printf("bitmap:[%d %d] %s", bm.width(), bm.height(),
toString(bm.config()));
SkPixelRef* pr = bm.pixelRef();
if (NULL == pr) {
// show null or the explicit pixel address (rare)
str->appendf(" pixels:%p", bm.getPixels());
} else {
const char* uri = pr->getURI();
if (uri) {
str->appendf(" uri:\"%s\"", uri);
} else {
str->appendf(" pixelref:%p", pr);
}
}
}
static void toString(const void* text, size_t len, SkPaint::TextEncoding enc,
SkString* str) {
switch (enc) {
case SkPaint::kUTF8_TextEncoding:
str->printf("\"%.*s\"%s", SkMax32(len, 32), text,
len > 32 ? "..." : "");
break;
case SkPaint::kUTF16_TextEncoding:
str->printf("\"%.*S\"%s", SkMax32(len, 32), text,
len > 64 ? "..." : "");
break;
case SkPaint::kGlyphID_TextEncoding:
str->set("<glyphs>");
break;
}
}
///////////////////////////////////////////////////////////////////////////////
SkDumpCanvasM::SkDumpCanvasM(Dumper* dumper) : fNestLevel(0) {
SkSafeRef(dumper);
fDumper = dumper;
static const int WIDE_OPEN = 16384;
SkBitmap emptyBitmap;
emptyBitmap.setConfig(SkBitmap::kNo_Config, WIDE_OPEN, WIDE_OPEN);
this->setBitmapDevice(emptyBitmap);
}
SkDumpCanvasM::~SkDumpCanvasM() {
SkSafeUnref(fDumper);
}
void SkDumpCanvasM::dump(Verb verb, const SkPaint* paint,
const char format[], ...) {
static const size_t BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
va_list args;
va_start(args, format);
vsnprintf(buffer, BUFFER_SIZE, format, args);
va_end(args);
if (fDumper) {
fDumper->dump(this, verb, buffer, paint);
}
}
///////////////////////////////////////////////////////////////////////////////
int SkDumpCanvasM::save(SaveFlags flags) {
this->dump(kSave_Verb, NULL, "save(0x%X)", flags);
return this->INHERITED::save(flags);
}
int SkDumpCanvasM::saveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) {
this->dump(kSave_Verb, paint, "saveLayer(0x%X)", flags);
return this->INHERITED::saveLayer(bounds, paint, flags);
}
void SkDumpCanvasM::restore() {
this->INHERITED::restore();
this->dump(kRestore_Verb, NULL, "restore");
}
bool SkDumpCanvasM::translate(SkScalar dx, SkScalar dy) {
this->dump(kMatrix_Verb, NULL, "translate(%g %g)",
SkScalarToFloat(dx), SkScalarToFloat(dy));
return this->INHERITED::translate(dx, dy);
}
bool SkDumpCanvasM::scale(SkScalar sx, SkScalar sy) {
this->dump(kMatrix_Verb, NULL, "scale(%g %g)",
SkScalarToFloat(sx), SkScalarToFloat(sy));
return this->INHERITED::scale(sx, sy);
}
bool SkDumpCanvasM::rotate(SkScalar degrees) {
this->dump(kMatrix_Verb, NULL, "rotate(%g)", SkScalarToFloat(degrees));
return this->INHERITED::rotate(degrees);
}
bool SkDumpCanvasM::skew(SkScalar sx, SkScalar sy) {
this->dump(kMatrix_Verb, NULL, "skew(%g %g)",
SkScalarToFloat(sx), SkScalarToFloat(sy));
return this->INHERITED::skew(sx, sy);
}
bool SkDumpCanvasM::concat(const SkMatrix& matrix) {
SkString str;
matrix.toDumpString(&str);
this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str());
return this->INHERITED::concat(matrix);
}
void SkDumpCanvasM::setMatrix(const SkMatrix& matrix) {
SkString str;
matrix.toDumpString(&str);
this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str());
this->INHERITED::setMatrix(matrix);
}
///////////////////////////////////////////////////////////////////////////////
bool SkDumpCanvasM::clipRect(const SkRect& rect, SkRegion::Op op) {
SkString str;
toString(rect, &str);
this->dump(kClip_Verb, NULL, "clipRect(%s %s)", str.c_str(), toString(op));
return this->INHERITED::clipRect(rect, op);
}
bool SkDumpCanvasM::clipPath(const SkPath& path, SkRegion::Op op) {
SkString str;
toString(path, &str);
this->dump(kClip_Verb, NULL, "clipPath(%s %s)", str.c_str(), toString(op));
return this->INHERITED::clipPath(path, op);
}
bool SkDumpCanvasM::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
SkString str;
toString(deviceRgn, &str);
this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(),
toString(op));
return this->INHERITED::clipRegion(deviceRgn, op);
}
///////////////////////////////////////////////////////////////////////////////
void SkDumpCanvasM::drawPaint(const SkPaint& paint) {
this->dump(kDrawPaint_Verb, &paint, "drawPaint()");
}
void SkDumpCanvasM::drawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode),
count);
}
void SkDumpCanvasM::drawRect(const SkRect& rect, const SkPaint& paint) {
SkString str;
toString(rect, &str);
this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str());
}
void SkDumpCanvasM::drawPath(const SkPath& path, const SkPaint& paint) {
SkString str;
toString(path, &str);
this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str());
}
void SkDumpCanvasM::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
const SkPaint* paint) {
SkString str;
toString(bitmap, &str);
this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(),
SkScalarToFloat(x), SkScalarToFloat(y));
}
void SkDumpCanvasM::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
const SkRect& dst, const SkPaint* paint) {
SkString bs, rs;
toString(bitmap, &bs);
toString(dst, &rs);
// show the src-rect only if its not everything
if (src && (src->fLeft > 0 || src->fTop > 0 ||
src->fRight < bitmap.width() ||
src->fBottom < bitmap.height())) {
SkString ss;
toString(*src, &ss);
rs.prependf("%s ", ss.c_str());
}
this->dump(kDrawBitmap_Verb, paint, "drawBitmapRect(%s %s)",
bs.c_str(), rs.c_str());
}
void SkDumpCanvasM::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint* paint) {
SkString bs, ms;
toString(bitmap, &bs);
m.toDumpString(&ms);
this->dump(kDrawBitmap_Verb, paint, "drawBitmapMatrix(%s %s)",
bs.c_str(), ms.c_str());
}
void SkDumpCanvasM::drawSprite(const SkBitmap& bitmap, int x, int y,
const SkPaint* paint) {
SkString str;
toString(bitmap, &str);
this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(),
x, y);
}
void SkDumpCanvasM::drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
SkString str;
toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawText(%s [%d] %g %g)", str.c_str(),
byteLength, SkScalarToFloat(x), SkScalarToFloat(y));
}
void SkDumpCanvasM::drawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint) {
SkString str;
toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawPosText(%s [%d] %g %g ...)",
str.c_str(), byteLength, SkScalarToFloat(pos[0].fX),
SkScalarToFloat(pos[0].fY));
}
void SkDumpCanvasM::drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
SkString str;
toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawPosTextH(%s [%d] %g %g ...)",
str.c_str(), byteLength, SkScalarToFloat(xpos[0]),
SkScalarToFloat(constY));
}
void SkDumpCanvasM::drawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) {
SkString str;
toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawTextOnPath(%s [%d])",
str.c_str(), byteLength);
}
void SkDumpCanvasM::drawPicture(SkPicture& picture) {
this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", &picture,
picture.width(), picture.height());
fNestLevel += 1;
this->INHERITED::drawPicture(picture);
fNestLevel -= 1;
this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %d:%d", &picture,
picture.width(), picture.height());
}
void SkDumpCanvasM::drawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)",
toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX),
SkScalarToFloat(vertices[0].fY));
}
void SkDumpCanvasM::drawData(const void* data, size_t length) {
// this->dump(kDrawData_Verb, NULL, "drawData(%d)", length);
this->dump(kDrawData_Verb, NULL, "drawData(%d) %.*s", length,
SkMin32(length, 64), data);
}

View File

@ -1,122 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkDumpCanvasM_DEFINED
#define SkDumpCanvasM_DEFINED
#include "SkCanvas.h"
/** This class overrides all the draw methods on SkCanvas, and formats them
as text, and then sends that to a Dumper helper object.
Typical use might be to dump a display list to a log file to see what is
being drawn.
*/
class SkDumpCanvasM : public SkCanvas {
public:
class Dumper;
explicit SkDumpCanvasM(Dumper* = 0);
virtual ~SkDumpCanvasM();
enum Verb {
kNULL_Verb,
kSave_Verb,
kRestore_Verb,
kMatrix_Verb,
kClip_Verb,
kDrawPaint_Verb,
kDrawPoints_Verb,
kDrawRect_Verb,
kDrawPath_Verb,
kDrawBitmap_Verb,
kDrawText_Verb,
kDrawPicture_Verb,
kDrawVertices_Verb,
kDrawData_Verb
};
/** Subclasses of this are installed on the DumpCanvas, and then called for
each drawing command.
*/
class Dumper : public SkRefCnt {
public:
virtual void dump(SkDumpCanvasM*, SkDumpCanvasM::Verb, const char str[],
const SkPaint*) = 0;
};
Dumper* getDumper() const { return fDumper; }
void setDumper(Dumper*);
int getNestLevel() const { return fNestLevel; }
// overrides from SkCanvas
virtual int save(SaveFlags flags = kMatrixClip_SaveFlag);
virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags = kARGB_ClipLayer_SaveFlag);
virtual void restore();
virtual bool translate(SkScalar dx, SkScalar dy);
virtual bool scale(SkScalar sx, SkScalar sy);
virtual bool rotate(SkScalar degrees);
virtual bool skew(SkScalar sx, SkScalar sy);
virtual bool concat(const SkMatrix& matrix);
virtual void setMatrix(const SkMatrix& matrix);
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op);
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op);
virtual bool clipRegion(const SkRegion& deviceRgn,
SkRegion::Op op = SkRegion::kIntersect_Op);
virtual void drawPaint(const SkPaint& paint);
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
const SkPaint& paint);
virtual void drawRect(const SkRect& rect, const SkPaint& paint);
virtual void drawPath(const SkPath& path, const SkPaint& paint);
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint = NULL);
virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
const SkRect& dst, const SkPaint* paint = NULL);
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint* paint = NULL);
virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint = NULL);
virtual void drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint);
virtual void drawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint);
virtual void drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint);
virtual void drawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint);
virtual void drawPicture(SkPicture&);
virtual void drawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint);
virtual void drawData(const void*, size_t);
private:
Dumper* fDumper;
int fNestLevel; // for nesting recursive elements like pictures
void dump(Verb, const SkPaint*, const char format[], ...);
typedef SkCanvas INHERITED;
};
#endif

View File

@ -1,14 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#import <Cocoa/Cocoa.h>
#import "SkDebugger.h"
@interface SkMenuController : NSObject {
IBOutlet SkDebugger *fWindow;
}
-(IBAction) openFile:(id) sender;
@end

View File

@ -1,16 +0,0 @@
#import "SkMenuController.h"
@implementation SkMenuController
-(IBAction) openFile:(id) sender {
NSOpenPanel* panel = [NSOpenPanel openPanel];
NSInteger response = [panel runModal];
[panel setFloatingPanel:YES];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
if(response == NSOKButton){
[fWindow loadFile:[panel filename]];
}
}
@end

View File

@ -1,16 +0,0 @@
//
// main.m
// CocoaSampleApp
//
// Created by Yang Su on 6/14/11.
// Copyright 2011 Google Inc.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}

View File

@ -11,9 +11,9 @@
<string key="NS.object.0">851</string>
</object>
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<integer value="296"/>
<integer value="372"/>
<integer value="24"/>
<integer value="634"/>
<integer value="372"/>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -952,24 +952,6 @@
<object class="NSMenu" key="NSSubmenu" id="466310130">
<string key="NSTitle">View</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="962976284">
<reference key="NSMenu" ref="466310130"/>
<string key="NSTitle">Increase Increase Size</string>
<string key="NSKeyEquiv">=</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="368680108">
<reference key="NSMenu" ref="466310130"/>
<string key="NSTitle">Decrease Window Size</string>
<string key="NSKeyEquiv">-</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="87708234">
<reference key="NSMenu" ref="466310130"/>
<string key="NSTitle">Show Menu Key Equivalents</string>
@ -1507,6 +1489,15 @@
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="92029792">
<reference key="NSMenu" ref="835318025"/>
<string key="NSTitle">768 x 1024</string>
<string key="NSKeyEquiv">=</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="299356726">
<reference key="NSMenu" ref="835318025"/>
<bool key="NSIsDisabled">YES</bool>
@ -2292,22 +2283,6 @@
</object>
<int key="connectionID">707</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">increaseWindowSize:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="962976284"/>
</object>
<int key="connectionID">711</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">decreaseWindowSize:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="368680108"/>
</object>
<int key="connectionID">712</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleKeyEquivalents:</string>
@ -2316,6 +2291,14 @@
</object>
<int key="connectionID">719</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toiPadSize:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="92029792"/>
</object>
<int key="connectionID">721</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -2717,6 +2700,7 @@
<reference ref="625202149"/>
<reference ref="575023229"/>
<reference ref="1011231497"/>
<reference ref="92029792"/>
</array>
<reference key="parent" ref="713487014"/>
</object>
@ -2754,8 +2738,6 @@
<array class="NSMutableArray" key="children">
<reference ref="102151532"/>
<reference ref="237841660"/>
<reference ref="962976284"/>
<reference ref="368680108"/>
<reference ref="87708234"/>
</array>
<reference key="parent" ref="586577488"/>
@ -3405,21 +3387,16 @@
<reference key="object" ref="24092627"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">708</int>
<reference key="object" ref="962976284"/>
<reference key="parent" ref="466310130"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">710</int>
<reference key="object" ref="368680108"/>
<reference key="parent" ref="466310130"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">718</int>
<reference key="object" ref="87708234"/>
<reference key="parent" ref="466310130"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">720</int>
<reference key="object" ref="92029792"/>
<reference key="parent" ref="835318025"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@ -3523,7 +3500,7 @@
<integer value="1" key="236.ImportedFromIB2"/>
<string key="239.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="239.ImportedFromIB2"/>
<string key="24.IBEditorWindowLastContentRect">{{707, 426}, {194, 73}}</string>
<string key="24.IBEditorWindowLastContentRect">{{707, 406}, {194, 93}}</string>
<string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="24.ImportedFromIB2"/>
<string key="24.editorWindowContentRectSynchronizationRect">{{525, 802}, {197, 73}}</string>
@ -3533,7 +3510,7 @@
<string key="29.WindowOrigin">{74, 862}</string>
<string key="29.editorWindowContentRectSynchronizationRect">{{6, 978}, {478, 20}}</string>
<string key="295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="296.IBEditorWindowLastContentRect">{{591, 396}, {279, 103}}</string>
<string key="296.IBEditorWindowLastContentRect">{{591, 436}, {276, 63}}</string>
<string key="296.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="296.editorWindowContentRectSynchronizationRect">{{475, 832}, {234, 43}}</string>
<string key="297.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -3552,9 +3529,9 @@
<integer value="1" key="351.ImportedFromIB2"/>
<string key="354.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="354.ImportedFromIB2"/>
<string key="371.IBEditorWindowLastContentRect">{{199, 4}, {640, 480}}</string>
<string key="371.IBEditorWindowLastContentRect">{{254, 23}, {640, 480}}</string>
<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="371.IBWindowTemplateEditedContentRect">{{199, 4}, {640, 480}}</string>
<string key="371.IBWindowTemplateEditedContentRect">{{254, 23}, {640, 480}}</string>
<integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
<string key="371.editorWindowContentRectSynchronizationRect">{{33, 99}, {480, 360}}</string>
<string key="371.windowTemplate.maxSize">{3.40282e+38, 3.40282e+38}</string>
@ -3642,7 +3619,7 @@
<string key="515.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="516.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="517.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="538.IBEditorWindowLastContentRect">{{136, 946}, {341, 321}}</string>
<string key="538.IBEditorWindowLastContentRect">{{136, 685}, {341, 321}}</string>
<string key="538.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="539.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -3670,11 +3647,10 @@
<string key="698.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="705.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="706.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="708.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="710.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="718.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="72.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="72.ImportedFromIB2"/>
<string key="720.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="73.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="73.ImportedFromIB2"/>
<string key="74.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -3704,27 +3680,24 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">719</int>
<int key="maxID">721</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">SampleAppDelegate</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="decreaseWindowSize:">id</string>
<string key="increaseWindowSize:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="decreaseWindowSize:">
<string key="name">decreaseWindowSize:</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">toiPadSize:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">toiPadSize:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">toiPadSize:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="increaseWindowSize:">
<string key="name">increaseWindowSize:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="fOptions">SkOptionsTableView</string>
<string key="fView">SkNSView</string>

View File

@ -11,6 +11,5 @@
@property (assign) IBOutlet SkNSView* fView;
@property (assign) IBOutlet SkOptionsTableView* fOptions;
- (IBAction)decreaseWindowSize:(id)sender;
- (IBAction)increaseWindowSize:(id)sender;
- (IBAction)toiPadSize:(id)sender;
@end

View File

@ -8,24 +8,8 @@
[fOptions registerMenus:fView.fWind->getMenus()];
}
static float deltaw = 120;
static float deltah = 80;
- (IBAction)decreaseWindowSize:(id)sender {
NSRect frame = [fWindow frame];
frame.origin.y += deltah;
frame.size.width -=deltaw;
frame.size.height -= deltah;
[fWindow setFrame:frame display:YES animate:YES];
}
- (IBAction)increaseWindowSize:(id)sender {
NSRect frame = [fWindow frame];
frame.origin.y -= deltah;
frame.size.width += deltaw;
frame.size.height += deltah;
- (IBAction)toiPadSize:(id)sender {
NSRect frame = NSMakeRect(fWindow.frame.origin.x, fWindow.frame.origin.y, 768, 1024);
[fWindow setFrame:frame display:YES animate:YES];
}
@end

View File

@ -204,10 +204,7 @@ static SkKey raw2key(UInt32 raw)
CGLContextObj createGLContext() {
GLint major, minor;
CGLContextObj ctx;
CGLGetVersion(&major, &minor);
SkDebugf("---- cgl version %d %d\n", major, minor);
const CGLPixelFormatAttribute attributes[] = {
kCGLPFAStencilSize, (CGLPixelFormatAttribute)8,
@ -224,11 +221,9 @@ CGLContextObj createGLContext() {
CGLPixelFormatObj format;
GLint npix;
CGLChoosePixelFormat(attributes, &format, &npix);
SkDebugf("----- cgl format %p\n", format);
CGLContextObj ctx;
CGLCreateContext(format, NULL, &ctx);
SkDebugf("----- cgl context %p\n", ctx);
CGLDestroyPixelFormat(format);
static const GLint interval = 1;

View File

@ -54,7 +54,7 @@
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
NSUInteger first = 0;
for (NSInteger i = 0; i < menuIndex; ++i) {
first += (*fMenus)[i]->countItems();
first += (*fMenus)[i]->getCount();
}
[fItems removeObjectsInRange:NSMakeRange(first, [fItems count] - first)];
[self loadMenu:menu];
@ -72,20 +72,22 @@
}
- (void)loadMenu:(const SkOSMenu*)menu {
for (int i = 0; i < menu->countItems(); ++i) {
const SkOSMenu::Item* item = menu->getItem(i);
const SkOSMenu::Item* menuitems[menu->getCount()];
menu->getItems(menuitems);
for (int i = 0; i < menu->getCount(); ++i) {
const SkOSMenu::Item* item = menuitems[i];
SkOptionItem* option = [[SkOptionItem alloc] init];
option.fItem = item;
if (SkOSMenu::kList_Type == item->getType()) {
int index = 0, count = 0;
SkOSMenu::FindListItemCount(item->getEvent(), &count);
SkOSMenu::FindListItemCount(*item->getEvent(), &count);
NSMutableArray* optionstrs = [[NSMutableArray alloc] initWithCapacity:count];
SkString options[count];
SkOSMenu::FindListItems(item->getEvent(), options);
SkOSMenu::FindListItems(*item->getEvent(), options);
for (int i = 0; i < count; ++i)
[optionstrs addObject:[NSString stringWithUTF8String:options[i].c_str()]];
SkOSMenu::FindListIndex(item->getEvent(), item->getSlotName(), &index);
SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &index);
option.fCell = [self createList:optionstrs current:index];
[optionstrs release];
}
@ -99,23 +101,23 @@
break;
case SkOSMenu::kSlider_Type:
SkScalar min, max, value;
SkOSMenu::FindSliderValue(item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindSliderMin(item->getEvent(), &min);
SkOSMenu::FindSliderMax(item->getEvent(), &max);
SkOSMenu::FindSliderValue(*item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindSliderMin(*item->getEvent(), &min);
SkOSMenu::FindSliderMax(*item->getEvent(), &max);
option.fCell = [self createSlider:value
min:min
max:max];
break;
case SkOSMenu::kSwitch_Type:
SkOSMenu::FindSwitchState(item->getEvent(), item->getSlotName(), &state);
SkOSMenu::FindSwitchState(*item->getEvent(), item->getSlotName(), &state);
option.fCell = [self createSwitch:(BOOL)state];
break;
case SkOSMenu::kTriState_Type:
SkOSMenu::FindTriState(item->getEvent(), item->getSlotName(), &tristate);
SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate);
option.fCell = [self createTriState:[self triStateToNSState:tristate]];
break;
case SkOSMenu::kTextField_Type:
SkOSMenu::FindText(item->getEvent(),item->getSlotName(), &str);
SkOSMenu::FindText(*item->getEvent(),item->getSlotName(), &str);
option.fCell = [self createTextField:[NSString stringWithUTF8String:str.c_str()]];
break;
default:
@ -202,29 +204,30 @@
break;
case SkOSMenu::kList_Type:
[(NSPopUpButtonCell*)cell selectItemAtIndex:[anObject intValue]];
item->postEventWithInt([anObject intValue]);
item->setInt([anObject intValue]);
break;
case SkOSMenu::kSlider_Type:
[cell setFloatValue:[anObject floatValue]];
item->postEventWithScalar([anObject floatValue]);
item->setScalar([anObject floatValue]);
break;
case SkOSMenu::kSwitch_Type:
[cell setState:[anObject boolValue]];
item->postEventWithBool([anObject boolValue]);
item->setBool([anObject boolValue]);
break;
case SkOSMenu::kTextField_Type:
if ([anObject length] > 0) {
[cell setStringValue:anObject];
item->postEventWithString([anObject UTF8String]);
item->setString([anObject UTF8String]);
}
break;
case SkOSMenu::kTriState_Type:
[cell setState:[anObject intValue]];
item->postEventWithInt([anObject intValue]);
item->setTriState((SkOSMenu::TriState)[anObject intValue]);
break;
default:
break;
}
item->postEvent();
}
}

View File

@ -5,95 +5,88 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkDebuggerViews.h"
#include "DebuggerViews.h"
SkCommandListView::SkCommandListView() {
DebuggerCommandsView::DebuggerCommandsView() {
fBGColor = 0xFFBBBBBB;
fTopIndex = 0;
fHighlight = 0;
fResizing = false;
SkPaint p;
p.setTextSize(SkIntToScalar(SkDebugger_TextSize));
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
fSpacing = p.getFontSpacing();
fCentered = false;
fRange = (int)(this->height()/fSpacing) - 1;
}
bool SkCommandListView::onEvent(const SkEvent& evt) {
if (evt.isType(SkDebugger_CommandType)) {
SkString msg(evt.findString(SkDebugger_Atom));
fList.push_back(msg);
DebuggerCommandsView::~DebuggerCommandsView() {
fList.deleteAll();
}
bool DebuggerCommandsView::onEvent(const SkEvent& evt) {
if (evt.isType(SKDEBUGGER_COMMANDTYPE)) {
*fList.append() = new SkString(evt.findString(SKDEBUGGER_ATOM));
this->inval(NULL);
return true;
}
return this->INHERITED::onEvent(evt);
}
void SkCommandListView::onSizeChange() {
fRange = (int)(this->height()/fSpacing) - 1;
void DebuggerCommandsView::onSizeChange() {
fRange = (int)(this->height()/fSpacing);
this->INHERITED::onSizeChange();
}
void SkCommandListView::reinit() {
fList.clear();
fTopIndex = 0;
fHighlight = 0;
}
void SkCommandListView::alignCenter() {
if (!fCentered || fHighlight < fRange/2 || fHighlight > (fList.size() - fRange/2))
void DebuggerCommandsView::alignCenter() {
if (!fCentered || fHighlight < fRange/2 || fHighlight > (fList.count() - fRange/2)) {
return;
else {
if (fHighlight > (fTopIndex + fRange/2)) {
} else {
if (fHighlight > (fTopIndex + fRange/2))
fTopIndex += fHighlight - (fTopIndex + fRange/2);
}
if (fHighlight < (fTopIndex + fRange/2)) {
if (fHighlight < (fTopIndex + fRange/2))
fTopIndex -= (fTopIndex + fRange/2) - fHighlight;
}
}
}
int SkCommandListView::nextItem() {
if (fHighlight < fList.size() - 1)
int DebuggerCommandsView::nextItem() {
if (fHighlight < fList.count() - 1)
++fHighlight;
if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange)) {
if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange))
fTopIndex = fHighlight;
}
if (fHighlight == (fTopIndex + fRange)) {
if (fHighlight == (fTopIndex + fRange))
++fTopIndex;
}
this->alignCenter();
this->inval(NULL);
return fHighlight;
}
int SkCommandListView::prevItem() {
int DebuggerCommandsView::prevItem() {
if (fHighlight > 0)
--fHighlight;
if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange)) {
if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange))
fTopIndex = fHighlight;
}
this->alignCenter();
this->inval(NULL);
return fHighlight;
}
int SkCommandListView::scrollUp() {
int DebuggerCommandsView::scrollUp() {
if (fTopIndex > 0)
--fTopIndex;
this->inval(NULL);
return fHighlight;
}
int SkCommandListView::scrollDown() {
if (fTopIndex < (fList.size() - 1))
int DebuggerCommandsView::scrollDown() {
if (fTopIndex < (fList.count() - 1))
++fTopIndex;
this->inval(NULL);
return fHighlight;
}
void SkCommandListView::highlight(int index) {
SkASSERT(index >= 0 && index < fList.size());
void DebuggerCommandsView::highlight(int index) {
SkASSERT(index >= 0 && index < fList.count());
if (fHighlight != index) {
fHighlight = index;
this->alignCenter();
@ -101,10 +94,10 @@ void SkCommandListView::highlight(int index) {
}
}
int SkCommandListView::selectHighlight(int ypos) {
int DebuggerCommandsView::selectHighlight(int ypos) {
int i = (int)(ypos/fSpacing) + fTopIndex;
if (i >= fList.size()) {
i = fList.size() - 1;
if (i >= fList.count()) {
i = fList.count() - 1;
}
if (fHighlight != i) {
fHighlight = i;
@ -114,35 +107,39 @@ int SkCommandListView::selectHighlight(int ypos) {
return fHighlight;
}
void SkCommandListView::toggleCentered() {
void DebuggerCommandsView::toggleCentered() {
fCentered = !fCentered;
this->alignCenter();
this->inval(NULL);
}
void SkCommandListView::onDraw(SkCanvas* canvas) {
void DebuggerCommandsView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
SkPaint p;
p.setTextSize(SkIntToScalar(SkDebugger_TextSize));
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
p.setAntiAlias(true);
//draw highlight
int selected = fHighlight - fTopIndex;
SkRect r = {0, fSpacing * selected, this->width(), fSpacing * (selected+1)};
p.setColor(0x880033DD);
p.setColor(SKDEBUGGER_HIGHLIGHTCOLOR);
canvas->drawRect(r, p);
int endIndex = fTopIndex + fRange;
if (endIndex > fList.size())
endIndex = fList.size();
if (endIndex > fList.count())
endIndex = fList.count();
p.setColor(0xFF000000);
p.setColor(SKDEBUGGER_TEXTCOLOR);
int pos;
for (int i = fTopIndex; i < endIndex; ++i) {
pos = i - fTopIndex;
canvas->drawText(fList[i].c_str(), fList[i].size(),
canvas->drawText(fList[i]->c_str(), fList[i]->size(),
0, fSpacing - 2 + fSpacing * pos, p);
}
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0,
SKDEBUGGER_RESIZEBARSIZE, this->height());
canvas->drawRect(r, p);
this->INHERITED::onDraw(canvas);
}

View File

@ -0,0 +1,271 @@
#include "SampleCode.h"
#include "SkView.h"
#include "SkCanvas.h"
#include "SkGradientShader.h"
#include "SkGPipe.h"
#include "SkOSMenu.h"
#include "DebuggerViews.h"
static const char gIsDebuggerQuery[] = "is-debugger";
class DebuggerView : public SampleView {
public:
DebuggerView(const char* data, size_t size) {
fData.append(size, data);
fCommandsVisible = true;
fCommandsResizing = false;
fStateVisible = true;
fStateResizing = false;
fCommands = new DebuggerCommandsView;
fCommands->setVisibleP(fCommandsVisible);
this->attachChildToFront(fCommands)->unref();
fState = new DebuggerStateView;
fState->setVisibleP(fStateVisible);
this->attachChildToFront(fState)->unref();
fAtomsToRead = 0;
fDisplayClip = false;
fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(),
fState->getSinkID());
fDumper->unload();
fAtomBounds.reset();
fFrameBounds.reset();
SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
if (size > 0) {
int offset = 0;
int frameBound = 0;
size_t bytesRead;
while (offset < size) {
SkGPipeReader::Status s = dumpReader->playback(data + offset,
size - offset,
&bytesRead,
true);
SkASSERT(SkGPipeReader::kError_Status != s);
offset += bytesRead;
if (SkGPipeReader::kDone_Status == s) {
fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb,
"End of Frame", NULL);
delete dumpReader;
delete dumpCanvas;
dumpCanvas = new SkDumpCanvas(fDumper);
dumpReader = new SkGPipeReader(dumpCanvas);
frameBound = offset;
}
fAtomBounds.append(1, &offset);
fFrameBounds.append(1, &frameBound);
}
}
delete dumpReader;
delete dumpCanvas;
fDumper->load();
}
~DebuggerView() {
fAtomBounds.reset();
fFrameBounds.reset();
delete fDumper;
}
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Debugger");
menu->appendSwitch("Show Commands", "Commands", this->getSinkID(), fCommandsVisible);
menu->appendSwitch("Show State", "State", this->getSinkID(), fStateVisible);
menu->appendSwitch("Display Clip", "Clip", this->getSinkID(), fDisplayClip);
}
void goToAtom(int atom) {
if (atom != fAtomsToRead) {
fAtomsToRead = atom;
this->inval(NULL);
}
}
protected:
virtual bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Debugger");
return true;
}
if (evt->isType(gIsDebuggerQuery)) {
return true;
}
return this->INHERITED::onQuery(evt);
}
virtual bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindSwitchState(evt, "Commands", &fCommandsVisible) ||
SkOSMenu::FindSwitchState(evt, "State", &fStateVisible)) {
fCommands->setVisibleP(fCommandsVisible);
fState->setVisibleP(fStateVisible);
fStateOffset = (fCommandsVisible) ? fCommands->width() : 0;
fState->setSize(this->width() - fStateOffset, fState->height());
fState->setLoc(fStateOffset, this->height() - fState->height());
this->inval(NULL);
return true;
}
if (SkOSMenu::FindSwitchState(evt, "Clip", &fDisplayClip)) {
this->inval(NULL);
return true;
}
return this->INHERITED::onEvent(evt);
}
virtual void onDrawContent(SkCanvas* canvas) {
if (fData.count() <= 0)
return;
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(fStateOffset, 0);
int lastFrameBound = fFrameBounds[fAtomsToRead];
int toBeRead = fAtomBounds[fAtomsToRead] - lastFrameBound;
int firstChunk = (fAtomsToRead > 0) ? fAtomBounds[fAtomsToRead - 1] - lastFrameBound: 0;
if (toBeRead > 0) {
SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
SkGPipeReader* reader = new SkGPipeReader(canvas);
fDumper->disable();
int offset = 0;
size_t bytesRead;
SkGPipeReader::Status s;
//Read the first chunk
if (offset < firstChunk && firstChunk < toBeRead) {
s = dumpReader->playback(fData.begin() + offset, firstChunk - offset, NULL, false);
SkASSERT(SkGPipeReader::kError_Status != s);
s = reader->playback(fData.begin() + offset, firstChunk - offset, &bytesRead, false);
SkASSERT(SkGPipeReader::kError_Status != s);
if (SkGPipeReader::kDone_Status == s){
delete dumpReader;
delete dumpCanvas;
dumpCanvas = new SkDumpCanvas(fDumper);
dumpReader = new SkGPipeReader(dumpCanvas);
delete reader;
reader = new SkGPipeReader(canvas);
}
offset += bytesRead;
}
SkASSERT(offset == firstChunk);
//Then read the current atom
fDumper->enable();
s = dumpReader->playback(fData.begin() + offset, toBeRead - offset, NULL, true);
SkASSERT(SkGPipeReader::kError_Status != s);
s = reader->playback(fData.begin() + offset, toBeRead - offset, &bytesRead, true);
SkASSERT(SkGPipeReader::kError_Status != s);
delete reader;
delete dumpReader;
delete dumpCanvas;
if (fDisplayClip) {
SkPaint p;
p.setColor(0x440000AA);
SkPath path;
canvas->getTotalClip().getBoundaryPath(&path);
canvas->drawPath(path, p);
}
}
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
return new Click(this);
}
virtual bool onClick(SkView::Click* click) {
SkPoint prev = click->fPrev;
SkPoint curr = click->fCurr;
bool handled = true;
switch (click->fState) {
case SkView::Click::kDown_State:
if (SkScalarAbs(curr.fX - fCommands->width()) <= SKDEBUGGER_RESIZEBARSIZE) {
fCommandsResizing = true;
}
else if (SkScalarAbs(curr.fY - (this->height() - fState->height())) <= SKDEBUGGER_RESIZEBARSIZE &&
curr.fX > fCommands->width()) {
fStateResizing = true;
}
else if (curr.fX < fCommands->width()) {
fAtomsToRead = fCommands->selectHighlight(curr.fY);
}
else
handled = false;
break;
case SkView::Click::kMoved_State:
if (fCommandsResizing)
fCommands->setSize(curr.fX, this->height());
else if (fStateResizing)
fState->setSize(this->width(), this->height() - curr.fY);
else if (curr.fX < fCommands->width()) {
if (curr.fY - prev.fY < 0) {
fCommands->scrollDown();
}
if (curr.fY - prev.fY > 0) {
fCommands->scrollUp();
}
}
else
handled = false;
break;
case SkView::Click::kUp_State:
fStateResizing = fCommandsResizing = false;
break;
default:
break;
}
fStateOffset = fCommands->width();
fState->setSize(this->width() - fStateOffset, fState->height());
fState->setLoc(fStateOffset, this->height() - fState->height());
if (handled)
this->inval(NULL);
return handled;
}
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fCommands->setSize(CMD_WIDTH, this->height());
fCommands->setLoc(0, 0);
fState->setSize(this->width() - CMD_WIDTH, INFO_HEIGHT);
fState->setLoc(CMD_WIDTH, this->height() - INFO_HEIGHT);
}
private:
DebuggerCommandsView* fCommands;
DebuggerStateView* fState;
bool fCommandsResizing;
bool fCommandsVisible;
bool fStateResizing;
bool fStateVisible;
float fStateOffset;
bool fDisplayClip;
int fAtomsToRead;
SkTDArray<int> fAtomBounds;
SkTDArray<int> fFrameBounds;
SkTDArray<char> fData;
SkDebugDumper* fDumper;
typedef SampleView INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
SkView* create_debugger(const char* data, size_t size) {
return SkNEW_ARGS(DebuggerView, (data, size));
};
bool is_debugger(SkView* view) {
SkEvent isDebugger(gIsDebuggerQuery);
return view->doQuery(&isDebugger);
}

View File

@ -5,23 +5,24 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkDebuggerViews.h"
#include "DebuggerViews.h"
#include "SkRect.h"
SkInfoPanelView::SkInfoPanelView() {
DebuggerStateView::DebuggerStateView() {
fBGColor = 0xFF999999;
fPaint.setColor(fBGColor);
fResizing = false;
}
bool SkInfoPanelView::onEvent(const SkEvent& evt) {
if (evt.isType(SkDebugger_StateType)) {
fMatrix = evt.findString(SkDebugger_Matrix);
fClip = evt.findString(SkDebugger_Clip);
bool DebuggerStateView::onEvent(const SkEvent& evt) {
if (evt.isType(SKDEBUGGER_STATETYPE)) {
fMatrix = evt.findString(SKDEBUGGER_MATRIX);
fClip = evt.findString(SKDEBUGGER_CLIP);
SkPaint* ptr;
if (evt.getMetaData().findPtr(SkDebugger_Paint, (void**)&ptr)) {
if (evt.getMetaData().findPtr(SKDEBUGGER_PAINT, (void**)&ptr)) {
fPaint = *ptr;
fPaintInfo = evt.findString(SkDebugger_PaintInfo);
fPaintInfo = evt.findString(SKDEBUGGER_PAINTINFO);
}
this->inval(NULL);
return true;
@ -29,7 +30,7 @@ bool SkInfoPanelView::onEvent(const SkEvent& evt) {
return this->INHERITED::onEvent(evt);
}
void SkInfoPanelView::onDraw(SkCanvas* canvas) {
void DebuggerStateView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
//Display Current Paint
@ -37,12 +38,15 @@ void SkInfoPanelView::onDraw(SkCanvas* canvas) {
canvas->drawRect(r, fPaint);
//Display Information
SkPaint p;
p.setTextSize(SkDebugger_TextSize);
p.setTextSize(SKDEBUGGER_TEXTSIZE);
p.setAntiAlias(true);
int x = 50;
canvas->drawText(fPaintInfo.c_str(), fPaintInfo.size(), x, 30, p);
canvas->drawText(fMatrix.c_str(), fMatrix.size(), x, 60, p);
canvas->drawText(fClip.c_str(), fClip.size(), x, 90, p);
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
r = SkRect::MakeXYWH(0, 0, this->width(), SKDEBUGGER_RESIZEBARSIZE);
canvas->drawRect(r, p);
this->INHERITED::onDraw(canvas);
}

View File

@ -13,73 +13,51 @@
#include "SkPaint.h"
#include "SkDebugDumper.h"
#include <deque>
#define SkDebugger_TextSize 14
#define SkDebugger_CommandType "SkDebugger_Command"
#define SkDebugger_StateType "SkDebugger_State"
#define SKDEBUGGER_COMMANDTYPE "SKDEBUGGER_COMMAND"
#define SKDEBUGGER_STATETYPE "SKDEBUGGER_STATE"
#define SkDebugger_Atom "SkDebugger_Atom"
#define SkDebugger_Matrix "SkDebugger_Matrix"
#define SkDebugger_Clip "SkDebugger_Clip"
#define SkDebugger_PaintInfo "SkDebugger_PaintInfo"
#define SkDebugger_Paint "SkDebugger_Paint"
#define SKDEBUGGER_ATOM "SKDEBUGGER_ATOM"
#define SKDEBUGGER_MATRIX "SKDEBUGGER_MATRIX"
#define SKDEBUGGER_CLIP "SKDEBUGGER_CLIP"
#define SKDEBUGGER_PAINTINFO "SKDEBUGGER_PAINTINFO"
#define SKDEBUGGER_PAINT "SKDEBUGGER_PAINT"
/*
* Debugger - Main Content
*/
class SkContentView : public SkView {
public:
SkContentView(SkEventSinkID clID, SkEventSinkID ipID);
~SkContentView();
void init();
void reinit(const char* fileName);
void toggleClip();
void goToAtom(int atom);
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onDraw(SkCanvas* canvas);
private:
SkColor fBGColor;
int fAtomsToRead;
std::deque<int> fAtomBounds;
std::deque<int> fFrameBounds;
bool fDisplayClip;
SkString fFilePath;
SkDebugDumper fDumper;
typedef SkView INHERITED;
};
#define SKDEBUGGER_TEXTSIZE 14
#define CMD_WIDTH 200
#define INFO_HEIGHT 150.0
#define SKDEBUGGER_HIGHLIGHTCOLOR 0xFF113399
#define SKDEBUGGER_TEXTCOLOR 0xFF000000
#define SKDEBUGGER_RESIZEBARCOLOR 0xFF333333
#define SKDEBUGGER_RESIZEBARSIZE 5
/*
* Debugger - Info Panel
*/
class SkInfoPanelView : public SkView {
class DebuggerStateView : public SkView {
public:
SkInfoPanelView();
DebuggerStateView();
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onDraw(SkCanvas* canvas);
private:
SkColor fBGColor;
SkPaint fPaint;
SkString fMatrix;
SkString fPaintInfo;
SkString fClip;
bool fResizing;
typedef SkView INHERITED;
};
/*
* Debugger - Commands List
*/
class SkCommandListView : public SkView {
class DebuggerCommandsView : public SkView {
public:
SkCommandListView();
void reinit();
DebuggerCommandsView();
~DebuggerCommandsView();
int nextItem();
int prevItem();
int scrollUp();
@ -100,8 +78,9 @@ private:
int fHighlight;
SkScalar fSpacing;
int fRange;
bool fResizing;
bool fCentered;
std::deque<SkString> fList;
SkTDArray<SkString*> fList;
typedef SkView INHERITED;
};

View File

@ -14,31 +14,16 @@
#include "SkColorFilter.h"
#include "SkPathEffect.h"
#include "SkMaskFilter.h"
#include "SkGradientShader.h"
#include "SkDebuggerViews.h"
bool gNeverSetToTrueJustNeedToFoolLinker;
static void init_effects() {
if (gNeverSetToTrueJustNeedToFoolLinker) {
SkPoint p = SkPoint::Make(0,0);
SkPoint q = SkPoint::Make(100,100);
SkPoint pts[] = {p, q};
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
SkScalar pos[] = { 0, 1.0};
SkGradientShader::CreateLinear(pts, colors, pos, 2,
SkShader::kMirror_TileMode);
}
}
#include "DebuggerViews.h"
SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID,
SkEventSinkID ipID) {
fContentID = cID;
fCommandListID = clID;
fInfoPanelID = ipID;
fCommandsID = clID;
fStateID = ipID;
fInit = false;
fDisabled = false;
fCount = 0;
init_effects();
}
static void appendPtr(SkString* str, const void* ptr, const char name[]) {
@ -52,14 +37,14 @@ static void appendFlattenable(SkString* str, const SkFlattenable* ptr,
if (ptr) {
SkString info;
if (ptr->toDumpString(&info)) {
str->appendf("%s", info.c_str());
str->appendf("%s\n", info.c_str());
} else {
str->appendf("%s: %p", name, ptr);
str->appendf("%s: %p\n", name, ptr);
}
}
}
static SkString dumpMatrix(SkDumpCanvasM* canvas) {
static SkString dumpMatrix(SkDumpCanvas* canvas) {
SkString str;
SkMatrix m = canvas->getTotalMatrix();
str.appendf("Matrix:");
@ -79,7 +64,7 @@ static SkString dumpMatrix(SkDumpCanvasM* canvas) {
return str;
}
static SkString dumpClip(SkDumpCanvasM* canvas) {
static SkString dumpClip(SkDumpCanvas* canvas) {
SkString str;
SkPath p;
int maxPts = 50;
@ -111,13 +96,12 @@ static const char* gPaintFlags[] = {
"LCD/Subpixel Glyph Rendering",
"Embedded Bitmap Text",
"Freetype Autohinting",
"ALL"
};
static SkString dumpPaint(SkDumpCanvasM* canvas, const SkPaint* p,
SkDumpCanvasM::Verb verb) {
static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p,
SkDumpCanvas::Verb verb) {
SkString str;
str.appendf("Color: #%08X\n", p->getColor());
str.appendf("Flags: %s\n", gPaintFlags[p->getFlags()]);
@ -128,7 +112,7 @@ static SkString dumpPaint(SkDumpCanvasM* canvas, const SkPaint* p,
appendFlattenable(&str, p->getPathEffect(), "pathEffect");
appendFlattenable(&str, p->getColorFilter(), "filter");
if (SkDumpCanvasM::kDrawText_Verb == verb) {
if (SkDumpCanvas::kDrawText_Verb == verb) {
str.appendf("Text Size:%0.4g\n", SkScalarToFloat(p->getTextSize()));
appendPtr(&str, p->getTypeface(), "typeface");
}
@ -136,7 +120,7 @@ static SkString dumpPaint(SkDumpCanvasM* canvas, const SkPaint* p,
return str;
}
void SkDebugDumper::dump(SkDumpCanvasM* canvas, SkDumpCanvasM::Verb verb,
void SkDebugDumper::dump(SkDumpCanvas* canvas, SkDumpCanvas::Verb verb,
const char str[], const SkPaint* p) {
if (!fDisabled) {
SkString msg, tab;
@ -150,19 +134,19 @@ void SkDebugDumper::dump(SkDumpCanvasM* canvas, SkDumpCanvasM::Verb verb,
msg.appendf("%03d: %s%s\n", fCount, tab.c_str(), str);
++fCount;
if (!fInit) {
SkEvent* cmd = new SkEvent(SkDebugger_CommandType);
cmd->setString(SkDebugger_Atom, msg);
cmd->post(fCommandListID, 100);
SkEvent* cmd = new SkEvent(SKDEBUGGER_COMMANDTYPE, fCommandsID);
cmd->setString(SKDEBUGGER_ATOM, msg);
cmd->postDelay(100);
}
else {
SkEvent* state = new SkEvent(SkDebugger_StateType);
state->setString(SkDebugger_Matrix, dumpMatrix(canvas));
state->setString(SkDebugger_Clip, dumpClip(canvas));
SkEvent* state = new SkEvent(SKDEBUGGER_STATETYPE, fStateID);
state->setString(SKDEBUGGER_MATRIX, dumpMatrix(canvas));
state->setString(SKDEBUGGER_CLIP, dumpClip(canvas));
if (p) {
state->setString(SkDebugger_PaintInfo, dumpPaint(canvas, p, verb));
state->getMetaData().setPtr(SkDebugger_Paint, (void*)p, PaintProc);
state->setString(SKDEBUGGER_PAINTINFO, dumpPaint(canvas, p, verb));
state->getMetaData().setPtr(SKDEBUGGER_PAINT, (void*)p, PaintProc);
}
state->post(fInfoPanelID);
state->post();
}
}
}

View File

@ -7,21 +7,18 @@
*/
#ifndef SkDebugDumper_DEFINED
#define SkDebugDumper_DEFINED
#include "SkDumpCanvasM.h"
#include "SkDumpCanvas.h"
#include "SkEvent.h"
class CommandListView;
class InfoPanelView;
class ContentView;
/** Formats the draw commands, and send them to a function-pointer provided
by the caller.
*/
class SkDebugDumper : public SkDumpCanvasM::Dumper {
class SkDebugDumper : public SkDumpCanvas::Dumper {
public:
SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID, SkEventSinkID ipID);
// override from baseclass that does the formatting, and in turn calls
// the function pointer that was passed to the constructor
virtual void dump(SkDumpCanvasM*, SkDumpCanvasM::Verb, const char str[],
virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
const SkPaint*);
void load() { fInit = true; };
@ -33,9 +30,9 @@ private:
bool fInit;
bool fDisabled;
SkEventSinkID fContentID;
SkEventSinkID fCommandListID;
SkEventSinkID fInfoPanelID;
SkEventSinkID fCommandsID;
SkEventSinkID fStateID;
typedef SkDumpCanvasM::Dumper INHERITED;
typedef SkDumpCanvas::Dumper INHERITED;
};
#endif

View File

@ -8,7 +8,32 @@
#include "SkColorPalette.h"
#include "SkOSMenu.h"
/**
* Drawing Client
*
* A drawing client that allows a user to perform simple brush stokes with
* a selected color and brush size. The drawing client communicates with a
* drawing server to send/receive data to/from other clients connected to the
* same server. The drawing client stores data in fData and fBuffer depending on
* the data type. Append type means that the drawing data is a completed stroke
* and Replace type means that the drawing data is in progress and will be
* replaced by subsequent data. fData and fBuffer are read by a pipe reader and
* reproduce the drawing. When the client is in a normal state, the data stored
* on the client and the server should be identical.
* The drawing client is also able to switch between vector and bitmap drawing.
* The drawing client also renders the latest drawing stroke locally in order to
* produce better reponses. This can be disabled by calling
* controller.disablePlayBack(), which will introduce a lag between the input
* and the drawing.
* Note: in order to keep up with the drawing data, the client will try to read
* a few times each frame in case more than one frame worth of data has been
* received and render them together. This behavior can be adjusted by tweaking
* MAX_READ_PER_FRAME or disabled by turning fSync to false
*/
#define MAX_READ_PER_FRAME 5
class DrawingClientView : public SampleView {
public:
DrawingClientView() {
@ -22,8 +47,8 @@ public:
fBrushSize = SkFloatToScalar(2.5);
fAA = false;
fPaletteVisible = true;
fSync = false;
fVector = false;
fSync = true;
fVector = true;
}
~DrawingClientView() {
if (fSocket) {
@ -35,11 +60,14 @@ public:
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Drawing Client");
menu->appendTextField("Server IP", "Server IP", this->getSinkID(), "IP address or hostname");
menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
"IP address or hostname");
menu->appendSwitch("Vector", "Vector", this->getSinkID(), fVector);
menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0, 100.0, fBrushSize);
menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0,
100.0, fBrushSize);
menu->appendSwitch("Anti-Aliasing", "AA", this->getSinkID(), fAA);
menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(), fPaletteVisible);
menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(),
fPaletteVisible);
menu->appendSwitch("Sync", "Sync", this->getSinkID(), fSync);
menu->appendAction("Clear", this->getSinkID());
}
@ -75,11 +103,11 @@ protected:
}
bool onEvent(const SkEvent& evt) {;
if (SkOSMenu::FindSliderValue(&evt, "Brush Size", &fBrushSize))
if (SkOSMenu::FindSliderValue(evt, "Brush Size", &fBrushSize))
return true;
SkString s;
if (SkOSMenu::FindText(&evt, "Server IP", &s)) {
if (SkOSMenu::FindText(evt, "Server IP", &s)) {
if (NULL != fSocket) {
delete fSocket;
}
@ -92,18 +120,18 @@ protected:
this->inval(NULL);
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "AA", &fAA) ||
SkOSMenu::FindSwitchState(&evt, "Sync", &fSync))
if (SkOSMenu::FindSwitchState(evt, "AA", &fAA) ||
SkOSMenu::FindSwitchState(evt, "Sync", &fSync))
return true;
if (SkOSMenu::FindSwitchState(&evt, "Vector", &fVector)) {
if (SkOSMenu::FindSwitchState(evt, "Vector", &fVector)) {
this->clearBitmap();
return true;
}
if (SkOSMenu::FindAction(&evt, "Clear")) {
if (SkOSMenu::FindAction(evt, "Clear")) {
this->clear();
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Palette", &fPaletteVisible)) {
if (SkOSMenu::FindSwitchState(evt, "Palette", &fPaletteVisible)) {
fPalette->setVisibleP(fPaletteVisible);
return true;
}
@ -150,6 +178,7 @@ protected:
fSocket->connectToServer();
}
size_t bytesRead = 0;
SkGPipeReader::Status status;
SkCanvas bufferCanvas(fBase);
SkCanvas* tempCanvas;
while (fTotalBytesRead < fData.count()) {
@ -158,7 +187,7 @@ protected:
else
tempCanvas = &bufferCanvas;
SkGPipeReader reader(tempCanvas);
SkGPipeReader::Status status = reader.playback(fData.begin() + fTotalBytesRead,
status = reader.playback(fData.begin() + fTotalBytesRead,
fData.count() - fTotalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != status);
@ -172,10 +201,10 @@ protected:
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
reader.playback(fBuffer.begin() + totalBytesRead,
status = reader.playback(fBuffer.begin() + totalBytesRead,
fBuffer.count() - totalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != status);
totalBytesRead += bytesRead;
}

View File

@ -7,6 +7,25 @@
#include "SkCornerPathEffect.h"
#include "SkOSMenu.h"
#include <map>
/**
* Drawing Server
*
* This simple drawing server can accept connections from multiple drawing
* clients simultaneously. It accumulates drawing data from each client each
* frame, stores it in the appropriate place, and then broadcasts incremental
* changes back to all the clients. Each logical packet, meaning one brush
* stoke in this case can be of two types, append and replace. Append types are
* completed strokes ready to be stored in the fData queue and will no longer be
* modified. Replace types are drawing operations that are still in progress on
* the client side, so they are appended to fBuffer. The location and size of
* the buffered data for each client is stored in a map and updated properly.
* Each time a new replace drawing call is received from a client, its previous
* buffered data is discarded.
* Since the Server keeps all the complete drawing data and the latest buffered
* data, it's able to switch between vector and bitmap drawing
*/
class DrawingServerView : public SampleView {
public:
DrawingServerView(){
@ -77,14 +96,12 @@ protected:
SkSocket::kPipeAppend_type);
fTotalBytesWritten = fData.count();
fServer->suspendWrite();
//this->clearBitmap();
}
else {
//other types of data
}
}
// overrides from SkEventSink
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Drawing Server");
@ -94,11 +111,11 @@ protected:
}
bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindAction(&evt, "Clear")) {
if (SkOSMenu::FindAction(evt, "Clear")) {
this->clear();
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Vector", &fVector)) {
if (SkOSMenu::FindSwitchState(evt, "Vector", &fVector)) {
this->clearBitmap();
return true;
}
@ -121,33 +138,35 @@ protected:
}
size_t bytesRead;
SkGPipeReader::Status stat;
SkCanvas bufferCanvas(fBase);
SkCanvas* tempCanvas;
while (fTotalBytesRead < fData.count()) {
if (fVector)
if (fVector) {
tempCanvas = canvas;
else
} else {
tempCanvas = &bufferCanvas;
}
SkGPipeReader reader(tempCanvas);
SkGPipeReader::Status stat = reader.playback(fData.begin() + fTotalBytesRead,
stat = reader.playback(fData.begin() + fTotalBytesRead,
fData.count() - fTotalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != stat);
fTotalBytesRead += bytesRead;
if (SkGPipeReader::kDone_Status == stat) {}
}
if (fVector)
if (fVector) {
fTotalBytesRead = 0;
else
} else {
canvas->drawBitmap(fBase, 0, 0, NULL);
}
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
reader.playback(fBuffer.begin() + totalBytesRead,
stat = reader.playback(fBuffer.begin() + totalBytesRead,
fBuffer.count() - totalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != stat);
totalBytesRead += bytesRead;
}
@ -159,7 +178,9 @@ protected:
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fBase.setConfig(SkBitmap::kARGB_8888_Config, this->width(), this->height());
fBase.setConfig(SkBitmap::kARGB_8888_Config,
this->width(),
this->height());
fBase.allocPixels(NULL);
this->clearBitmap();
}
@ -181,6 +202,7 @@ private:
int bufferBase;
int bufferSize;
};
std::map<int, ClientState*> fClientMap;
SkTDArray<char> fData;
SkTDArray<char> fBuffer;

View File

@ -6,12 +6,26 @@
#include "SkSockets.h"
#include "SkOSMenu.h"
#define MAX_READS_PER_FRAME 5
/**
* A simple networked pipe reader
*
* This view will connect to a user specified server, in this case meaning any
* Skia app that's has a SkTCPServer set up to broadcast its piped drawing data,
* received all the data transmitted and attempt to reproduce the drawing calls.
* This reader will only keep the latest batch of data. In order to keep up with
* the server, which may be producing data at a much higher rate than the reader
* is consuming, the reader will attempt multiple reads and only render the
* latest frame. this behavior can be adjusted by changing MAX_READS_PER_FRAME
* or disabled by setting fSync to false
*/
#define MAX_READS_PER_FRAME 12
class NetPipeReaderView : public SampleView {
public:
NetPipeReaderView() {
fSocket = NULL;
fSync = false;
fSync = true;
}
~NetPipeReaderView() {
@ -47,9 +61,9 @@ protected:
return this->INHERITED::onQuery(evt);
}
bool onEvent(const SkEvent& evt) {;
bool onEvent(const SkEvent& evt) {
SkString s;
if (SkOSMenu::FindText(&evt, "Server IP", &s)) {
if (SkOSMenu::FindText(evt, "Server IP", &s)) {
if (NULL != fSocket) {
delete fSocket;
}
@ -58,7 +72,7 @@ protected:
SkDebugf("Connecting to %s\n", s.c_str());
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Sync", &fSync))
if (SkOSMenu::FindSwitchState(evt, "Sync", &fSync))
return true;
return this->INHERITED::onEvent(evt);
}
@ -73,10 +87,17 @@ protected:
int numreads = 0;
while (fSocket->readPacket(readData, this) > 0 &&
numreads < MAX_READS_PER_FRAME) {
// at this point, new data has been read and stored, discard
// old data since it's not needed anymore
SkASSERT(fDataArray.count() > dataToRemove);
fDataArray.remove(0, dataToRemove);
dataToRemove = fDataArray.count();
++numreads;
}
// clean up if max reads reached
if (numreads == MAX_READS_PER_FRAME &&
fDataArray.count() > dataToRemove)
fDataArray.remove(0, dataToRemove);
}
else {
if (fSocket->readPacket(readData, this) > 0)
@ -102,7 +123,6 @@ private:
typedef SampleView INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
static SkView* MyFactory() { return new NetPipeReaderView; }

View File

@ -23,6 +23,7 @@ SkSocket::SkSocket() {
SkSocket::~SkSocket() {
this->closeSocket(fSockfd);
shutdown(fSockfd, 2); //stop sending/receiving
}
int SkSocket::createSocket() {
@ -49,7 +50,6 @@ void SkSocket::closeSocket(int sockfd) {
if (!fReady)
return;
shutdown(sockfd, 2); //stop sending/receiving
close(sockfd);
//SkDebugf("Closed fd:%d\n", sockfd);
@ -151,7 +151,7 @@ int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
}
if (failure) {
onRead(NULL, 0, i, h.type, context);
onRead(i, NULL, 0, h.type, context);
this->onFailedConnection(i);
continue;
}

View File

@ -52,8 +52,8 @@ public:
* For blocking sockets, write will block indefinitely if the socket at the
* other end of the connection doesn't receive any data.
* NOTE: This method guarantees that all of the data will be sent unless
* there was an error, so it might block temporarily when the write buffer
* is full
* there was an error, so it may block temporarily when the write buffer is
* full
*/
int writePacket(void* data, size_t size, DataType type = kPipeAppend_type);
@ -67,7 +67,7 @@ public:
* blocking sockets, read will block indefinitely if the socket doesn't
* receive any data.
* NOTE: This method guarantees that all the data in a logical packet will
* be read so there might be temporary delays if it's waiting for parts of a
* be read so it may block temporarily if it's waiting for parts of a
* packet
*/
int readPacket(void (*onRead)(int cid, const void* data, size_t size,

View File

@ -38,7 +38,7 @@
- (NSUInteger)convertPathToIndex:(NSIndexPath*)path {
NSUInteger index = 0;
for (NSInteger i = 0; i < path.section; ++i) {
index += (*fMenus)[i]->countItems();
index += (*fMenus)[i]->getCount();
}
return index + path.row;
}
@ -57,7 +57,7 @@
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
NSUInteger first = 0;
for (NSInteger i = 0; i < menuIndex; ++i) {
first += (*fMenus)[i]->countItems();
first += (*fMenus)[i]->getCount();
}
[fItems removeObjectsInRange:NSMakeRange(first, [fItems count] - first)];
[self loadMenu:menu];
@ -66,8 +66,10 @@
}
- (void)loadMenu:(const SkOSMenu*)menu {
for (int i = 0; i < menu->countItems(); ++i) {
const SkOSMenu::Item* item = menu->getItem(i);
const SkOSMenu::Item* menuitems[menu->getCount()];
menu->getItems(menuitems);
for (int i = 0; i < menu->getCount(); ++i) {
const SkOSMenu::Item* item = menuitems[i];
NSString* title = [NSString stringWithUTF8String:item->getLabel()];
if (SkOSMenu::kList_Type == item->getType()) {
@ -78,12 +80,12 @@
List.fOptions = [[SkOptionListController alloc] initWithStyle:UITableViewStyleGrouped];
int count = 0;
SkOSMenu::FindListItemCount(item->getEvent(), &count);
SkOSMenu::FindListItemCount(*item->getEvent(), &count);
SkString options[count];
SkOSMenu::FindListItems(item->getEvent(), options);
SkOSMenu::FindListItems(*item->getEvent(), options);
for (int i = 0; i < count; ++i)
[List.fOptions addOption:[NSString stringWithUTF8String:options[i].c_str()]];
SkOSMenu::FindListIndex(item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value);
List.fOptions.fSelectedIndex = value;
List.fCell = [self createList:title
@ -104,25 +106,25 @@
option.fCell = [self createAction:title];
break;
case SkOSMenu::kSwitch_Type:
SkOSMenu::FindSwitchState(item->getEvent(), item->getSlotName(), &state);
SkOSMenu::FindSwitchState(*item->getEvent(), item->getSlotName(), &state);
option.fCell = [self createSwitch:title default:(BOOL)state];
break;
case SkOSMenu::kSlider_Type:
SkScalar min, max, value;
SkOSMenu::FindSliderValue(item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindSliderMin(item->getEvent(), &min);
SkOSMenu::FindSliderMax(item->getEvent(), &max);
SkOSMenu::FindSliderValue(*item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindSliderMin(*item->getEvent(), &min);
SkOSMenu::FindSliderMax(*item->getEvent(), &max);
option.fCell = [self createSlider:title
min:min
max:max
default:value];
break;
case SkOSMenu::kTriState_Type:
SkOSMenu::FindTriState(item->getEvent(), item->getSlotName(), &tristate);
SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate);
option.fCell = [self createTriState:title default:(int)tristate];
break;
case SkOSMenu::kTextField_Type:
SkOSMenu::FindText(item->getEvent(), item->getSlotName(), &str);
SkOSMenu::FindText(*item->getEvent(), item->getSlotName(), &str);
option.fCell = [self createTextField:title
default:[NSString stringWithUTF8String:str.c_str()]];
break;
@ -142,26 +144,31 @@
if ([sender isKindOfClass:[UISlider class]]) {//Slider
UISlider* slider = (UISlider *)sender;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%1.1f", slider.value];
item.fItem->postEventWithScalar(slider.value);
item.fItem->setScalar(slider.value);
}
else if ([sender isKindOfClass:[UISwitch class]]) {//Switch
UISwitch* switch_ = (UISwitch *)sender;
item.fItem->postEventWithBool(switch_.on);
item.fItem->setBool(switch_.on);
}
else if ([sender isKindOfClass:[UITextField class]]) { //TextField
UITextField* textField = (UITextField *)sender;
[textField resignFirstResponder];
item.fItem->postEventWithString([textField.text UTF8String]);
item.fItem->setString([textField.text UTF8String]);
}
else if ([sender isKindOfClass:[UISegmentedControl class]]) { //Action
UISegmentedControl* segmented = (UISegmentedControl *)sender;
item.fItem->postEventWithInt((2 == segmented.selectedSegmentIndex) ?
SkOSMenu::kMixedState :
segmented.selectedSegmentIndex);
SkOSMenu::TriState state;
if (2 == segmented.selectedSegmentIndex) {
state = SkOSMenu::kMixedState;
} else {
state = (SkOSMenu::TriState)segmented.selectedSegmentIndex;
}
item.fItem->setTriState(state);
}
else{
NSLog(@"unknown");
}
item.fItem->postEvent();
}
- (UITableViewCell*)createAction:(NSString*)title {
@ -272,7 +279,7 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return (*fMenus)[section]->countItems();
return (*fMenus)[section]->getCount();
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@ -314,7 +321,8 @@
if (self == viewController) { //when a List option is popped, trigger event
NSString* selectedOption = [fCurrentList.fOptions getSelectedOption];
fCurrentList.fCell.detailTextLabel.text = selectedOption;
fCurrentList.fItem->postEventWithInt(fCurrentList.fOptions.fSelectedIndex);
fCurrentList.fItem->setInt(fCurrentList.fOptions.fSelectedIndex);
fCurrentList.fItem->postEvent();
}
}

View File

@ -1,4 +1,3 @@
#import "SkAlertPrompt.h"
#import "SkUIDetailViewController.h"
#include "SampleApp.h"
#include "SkCGUtils.h"

View File

@ -5,7 +5,7 @@
#define SKGL_CONFIG kEAGLColorFormatRGB565
//#define SKGL_CONFIG kEAGLColorFormatRGBA8
//#define FORCE_REDRAW
#define FORCE_REDRAW
//#define USE_GL_1
#define USE_GL_2

View File

@ -9,92 +9,51 @@
/* Begin PBXBuildFile section */
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
260E00D513B11F5B0064D447 /* bitmapfilters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001513B11F5B0064D447 /* bitmapfilters.cpp */; };
260E00D613B11F5B0064D447 /* blurs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001613B11F5B0064D447 /* blurs.cpp */; };
260E00D713B11F5B0064D447 /* complexclip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001713B11F5B0064D447 /* complexclip.cpp */; };
260E00D813B11F5B0064D447 /* filltypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001813B11F5B0064D447 /* filltypes.cpp */; };
260E00D913B11F5B0064D447 /* gradients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001A13B11F5B0064D447 /* gradients.cpp */; };
260E00DA13B11F5B0064D447 /* nocolorbleed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001B13B11F5B0064D447 /* nocolorbleed.cpp */; };
260E00DB13B11F5B0064D447 /* points.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001C13B11F5B0064D447 /* points.cpp */; };
260E00DC13B11F5B0064D447 /* poly2poly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001D13B11F5B0064D447 /* poly2poly.cpp */; };
260E00DD13B11F5B0064D447 /* shadertext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001E13B11F5B0064D447 /* shadertext.cpp */; };
260E00DE13B11F5B0064D447 /* shadows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001F13B11F5B0064D447 /* shadows.cpp */; };
260E00DF13B11F5B0064D447 /* shapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002013B11F5B0064D447 /* shapes.cpp */; };
260E00E013B11F5B0064D447 /* tilemodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002113B11F5B0064D447 /* tilemodes.cpp */; };
260E00E113B11F5B0064D447 /* xfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002213B11F5B0064D447 /* xfermodes.cpp */; };
2605F44213F18B1B0044A072 /* DebuggerView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F43C13F18B1B0044A072 /* DebuggerView.cpp */; };
2605F44313F18B1B0044A072 /* DebuggerCommandsView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F43E13F18B1B0044A072 /* DebuggerCommandsView.cpp */; };
2605F44413F18B1B0044A072 /* SkDebugDumper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F43F13F18B1B0044A072 /* SkDebugDumper.cpp */; };
2605F44513F18B1B0044A072 /* DebuggerStateView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F44113F18B1B0044A072 /* DebuggerStateView.cpp */; };
2605F65D13F19D1D0044A072 /* SamplePicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005913B11F5B0064D447 /* SamplePicture.cpp */; };
2605F66513F19EB80044A072 /* GrStencilBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F66413F19EB80044A072 /* GrStencilBuffer.cpp */; };
2605F83013F1AE4B0044A072 /* xfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002213B11F5B0064D447 /* xfermodes.cpp */; };
2605F83113F1AE4C0044A072 /* tilemodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002113B11F5B0064D447 /* tilemodes.cpp */; };
2605F83213F1AE4C0044A072 /* shapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002013B11F5B0064D447 /* shapes.cpp */; };
2605F83313F1AE4D0044A072 /* shadows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001F13B11F5B0064D447 /* shadows.cpp */; };
2605F83413F1AE4D0044A072 /* shadertext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001E13B11F5B0064D447 /* shadertext.cpp */; };
2605F83513F1AE4E0044A072 /* poly2poly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001D13B11F5B0064D447 /* poly2poly.cpp */; };
2605F83613F1AE4F0044A072 /* nocolorbleed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001B13B11F5B0064D447 /* nocolorbleed.cpp */; };
2605F83713F1AE500044A072 /* points.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001C13B11F5B0064D447 /* points.cpp */; };
2605F83813F1AE500044A072 /* gradients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001A13B11F5B0064D447 /* gradients.cpp */; };
2605F83913F1AE510044A072 /* filltypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001813B11F5B0064D447 /* filltypes.cpp */; };
2605F83A13F1AE520044A072 /* complexclip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001713B11F5B0064D447 /* complexclip.cpp */; };
2605F83B13F1AE520044A072 /* blurs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001613B11F5B0064D447 /* blurs.cpp */; };
2605F83C13F1AE530044A072 /* bitmapfilters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E001513B11F5B0064D447 /* bitmapfilters.cpp */; };
260E00E313B11F5B0064D447 /* OverView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002513B11F5B0064D447 /* OverView.cpp */; };
260E00E413B11F5B0064D447 /* SampleAARects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002613B11F5B0064D447 /* SampleAARects.cpp */; };
260E00E513B11F5B0064D447 /* SampleAll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002713B11F5B0064D447 /* SampleAll.cpp */; };
260E00E613B11F5B0064D447 /* SampleAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002813B11F5B0064D447 /* SampleAnimator.cpp */; };
260E00E813B11F5B0064D447 /* SampleArc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002A13B11F5B0064D447 /* SampleArc.cpp */; };
260E00E913B11F5B0064D447 /* SampleAvoid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002B13B11F5B0064D447 /* SampleAvoid.cpp */; };
260E00EA13B11F5B0064D447 /* SampleBigGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002C13B11F5B0064D447 /* SampleBigGradient.cpp */; };
260E00EB13B11F5B0064D447 /* SampleBitmapRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002D13B11F5B0064D447 /* SampleBitmapRect.cpp */; };
260E00EC13B11F5B0064D447 /* SampleBlur.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002E13B11F5B0064D447 /* SampleBlur.cpp */; };
260E00ED13B11F5B0064D447 /* SampleCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E002F13B11F5B0064D447 /* SampleCamera.cpp */; };
260E00EE13B11F5B0064D447 /* SampleCircle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003013B11F5B0064D447 /* SampleCircle.cpp */; };
260E00EF13B11F5B0064D447 /* SampleColorFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003213B11F5B0064D447 /* SampleColorFilter.cpp */; };
260E00F013B11F5B0064D447 /* SampleComplexClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003313B11F5B0064D447 /* SampleComplexClip.cpp */; };
260E00F113B11F5B0064D447 /* SampleConcavePaths.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003413B11F5B0064D447 /* SampleConcavePaths.cpp */; };
260E00F213B11F5B0064D447 /* SampleCull.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003513B11F5B0064D447 /* SampleCull.cpp */; };
260E00F313B11F5B0064D447 /* SampleDecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003613B11F5B0064D447 /* SampleDecode.cpp */; };
260E00F413B11F5B0064D447 /* SampleDither.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003713B11F5B0064D447 /* SampleDither.cpp */; };
260E00F513B11F5B0064D447 /* SampleDitherBitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003813B11F5B0064D447 /* SampleDitherBitmap.cpp */; };
260E00F613B11F5B0064D447 /* SampleDrawLooper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003913B11F5B0064D447 /* SampleDrawLooper.cpp */; };
260E00F713B11F5B0064D447 /* SampleEffects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003A13B11F5B0064D447 /* SampleEffects.cpp */; };
260E00F813B11F5B0064D447 /* SampleEmboss.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003B13B11F5B0064D447 /* SampleEmboss.cpp */; };
260E00F913B11F5B0064D447 /* SampleEncode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003C13B11F5B0064D447 /* SampleEncode.cpp */; };
260E00FA13B11F5B0064D447 /* SampleExtractAlpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003D13B11F5B0064D447 /* SampleExtractAlpha.cpp */; };
260E00FB13B11F5B0064D447 /* SampleFillType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003E13B11F5B0064D447 /* SampleFillType.cpp */; };
260E00FC13B11F5B0064D447 /* SampleFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E003F13B11F5B0064D447 /* SampleFilter.cpp */; };
260E00FD13B11F5B0064D447 /* SampleFilter2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004013B11F5B0064D447 /* SampleFilter2.cpp */; };
260E00FE13B11F5B0064D447 /* SampleFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004113B11F5B0064D447 /* SampleFontCache.cpp */; };
260E010213B11F5B0064D447 /* SampleGradients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004513B11F5B0064D447 /* SampleGradients.cpp */; };
260E010313B11F5B0064D447 /* SampleHairline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004613B11F5B0064D447 /* SampleHairline.cpp */; };
260E010413B11F5B0064D447 /* SampleImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004713B11F5B0064D447 /* SampleImage.cpp */; };
260E010513B11F5B0064D447 /* SampleImageDir.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004813B11F5B0064D447 /* SampleImageDir.cpp */; };
260E010613B11F5B0064D447 /* SampleLCD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004913B11F5B0064D447 /* SampleLCD.cpp */; };
260E010713B11F5B0064D447 /* SampleLayerMask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004A13B11F5B0064D447 /* SampleLayerMask.cpp */; };
260E010813B11F5B0064D447 /* SampleLayers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004B13B11F5B0064D447 /* SampleLayers.cpp */; };
260E010913B11F5B0064D447 /* SampleLineClipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004C13B11F5B0064D447 /* SampleLineClipper.cpp */; };
260E010A13B11F5B0064D447 /* SampleLines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004D13B11F5B0064D447 /* SampleLines.cpp */; };
260E010B13B11F5B0064D447 /* SampleMeasure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004E13B11F5B0064D447 /* SampleMeasure.cpp */; };
260E010C13B11F5B0064D447 /* SampleMipMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004F13B11F5B0064D447 /* SampleMipMap.cpp */; };
260E010D13B11F5B0064D447 /* SampleMovie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005013B11F5B0064D447 /* SampleMovie.cpp */; };
260E010E13B11F5B0064D447 /* SampleNinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005113B11F5B0064D447 /* SampleNinePatch.cpp */; };
260E010F13B11F5B0064D447 /* SampleOvalTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005213B11F5B0064D447 /* SampleOvalTest.cpp */; };
260E011013B11F5B0064D447 /* SampleOverflow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005313B11F5B0064D447 /* SampleOverflow.cpp */; };
260E011113B11F5B0064D447 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005413B11F5B0064D447 /* SamplePageFlip.cpp */; };
260E011213B11F5B0064D447 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005513B11F5B0064D447 /* SamplePatch.cpp */; };
260E011313B11F5B0064D447 /* SamplePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005613B11F5B0064D447 /* SamplePath.cpp */; };
260E011413B11F5B0064D447 /* SamplePathClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005713B11F5B0064D447 /* SamplePathClip.cpp */; };
260E011513B11F5B0064D447 /* SamplePathEffects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005813B11F5B0064D447 /* SamplePathEffects.cpp */; };
260E011613B11F5B0064D447 /* SamplePicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005913B11F5B0064D447 /* SamplePicture.cpp */; };
260E011713B11F5B0064D447 /* SamplePoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005A13B11F5B0064D447 /* SamplePoints.cpp */; };
260E011813B11F5B0064D447 /* SamplePolyToPoly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005B13B11F5B0064D447 /* SamplePolyToPoly.cpp */; };
260E011913B11F5B0064D447 /* SampleRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005C13B11F5B0064D447 /* SampleRegion.cpp */; };
260E011A13B11F5B0064D447 /* SampleRepeatTile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005D13B11F5B0064D447 /* SampleRepeatTile.cpp */; };
260E011B13B11F5B0064D447 /* SampleShaderText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005E13B11F5B0064D447 /* SampleShaderText.cpp */; };
260E011C13B11F5B0064D447 /* SampleShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E005F13B11F5B0064D447 /* SampleShaders.cpp */; };
260E011D13B11F5B0064D447 /* SampleShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006013B11F5B0064D447 /* SampleShapes.cpp */; };
260E011E13B11F5B0064D447 /* SampleSkLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006113B11F5B0064D447 /* SampleSkLayer.cpp */; };
260E011F13B11F5B0064D447 /* SampleSlides.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006213B11F5B0064D447 /* SampleSlides.cpp */; };
260E012013B11F5B0064D447 /* SampleStrokePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006313B11F5B0064D447 /* SampleStrokePath.cpp */; };
260E012113B11F5B0064D447 /* SampleStrokeText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006413B11F5B0064D447 /* SampleStrokeText.cpp */; };
260E012313B11F5B0064D447 /* SampleText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006613B11F5B0064D447 /* SampleText.cpp */; };
260E012413B11F5B0064D447 /* SampleTextAlpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006713B11F5B0064D447 /* SampleTextAlpha.cpp */; };
260E012513B11F5B0064D447 /* SampleTextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006813B11F5B0064D447 /* SampleTextBox.cpp */; };
260E012613B11F5B0064D447 /* SampleTextEffects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006913B11F5B0064D447 /* SampleTextEffects.cpp */; };
260E012713B11F5B0064D447 /* SampleTextOnPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006A13B11F5B0064D447 /* SampleTextOnPath.cpp */; };
260E012813B11F5B0064D447 /* SampleTextureDomain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006B13B11F5B0064D447 /* SampleTextureDomain.cpp */; };
260E012913B11F5B0064D447 /* SampleTiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006C13B11F5B0064D447 /* SampleTiling.cpp */; };
260E012A13B11F5B0064D447 /* SampleTinyBitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006D13B11F5B0064D447 /* SampleTinyBitmap.cpp */; };
260E012B13B11F5B0064D447 /* SampleTriangles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006E13B11F5B0064D447 /* SampleTriangles.cpp */; };
260E012C13B11F5B0064D447 /* SampleTypeface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E006F13B11F5B0064D447 /* SampleTypeface.cpp */; };
260E012D13B11F5B0064D447 /* SampleUnitMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007013B11F5B0064D447 /* SampleUnitMapper.cpp */; };
260E012E13B11F5B0064D447 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007113B11F5B0064D447 /* SampleVertices.cpp */; };
260E012F13B11F5B0064D447 /* SampleXfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007213B11F5B0064D447 /* SampleXfermodes.cpp */; };
260E013013B11F5B0064D447 /* SampleXfermodesBlur.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007313B11F5B0064D447 /* SampleXfermodesBlur.cpp */; };
260E013113B11F5B0064D447 /* SkGPipeRead.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007513B11F5B0064D447 /* SkGPipeRead.cpp */; };
260E013213B11F5B0064D447 /* SkGPipeWrite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E007613B11F5B0064D447 /* SkGPipeWrite.cpp */; };
260E02A213B1225D0064D447 /* Sk64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E020C13B1225D0064D447 /* Sk64.cpp */; };
@ -410,8 +369,6 @@
260E095813B134C90064D447 /* GrDrawMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E095613B134C90064D447 /* GrDrawMesh.cpp */; };
260E147913B2734E0064D447 /* SkUISplitViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 260E147813B2734E0064D447 /* SkUISplitViewController.mm */; };
260E16E613B2853F0064D447 /* SampleGM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004413B11F5B0064D447 /* SampleGM.cpp */; };
260E16F013B285540064D447 /* SampleFuzz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004313B11F5B0064D447 /* SampleFuzz.cpp */; };
260E16F213B285570064D447 /* SampleFontScalerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E004213B11F5B0064D447 /* SampleFontScalerTest.cpp */; };
260E1DCD13B3AA490064D447 /* SkUINavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 260E1DCB13B3AA490064D447 /* SkUINavigationController.mm */; };
260E1EA213B3B15A0064D447 /* SkPDFCatalog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E1E9613B3B15A0064D447 /* SkPDFCatalog.cpp */; };
260E1EA313B3B15A0064D447 /* SkPDFDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E1E9713B3B15A0064D447 /* SkPDFDevice.cpp */; };
@ -429,6 +386,7 @@
260EF18513AFD62E0064D447 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260EF18413AFD62E0064D447 /* CoreText.framework */; };
260EF2B013AFDBD30064D447 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
263BE75813CCC7BF00CCE991 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 263BE75713CCC7BF00CCE991 /* QuartzCore.framework */; };
2645945F13F34FB100DCF534 /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2645945E13F34FB100DCF534 /* test.cpp */; };
26591EB913EB16EB000DA8A8 /* TransitionView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26591EB813EB16EB000DA8A8 /* TransitionView.cpp */; };
265C7DE313D75752008329F6 /* SkOptionListController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 265C7DE213D75752008329F6 /* SkOptionListController.mm */; };
2662AB7013BD067900CDE7E9 /* SkiOSSampleApp-Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 2662AB6F13BD067900CDE7E9 /* SkiOSSampleApp-Debug.xcconfig */; };
@ -440,7 +398,6 @@
268C50D613F022820003FF9A /* SkColorPalette.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50D213F022820003FF9A /* SkColorPalette.cpp */; };
268C50D713F022820003FF9A /* SkNetPipeController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50D413F022820003FF9A /* SkNetPipeController.cpp */; };
268C50DA13F022AF0003FF9A /* SampleDrawingClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50D813F022AF0003FF9A /* SampleDrawingClient.cpp */; };
268C50DB13F022AF0003FF9A /* SampleDrawingServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50D913F022AF0003FF9A /* SampleDrawingServer.cpp */; };
268C50DF13F0230C0003FF9A /* SampleNetPipeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50DC13F0230C0003FF9A /* SampleNetPipeReader.cpp */; };
268C50E013F0230C0003FF9A /* SkSockets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268C50DD13F0230C0003FF9A /* SkSockets.cpp */; };
26962B2313CDF6A00039B1FB /* SkOSFile_iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 260EE8BB13AFA7790064D447 /* SkOSFile_iOS.mm */; };
@ -482,6 +439,13 @@
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* iOSSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2605F43C13F18B1B0044A072 /* DebuggerView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerView.cpp; sourceTree = "<group>"; };
2605F43D13F18B1B0044A072 /* DebuggerViews.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerViews.h; sourceTree = "<group>"; };
2605F43E13F18B1B0044A072 /* DebuggerCommandsView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerCommandsView.cpp; sourceTree = "<group>"; };
2605F43F13F18B1B0044A072 /* SkDebugDumper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkDebugDumper.cpp; sourceTree = "<group>"; };
2605F44013F18B1B0044A072 /* SkDebugDumper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkDebugDumper.h; sourceTree = "<group>"; };
2605F44113F18B1B0044A072 /* DebuggerStateView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerStateView.cpp; sourceTree = "<group>"; };
2605F66413F19EB80044A072 /* GrStencilBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrStencilBuffer.cpp; sourceTree = "<group>"; };
260E001513B11F5B0064D447 /* bitmapfilters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bitmapfilters.cpp; sourceTree = "<group>"; };
260E001613B11F5B0064D447 /* blurs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = blurs.cpp; sourceTree = "<group>"; };
260E001713B11F5B0064D447 /* complexclip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = complexclip.cpp; sourceTree = "<group>"; };
@ -1327,6 +1291,7 @@
260EE9D113AFA7850064D447 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
260EF18413AFD62E0064D447 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
263BE75713CCC7BF00CCE991 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
2645945E13F34FB100DCF534 /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test.cpp; sourceTree = SOURCE_ROOT; };
26591EB813EB16EB000DA8A8 /* TransitionView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransitionView.cpp; sourceTree = "<group>"; };
265C7DE113D75752008329F6 /* SkOptionListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkOptionListController.h; path = Shared/SkOptionListController.h; sourceTree = "<group>"; };
265C7DE213D75752008329F6 /* SkOptionListController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SkOptionListController.mm; path = Shared/SkOptionListController.mm; sourceTree = "<group>"; };
@ -1434,6 +1399,20 @@
name = Products;
sourceTree = "<group>";
};
2605F43B13F18B1B0044A072 /* Debugger */ = {
isa = PBXGroup;
children = (
2605F43C13F18B1B0044A072 /* DebuggerView.cpp */,
2605F43D13F18B1B0044A072 /* DebuggerViews.h */,
2605F43E13F18B1B0044A072 /* DebuggerCommandsView.cpp */,
2605F43F13F18B1B0044A072 /* SkDebugDumper.cpp */,
2605F44013F18B1B0044A072 /* SkDebugDumper.h */,
2605F44113F18B1B0044A072 /* DebuggerStateView.cpp */,
);
name = Debugger;
path = ../Debugger;
sourceTree = SOURCE_ROOT;
};
260E001413B11F5B0064D447 /* gm */ = {
isa = PBXGroup;
children = (
@ -1459,6 +1438,7 @@
260E002313B11F5B0064D447 /* samplecode */ = {
isa = PBXGroup;
children = (
2645945E13F34FB100DCF534 /* test.cpp */,
26591EB813EB16EB000DA8A8 /* TransitionView.cpp */,
260E002413B11F5B0064D447 /* ClockFaceView.cpp */,
260E002513B11F5B0064D447 /* OverView.cpp */,
@ -2028,6 +2008,7 @@
260E03C813B122D40064D447 /* src */ = {
isa = PBXGroup;
children = (
2605F66413F19EB80044A072 /* GrStencilBuffer.cpp */,
26FB12B313E70D51001AFF6D /* GrRenderTarget.cpp */,
26FB12AD13E70D3B001AFF6D /* GrGLRenderTarget.cpp */,
26FB12AE13E70D3B001AFF6D /* GrGLRenderTarget.h */,
@ -2822,6 +2803,7 @@
26962C8E13CE25D60039B1FB /* iOSSampleApp_Prefix.pch */,
26962C8F13CE25D60039B1FB /* iOSSampleApp-Info.plist */,
26962CC813CE27390039B1FB /* xcconfig */,
2605F43B13F18B1B0044A072 /* Debugger */,
26F67B2A13CB3564005DDCD2 /* Networking */,
26962CE713CE29120039B1FB /* DrawingBoard */,
260EE8B913AFA7790064D447 /* iOS */,
@ -2912,92 +2894,32 @@
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
2860E328111B887F00E27156 /* AppDelegate_iPhone.mm in Sources */,
2860E32E111B888700E27156 /* AppDelegate_iPad.mm in Sources */,
260E00D513B11F5B0064D447 /* bitmapfilters.cpp in Sources */,
260E00D613B11F5B0064D447 /* blurs.cpp in Sources */,
260E00D713B11F5B0064D447 /* complexclip.cpp in Sources */,
260E00D813B11F5B0064D447 /* filltypes.cpp in Sources */,
260E00D913B11F5B0064D447 /* gradients.cpp in Sources */,
260E00DA13B11F5B0064D447 /* nocolorbleed.cpp in Sources */,
260E00DB13B11F5B0064D447 /* points.cpp in Sources */,
260E00DC13B11F5B0064D447 /* poly2poly.cpp in Sources */,
260E00DD13B11F5B0064D447 /* shadertext.cpp in Sources */,
260E00DE13B11F5B0064D447 /* shadows.cpp in Sources */,
260E00DF13B11F5B0064D447 /* shapes.cpp in Sources */,
260E00E013B11F5B0064D447 /* tilemodes.cpp in Sources */,
260E00E113B11F5B0064D447 /* xfermodes.cpp in Sources */,
260E00E313B11F5B0064D447 /* OverView.cpp in Sources */,
260E00E413B11F5B0064D447 /* SampleAARects.cpp in Sources */,
260E00E513B11F5B0064D447 /* SampleAll.cpp in Sources */,
260E00E613B11F5B0064D447 /* SampleAnimator.cpp in Sources */,
260E00E813B11F5B0064D447 /* SampleArc.cpp in Sources */,
260E00E913B11F5B0064D447 /* SampleAvoid.cpp in Sources */,
260E00EA13B11F5B0064D447 /* SampleBigGradient.cpp in Sources */,
260E00EB13B11F5B0064D447 /* SampleBitmapRect.cpp in Sources */,
260E00EC13B11F5B0064D447 /* SampleBlur.cpp in Sources */,
260E00ED13B11F5B0064D447 /* SampleCamera.cpp in Sources */,
260E00EE13B11F5B0064D447 /* SampleCircle.cpp in Sources */,
260E00EF13B11F5B0064D447 /* SampleColorFilter.cpp in Sources */,
260E00F013B11F5B0064D447 /* SampleComplexClip.cpp in Sources */,
260E00F113B11F5B0064D447 /* SampleConcavePaths.cpp in Sources */,
260E00F213B11F5B0064D447 /* SampleCull.cpp in Sources */,
260E00F313B11F5B0064D447 /* SampleDecode.cpp in Sources */,
260E00F413B11F5B0064D447 /* SampleDither.cpp in Sources */,
260E00F513B11F5B0064D447 /* SampleDitherBitmap.cpp in Sources */,
260E00F613B11F5B0064D447 /* SampleDrawLooper.cpp in Sources */,
260E00F713B11F5B0064D447 /* SampleEffects.cpp in Sources */,
260E00F813B11F5B0064D447 /* SampleEmboss.cpp in Sources */,
260E00F913B11F5B0064D447 /* SampleEncode.cpp in Sources */,
260E00FA13B11F5B0064D447 /* SampleExtractAlpha.cpp in Sources */,
260E00FB13B11F5B0064D447 /* SampleFillType.cpp in Sources */,
260E00FC13B11F5B0064D447 /* SampleFilter.cpp in Sources */,
260E00FD13B11F5B0064D447 /* SampleFilter2.cpp in Sources */,
260E00FE13B11F5B0064D447 /* SampleFontCache.cpp in Sources */,
260E010213B11F5B0064D447 /* SampleGradients.cpp in Sources */,
260E010313B11F5B0064D447 /* SampleHairline.cpp in Sources */,
260E010413B11F5B0064D447 /* SampleImage.cpp in Sources */,
260E010513B11F5B0064D447 /* SampleImageDir.cpp in Sources */,
260E010613B11F5B0064D447 /* SampleLCD.cpp in Sources */,
260E010713B11F5B0064D447 /* SampleLayerMask.cpp in Sources */,
260E010813B11F5B0064D447 /* SampleLayers.cpp in Sources */,
260E010913B11F5B0064D447 /* SampleLineClipper.cpp in Sources */,
260E010A13B11F5B0064D447 /* SampleLines.cpp in Sources */,
260E010B13B11F5B0064D447 /* SampleMeasure.cpp in Sources */,
260E010C13B11F5B0064D447 /* SampleMipMap.cpp in Sources */,
260E010D13B11F5B0064D447 /* SampleMovie.cpp in Sources */,
260E010E13B11F5B0064D447 /* SampleNinePatch.cpp in Sources */,
260E010F13B11F5B0064D447 /* SampleOvalTest.cpp in Sources */,
260E011013B11F5B0064D447 /* SampleOverflow.cpp in Sources */,
260E011113B11F5B0064D447 /* SamplePageFlip.cpp in Sources */,
260E011213B11F5B0064D447 /* SamplePatch.cpp in Sources */,
260E011313B11F5B0064D447 /* SamplePath.cpp in Sources */,
260E011413B11F5B0064D447 /* SamplePathClip.cpp in Sources */,
260E011513B11F5B0064D447 /* SamplePathEffects.cpp in Sources */,
260E011613B11F5B0064D447 /* SamplePicture.cpp in Sources */,
260E011713B11F5B0064D447 /* SamplePoints.cpp in Sources */,
260E011813B11F5B0064D447 /* SamplePolyToPoly.cpp in Sources */,
260E011913B11F5B0064D447 /* SampleRegion.cpp in Sources */,
260E011A13B11F5B0064D447 /* SampleRepeatTile.cpp in Sources */,
260E011B13B11F5B0064D447 /* SampleShaderText.cpp in Sources */,
260E011C13B11F5B0064D447 /* SampleShaders.cpp in Sources */,
260E011D13B11F5B0064D447 /* SampleShapes.cpp in Sources */,
260E011E13B11F5B0064D447 /* SampleSkLayer.cpp in Sources */,
260E011F13B11F5B0064D447 /* SampleSlides.cpp in Sources */,
260E012013B11F5B0064D447 /* SampleStrokePath.cpp in Sources */,
260E012113B11F5B0064D447 /* SampleStrokeText.cpp in Sources */,
260E012313B11F5B0064D447 /* SampleText.cpp in Sources */,
260E012413B11F5B0064D447 /* SampleTextAlpha.cpp in Sources */,
260E012513B11F5B0064D447 /* SampleTextBox.cpp in Sources */,
260E012613B11F5B0064D447 /* SampleTextEffects.cpp in Sources */,
260E012713B11F5B0064D447 /* SampleTextOnPath.cpp in Sources */,
260E012813B11F5B0064D447 /* SampleTextureDomain.cpp in Sources */,
260E012913B11F5B0064D447 /* SampleTiling.cpp in Sources */,
260E012A13B11F5B0064D447 /* SampleTinyBitmap.cpp in Sources */,
260E012B13B11F5B0064D447 /* SampleTriangles.cpp in Sources */,
260E012C13B11F5B0064D447 /* SampleTypeface.cpp in Sources */,
260E012D13B11F5B0064D447 /* SampleUnitMapper.cpp in Sources */,
260E012E13B11F5B0064D447 /* SampleVertices.cpp in Sources */,
260E012F13B11F5B0064D447 /* SampleXfermodes.cpp in Sources */,
260E013013B11F5B0064D447 /* SampleXfermodesBlur.cpp in Sources */,
260E013113B11F5B0064D447 /* SkGPipeRead.cpp in Sources */,
260E013213B11F5B0064D447 /* SkGPipeWrite.cpp in Sources */,
260E02A213B1225D0064D447 /* Sk64.cpp in Sources */,
@ -3313,8 +3235,6 @@
260E095813B134C90064D447 /* GrDrawMesh.cpp in Sources */,
260E147913B2734E0064D447 /* SkUISplitViewController.mm in Sources */,
260E16E613B2853F0064D447 /* SampleGM.cpp in Sources */,
260E16F013B285540064D447 /* SampleFuzz.cpp in Sources */,
260E16F213B285570064D447 /* SampleFontScalerTest.cpp in Sources */,
260E1DCD13B3AA490064D447 /* SkUINavigationController.mm in Sources */,
260E1EA213B3B15A0064D447 /* SkPDFCatalog.cpp in Sources */,
260E1EA313B3B15A0064D447 /* SkPDFDevice.cpp in Sources */,
@ -3363,9 +3283,28 @@
268C50D613F022820003FF9A /* SkColorPalette.cpp in Sources */,
268C50D713F022820003FF9A /* SkNetPipeController.cpp in Sources */,
268C50DA13F022AF0003FF9A /* SampleDrawingClient.cpp in Sources */,
268C50DB13F022AF0003FF9A /* SampleDrawingServer.cpp in Sources */,
268C50DF13F0230C0003FF9A /* SampleNetPipeReader.cpp in Sources */,
268C50E013F0230C0003FF9A /* SkSockets.cpp in Sources */,
2605F44213F18B1B0044A072 /* DebuggerView.cpp in Sources */,
2605F44313F18B1B0044A072 /* DebuggerCommandsView.cpp in Sources */,
2605F44413F18B1B0044A072 /* SkDebugDumper.cpp in Sources */,
2605F44513F18B1B0044A072 /* DebuggerStateView.cpp in Sources */,
2605F65D13F19D1D0044A072 /* SamplePicture.cpp in Sources */,
2605F66513F19EB80044A072 /* GrStencilBuffer.cpp in Sources */,
2605F83013F1AE4B0044A072 /* xfermodes.cpp in Sources */,
2605F83113F1AE4C0044A072 /* tilemodes.cpp in Sources */,
2605F83213F1AE4C0044A072 /* shapes.cpp in Sources */,
2605F83313F1AE4D0044A072 /* shadows.cpp in Sources */,
2605F83413F1AE4D0044A072 /* shadertext.cpp in Sources */,
2605F83513F1AE4E0044A072 /* poly2poly.cpp in Sources */,
2605F83613F1AE4F0044A072 /* nocolorbleed.cpp in Sources */,
2605F83713F1AE500044A072 /* points.cpp in Sources */,
2605F83813F1AE500044A072 /* gradients.cpp in Sources */,
2605F83913F1AE510044A072 /* filltypes.cpp in Sources */,
2605F83A13F1AE520044A072 /* complexclip.cpp in Sources */,
2605F83B13F1AE520044A072 /* blurs.cpp in Sources */,
2605F83C13F1AE530044A072 /* bitmapfilters.cpp in Sources */,
2645945F13F34FB100DCF534 /* test.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -1,79 +0,0 @@
{
'includes': [
'common.gypi',
],
'targets': [
{
'target_name': 'CocoaDebuggerApp',
'type': 'executable',
'mac_bundle' : 1,
'include_dirs' : [
'../include/pipe',
'../experimental/CocoaDebugger',
'../experimental/SimpleCocoaApp',
],
'sources': [
'../experimental/CocoaDebugger/SkCommandListView.cpp',
'../experimental/CocoaDebugger/SkContentView.cpp',
'../experimental/CocoaDebugger/SkDebugDumper.cpp',
'../experimental/CocoaDebugger/SkDumpCanvasM.cpp',
'../experimental/CocoaDebugger/SkInfoPanelView.cpp',
'../src/pipe/SkGPipeRead.cpp',
],
'dependencies': [
'core.gyp:core',
'effects.gyp:effects',
'opts.gyp:opts',
'utils.gyp:utils',
'views.gyp:views',
'xml.gyp:xml',
],
'conditions' : [
# Only supports Mac currently
['skia_os == "mac"', {
'sources': [
'../experimental/CocoaDebugger/CocoaDebugger-Info.plist',
'../experimental/CocoaDebugger/CocoaDebugger_Prefix.pch',
'../experimental/CocoaDebugger/CocoaDebuggerAppDelegate.mm',
'../experimental/CocoaDebugger/main.m',
'../experimental/CocoaDebugger/SkDebugger.mm',
'../experimental/CocoaDebugger/SkMenuController.mm',
'../experimental/SimpleCocoaApp/SkNSView.mm',
'../experimental/SimpleCocoaApp/SkNSWindow.mm',
'../include/utils/mac/SkCGUtils.h',
'../src/utils/mac/SkCreateCGImageRef.cpp',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
],
'libraries!': [
# Currently skia mac apps rely on Carbon and AGL for UI. Future
# apps should use Cocoa instead and dependencies on Carbon and AGL
# should eventually be removed
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
'$(SDKROOT)/System/Library/Frameworks/AGL.framework',
],
},
'xcode_settings' : {
'INFOPLIST_FILE' : '../experimental/CocoaDebugger/CocoaDebugger-Info.plist',
},
'mac_bundle_resources' : [
'../experimental/CocoaDebugger/English.lproj/InfoPlist.strings',
'../experimental/CocoaDebugger/English.lproj/MainMenu.xib',
],
}],
],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:

View File

@ -14,104 +14,104 @@
],
'sources': [
# gm files needed for SampleGM.cpp
'../gm/bitmapfilters.cpp',
'../gm/blurs.cpp',
'../gm/complexclip.cpp',
'../gm/filltypes.cpp',
'../gm/gm.h',
'../gm/gradients.cpp',
'../gm/nocolorbleed.cpp',
'../gm/points.cpp',
'../gm/poly2poly.cpp',
'../gm/shadertext.cpp',
'../gm/shadows.cpp',
'../gm/shapes.cpp',
'../gm/tilemodes.cpp',
'../gm/xfermodes.cpp',
#'../gm/bitmapfilters.cpp',
#'../gm/blurs.cpp',
#'../gm/complexclip.cpp',
#'../gm/filltypes.cpp',
#'../gm/gm.h',
#'../gm/gradients.cpp',
#'../gm/nocolorbleed.cpp',
#'../gm/points.cpp',
#'../gm/poly2poly.cpp',
#'../gm/shadertext.cpp',
#'../gm/shadows.cpp',
#'../gm/shapes.cpp',
#'../gm/tilemodes.cpp',
#'../gm/xfermodes.cpp',
'../samplecode/ClockFaceView.cpp',
#'../samplecode/ClockFaceView.cpp',
'../samplecode/OverView.cpp',
'../samplecode/Sample2PtRadial.cpp',
'../samplecode/SampleAll.cpp',
'../samplecode/SampleAnimator.cpp',
#'../samplecode/Sample2PtRadial.cpp',
#'../samplecode/SampleAll.cpp',
#'../samplecode/SampleAnimator.cpp',
'../samplecode/SampleApp.cpp',
'../samplecode/SampleArc.cpp',
'../samplecode/SampleAvoid.cpp',
'../samplecode/SampleBigBlur.cpp',
'../samplecode/SampleBigGradient.cpp',
'../samplecode/SampleBitmapRect.cpp',
#'../samplecode/SampleBigBlur.cpp',
#'../samplecode/SampleBigGradient.cpp',
#'../samplecode/SampleBitmapRect.cpp',
'../samplecode/SampleBlur.cpp',
'../samplecode/SampleCamera.cpp',
'../samplecode/SampleCircle.cpp',
#'../samplecode/SampleCamera.cpp',
#'../samplecode/SampleCircle.cpp',
'../samplecode/SampleCode.h',
'../samplecode/SampleColorFilter.cpp',
#'../samplecode/SampleColorFilter.cpp',
'../samplecode/SampleComplexClip.cpp',
'../samplecode/SampleConcavePaths.cpp',
#'../samplecode/SampleConcavePaths.cpp',
'../samplecode/SampleCull.cpp',
'../samplecode/SampleDecode.cpp',
#'../samplecode/SampleDecode.cpp',
'../samplecode/SampleDegenerateTwoPtRadials.cpp',
'../samplecode/SampleDither.cpp',
'../samplecode/SampleDitherBitmap.cpp',
'../samplecode/SampleDrawBitmap.cpp',
'../samplecode/SampleDrawLooper.cpp',
'../samplecode/SampleEffects.cpp',
'../samplecode/SampleEmboss.cpp',
'../samplecode/SampleEncode.cpp',
'../samplecode/SampleExtractAlpha.cpp',
#'../samplecode/SampleDither.cpp',
#'../samplecode/SampleDitherBitmap.cpp',
#'../samplecode/SampleDrawBitmap.cpp',
#'../samplecode/SampleDrawLooper.cpp',
#'../samplecode/SampleEffects.cpp',
#'../samplecode/SampleEmboss.cpp',
#'../samplecode/SampleEncode.cpp',
#'../samplecode/SampleExtractAlpha.cpp',
'../samplecode/SampleFillType.cpp',
'../samplecode/SampleFilter.cpp',
'../samplecode/SampleFilter2.cpp',
'../samplecode/SampleFontCache.cpp',
'../samplecode/SampleFontScalerTest.cpp',
'../samplecode/SampleFuzz.cpp',
'../samplecode/SampleGM.cpp',
'../samplecode/SampleGradients.cpp',
'../samplecode/SampleHairline.cpp',
'../samplecode/SampleImage.cpp',
'../samplecode/SampleImageDir.cpp',
'../samplecode/SampleLayerMask.cpp',
'../samplecode/SampleLayers.cpp',
#'../samplecode/SampleFilter.cpp',
#'../samplecode/SampleFilter2.cpp',
#'../samplecode/SampleFontCache.cpp',
#'../samplecode/SampleFontScalerTest.cpp',
#'../samplecode/SampleFuzz.cpp',
#'../samplecode/SampleGM.cpp',
#'../samplecode/SampleGradients.cpp',
#'../samplecode/SampleHairline.cpp',
#'../samplecode/SampleImage.cpp',
#'../samplecode/SampleImageDir.cpp',
#'../samplecode/SampleLayerMask.cpp',
#'../samplecode/SampleLayers.cpp',
'../samplecode/SampleLCD.cpp',
'../samplecode/SampleLineClipper.cpp',
'../samplecode/SampleLines.cpp',
'../samplecode/SampleMeasure.cpp',
'../samplecode/SampleMipMap.cpp',
'../samplecode/SampleMovie.cpp',
'../samplecode/SampleNinePatch.cpp',
'../samplecode/SampleOvalTest.cpp',
'../samplecode/SampleOverflow.cpp',
'../samplecode/SamplePageFlip.cpp',
'../samplecode/SamplePatch.cpp',
#'../samplecode/SampleLines.cpp',
#'../samplecode/SampleMeasure.cpp',
#'../samplecode/SampleMipMap.cpp',
#'../samplecode/SampleMovie.cpp',
#'../samplecode/SampleNinePatch.cpp',
#'../samplecode/SampleOvalTest.cpp',
#'../samplecode/SampleOverflow.cpp',
#'../samplecode/SamplePageFlip.cpp',
#'../samplecode/SamplePatch.cpp',
'../samplecode/SamplePath.cpp',
'../samplecode/SamplePathClip.cpp',
'../samplecode/SamplePathEffects.cpp',
'../samplecode/SamplePicture.cpp',
'../samplecode/SamplePoints.cpp',
'../samplecode/SamplePolyToPoly.cpp',
'../samplecode/SampleAARects.cpp',
##'../samplecode/SampleAARects.cpp',
'../samplecode/SampleRegion.cpp',
'../samplecode/SampleRepeatTile.cpp',
'../samplecode/SampleShaders.cpp',
'../samplecode/SampleShaderText.cpp',
'../samplecode/SampleShapes.cpp',
'../samplecode/SampleSkLayer.cpp',
#'../samplecode/SampleRepeatTile.cpp',
#'../samplecode/SampleShaders.cpp',
#'../samplecode/SampleShaderText.cpp',
#'../samplecode/SampleShapes.cpp',
#'../samplecode/SampleSkLayer.cpp',
'../samplecode/SampleSlides.cpp',
'../samplecode/SampleStrokePath.cpp',
'../samplecode/SampleStrokeText.cpp',
'../samplecode/SampleTests.cpp',
'../samplecode/SampleText.cpp',
'../samplecode/SampleTextAlpha.cpp',
#'../samplecode/SampleStrokePath.cpp',
#'../samplecode/SampleStrokeText.cpp',
#'../samplecode/SampleTests.cpp',
#'../samplecode/SampleText.cpp',
#'../samplecode/SampleTextAlpha.cpp',
'../samplecode/SampleTextBox.cpp',
'../samplecode/SampleTextEffects.cpp',
'../samplecode/SampleTextOnPath.cpp',
'../samplecode/SampleTextureDomain.cpp',
'../samplecode/SampleTiling.cpp',
'../samplecode/SampleTinyBitmap.cpp',
#'../samplecode/SampleTextureDomain.cpp',
#'../samplecode/SampleTiling.cpp',
#'../samplecode/SampleTinyBitmap.cpp',
'../samplecode/SampleTriangles.cpp',
'../samplecode/SampleTypeface.cpp',
'../samplecode/SampleUnitMapper.cpp',
'../samplecode/SampleVertices.cpp',
'../samplecode/SampleXfermodes.cpp',
#'../samplecode/SampleVertices.cpp',
#'../samplecode/SampleXfermodes.cpp',
'../samplecode/SampleXfermodesBlur.cpp',
'../samplecode/TransitionView.cpp',
@ -124,13 +124,21 @@
'../experimental/DrawingBoard/SkColorPalette.cpp',
'../experimental/DrawingBoard/SkNetPipeController.h',
'../experimental/DrawingBoard/SkNetPipeController.cpp',
'../experimental/DrawingBoard/SampleDrawingClient.cpp',
#'../experimental/DrawingBoard/SampleDrawingClient.cpp',
'../experimental/DrawingBoard/SampleDrawingServer.cpp',
# Networking
'../experimental/Networking/SampleNetPipeReader.cpp',
'../experimental/Networking/SkSockets.cpp',
'../experimental/Networking/SkSockets.h',
# Debugger
'../experimental/Debugger/DebuggerViews.h',
'../experimental/Debugger/DebuggerContentView.cpp',
'../experimental/Debugger/DebuggerCommandsView.cpp',
'../experimental/Debugger/DebuggerStateView.cpp',
'../experimental/Debugger/SkDebugDumper.cpp',
'../experimental/Debugger/SkDebugDumper.h',
],
'sources!': [
'../samplecode/SampleSkLayer.cpp', #relies on SkMatrix44 which doesn't compile

View File

@ -12,12 +12,16 @@
],
'sources': [
'../experimental/SimpleCocoaApp/main.m',
'../experimental/SimpleCocoaApp/SampleWindow.h',
'../experimental/SimpleCocoaApp/SampleWindow.mm',
'../experimental/SimpleCocoaApp/SimpleCocoaAppDelegate.h',
'../experimental/SimpleCocoaApp/SimpleCocoaAppDelegate.mm',
'../experimental/SimpleCocoaApp/SkNSView.h',
'../experimental/SimpleCocoaApp/SkNSView.mm',
'../experimental/SimpleCocoaApp/SkNSWindow.h',
'../experimental/SimpleCocoaApp/SkNSWindow.mm',
'../experimental/SimpleCocoaApp/SimpleCocoaApp-Info.plist',
'../experimental/SimpleCocoaApp/SimpleCocoaApp_Prefix.pch',
'../experimental/SimpleCocoaApp/SimpleCocoaAppDelegate.mm',
'../experimental/SimpleCocoaApp/SkNSView.mm',
'../experimental/SimpleCocoaApp/SkNSWindow.mm',
],
'dependencies': [
'core.gyp:core',

View File

@ -65,20 +65,21 @@ public:
void setKeyEquivalent(SkUnichar key) { fKey = key; }
SkUnichar getKeyEquivalent() const { return fKey; }
/**
* Helper functions for predefined types
*/
void setBool(bool value) const; //For Switch
void setScalar(SkScalar value) const; //For Slider
void setInt(int value) const; //For List
void setTriState(TriState value) const; //For Tristate
void setString(const char value[]) const; //For TextField
/**
* Post event associated with the menu item to target, any changes to
* the associated event must be made prior to calling this method
*/
void postEvent() const { (new SkEvent(*(fEvent)))->post(); }
/**
* Helper functions for predefined types
*/
void postEventWithBool(bool value) const; //For Switch
void postEventWithScalar(SkScalar value) const; //For Slider
void postEventWithInt(int value) const; //For List, TriState
void postEventWithString(const char value[]) const; //For TextField
private:
int fID;
SkEvent* fEvent;
@ -91,8 +92,9 @@ public:
void reset();
const char* getTitle() const { return fTitle.c_str(); }
void setTitle (const char title[]) { fTitle.set(title); }
int countItems() const { return fItems.count(); }
const Item* getItem(int index) const { return fItems[index]; }
int getCount() const { return fItems.count(); }
const Item* getItemByID(int itemID) const;
void getItems(const Item* items[]) const;
/**
* Assign key to the menu item with itemID, will do nothing if there's no
@ -143,30 +145,30 @@ public:
* Helper functions to retrieve information other than the stored value for
* some predefined types
*/
static bool FindListItemCount(const SkEvent* evt, int* count);
static bool FindListItemCount(const SkEvent& evt, int* count);
/**
* Ensure that the items array can store n SkStrings where n is the count
* extracted using FindListItemCount
*/
static bool FindListItems(const SkEvent* evt, SkString items[]);
static bool FindSliderMin(const SkEvent* evt, SkScalar* min);
static bool FindSliderMax(const SkEvent* evt, SkScalar* max);
static bool FindListItems(const SkEvent& evt, SkString items[]);
static bool FindSliderMin(const SkEvent& evt, SkScalar* min);
static bool FindSliderMax(const SkEvent& evt, SkScalar* max);
/**
* Returns true if an action with the given label is found, false otherwise
*/
static bool FindAction(const SkEvent* evt, const char label[]);
static bool FindAction(const SkEvent& evt, const char label[]);
/**
* The following helper functions will return true if evt is generated from
* a predefined item type and retrieve the corresponding state information.
* They will return false and leave value unchanged if there's a type
* mismatch or slotName is incorrect
*/
static bool FindListIndex(const SkEvent* evt, const char slotName[], int* value);
static bool FindSliderValue(const SkEvent* evt, const char slotName[], SkScalar* value);
static bool FindSwitchState(const SkEvent* evt, const char slotName[], bool* value);
static bool FindTriState(const SkEvent* evt, const char slotName[], TriState* value);
static bool FindText(const SkEvent* evt, const char slotName[], SkString* value);
static bool FindListIndex(const SkEvent& evt, const char slotName[], int* value);
static bool FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value);
static bool FindSwitchState(const SkEvent& evt, const char slotName[], bool* value);
static bool FindTriState(const SkEvent& evt, const char slotName[], TriState* value);
static bool FindText(const SkEvent& evt, const char slotName[], SkString* value);
private:
SkString fTitle;

View File

@ -13,6 +13,11 @@ static const int N = 8;
const SkScalar W = SkIntToScalar(640);
const SkScalar H = SkIntToScalar(480);
static const char gIsOverview[] = "is-overview";
bool is_overview(SkView* view) {
SkEvent isOverview(gIsOverview);
return view->doQuery(&isOverview);
}
class OverView : public SkView {
public:
OverView(int count, const SkViewFactory factories[]);
@ -33,6 +38,9 @@ protected:
SampleCode::TitleR(evt, "Overview");
return true;
}
if (evt->isType(gIsOverview)) {
return true;
}
return this->INHERITED::onQuery(evt);
}

View File

@ -29,7 +29,7 @@
#include "SkPDFDocument.h"
#include "SkStream.h"
#define TEST_GPIPEx
#define TEST_GPIPE
#ifdef TEST_GPIPE
#define PIPE_FILEx
@ -42,13 +42,24 @@
#include "SkSockets.h"
SkTCPServer gServer;
#endif
#define DEBUGGERx
#ifdef DEBUGGER
extern SkView* create_debugger(const char* data, size_t size);
extern bool is_debugger(SkView* view);
SkTDArray<char> gTempDataStore;
#endif
#endif
#define USE_ARROWS_FOR_ZOOM true
//#define DEFAULT_TO_GPU
extern SkView* create_overview(int, const SkViewFactory[]);
extern bool is_overview(SkView* view);
extern SkView* create_transition(SkView*, SkView*, int);
extern bool is_transition(SkView* view);
#define ANIMATING_EVENTTYPE "nextSample"
#define ANIMATING_DELAY 750
@ -438,6 +449,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fZoomScale = SK_Scalar1;
fMagnify = false;
fDebugger = false;
fSaveToPdf = false;
fPdfCanvas = NULL;
@ -449,7 +461,8 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fAppMenu.setTitle("Global Settings");
int itemID;
itemID =fAppMenu.appendList("Device Type", "Device Type", sinkID, 0, "Raster", "Picture", "OpenGL", NULL);
itemID =fAppMenu.appendList("Device Type", "Device Type", sinkID, 0,
"Raster", "Picture", "OpenGL", NULL);
fAppMenu.assignKeyEquivalentToItem(itemID, 'd');
itemID = fAppMenu.appendTriState("AA", "AA", sinkID, fAAState);
fAppMenu.assignKeyEquivalentToItem(itemID, 'b');
@ -459,14 +472,16 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fAppMenu.assignKeyEquivalentToItem(itemID, 'n');
itemID = fAppMenu.appendTriState("Hinting", "Hinting", sinkID, fHintingState);
fAppMenu.assignKeyEquivalentToItem(itemID, 'h');
itemID = fAppMenu.appendSwitch("Pipe", "Pipe" , sinkID, fUsePipe);
fAppMenu.assignKeyEquivalentToItem(itemID, 'p');
fUsePipeMenuItemID = fAppMenu.appendSwitch("Pipe", "Pipe" , sinkID, fUsePipe);
fAppMenu.assignKeyEquivalentToItem(fUsePipeMenuItemID, 'p');
#ifdef DEBUGGER
itemID = fAppMenu.appendSwitch("Debugger", "Debugger", sinkID, fDebugger);
fAppMenu.assignKeyEquivalentToItem(itemID, 'q');
#endif
itemID = fAppMenu.appendSwitch("Slide Show", "Slide Show" , sinkID, false);
fAppMenu.assignKeyEquivalentToItem(itemID, 'a');
itemID = fAppMenu.appendSwitch("Clip", "Clip" , sinkID, fUseClip);
fAppMenu.assignKeyEquivalentToItem(itemID, 'c');
itemID = fAppMenu.appendSwitch("Measure FPS", "Measure FPS" , sinkID, fMeasureFPS);
fAppMenu.assignKeyEquivalentToItem(itemID, 'f');
itemID = fAppMenu.appendSwitch("Flip X", "Flip X" , sinkID, false);
fAppMenu.assignKeyEquivalentToItem(itemID, 'x');
itemID = fAppMenu.appendSwitch("Flip Y", "Flip Y" , sinkID, false);
@ -970,6 +985,23 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
bm.scrollRect(&r, dx, dy, &inval);
paint_rgn(bm, r, inval);
}
#ifdef DEBUGGER
SkView* curr = curr_view(this);
if (fDebugger && !is_debugger(curr) && !is_transition(curr) && !is_overview(curr)) {
//Stop Pipe when fDebugger is active
fUsePipe = false;
(void)SampleView::SetUsePipe(curr, false);
fAppMenu.getItemByID(fUsePipeMenuItemID)->setBool(fUsePipe);
this->onUpdateMenu(&fAppMenu);
//Reset any transformations
fGesture.stop();
fGesture.reset();
this->loadView(create_debugger(gTempDataStore.begin(),
gTempDataStore.count()));
}
#endif
}
void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
@ -1000,7 +1032,7 @@ void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
} else {
(void)SampleView::SetRepeatDraw(child, 1);
}
(void)SampleView::SetUsePipe(child, fUsePipe);
//(void)SampleView::SetUsePipe(child, fUsePipe);
}
void SampleWindow::afterChild(SkView* child, SkCanvas* canvas) {
@ -1089,8 +1121,8 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
}
return true;
}
if (evt.isType("unref-transition-view")) {
SkEventSink::FindSink(evt.getFast32())->unref();
if (evt.isType("replace-transition-view")) {
this->loadView((SkView*)SkEventSink::FindSink(evt.getFast32()));
return true;
}
if (evt.isType("set-curr-index")) {
@ -1102,49 +1134,65 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
return true;
}
int selected = -1;
if (SkOSMenu::FindListIndex(&evt, "Device Type", &selected)) {
if (SkOSMenu::FindListIndex(evt, "Device Type", &selected)) {
this->setDeviceType((DeviceType)selected);
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Pipe", NULL)) {
this->togglePipe();
if (SkOSMenu::FindSwitchState(evt, "Pipe", &fUsePipe)) {
#ifdef PIPE_NET
if (!fUsePipe)
gServer.disconnectAll();
#endif
(void)SampleView::SetUsePipe(curr_view(this), fUsePipe);
this->updateTitle();
this->inval(NULL);
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Slide Show", NULL)) {
if (SkOSMenu::FindSwitchState(evt, "Slide Show", NULL)) {
this->toggleSlideshow();
return true;
}
if (SkOSMenu::FindTriState(&evt, "AA", &fAAState) ||
SkOSMenu::FindTriState(&evt, "LCD", &fLCDState) ||
SkOSMenu::FindTriState(&evt, "Filter", &fFilterState) ||
SkOSMenu::FindTriState(&evt, "Hinting", &fHintingState) ||
SkOSMenu::FindSwitchState(&evt, "Clip", &fUseClip) ||
SkOSMenu::FindSwitchState(&evt, "Zoomer", &fShowZoomer) ||
SkOSMenu::FindSwitchState(&evt, "Magnify", &fMagnify) ||
SkOSMenu::FindSwitchState(&evt, "Measure FPS", &fMeasureFPS) ||
SkOSMenu::FindListIndex(&evt, "Transition-Next", &fTransitionNext) ||
SkOSMenu::FindListIndex(&evt, "Transition-Prev", &fTransitionPrev)) {
if (SkOSMenu::FindTriState(evt, "AA", &fAAState) ||
SkOSMenu::FindTriState(evt, "LCD", &fLCDState) ||
SkOSMenu::FindTriState(evt, "Filter", &fFilterState) ||
SkOSMenu::FindTriState(evt, "Hinting", &fHintingState) ||
SkOSMenu::FindSwitchState(evt, "Clip", &fUseClip) ||
SkOSMenu::FindSwitchState(evt, "Zoomer", &fShowZoomer) ||
SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify) ||
SkOSMenu::FindListIndex(evt, "Transition-Next", &fTransitionNext) ||
SkOSMenu::FindListIndex(evt, "Transition-Prev", &fTransitionPrev)) {
this->inval(NULL);
this->updateTitle();
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Flip X", NULL)) {
if (SkOSMenu::FindSwitchState(evt, "Flip X", NULL)) {
fFlipAxis ^= kFlipAxis_X;
this->updateTitle();
this->inval(NULL);
return true;
}
if (SkOSMenu::FindSwitchState(&evt, "Flip Y", NULL)) {
if (SkOSMenu::FindSwitchState(evt, "Flip Y", NULL)) {
fFlipAxis ^= kFlipAxis_Y;
this->updateTitle();
this->inval(NULL);
return true;
}
if (SkOSMenu::FindAction(&evt,"Save to PDF")) {
if (SkOSMenu::FindAction(evt,"Save to PDF")) {
this->saveToPdf();
return true;
}
#ifdef DEBUGGER
if (SkOSMenu::FindSwitchState(evt, "Debugger", &fDebugger)) {
if (fDebugger) {
fUsePipe = true;
(void)SampleView::SetUsePipe(curr_view(this), true);
} else {
this->loadView(fSamples[fCurrIndex]());
}
this->inval(NULL);
return true;
}
#endif
return this->INHERITED::onEvent(evt);
}
@ -1230,6 +1278,12 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
case 'd':
SkGraphics::SetFontCacheUsed(0);
return true;
case 'f':
// only
fMeasureFPS = !fMeasureFPS;
this->updateTitle();
this->inval(NULL);
break;
case 'g':
fRequestGrabImage = true;
this->inval(NULL);
@ -1285,16 +1339,6 @@ void SampleWindow::toggleRendering() {
this->inval(NULL);
}
void SampleWindow::togglePipe() {
fUsePipe = !fUsePipe;
#ifdef PIPE_NET
if (!fUsePipe)
gServer.disconnectAll();
#endif
this->updateTitle();
this->inval(NULL);
}
#include "SkDumpCanvas.h"
bool SampleWindow::onHandleKey(SkKey key) {
@ -1435,10 +1479,16 @@ void SampleWindow::loadView(SkView* view) {
//repopulate the slide menu when a view is loaded
fSlideMenu.reset();
#ifdef DEBUGGER
if (!is_debugger(view) && !is_overview(view) && !is_transition(view) && fDebugger) {
//Force Pipe to be on if using debugger
fUsePipe = true;
}
#endif
(void)SampleView::SetUsePipe(view, fUsePipe);
if (SampleView::IsSampleView(view))
((SampleView*)view)->requestMenu(&fSlideMenu);
this->onUpdateMenu(&fSlideMenu);
this->updateTitle();
}
@ -1648,10 +1698,9 @@ SimplePC::SimplePC(SkCanvas* target) : fReader(target) {
SimplePC::~SimplePC() {
// SkASSERT(SkGPipeReader::kDone_Status == fStatus);
if (fTotalWritten) {
if (fWriteToPipe) {
SkDebugf("--- %d bytes %d atoms, status %d\n", fTotalWritten,
fAtomsWritten, fStatus);
if (fWriteToPipe) {
#ifdef PIPE_FILE
//File is open in append mode
FILE* f = fopen(FILE_PATH, "ab");
@ -1664,6 +1713,10 @@ SimplePC::~SimplePC() {
gServer.acceptConnections();
gServer.writePacket(fBlock, fTotalWritten);
}
#endif
#ifdef DEBUGGER
gTempDataStore.reset();
gTempDataStore.append(fTotalWritten, (const char*)fBlock);
#endif
}
}
@ -1701,6 +1754,9 @@ void SampleView::draw(SkCanvas* canvas) {
canvas = writer.startRecording(&controller, flags);
//Must draw before controller goes out of scope and sends data
this->INHERITED::draw(canvas);
//explicitly end recording to ensure writer is flushed before the memory
//is freed in the deconstructor of the controller
writer.endRecording();
controller.setWriteToPipe(fUsePipe);
}
else

View File

@ -82,7 +82,6 @@ public:
void toggleRendering();
void toggleSlideshow();
void toggleFPS();
void togglePipe();
void showOverview();
GrContext* getGrContext() const { return fDevManager->getGrContext(); }
@ -144,11 +143,15 @@ private:
bool fRotate;
bool fScale;
bool fRequestGrabImage;
bool fUsePipe;
bool fMeasureFPS;
SkMSec fMeasureFPS_Time;
bool fMagnify;
bool fUsePipe;
int fUsePipeMenuItemID;
bool fDebugger;
// The following are for the 'fatbits' drawing
// Latest position of the mouse.
int fMouseX, fMouseY;

View File

@ -10,9 +10,12 @@
#include "SkTime.h"
#include "SkInterpolator.h"
extern bool is_overview(SkView* view);
static const char gIsTransitionQuery[] = "is-transition";
static const char gReplaceTransitionEvt[] = "replace-transition-view";
static bool isTransition(SkView* view) {
bool is_transition(SkView* view) {
SkEvent isTransition(gIsTransitionQuery);
return view->doQuery(&isTransition);
}
@ -37,10 +40,13 @@ public:
//Calling unref because next is a newly created view and TransitionView
//is now the sole owner of fNext
this->attachChildToFront(fNext)->unref();
fDone = false;
//SkDebugf("--created transition\n");
}
~TransitionView(){
//SkDebugf("deleted transition\n");
//SkDebugf("--deleted transition\n");
}
virtual void requestMenu(SkOSMenu* menu) {
@ -73,10 +79,29 @@ protected:
this->inval(NULL);
return true;
}
if (evt.isType("transition-done")) {
fNext->setLoc(0, 0);
fNext->setClipToBounds(false);
SkEvent* evt = new SkEvent(gReplaceTransitionEvt,
this->getParent()->getSinkID());
evt->setFast32(fNext->getSinkID());
//increate ref count of fNext so it survives detachAllChildren
fNext->ref();
this->detachAllChildren();
evt->post();
return true;
}
return this->INHERITED::onEvent(evt);
}
virtual void onDrawBackground(SkCanvas* canvas) {}
virtual void onDrawContent(SkCanvas* canvas) {
if (fDone)
return;
if (is_overview(fNext) || is_overview(fPrev)) {
fUsePipe = false;
}
SkScalar values[4];
SkInterpolator::Result result = fInterp.timeToValues(SkTime::GetMSecs(), values);
//SkDebugf("transition %x %d pipe:%d\n", this, result, fUsePipe);
@ -89,35 +114,9 @@ protected:
this->inval(NULL);
}
else {
fNext->setLocX(0);
fNext->setLocY(0);
fNext->setClipToBounds(false);
SkView* parent = this->getParent();
int id = this->getParent()->getSinkID();
SkEvent* evt;
if (isTransition(parent)) {
evt = new SkEvent(gReplaceTransitionEvt, id);
evt->setFast32(fNext->getSinkID());
//increate ref count of fNext so it survives detachAllChildren
fNext->ref();
(new SkEvent("transition-done", this->getSinkID()))->post();
fDone = true;
}
else {
parent->attachChildToFront(fNext);
(void)SampleView::SetUsePipe(fNext, fUsePipe);
evt = new SkEvent("unref-transition-view", id);
evt->setFast32(this->getSinkID());
fUsePipe = false;
//keep this(TransitionView) alive so it can be deleted by its
//parent through the unref-transition-view event
this->ref();
this->detachFromParent();
}
this->detachAllChildren();
evt->post();
}
this->inval(NULL);
}
virtual void onSizeChange() {
@ -142,7 +141,7 @@ protected:
fNext->setLocX(lr);
fNext->setLocY(ud);
if (isTransition(fPrev))
if (is_transition(fPrev))
lr = ud = 0;
fEnd[kPrevX] = -lr;
fEnd[kPrevY] = -ud;
@ -161,6 +160,7 @@ private:
};
SkView* fPrev;
SkView* fNext;
bool fDone;
SkInterpolator fInterp;
enum Direction{

View File

@ -23,6 +23,22 @@ void SkOSMenu::reset() {
fTitle.reset();
}
const SkOSMenu::Item* SkOSMenu::getItemByID(int itemID) const {
for (int i = 0; i < fItems.count(); ++i) {
if (itemID == fItems[i]->getID())
return fItems[i];
}
return NULL;
}
void SkOSMenu::getItems(const SkOSMenu::Item* items[]) const {
if (NULL != items) {
for (int i = 0; i < fItems.count(); ++i) {
items[i] = fItems[i];
}
}
}
void SkOSMenu::assignKeyEquivalentToItem(int itemID, SkUnichar key) {
for (int i = 0; i < fItems.count(); ++i) {
if (itemID == fItems[i]->getID())
@ -40,31 +56,31 @@ bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
SkString list;
switch (item->getType()) {
case kList_Type:
SkOSMenu::FindListItemCount(item->getEvent(), &size);
SkOSMenu::FindListIndex(item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindListItemCount(*item->getEvent(), &size);
SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value);
value = (value + 1) % size;
item->postEventWithInt(value);
item->setInt(value);
break;
case kSwitch_Type:
SkOSMenu::FindSwitchState(item->getEvent(), item->getSlotName(), &state);
item->postEventWithBool(!state);
SkOSMenu::FindSwitchState(*item->getEvent(), item->getSlotName(), &state);
item->setBool(!state);
break;
case kTriState_Type:
SkOSMenu::FindTriState(item->getEvent(), item->getSlotName(), &tristate);
SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate);
if (kOnState == tristate)
tristate = kMixedState;
else
tristate = (SkOSMenu::TriState)((int)tristate + 1);
item->postEventWithInt(tristate);
item->setTriState(tristate);
break;
case kAction_Type:
case kCustom_Type:
case kSlider_Type:
case kTextField_Type:
default:
item->postEvent();
break;
}
item->postEvent();
return true;
}
}
@ -83,28 +99,29 @@ SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
fID = sk_atomic_inc(&gOSMenuCmd);
}
void SkOSMenu::Item::postEventWithBool(bool value) const {
void SkOSMenu::Item::setBool(bool value) const {
SkASSERT(SkOSMenu::kSwitch_Type == fType);
fEvent->setBool(fSlotName.c_str(), value);
this->postEvent();
}
void SkOSMenu::Item::postEventWithScalar(SkScalar value) const {
void SkOSMenu::Item::setScalar(SkScalar value) const {
SkASSERT(SkOSMenu::kSlider_Type == fType);
fEvent->setScalar(fSlotName.c_str(), value);
this->postEvent();
}
void SkOSMenu::Item::postEventWithInt(int value) const {
SkASSERT(SkOSMenu::kList_Type == fType || SkOSMenu::kTriState_Type == fType);
void SkOSMenu::Item::setInt(int value) const {
SkASSERT(SkOSMenu::kList_Type == fType);
fEvent->setS32(fSlotName.c_str(), value);
this->postEvent();
}
void SkOSMenu::Item::postEventWithString(const char value[]) const {
void SkOSMenu::Item::setTriState(TriState value) const {
SkASSERT(SkOSMenu::kTriState_Type == fType);
fEvent->setS32(fSlotName.c_str(), value);
}
void SkOSMenu::Item::setString(const char value[]) const {
SkASSERT(SkOSMenu::kTextField_Type == fType);
fEvent->setString(fSlotName.c_str(), value);
this->postEvent();
}
////////////////////////////////////////////////////////////////////////////////
@ -182,13 +199,13 @@ int SkOSMenu::appendTextField(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kTextField_Type, slotName, evt);
}
bool SkOSMenu::FindListItemCount(const SkEvent* evt, int* count) {
return evt->isType(gMenuEventType) && evt->findS32(gList_ItemCount_S32, count);
bool SkOSMenu::FindListItemCount(const SkEvent& evt, int* count) {
return evt.isType(gMenuEventType) && evt.findS32(gList_ItemCount_S32, count);
}
bool SkOSMenu::FindListItems(const SkEvent* evt, SkString items[]) {
if (evt->isType(gMenuEventType) && NULL != items) {
const char* text = evt->findString(gList_Items_Str);
bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) {
if (evt.isType(gMenuEventType) && NULL != items) {
const char* text = evt.findString(gList_Items_Str);
if (text != NULL) {
SkString temp(text);
char* token = strtok((char*)temp.c_str(), gDelimiter);
@ -204,37 +221,37 @@ bool SkOSMenu::FindListItems(const SkEvent* evt, SkString items[]) {
return false;
}
bool SkOSMenu::FindSliderMin(const SkEvent* evt, SkScalar* min) {
return evt->isType(gMenuEventType) && evt->findScalar(gSlider_Min_Scalar, min);
bool SkOSMenu::FindSliderMin(const SkEvent& evt, SkScalar* min) {
return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Min_Scalar, min);
}
bool SkOSMenu::FindSliderMax(const SkEvent* evt, SkScalar* max) {
return evt->isType(gMenuEventType) && evt->findScalar(gSlider_Max_Scalar, max);
bool SkOSMenu::FindSliderMax(const SkEvent& evt, SkScalar* max) {
return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Max_Scalar, max);
}
bool SkOSMenu::FindAction(const SkEvent* evt, const char label[]) {
return evt->isType(gMenuEventType) && evt->findString(label);
bool SkOSMenu::FindAction(const SkEvent& evt, const char label[]) {
return evt.isType(gMenuEventType) && evt.findString(label);
}
bool SkOSMenu::FindListIndex(const SkEvent* evt, const char slotName[], int* value) {
return evt->isType(gMenuEventType) && evt->findS32(slotName, value);
bool SkOSMenu::FindListIndex(const SkEvent& evt, const char slotName[], int* value) {
return evt.isType(gMenuEventType) && evt.findS32(slotName, value);
}
bool SkOSMenu::FindSliderValue(const SkEvent* evt, const char slotName[], SkScalar* value) {
return evt->isType(gMenuEventType) && evt->findScalar(slotName, value);
bool SkOSMenu::FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value) {
return evt.isType(gMenuEventType) && evt.findScalar(slotName, value);
}
bool SkOSMenu::FindSwitchState(const SkEvent* evt, const char slotName[], bool* value) {
return evt->isType(gMenuEventType) && evt->findBool(slotName, value);
bool SkOSMenu::FindSwitchState(const SkEvent& evt, const char slotName[], bool* value) {
return evt.isType(gMenuEventType) && evt.findBool(slotName, value);
}
bool SkOSMenu::FindTriState(const SkEvent* evt, const char slotName[], SkOSMenu::TriState* value) {
return evt->isType(gMenuEventType) && evt->findS32(slotName, (int*)value);
bool SkOSMenu::FindTriState(const SkEvent& evt, const char slotName[], SkOSMenu::TriState* value) {
return evt.isType(gMenuEventType) && evt.findS32(slotName, (int*)value);
}
bool SkOSMenu::FindText(const SkEvent* evt, const char slotName[], SkString* value) {
if (evt->isType(gMenuEventType)) {
const char* text = evt->findString(slotName);
bool SkOSMenu::FindText(const SkEvent& evt, const char slotName[], SkString* value) {
if (evt.isType(gMenuEventType)) {
const char* text = evt.findString(slotName);
if (!text || !*text)
return false;
else {