aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
commitd6176b0dcacb124539e0cfd051e6d93a9782f020 (patch)
tree9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /src
parentfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6474054 git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/animator/SkAnimateActive.cpp32
-rw-r--r--src/animator/SkAnimateBase.cpp22
-rw-r--r--src/animator/SkAnimateField.cpp8
-rw-r--r--src/animator/SkAnimateMaker.cpp10
-rw-r--r--src/animator/SkAnimateMaker.h8
-rw-r--r--src/animator/SkAnimateSet.cpp4
-rw-r--r--src/animator/SkAnimator.cpp30
-rw-r--r--src/animator/SkAnimatorScript.cpp40
-rw-r--r--src/animator/SkAnimatorScript.h20
-rw-r--r--src/animator/SkAnimatorScript2.cpp1020
-rw-r--r--src/animator/SkAnimatorScript2.h38
-rw-r--r--src/animator/SkBoundable.cpp2
-rw-r--r--src/animator/SkBuildCondensedInfo.cpp6
-rw-r--r--src/animator/SkCondensedDebug.cpp164
-rw-r--r--src/animator/SkCondensedRelease.cpp162
-rw-r--r--src/animator/SkDisplayAdd.cpp4
-rw-r--r--src/animator/SkDisplayAdd.h4
-rw-r--r--src/animator/SkDisplayApply.cpp32
-rw-r--r--src/animator/SkDisplayApply.h4
-rw-r--r--src/animator/SkDisplayBounds.cpp2
-rw-r--r--src/animator/SkDisplayEvent.cpp10
-rw-r--r--src/animator/SkDisplayEvents.cpp2
-rw-r--r--src/animator/SkDisplayInput.cpp2
-rw-r--r--src/animator/SkDisplayList.cpp12
-rw-r--r--src/animator/SkDisplayList.h8
-rw-r--r--src/animator/SkDisplayMath.cpp14
-rw-r--r--src/animator/SkDisplayMath.h4
-rw-r--r--src/animator/SkDisplayMovie.cpp2
-rw-r--r--src/animator/SkDisplayNumber.h2
-rw-r--r--src/animator/SkDisplayPost.cpp20
-rw-r--r--src/animator/SkDisplayRandom.cpp2
-rw-r--r--src/animator/SkDisplayType.cpp12
-rw-r--r--src/animator/SkDisplayType.h2
-rw-r--r--src/animator/SkDisplayTypes.cpp8
-rw-r--r--src/animator/SkDisplayTypes.h2
-rw-r--r--src/animator/SkDisplayXMLParser.cpp18
-rw-r--r--src/animator/SkDisplayable.cpp90
-rw-r--r--src/animator/SkDisplayable.h18
-rw-r--r--src/animator/SkDraw3D.cpp6
-rw-r--r--src/animator/SkDraw3D.h2
-rw-r--r--src/animator/SkDrawBitmap.cpp12
-rw-r--r--src/animator/SkDrawBitmap.h2
-rw-r--r--src/animator/SkDrawBlur.cpp2
-rw-r--r--src/animator/SkDrawColor.cpp24
-rw-r--r--src/animator/SkDrawEmboss.cpp2
-rw-r--r--src/animator/SkDrawGradient.cpp20
-rw-r--r--src/animator/SkDrawGradient.h4
-rw-r--r--src/animator/SkDrawGroup.cpp2
-rw-r--r--src/animator/SkDrawLine.cpp2
-rw-r--r--src/animator/SkDrawMatrix.cpp16
-rw-r--r--src/animator/SkDrawPaint.h2
-rw-r--r--src/animator/SkDrawPath.cpp18
-rw-r--r--src/animator/SkDrawPoint.cpp4
-rw-r--r--src/animator/SkDrawRectangle.cpp4
-rw-r--r--src/animator/SkDrawRectangle.h2
-rw-r--r--src/animator/SkDrawSaveLayer.cpp2
-rw-r--r--src/animator/SkDrawShader.cpp10
-rw-r--r--src/animator/SkDrawText.h2
-rw-r--r--src/animator/SkDrawTextBox.cpp2
-rw-r--r--src/animator/SkDrawable.cpp4
-rw-r--r--src/animator/SkDrawable.h2
-rw-r--r--src/animator/SkDump.cpp2
-rw-r--r--src/animator/SkGetCondensedInfo.cpp2
-rw-r--r--src/animator/SkIntArray.h28
-rw-r--r--src/animator/SkMatrixParts.cpp30
-rw-r--r--src/animator/SkMatrixParts.h2
-rw-r--r--src/animator/SkMemberInfo.cpp44
-rw-r--r--src/animator/SkMemberInfo.h16
-rw-r--r--src/animator/SkOpArray.cpp12
-rw-r--r--src/animator/SkOpArray.h18
-rw-r--r--src/animator/SkOperand2.h62
-rw-r--r--src/animator/SkOperandIterpolator.cpp2
-rw-r--r--src/animator/SkParseSVGPath.cpp8
-rw-r--r--src/animator/SkPathParts.cpp14
-rw-r--r--src/animator/SkPostParts.cpp2
-rw-r--r--src/animator/SkScript.cpp106
-rw-r--r--src/animator/SkScript.h6
-rw-r--r--src/animator/SkScript2.h476
-rw-r--r--src/animator/SkScriptCallBack.h52
-rw-r--r--src/animator/SkScriptDecompile.cpp4
-rw-r--r--src/animator/SkScriptRuntime.cpp584
-rw-r--r--src/animator/SkScriptRuntime.h52
-rw-r--r--src/animator/SkScriptTokenizer.cpp98
-rw-r--r--src/animator/SkTDArray_Experimental.h10
-rw-r--r--src/animator/SkTextOnPath.cpp2
-rw-r--r--src/animator/SkTextToPath.cpp2
-rw-r--r--src/animator/SkTime.cpp2
-rw-r--r--src/animator/SkTypedArray.h2
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.h2
-rw-r--r--src/gpu/GrAARectRenderer.cpp2
-rwxr-xr-xsrc/gpu/GrAllocator.h36
-rw-r--r--src/gpu/GrClipMaskManager.h20
-rw-r--r--src/gpu/GrDrawState.h36
-rw-r--r--src/gpu/GrDrawTarget.cpp32
-rw-r--r--src/gpu/GrDrawTarget.h56
-rw-r--r--src/gpu/GrGpu.cpp18
-rw-r--r--src/gpu/GrGpu.h28
-rw-r--r--src/gpu/GrGpuVertex.h8
-rw-r--r--src/gpu/GrPathRenderer.h6
-rw-r--r--src/gpu/GrPathUtils.cpp10
-rw-r--r--src/gpu/GrPlotMgr.h2
-rw-r--r--src/gpu/GrRectanizer.cpp2
-rw-r--r--src/gpu/GrSWMaskHelper.h18
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp18
-rw-r--r--src/gpu/GrSoftwarePathRenderer.h4
-rw-r--r--src/gpu/GrStencil.h18
-rw-r--r--src/gpu/GrStencilBuffer.cpp6
-rw-r--r--src/gpu/GrTBSearch.h6
-rw-r--r--src/gpu/GrTDArray.h2
-rw-r--r--src/gpu/GrTLList.h2
-rw-r--r--src/gpu/GrTemplates.h6
-rw-r--r--src/gpu/GrTextContext.cpp8
-rw-r--r--src/gpu/GrTextStrike_impl.h14
-rw-r--r--src/gpu/GrTexture.cpp6
-rw-r--r--src/gpu/SkGpuDevice.cpp32
-rw-r--r--src/gpu/gl/GrGLPath.h2
-rw-r--r--src/gpu/gl/GrGLProgram.h12
-rw-r--r--src/gpu/gl/GrGLTexture.h2
-rw-r--r--src/gpu/gl/GrGpuGL.h6
-rw-r--r--src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp6
-rw-r--r--src/gpu/gl/win/SkNativeGLContext_win.cpp8
-rw-r--r--src/gpu/gr_unittests.cpp2
-rw-r--r--src/gpu/ios/GrGLDefaultInterface_iOS.cpp6
-rw-r--r--src/images/SkFlipPixelRef.cpp6
-rw-r--r--src/images/SkImageDecoder_libbmp.cpp24
-rw-r--r--src/images/SkImageDecoder_libgif.cpp34
-rw-r--r--src/images/SkImageDecoder_libico.cpp94
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp8
-rw-r--r--src/images/SkImageDecoder_libpng.cpp60
-rw-r--r--src/images/SkImageDecoder_wbmp.cpp26
-rw-r--r--src/images/SkImageRefPool.cpp38
-rw-r--r--src/images/SkImageRefPool.h16
-rw-r--r--src/images/SkImageRef_GlobalPool.cpp6
-rw-r--r--src/images/SkMovie.cpp2
-rw-r--r--src/images/SkMovie_gif.cpp2
-rw-r--r--src/images/SkPageFlipper.cpp2
-rw-r--r--src/images/SkScaledBitmapSampler.cpp18
-rw-r--r--src/images/SkScaledBitmapSampler.h6
-rw-r--r--src/images/bmpdecoderhelper.h10
-rw-r--r--src/pdf/SkPDFFont.cpp2
-rw-r--r--src/pdf/SkPDFShader.cpp6
-rw-r--r--src/pdf/SkPDFTypes.h14
-rw-r--r--src/pipe/SkGPipePriv.h10
-rw-r--r--src/pipe/SkGPipeRead.cpp10
-rw-r--r--src/pipe/SkGPipeWrite.cpp18
-rw-r--r--src/ports/SkFontDescriptor.cpp2
-rw-r--r--src/ports/SkFontDescriptor.h2
-rw-r--r--src/ports/SkFontHost_FONTPATH.cpp10
-rw-r--r--src/ports/SkFontHost_FreeType.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType_common.cpp8
-rw-r--r--src/ports/SkFontHost_ascender.cpp32
-rw-r--r--src/ports/SkFontHost_freetype_mac.cpp4
-rw-r--r--src/ports/SkFontHost_mac_coretext.cpp56
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp4
-rw-r--r--src/ports/SkFontHost_win_dw.cpp18
-rw-r--r--src/ports/SkGlobalInitialization_default.cpp2
-rw-r--r--src/ports/SkImageDecoder_CG.cpp16
-rw-r--r--src/ports/SkImageDecoder_WIC.cpp58
-rw-r--r--src/ports/SkImageRef_ashmem.cpp28
-rw-r--r--src/ports/SkImageRef_ashmem.h6
-rw-r--r--src/ports/SkThread_pthread.cpp6
-rw-r--r--src/ports/SkXMLParser_expat.cpp2
-rw-r--r--src/ports/SkXMLParser_tinyxml.cpp18
-rw-r--r--src/ports/SkXMLPullParser_expat.cpp18
-rw-r--r--src/sfnt/SkOTUtils.cpp2
-rw-r--r--src/sfnt/SkTypedEnum.h2
-rw-r--r--src/svg/SkSVGClipPath.cpp2
-rw-r--r--src/svg/SkSVGElements.cpp4
-rw-r--r--src/svg/SkSVGGradient.cpp2
-rw-r--r--src/svg/SkSVGPaintState.cpp12
-rw-r--r--src/svg/SkSVGParser.cpp20
-rw-r--r--src/svg/SkSVGPath.cpp2
-rw-r--r--src/svg/SkSVGPolygon.cpp4
-rw-r--r--src/svg/SkSVGPolygon.h2
-rw-r--r--src/svg/SkSVGPolyline.cpp4
-rw-r--r--src/svg/SkSVGPolyline.h2
-rw-r--r--src/svg/SkSVGSVG.cpp6
-rw-r--r--src/svg/SkSVGSVG.h4
-rw-r--r--src/svg/SkSVGSymbol.cpp2
-rw-r--r--src/utils/SkBase64.cpp10
-rw-r--r--src/utils/SkBoundaryPatch.cpp2
-rw-r--r--src/utils/SkCamera.cpp4
-rw-r--r--src/utils/SkCubicInterval.cpp2
-rw-r--r--src/utils/SkCullPoints.cpp14
-rw-r--r--src/utils/SkDeferredCanvas.cpp54
-rw-r--r--src/utils/SkInterpolator.cpp10
-rw-r--r--src/utils/SkJSON.cpp16
-rw-r--r--src/utils/SkMeshUtils.cpp6
-rw-r--r--src/utils/SkNinePatch.cpp42
-rw-r--r--src/utils/SkParse.cpp8
-rw-r--r--src/utils/SkParsePath.cpp10
-rw-r--r--src/utils/SkThreadUtils.h12
-rw-r--r--src/utils/mac/SkBitmap_Mac.cpp18
-rw-r--r--src/utils/mac/SkCreateCGImageRef.cpp22
-rw-r--r--src/utils/win/SkDWriteFontFileStream.h2
-rw-r--r--src/utils/win/SkDWriteGeometrySink.cpp2
-rw-r--r--src/utils/win/SkHRESULT.cpp4
-rw-r--r--src/utils/win/SkIStream.cpp6
-rw-r--r--src/views/SkBGViewArtist.cpp8
-rw-r--r--src/views/SkEvent.cpp30
-rw-r--r--src/views/SkEventSink.cpp4
-rw-r--r--src/views/SkOSMenu.cpp20
-rw-r--r--src/views/SkParsePaint.cpp178
-rw-r--r--src/views/SkProgressView.cpp170
-rw-r--r--src/views/SkStackViewLayout.cpp340
-rw-r--r--src/views/SkTextBox.cpp2
-rw-r--r--src/views/SkTouchGesture.cpp4
-rw-r--r--src/views/SkView.cpp74
-rw-r--r--src/views/SkViewInflate.cpp184
-rw-r--r--src/views/SkViewPriv.cpp98
-rw-r--r--src/views/SkViewPriv.h48
-rw-r--r--src/views/SkWidget.cpp386
-rw-r--r--src/views/SkWidgets.cpp550
-rw-r--r--src/views/SkWindow.cpp270
-rw-r--r--src/views/animated/SkBorderView.cpp104
-rw-r--r--src/views/animated/SkImageView.cpp424
-rw-r--r--src/views/animated/SkListView.cpp1296
-rw-r--r--src/views/animated/SkListWidget.cpp972
-rw-r--r--src/views/animated/SkProgressBarView.cpp124
-rw-r--r--src/views/animated/SkScrollBarView.cpp184
-rw-r--r--src/views/animated/SkStaticTextView.cpp184
-rw-r--r--src/views/animated/SkWidgetViews.cpp70
-rw-r--r--src/views/mac/SkNSView.h2
-rw-r--r--src/views/mac/SkOSWindow_Mac.cpp290
-rw-r--r--src/views/sdl/SkOSWindow_SDL.cpp10
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp2
-rw-r--r--src/views/unix/keysym2ucs.c20
-rw-r--r--src/views/win/SkOSWindow_win.cpp48
-rw-r--r--src/xml/SkDOM.cpp10
-rw-r--r--src/xml/SkJSDisplayable.cpp6
-rw-r--r--src/xml/SkXMLParser.cpp2
-rw-r--r--src/xml/SkXMLPullParser.cpp10
-rw-r--r--src/xml/SkXMLWriter.cpp2
233 files changed, 5605 insertions, 5605 deletions
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index 4177aa0568..00ee9df451 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -22,7 +22,7 @@ SkActive::SkActive(SkApply& apply, SkAnimateMaker& maker) : fApply(apply),
fMaxTime(0), fMaker(maker), fDrawIndex(0), fDrawMax(0) {
}
-void SkActive::init()
+void SkActive::init()
{
fAnimators = fApply.fAnimators;
int animators = fAnimators.count();
@@ -98,7 +98,7 @@ void SkActive::append(SkApply* apply) {
saveIndex -= oldCount;
delete[] fSaveRestore[saveIndex];
fSaveRestore.remove(saveIndex);
- delete[] fSaveInterpolators[saveIndex];
+ delete[] fSaveInterpolators[saveIndex];
fSaveInterpolators.remove(saveIndex);
} while (saveIndex > 0);
}
@@ -127,17 +127,17 @@ void SkActive::appendSave(int oldCount) {
SkASSERT(saveIndex >= 0);
SkASSERT(newTotal >= 0);
memmove(&fSaveRestore[newTotal], &fSaveRestore[saveIndex], oldCount);
- memset(&fSaveRestore[newTotal + oldCount], 0,
+ memset(&fSaveRestore[newTotal + oldCount], 0,
sizeof(fSaveRestore[0]) * (newCount - oldCount));
- memmove(&fSaveInterpolators[newTotal],
+ memmove(&fSaveInterpolators[newTotal],
&fSaveInterpolators[saveIndex], oldCount);
- memset(&fSaveInterpolators[newTotal + oldCount], 0,
+ memset(&fSaveInterpolators[newTotal + oldCount], 0,
sizeof(fSaveRestore[0]) * (newCount - oldCount));
} while (saveIndex > 0);
SkASSERT(newTotal == 0);
}
-void SkActive::calcDurations(int index)
+void SkActive::calcDurations(int index)
{
SkAnimateBase* animate = fAnimators[index];
SkMSec duration = animate->dur;
@@ -174,7 +174,7 @@ void SkActive::create(SkDrawable* drawable, SkMSec time) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -212,7 +212,7 @@ bool SkActive::immediate(bool enable) {
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -259,7 +259,7 @@ bool SkActive::initializeSave() {
memset(&fSaveRestore[oldCount], 0, sizeof(fSaveRestore[0]) * (activeTotal - oldCount));
SkASSERT(fSaveInterpolators.count() == oldCount);
fSaveInterpolators.setCount(activeTotal);
- memset(&fSaveInterpolators[oldCount], 0,
+ memset(&fSaveInterpolators[oldCount], 0,
sizeof(fSaveInterpolators[0]) * (activeTotal - oldCount));
return true;
}
@@ -287,7 +287,7 @@ void SkActive::initState(SkApply* apply, int offset) {
state.fStarted = false;
state.fSteps = apply->steps;
state.fTicks = 0;
- state.fUnpostedEndEvent = (SkBool8) animate->fHasEndEvent;
+ state.fUnpostedEndEvent = (SkBool8) animate->fHasEndEvent;
calcDurations(index);
setInterpolator(index, from);
}
@@ -317,7 +317,7 @@ void SkActive::pickUp(SkActive* existing) {
if (workingSum < originalSum) {
SkScalar originalDistance = SkScalarSqrt(originalSum);
SkScalar workingDistance = SkScalarSqrt(workingSum);
- existing->fState[index].fDuration = (SkMSec) SkScalarMulDiv(fState[index].fDuration,
+ existing->fState[index].fDuration = (SkMSec) SkScalarMulDiv(fState[index].fDuration,
workingDistance, originalDistance);
}
fInterpolators[index]->reset(components, 2, SkType_Float);
@@ -376,7 +376,7 @@ void SkActive::setInterpolator(int index, SkOperand* from) {
SkMSec duration = fState[index].fDuration;
int components = animate->components();
SkOperandInterpolator& interpolator = *fInterpolators[index];
- interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValuesType());
+ interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValuesType());
interpolator.setMirror(SkToBool(animate->fMirror));
interpolator.setReset(SkToBool(animate->fReset));
interpolator.setRepeatCount(animate->repeat);
@@ -387,7 +387,7 @@ void SkActive::setInterpolator(int index, SkOperand* from) {
}
for (int entry = 0; entry < entries; entry++) {
int blendIndex = SkMin32(animate->blend.count() - 1, entry);
- interpolator.setKeyFrame(entry, entry * duration / (entries - 1), from,
+ interpolator.setKeyFrame(entry, entry * duration / (entries - 1), from,
animate->blend[blendIndex]);
from += components;
}
@@ -475,12 +475,12 @@ void SkActive::validate() {
// the code below should only be bumping fSave, and there shouldn't be anything
// it needs to be synchronized with
-// however, if there are two animates both operating on the same field, then
-// when one replaces the other, it may make sense to pick up the old value as a starting
+// however, if there are two animates both operating on the same field, then
+// when one replaces the other, it may make sense to pick up the old value as a starting
// value for the new one somehow.
//void SkActive::SkState::bumpSave() {
-// if (fMode != SkApply::kMode_hold)
+// if (fMode != SkApply::kMode_hold)
// return;
// if (fTransition == SkApply::kTransition_reverse) {
// if (fSave > 0)
diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp
index fe3815d75d..0e56faaf1e 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -39,8 +39,8 @@ const SkMemberInfo SkAnimateBase::fInfo[] = {
DEFINE_GET_MEMBER(SkAnimateBase);
SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1),
- fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL),
- fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0),
+ fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fTarget(NULL),
+ fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0),
fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) {
blend.setCount(1);
blend[0] = SK_Scalar1;
@@ -54,8 +54,8 @@ SkAnimateBase::~SkAnimateBase() {
}
}
-int SkAnimateBase::components() {
- return 1;
+int SkAnimateBase::components() {
+ return 1;
}
SkDisplayable* SkAnimateBase::deepCopy(SkAnimateMaker* maker) {
@@ -131,9 +131,9 @@ returnBool:
return true;
}
-bool SkAnimateBase::hasExecute() const
+bool SkAnimateBase::hasExecute() const
{
- return false;
+ return false;
}
void SkAnimateBase::onEndElement(SkAnimateMaker& maker) {
@@ -159,11 +159,11 @@ void SkAnimateBase::onEndElement(SkAnimateMaker& maker) {
}
}
-void SkAnimateBase::packARGB(SkScalar array[], int count, SkTDOperandArray* converted)
-{
+void SkAnimateBase::packARGB(SkScalar array[], int count, SkTDOperandArray* converted)
+{
SkASSERT(count == 4);
converted->setCount(1);
- SkColor color = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
+ SkColor color = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
SkScalarRound(array[2]), SkScalarRound(array[3]));
(*converted)[0].fS32 = color;
}
@@ -228,8 +228,8 @@ void SkAnimateBase::setTarget(SkAnimateMaker& maker) {
}
}
-bool SkAnimateBase::targetNeedsInitialization() const {
- return false;
+bool SkAnimateBase::targetNeedsInitialization() const {
+ return false;
}
diff --git a/src/animator/SkAnimateField.cpp b/src/animator/SkAnimateField.cpp
index 65e084a0a5..43f510e444 100644
--- a/src/animator/SkAnimateField.cpp
+++ b/src/animator/SkAnimateField.cpp
@@ -28,8 +28,8 @@ SkAnimate::SkAnimate() : fComponents(0) {
SkAnimate::~SkAnimate() {
}
-int SkAnimate::components() {
- return fComponents;
+int SkAnimate::components() {
+ return fComponents;
}
#ifdef SK_DUMP_ENABLED
@@ -50,7 +50,7 @@ void SkAnimate::dump(SkAnimateMaker* maker) {
SkDebugf("blend=\"[");
bool firstElem = true;
for (int i = 0; i < blend.count(); i++) {
- if (!firstElem)
+ if (!firstElem)
SkDebugf(",");
firstElem = false;
SkDebugf("%g", SkScalarToFloat(blend[i]));
@@ -82,7 +82,7 @@ void SkAnimate::onEndElement(SkAnimateMaker& maker) {
SkASSERT(to.size() > 0);
fFieldInfo->setValue(maker, &fValues, 0, 0, NULL, outType, to);
SkASSERT(0);
- // !!! this needs to set fComponents
+ // !!! this needs to set fComponents
return;
}
fComponents = fFieldInfo->getCount();
diff --git a/src/animator/SkAnimateMaker.cpp b/src/animator/SkAnimateMaker.cpp
index 414e728979..ddde2eb891 100644
--- a/src/animator/SkAnimateMaker.cpp
+++ b/src/animator/SkAnimateMaker.cpp
@@ -28,7 +28,7 @@ class DefaultTimeline : public SkAnimator::Timeline {
} gDefaultTimeline;
SkAnimateMaker::SkAnimateMaker(SkAnimator* animator, SkCanvas* canvas, SkPaint* paint)
- : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
+ : fActiveEvent(NULL), fAdjustedStart(0), fCanvas(canvas), fEnableTime(0),
fHostEventSinkID(0), fMinimumInterval((SkMSec) -1), fPaint(paint), fParentMaker(NULL),
fTimeline(&gDefaultTimeline), fInInclude(false), fInMovie(false),
fFirstScriptError(false), fLoaded(false), fIDs(256), fAnimator(animator)
@@ -82,7 +82,7 @@ bool SkAnimateMaker::computeID(SkDisplayable* displayable, SkDisplayable* parent
SkDisplayable* SkAnimateMaker::createInstance(const char name[], size_t len) {
SkDisplayTypes type = SkDisplayType::GetType(this, name, len );
- if ((int)type >= 0)
+ if ((int)type >= 0)
return SkDisplayType::CreateInstance(this, type);
return NULL;
}
@@ -124,7 +124,7 @@ void SkAnimateMaker::delayEnable(SkApply* apply, SkMSec time) {
if (index < 0) {
*fDelayed.append() = apply;
}
-
+
(new SkEvent(SK_EventType_Delay, fAnimator->getSinkID()))->postTime(time);
}
@@ -302,7 +302,7 @@ void SkAnimateMaker::setErrorString() {
#if defined SK_DEBUG
SkDebugf("%s\n", fErrorString.c_str());
#endif
- }
+ }
}
void SkAnimateMaker::setEnableTime(SkMSec appTime, SkMSec expectedTime) {
@@ -330,7 +330,7 @@ void SkAnimateMaker::setEnableTime(SkMSec appTime, SkMSec expectedTime) {
}
}
-void SkAnimateMaker::setExtraPropertyCallBack(SkDisplayTypes type,
+void SkAnimateMaker::setExtraPropertyCallBack(SkDisplayTypes type,
SkScriptEngine::_propertyCallBack callBack, void* userStorage) {
SkExtras** end = fExtras.end();
for (SkExtras** extraPtr = fExtras.begin(); extraPtr < end; extraPtr++) {
diff --git a/src/animator/SkAnimateMaker.h b/src/animator/SkAnimateMaker.h
index f20a7d433a..53a5521aa2 100644
--- a/src/animator/SkAnimateMaker.h
+++ b/src/animator/SkAnimateMaker.h
@@ -57,16 +57,16 @@ public:
void dump(const char* match);
#endif
int dynamicProperty(SkString& nameStr, SkDisplayable** );
- bool find(const char* str, SkDisplayable** displayablePtr) const {
+ bool find(const char* str, SkDisplayable** displayablePtr) const {
return fIDs.find(str, displayablePtr);
}
- bool find(const char* str, size_t len, SkDisplayable** displayablePtr) const {
+ bool find(const char* str, size_t len, SkDisplayable** displayablePtr) const {
return fIDs.find(str, len, displayablePtr);
}
bool findKey(SkDisplayable* displayable, const char** string) const {
return fIDs.findKey(displayable, string);
}
-// bool find(SkString& string, SkDisplayable** displayablePtr) {
+// bool find(SkString& string, SkDisplayable** displayablePtr) {
// return fIDs.find(string.c_str(), displayablePtr);
// }
SkAnimator* getAnimator() { return fAnimator; }
@@ -80,7 +80,7 @@ public:
bool hasError() { return fError.hasError(); }
void helperAdd(SkDisplayable* trackMe);
void helperRemove(SkDisplayable* alreadyTracked);
- void idsSet(const char* attrValue, size_t len, SkDisplayable* displayable) {
+ void idsSet(const char* attrValue, size_t len, SkDisplayable* displayable) {
fIDs.set(attrValue, len, displayable); }
// void loadMovies();
void notifyInval();
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index 3dd9648afa..f153b16bbd 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -32,7 +32,7 @@ const SkMemberInfo SkSet::fInfo[] = {
DEFINE_GET_MEMBER(SkSet);
SkSet::SkSet() {
- dur = 1;
+ dur = 1;
}
#ifdef SK_DUMP_ENABLED
@@ -48,7 +48,7 @@ void SkSet::dump(SkAnimateMaker* maker) {
#endif
void SkSet::refresh(SkAnimateMaker& maker) {
- fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
+ fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
fFieldInfo->getType(), to);
}
diff --git a/src/animator/SkAnimator.cpp b/src/animator/SkAnimator.cpp
index c1fba65244..5d1f220a87 100644
--- a/src/animator/SkAnimator.cpp
+++ b/src/animator/SkAnimator.cpp
@@ -34,7 +34,7 @@
#define _static static
#endif
-_static const char gMathPrimerText[] =
+_static const char gMathPrimerText[] =
"<screenplay>"
"<Math id=\"Math\"/>"
"<Number id=\"Number\"/>"
@@ -108,9 +108,9 @@ bool SkAnimator::doClickEvent(int clickState, SkScalar x, SkScalar y) {
state.fX = x;
state.fY = y;
fMaker->fEnableTime = fMaker->getAppTime();
- bool result = fMaker->fEvents.doEvent(*fMaker,
- clickState == 0 ? SkDisplayEvent::kMouseDown :
- clickState == 1 ? SkDisplayEvent::kMouseDrag :
+ bool result = fMaker->fEvents.doEvent(*fMaker,
+ clickState == 0 ? SkDisplayEvent::kMouseDown :
+ clickState == 1 ? SkDisplayEvent::kMouseDrag :
SkDisplayEvent::kMouseUp, &state);
fMaker->notifyInval();
return result;
@@ -160,7 +160,7 @@ SkAnimator::DifferenceType SkAnimator::draw(SkCanvas* canvas, SkMSec time) {
SkPaint paint;
return draw(canvas, &paint, time);
}
-
+
#ifdef SK_DEBUG
void SkAnimator::eventDone(const SkEvent& ) {
}
@@ -231,7 +231,7 @@ SkFieldType SkAnimator::getFieldType(const char* id, const char* fieldID) {
return info->getArrayValue(element, index, operand);
}
-int32_t SkAnimator::getArrayInt(const SkDisplayable* ae,
+int32_t SkAnimator::getArrayInt(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_Int);
@@ -248,7 +248,7 @@ int32_t SkAnimator::getArrayInt(const char* id, const char* fieldID, int index)
return getArrayInt(element, field, index);
}
-SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae,
+SkScalar SkAnimator::getArrayScalar(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_Float);
@@ -265,7 +265,7 @@ SkScalar SkAnimator::getArrayScalar(const char* id, const char* fieldID, int ind
return getArrayScalar(element, field, index);
}
-const char* SkAnimator::getArrayString(const SkDisplayable* ae,
+const char* SkAnimator::getArrayString(const SkDisplayable* ae,
const SkMemberInfo* ai, int index) {
SkOperand operand;
bool result = getArrayCommon(ae, ai, index, &operand, SkType_String);
@@ -360,7 +360,7 @@ SkScalar SkAnimator::getScalar(const char* id, const char* fieldID) {
return getScalar(element, field);
}
-const char* SkAnimator::getString(const SkDisplayable* ae,
+const char* SkAnimator::getString(const SkDisplayable* ae,
const SkMemberInfo* ai) {
const SkDisplayable* element = (const SkDisplayable*) ae;
const SkMemberInfo* info = (const SkMemberInfo*) ai;
@@ -501,11 +501,11 @@ void SkAnimator::reset() {
}
SkEventSinkID SkAnimator::getHostEventSinkID() const {
- return fMaker->fHostEventSinkID;
+ return fMaker->fHostEventSinkID;
}
void SkAnimator::setHostEventSinkID(SkEventSinkID target) {
- fMaker->fHostEventSinkID = target;
+ fMaker->fHostEventSinkID = target;
}
void SkAnimator::onSetHostHandler(Handler ) {
@@ -530,7 +530,7 @@ bool SkAnimator::setArrayInt(const char* id, const char* fieldID, const int* arr
SkTypedArray tArray(SkType_Int);
tArray.setCount(num);
for (int i = 0; i < num; i++) {
- SkOperand op;
+ SkOperand op;
op.fS32 = array[i];
tArray[i] = op;
}
@@ -546,7 +546,7 @@ bool SkAnimator::setArray(SkDisplayable* element, const SkMemberInfo* info, SkTy
SkDisplayTypes type = element->getType();
if (type == SkType_Array) {
SkDisplayArray* dispArray = (SkDisplayArray*) element;
- dispArray->values = array;
+ dispArray->values = array;
return true;
}
else
@@ -614,9 +614,9 @@ bool SkAnimator::setScalar(const char* id, const char* fieldID, SkScalar scalar)
return setScalar(element, field, scalar);
}
-bool SkAnimator::setString(SkDisplayable* element,
+bool SkAnimator::setString(SkDisplayable* element,
const SkMemberInfo* info, const char* str) {
- // !!! until this is fixed, can't call script with global references from here
+ // !!! until this is fixed, can't call script with global references from here
info->setValue(*fMaker, NULL, 0, info->fCount, element, info->getType(), str, strlen(str));
return true;
}
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index 6aae006690..0e639f29e4 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -64,8 +64,8 @@ SkAnimatorScript::SkAnimatorScript(SkAnimateMaker& maker, SkDisplayable* working
if (SkDisplayType::IsEnum(&maker, type)) {
// !!! for SpiderMonkey, iterate through the enum values, and map them to globals
const SkDisplayEnumMap& map = GetEnumValues(type);
- propertyCallBack(EvalEnum, (void*) map.fValues);
- }
+ propertyCallBack(EvalEnum, (void*) map.fValues);
+ }
for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
SkExtras* extra = *extraPtr;
if (extra->fExtraCallBack)
@@ -116,7 +116,7 @@ bool SkAnimatorScript::Box(void* user, SkScriptValue* scriptValue) {
SkDisplayString* boxedValue = new SkDisplayString(*scriptValue->fOperand.fString);
displayable = boxedValue;
} break;
- case SkType_Displayable:
+ case SkType_Displayable:
scriptValue->fOperand.fObject = scriptValue->fOperand.fDisplayable;
scriptValue->fType = SkType_Displayable;
return true;
@@ -130,7 +130,7 @@ bool SkAnimatorScript::Box(void* user, SkScriptValue* scriptValue) {
return true;
}
-bool SkAnimatorScript::Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("eval", function, len) == false)
return false;
@@ -152,7 +152,7 @@ bool SkAnimatorScript::EvalEnum(const char* token, size_t len, void* callBack, S
const char* tokens = (const char*) callBack;
value->fType = SkType_Int;
if (MapEnums(tokens, token, len, (int*)&value->fOperand.fS32))
- return true;
+ return true;
return false;
}
@@ -160,7 +160,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
SkAnimatorScript* engine = (SkAnimatorScript*) user;
SkTDict<SkDisplayable*>* ids = &engine->fMaker.fIDs;
SkDisplayable* displayable;
- bool success = ids->find(token, len, &displayable);
+ bool success = ids->find(token, len, &displayable);
if (success == false) {
displayable = engine->fWorking;
if (SK_LITERAL_STR_EQUAL("parent", token, len)) {
@@ -176,7 +176,7 @@ bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScrip
if (displayable && EvalMember(token, len, displayable, engine, value))
return true;
value->fOperand.fString = NULL;
- value->fType = SkType_String;
+ value->fType = SkType_String;
} else {
SkDisplayable* working = engine->fWorking;
value->fOperand.fDisplayable = displayable;
@@ -199,7 +199,7 @@ bool SkAnimatorScript::EvalNamedColor(const char* token, size_t len, void* callb
return false;
}
-bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("rgb", function, len) == false)
return false;
@@ -218,7 +218,7 @@ bool SkAnimatorScript::EvalRGB(const char* function, size_t len, SkTDArray<SkScr
return true;
}
-bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberInfo* info,
+bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberInfo* info,
SkDisplayable* displayable, SkScriptValue* value) {
SkDisplayTypes original;
SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
@@ -232,10 +232,10 @@ bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberIn
case SkType_MSec:
case SkType_Float:
SkASSERT(info->getCount() == 1);
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
value->fOperand.fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
if (type == SkType_MSec) {
- value->fOperand.fScalar = SkScalarDiv((SkScalar) value->fOperand.fS32, 1000); // dividing two ints is the same as dividing two scalars
+ value->fOperand.fScalar = SkScalarDiv((SkScalar) value->fOperand.fS32, 1000); // dividing two ints is the same as dividing two scalars
type = SkType_Float;
}
break;
@@ -269,7 +269,7 @@ bool SkAnimatorScript::EvalMemberCommon(SkScriptEngine* engine, const SkMemberIn
return true;
}
-bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object, void* eng,
+bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object, void* eng,
SkScriptValue* value) {
SkScriptEngine* engine = (SkScriptEngine*) eng;
SkDisplayable* displayable = (SkDisplayable*) object;
@@ -292,7 +292,7 @@ bool SkAnimatorScript::EvalMember(const char* member, size_t len, void* object,
return EvalMemberCommon(engine, info, displayable, value);
}
-bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* object,
+bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* eng, SkScriptValue* value) {
SkScriptEngine* engine = (SkScriptEngine*) eng;
SkDisplayable* displayable = (SkDisplayable*) object;
@@ -303,7 +303,7 @@ bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void*
SkASSERT(0);
return false;
}
- displayable->executeFunction(displayable, info->functionIndex(), params, info->getType(),
+ displayable->executeFunction(displayable, info->functionIndex(), params, info->getType(),
value);
return EvalMemberCommon(engine, info, displayable, value);
}
@@ -355,7 +355,7 @@ bool SkAnimatorScript::EvaluateString(SkAnimateMaker& maker, SkDisplayable* disp
}
const SkDisplayEnumMap& SkAnimatorScript::GetEnumValues(SkDisplayTypes type) {
- int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
+ int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
sizeof(SkDisplayEnumMap));
SkASSERT(index >= 0);
return gEnumMaps[index];
@@ -369,7 +369,7 @@ bool SkAnimatorScript::Infinity(const char* token, size_t len, void* user, SkScr
return true;
}
-bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL(function, "isFinite", len) == false)
return false;
@@ -379,12 +379,12 @@ bool SkAnimatorScript::IsFinite(const char* function, size_t len, SkTDArray<SkSc
SkDisplayTypes type = scriptValue->fType;
SkScalar scalar = scriptValue->fOperand.fScalar;
value->fType = SkType_Int;
- value->fOperand.fS32 = type == SkType_Float ? SkScalarIsNaN(scalar) == false &&
+ value->fOperand.fS32 = type == SkType_Float ? SkScalarIsNaN(scalar) == false &&
SkScalarAbs(scalar) != SK_ScalarInfinity : type == SkType_Int;
return true;
}
-bool SkAnimatorScript::IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+bool SkAnimatorScript::IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* eng, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("isNaN", function, len) == false)
return false;
@@ -429,7 +429,7 @@ bool SkAnimatorScript::ObjectToString(void* object, void* user, SkScriptValue* v
SkTDict<SkDisplayable*>* ids = (SkTDict<SkDisplayable*>*) user;
SkDisplayable* displayable = (SkDisplayable*) object;
const char* key;
- bool success = ids->findKey(displayable, &key);
+ bool success = ids->findKey(displayable, &key);
if (success == false)
return false;
value->fOperand.fString = new SkString(key);
@@ -480,7 +480,7 @@ bool SkAnimatorScript::Unbox(void* m, SkScriptValue* scriptValue) {
#include "SkAnimator.h"
-static const char scriptTestSetup[] =
+static const char scriptTestSetup[] =
"<screenplay>\n"
"<text id='label' text='defg'/>\n"
"<add id='addLabel' use='label'/>\n"
diff --git a/src/animator/SkAnimatorScript.h b/src/animator/SkAnimatorScript.h
index a23f90de79..c8802a35e7 100644
--- a/src/animator/SkAnimatorScript.h
+++ b/src/animator/SkAnimatorScript.h
@@ -27,8 +27,8 @@ public:
SkAnimatorScript(SkAnimateMaker& , SkDisplayable* , SkDisplayTypes type);
~SkAnimatorScript();
bool evaluate(const char* script, SkScriptValue* , SkDisplayTypes type);
- void track(SkDisplayable* displayable) {
- SkASSERT(fTrackDisplayable.find(displayable) < 0);
+ void track(SkDisplayable* displayable) {
+ SkASSERT(fTrackDisplayable.find(displayable) < 0);
*fTrackDisplayable.append() = displayable; }
static bool EvaluateDisplayable(SkAnimateMaker& , SkDisplayable* , const char* script, SkDisplayable** );
static bool EvaluateFloat(SkAnimateMaker& , SkDisplayable* , const char* script, SkScalar* );
@@ -38,24 +38,24 @@ public:
static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
protected:
static bool Box(void* user, SkScriptValue* );
- static bool Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool Eval(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
static bool EvalEnum(const char* token, size_t len, void* callBack, SkScriptValue* );
static bool EvalID(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool EvalMember(const char* member, size_t len, void* object, void* eng,
+ static bool EvalMember(const char* member, size_t len, void* object, void* eng,
SkScriptValue* value);
- static bool EvalMemberCommon(SkScriptEngine* , const SkMemberInfo* info,
+ static bool EvalMemberCommon(SkScriptEngine* , const SkMemberInfo* info,
SkDisplayable* displayable, SkScriptValue* value);
- static bool EvalMemberFunction(const char* member, size_t len, void* object,
+ static bool EvalMemberFunction(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* user, SkScriptValue* value);
static bool EvalNamedColor(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool EvalRGB(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
- static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
+ static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
static bool Infinity(const char* token, size_t len, void* callBack, SkScriptValue* );
- static bool IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool IsFinite(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
- static bool IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
+ static bool IsNaN(const char* function, size_t len, SkTDArray<SkScriptValue>& params,
void* callBack, SkScriptValue* );
static bool NaN(const char* token, size_t len, void* callBack, SkScriptValue* );
static bool Unbox(void* , SkScriptValue* scriptValue);
diff --git a/src/animator/SkAnimatorScript2.cpp b/src/animator/SkAnimatorScript2.cpp
index ae51fdcd30..45ce3cee58 100644
--- a/src/animator/SkAnimatorScript2.cpp
+++ b/src/animator/SkAnimatorScript2.cpp
@@ -17,29 +17,29 @@
#include "SkScriptCallBack.h"
static const SkDisplayEnumMap gEnumMaps[] = {
- { SkType_AddMode, "indirect|immediate" },
- { SkType_Align, "left|center|right" },
- { SkType_ApplyMode, "immediate|once" },
- { SkType_ApplyTransition, "reverse" },
- { SkType_BitmapEncoding, "jpeg|png" },
- { SkType_BitmapFormat, "none|A1|A8|Index8|RGB16|RGB32" },
- { SkType_Boolean, "false|true" },
- { SkType_Cap, "butt|round|square" },
- { SkType_EventCode, "none|up|down|left|right|back|end|OK|send|leftSoftKey|rightSoftKey|key0|key1|key2|key3|key4|key5|key6|key7|key8|key9|star|hash" },
- { SkType_EventKind, "none|keyChar|keyPress|mouseDown|mouseDrag|mouseMove|mouseUp|onEnd|onLoad|user" },
- { SkType_EventMode, "deferred|immediate" },
- { SkType_FillType, "winding|evenOdd" },
- { SkType_FilterType, "none|bilinear" },
- { SkType_FromPathMode, "normal|angle|position" },
- { SkType_Join, "miter|round|blunt" },
- { SkType_MaskFilterBlurStyle, "normal|solid|outer|inner" },
- { SkType_PathDirection, "cw|ccw" },
- { SkType_Style, "fill|stroke|strokeAndFill" },
- { SkType_TextBoxAlign, "start|center|end" },
- { SkType_TextBoxMode, "oneLine|lineBreak" },
- { SkType_TileMode, "clamp|repeat|mirror" },
- { SkType_Xfermode, "clear|src|dst|srcOver|dstOver|srcIn|dstIn|srcOut|dstOut|"
- "srcATop|dstATop|xor|darken|lighten" },
+ { SkType_AddMode, "indirect|immediate" },
+ { SkType_Align, "left|center|right" },
+ { SkType_ApplyMode, "immediate|once" },
+ { SkType_ApplyTransition, "reverse" },
+ { SkType_BitmapEncoding, "jpeg|png" },
+ { SkType_BitmapFormat, "none|A1|A8|Index8|RGB16|RGB32" },
+ { SkType_Boolean, "false|true" },
+ { SkType_Cap, "butt|round|square" },
+ { SkType_EventCode, "none|up|down|left|right|back|end|OK|send|leftSoftKey|rightSoftKey|key0|key1|key2|key3|key4|key5|key6|key7|key8|key9|star|hash" },
+ { SkType_EventKind, "none|keyChar|keyPress|mouseDown|mouseDrag|mouseMove|mouseUp|onEnd|onLoad|user" },
+ { SkType_EventMode, "deferred|immediate" },
+ { SkType_FillType, "winding|evenOdd" },
+ { SkType_FilterType, "none|bilinear" },
+ { SkType_FromPathMode, "normal|angle|position" },
+ { SkType_Join, "miter|round|blunt" },
+ { SkType_MaskFilterBlurStyle, "normal|solid|outer|inner" },
+ { SkType_PathDirection, "cw|ccw" },
+ { SkType_Style, "fill|stroke|strokeAndFill" },
+ { SkType_TextBoxAlign, "start|center|end" },
+ { SkType_TextBoxMode, "oneLine|lineBreak" },
+ { SkType_TileMode, "clamp|repeat|mirror" },
+ { SkType_Xfermode, "clear|src|dst|srcOver|dstOver|srcIn|dstIn|srcOut|dstOut|"
+ "srcATop|dstATop|xor|darken|lighten" },
};
static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps);
@@ -47,575 +47,575 @@ static int gEnumMapCount = SK_ARRAY_COUNT(gEnumMaps);
class SkAnimatorScript_Box : public SkScriptCallBackConvert {
public:
- SkAnimatorScript_Box() {}
-
- ~SkAnimatorScript_Box() {
- for (SkDisplayable** dispPtr = fTrackDisplayable.begin(); dispPtr < fTrackDisplayable.end(); dispPtr++)
- delete *dispPtr;
- }
-
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
- SkDisplayable* displayable;
- switch (type) {
- case SkOperand2::kArray: {
- SkDisplayArray* boxedValue = new SkDisplayArray(*operand->fArray);
- displayable = boxedValue;
- } break;
- case SkOperand2::kS32: {
- SkDisplayInt* boxedValue = new SkDisplayInt;
- displayable = boxedValue;
- boxedValue->value = operand->fS32;
- } break;
- case SkOperand2::kScalar: {
- SkDisplayFloat* boxedValue = new SkDisplayFloat;
- displayable = boxedValue;
- boxedValue->value = operand->fScalar;
- } break;
- case SkOperand2::kString: {
- SkDisplayString* boxedValue = new SkDisplayString(*operand->fString);
- displayable = boxedValue;
- } break;
- case SkOperand2::kObject:
- return true;
- default:
- SkASSERT(0);
- return false;
- }
- track(displayable);
- operand->fObject = (void*) displayable;
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(int index) {
- return SkOperand2::kObject;
- }
-
- virtual Type getType() const {
- return kBox;
- }
-
- void track(SkDisplayable* displayable) {
- SkASSERT(fTrackDisplayable.find(displayable) < 0);
- *fTrackDisplayable.append() = displayable;
- }
-
- SkTDDisplayableArray fTrackDisplayable;
+ SkAnimatorScript_Box() {}
+
+ ~SkAnimatorScript_Box() {
+ for (SkDisplayable** dispPtr = fTrackDisplayable.begin(); dispPtr < fTrackDisplayable.end(); dispPtr++)
+ delete *dispPtr;
+ }
+
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
+ SkDisplayable* displayable;
+ switch (type) {
+ case SkOperand2::kArray: {
+ SkDisplayArray* boxedValue = new SkDisplayArray(*operand->fArray);
+ displayable = boxedValue;
+ } break;
+ case SkOperand2::kS32: {
+ SkDisplayInt* boxedValue = new SkDisplayInt;
+ displayable = boxedValue;
+ boxedValue->value = operand->fS32;
+ } break;
+ case SkOperand2::kScalar: {
+ SkDisplayFloat* boxedValue = new SkDisplayFloat;
+ displayable = boxedValue;
+ boxedValue->value = operand->fScalar;
+ } break;
+ case SkOperand2::kString: {
+ SkDisplayString* boxedValue = new SkDisplayString(*operand->fString);
+ displayable = boxedValue;
+ } break;
+ case SkOperand2::kObject:
+ return true;
+ default:
+ SkASSERT(0);
+ return false;
+ }
+ track(displayable);
+ operand->fObject = (void*) displayable;
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(int index) {
+ return SkOperand2::kObject;
+ }
+
+ virtual Type getType() const {
+ return kBox;
+ }
+
+ void track(SkDisplayable* displayable) {
+ SkASSERT(fTrackDisplayable.find(displayable) < 0);
+ *fTrackDisplayable.append() = displayable;
+ }
+
+ SkTDDisplayableArray fTrackDisplayable;
};
class SkAnimatorScript_Enum : public SkScriptCallBackProperty {
public:
- SkAnimatorScript_Enum(const char* tokens) : fTokens(tokens) {}
+ SkAnimatorScript_Enum(const char* tokens) : fTokens(tokens) {}
- virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
- return SkAnimatorScript2::MapEnums(fTokens, name, len, &value->fS32);
- }
+ virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
+ return SkAnimatorScript2::MapEnums(fTokens, name, len, &value->fS32);
+ }
private:
- const char* fTokens;
+ const char* fTokens;
};
- // !!! if type is string, call invoke
- // if any other type, return original value
- // distinction is undone: could do this by returning index == 0 only if param is string
- // still, caller of getParamTypes will attempt to convert param to string (I guess)
+ // !!! if type is string, call invoke
+ // if any other type, return original value
+ // distinction is undone: could do this by returning index == 0 only if param is string
+ // still, caller of getParamTypes will attempt to convert param to string (I guess)
class SkAnimatorScript_Eval : public SkScriptCallBackFunction {
public:
- SkAnimatorScript_Eval(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool getIndex(const char* name, int len, size_t* result) {
- if (SK_LITERAL_STR_EQUAL("eval", name, len) != 0)
- return false;
- *result = 0;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(1);
- SkOperand2::OpType* type = types->begin();
- type[0] = SkOperand2::kString;
- }
-
- virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
- SkAnimatorScript2 engine(fEngine->getMaker(), fEngine->getWorking(),
- SkAnimatorScript2::ToDisplayType(fEngine->getReturnType()));
- SkOperand2* op = params->begin();
- const char* script = op->fString->c_str();
- SkScriptValue2 value;
- return engine.evaluateScript(&script, &value);
- SkASSERT(value.fType == fEngine->getReturnType());
- *answer = value.fOperand;
- // !!! incomplete ?
- return true;
- }
+ SkAnimatorScript_Eval(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool getIndex(const char* name, int len, size_t* result) {
+ if (SK_LITERAL_STR_EQUAL("eval", name, len) != 0)
+ return false;
+ *result = 0;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(1);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = SkOperand2::kString;
+ }
+
+ virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
+ SkAnimatorScript2 engine(fEngine->getMaker(), fEngine->getWorking(),
+ SkAnimatorScript2::ToDisplayType(fEngine->getReturnType()));
+ SkOperand2* op = params->begin();
+ const char* script = op->fString->c_str();
+ SkScriptValue2 value;
+ return engine.evaluateScript(&script, &value);
+ SkASSERT(value.fType == fEngine->getReturnType());
+ *answer = value.fOperand;
+ // !!! incomplete ?
+ return true;
+ }
private:
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_ID : public SkScriptCallBackProperty {
public:
- SkAnimatorScript_ID(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool getIndex(const char* token, int len, size_t* result) {
- SkDisplayable* displayable;
- bool success = fEngine->getMaker().find(token, len, &displayable);
- if (success == false) {
- *result = 0;
- } else {
- *result = (size_t) displayable;
- SkDisplayable* working = fEngine->getWorking();
- if (displayable->canContainDependents() && working && working->isAnimate()) {
- SkAnimateBase* animator = (SkAnimateBase*) working;
- if (animator->isDynamic()) {
- SkDisplayDepend* depend = (SkDisplayDepend* ) displayable;
- depend->addDependent(working);
- }
- }
- }
- return true;
- }
-
- virtual bool getResult(size_t ref, SkOperand2* answer) {
- answer->fObject = (void*) ref;
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(size_t index) {
- return index == 0 ? SkOperand2::kString : SkOperand2::kObject;
- }
+ SkAnimatorScript_ID(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool getIndex(const char* token, int len, size_t* result) {
+ SkDisplayable* displayable;
+ bool success = fEngine->getMaker().find(token, len, &displayable);
+ if (success == false) {
+ *result = 0;
+ } else {
+ *result = (size_t) displayable;
+ SkDisplayable* working = fEngine->getWorking();
+ if (displayable->canContainDependents() && working && working->isAnimate()) {
+ SkAnimateBase* animator = (SkAnimateBase*) working;
+ if (animator->isDynamic()) {
+ SkDisplayDepend* depend = (SkDisplayDepend* ) displayable;
+ depend->addDependent(working);
+ }
+ }
+ }
+ return true;
+ }
+
+ virtual bool getResult(size_t ref, SkOperand2* answer) {
+ answer->fObject = (void*) ref;
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(size_t index) {
+ return index == 0 ? SkOperand2::kString : SkOperand2::kObject;
+ }
private:
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_Member : public SkScriptCallBackMember {
public:
- SkAnimatorScript_Member(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
- SkDisplayable* displayable = (SkDisplayable*) object;
- SkString name(member, len);
- SkDisplayable* named = displayable->contains(name);
- if (named) {
- ref->fType = SkOperand2::kObject;
- ref->fOperand.fObject = named;
- return true;
- }
- const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL)
- return false; // !!! add additional error info?
- ref->fType = SkAnimatorScript2::ToOpType(info->getType());
- ref->fOperand.fObject = (void*) info;
- return true;
- }
-
- bool invoke(size_t ref, void* object, SkOperand2* value) {
- const SkMemberInfo* info = (const SkMemberInfo* ) ref;
- SkDisplayable* displayable = (SkDisplayable*) object;
- if (info->fType == SkType_MemberProperty) {
- if (displayable->getProperty2(info->propertyIndex(), value) == false) {
- return false;
- }
- }
- return fEngine->evalMemberCommon(info, displayable, value);
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_Member(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ SkString name(member, len);
+ SkDisplayable* named = displayable->contains(name);
+ if (named) {
+ ref->fType = SkOperand2::kObject;
+ ref->fOperand.fObject = named;
+ return true;
+ }
+ const SkMemberInfo* info = displayable->getMember(name.c_str());
+ if (info == NULL)
+ return false; // !!! add additional error info?
+ ref->fType = SkAnimatorScript2::ToOpType(info->getType());
+ ref->fOperand.fObject = (void*) info;
+ return true;
+ }
+
+ bool invoke(size_t ref, void* object, SkOperand2* value) {
+ const SkMemberInfo* info = (const SkMemberInfo* ) ref;
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ if (info->fType == SkType_MemberProperty) {
+ if (displayable->getProperty2(info->propertyIndex(), value) == false) {
+ return false;
+ }
+ }
+ return fEngine->evalMemberCommon(info, displayable, value);
+ }
+
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_MemberFunction : public SkScriptCallBackMemberFunction {
public:
- SkAnimatorScript_MemberFunction(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
- SkDisplayable* displayable = (SkDisplayable*) object;
- SkString name(member, len);
- const SkMemberInfo* info = displayable->getMember(name.c_str());
- if (info == NULL || info->fType != SkType_MemberFunction)
- return false; // !!! add additional error info?
- ref->fType = SkAnimatorScript2::ToOpType(info->getType());
- ref->fOperand.fObject = (void*) info;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(3);
- SkOperand2::OpType* type = types->begin();
- type[0] = type[1] = type[2] = SkOperand2::kS32;
- }
-
- bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value)
- {
- const SkMemberInfo* info = (const SkMemberInfo* ) ref;
- SkDisplayable* displayable = (SkDisplayable*) object;
- displayable->executeFunction2(displayable, info->functionIndex(), params, info->getType(),
- value);
- return fEngine->evalMemberCommon(info, displayable, value);
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_MemberFunction(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ bool getMemberReference(const char* member, size_t len, void* object, SkScriptValue2* ref) {
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ SkString name(member, len);
+ const SkMemberInfo* info = displayable->getMember(name.c_str());
+ if (info == NULL || info->fType != SkType_MemberFunction)
+ return false; // !!! add additional error info?
+ ref->fType = SkAnimatorScript2::ToOpType(info->getType());
+ ref->fOperand.fObject = (void*) info;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(3);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = type[1] = type[2] = SkOperand2::kS32;
+ }
+
+ bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value)
+ {
+ const SkMemberInfo* info = (const SkMemberInfo* ) ref;
+ SkDisplayable* displayable = (SkDisplayable*) object;
+ displayable->executeFunction2(displayable, info->functionIndex(), params, info->getType(),
+ value);
+ return fEngine->evalMemberCommon(info, displayable, value);
+ }
+
+ SkAnimatorScript2* fEngine;
};
class SkAnimatorScript_NamedColor : public SkScriptCallBackProperty {
public:
- virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
- return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL;
- }
+ virtual bool getConstValue(const char* name, int len, SkOperand2* value) {
+ return SkParse::FindNamedColor(name, len, (SkColor*) &value->fS32) != NULL;
+ }
};
class SkAnimatorScript_RGB : public SkScriptCallBackFunction {
public:
- virtual bool getIndex(const char* name, int len, size_t* result) {
- if (SK_LITERAL_STR_EQUAL("rgb", name, len) != 0)
- return false;
- *result = 0;
- return true;
- }
-
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
- types->setCount(3);
- SkOperand2::OpType* type = types->begin();
- type[0] = type[1] = type[2] = SkOperand2::kS32;
- }
-
- virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
- SkASSERT(index == 0);
- unsigned result = 0xFF000000;
- int shift = 16;
- for (int index = 0; index < 3; index++) {
- result |= SkClampMax(params->begin()[index].fS32, 255) << shift;
- shift -= 8;
- }
- answer->fS32 = result;
- return true;
- }
+ virtual bool getIndex(const char* name, int len, size_t* result) {
+ if (SK_LITERAL_STR_EQUAL("rgb", name, len) != 0)
+ return false;
+ *result = 0;
+ return true;
+ }
+
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) {
+ types->setCount(3);
+ SkOperand2::OpType* type = types->begin();
+ type[0] = type[1] = type[2] = SkOperand2::kS32;
+ }
+
+ virtual bool invoke(size_t index, SkOpArray* params, SkOperand2* answer) {
+ SkASSERT(index == 0);
+ unsigned result = 0xFF000000;
+ int shift = 16;
+ for (int index = 0; index < 3; index++) {
+ result |= SkClampMax(params->begin()[index].fS32, 255) << shift;
+ shift -= 8;
+ }
+ answer->fS32 = result;
+ return true;
+ }
};
class SkAnimatorScript_Unbox : public SkScriptCallBackConvert {
public:
- SkAnimatorScript_Unbox(SkAnimatorScript2* engine) : fEngine(engine) {}
-
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
- SkASSERT(type == SkOperand2::kObject);
- SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
- switch (displayable->getType()) {
- case SkType_Array: {
- SkDisplayArray* boxedValue = (SkDisplayArray*) displayable;
- operand->fArray = new SkOpArray(SkAnimatorScript2::ToOpType(boxedValue->values.getType()));
- int count = boxedValue->values.count();
- operand->fArray->setCount(count);
- memcpy(operand->fArray->begin(), boxedValue->values.begin(), count * sizeof(SkOperand2));
- fEngine->track(operand->fArray);
- } break;
- case SkType_Boolean: {
- SkDisplayBoolean* boxedValue = (SkDisplayBoolean*) displayable;
- operand->fS32 = boxedValue->value;
- } break;
- case SkType_Int: {
- SkDisplayInt* boxedValue = (SkDisplayInt*) displayable;
- operand->fS32 = boxedValue->value;
- } break;
- case SkType_Float: {
- SkDisplayFloat* boxedValue = (SkDisplayFloat*) displayable;
- operand->fScalar = boxedValue->value;
- } break;
- case SkType_String: {
- SkDisplayString* boxedValue = (SkDisplayString*) displayable;
- operand->fString = SkNEW_ARGS(SkString, (boxedValue->value));
- } break;
- default: {
- const char* id;
- bool success = fEngine->getMaker().findKey(displayable, &id);
- SkASSERT(success);
- operand->fString = SkNEW_ARGS(SkString, (id));
- }
- }
- return true;
- }
-
- virtual SkOperand2::OpType getReturnType(int /*index*/, SkOperand2* operand) {
- SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
- switch (displayable->getType()) {
- case SkType_Array:
- return SkOperand2::kArray;
- case SkType_Int:
- return SkOperand2::kS32;
- case SkType_Float:
- return SkOperand2::kScalar;
- case SkType_String:
- default:
- return SkOperand2::kString;
- }
- }
-
- virtual Type getType() const {
- return kUnbox;
- }
-
- SkAnimatorScript2* fEngine;
+ SkAnimatorScript_Unbox(SkAnimatorScript2* engine) : fEngine(engine) {}
+
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) {
+ SkASSERT(type == SkOperand2::kObject);
+ SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
+ switch (displayable->getType()) {
+ case SkType_Array: {
+ SkDisplayArray* boxedValue = (SkDisplayArray*) displayable;
+ operand->fArray = new SkOpArray(SkAnimatorScript2::ToOpType(boxedValue->values.getType()));
+ int count = boxedValue->values.count();
+ operand->fArray->setCount(count);
+ memcpy(operand->fArray->begin(), boxedValue->values.begin(), count * sizeof(SkOperand2));
+ fEngine->track(operand->fArray);
+ } break;
+ case SkType_Boolean: {
+ SkDisplayBoolean* boxedValue = (SkDisplayBoolean*) displayable;
+ operand->fS32 = boxedValue->value;
+ } break;
+ case SkType_Int: {
+ SkDisplayInt* boxedValue = (SkDisplayInt*) displayable;
+ operand->fS32 = boxedValue->value;
+ } break;
+ case SkType_Float: {
+ SkDisplayFloat* boxedValue = (SkDisplayFloat*) displayable;
+ operand->fScalar = boxedValue->value;
+ } break;
+ case SkType_String: {
+ SkDisplayString* boxedValue = (SkDisplayString*) displayable;
+ operand->fString = SkNEW_ARGS(SkString, (boxedValue->value));
+ } break;
+ default: {
+ const char* id;
+ bool success = fEngine->getMaker().findKey(displayable, &id);
+ SkASSERT(success);
+ operand->fString = SkNEW_ARGS(SkString, (id));
+ }
+ }
+ return true;
+ }
+
+ virtual SkOperand2::OpType getReturnType(int /*index*/, SkOperand2* operand) {
+ SkDisplayable* displayable = (SkDisplayable*) operand->fObject;
+ switch (displayable->getType()) {
+ case SkType_Array:
+ return SkOperand2::kArray;
+ case SkType_Int:
+ return SkOperand2::kS32;
+ case SkType_Float:
+ return SkOperand2::kScalar;
+ case SkType_String:
+ default:
+ return SkOperand2::kString;
+ }
+ }
+
+ virtual Type getType() const {
+ return kUnbox;
+ }
+
+ SkAnimatorScript2* fEngine;
};
-SkAnimatorScript2::SkAnimatorScript2(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type) :
- SkScriptEngine2(ToOpType(type)), fMaker(maker), fWorking(working) {
- *fCallBackArray.append() = new SkAnimatorScript_Member(this);
- *fCallBackArray.append() = new SkAnimatorScript_MemberFunction(this);
- *fCallBackArray.append() = new SkAnimatorScript_Box();
- *fCallBackArray.append() = new SkAnimatorScript_Unbox(this);
- *fCallBackArray.append() = new SkAnimatorScript_ID(this);
- if (type == SkType_ARGB) {
- *fCallBackArray.append() = new SkAnimatorScript_RGB();
- *fCallBackArray.append() = new SkAnimatorScript_NamedColor();
- }
- if (SkDisplayType::IsEnum(&maker, type)) {
- // !!! for SpiderMonkey, iterate through the enum values, and map them to globals
- const SkDisplayEnumMap& map = GetEnumValues(type);
- *fCallBackArray.append() = new SkAnimatorScript_Enum(map.fValues);
- }
- *fCallBackArray.append() = new SkAnimatorScript_Eval(this);
-#if 0 // !!! no extra support for now
- for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
- SkExtras* extra = *extraPtr;
- if (extra->fExtraCallBack)
- *fCallBackArray.append() = new propertyCallBack(extra->fExtraCallBack, extra->fExtraStorage);
- }
+SkAnimatorScript2::SkAnimatorScript2(SkAnimateMaker& maker, SkDisplayable* working, SkDisplayTypes type) :
+ SkScriptEngine2(ToOpType(type)), fMaker(maker), fWorking(working) {
+ *fCallBackArray.append() = new SkAnimatorScript_Member(this);
+ *fCallBackArray.append() = new SkAnimatorScript_MemberFunction(this);
+ *fCallBackArray.append() = new SkAnimatorScript_Box();
+ *fCallBackArray.append() = new SkAnimatorScript_Unbox(this);
+ *fCallBackArray.append() = new SkAnimatorScript_ID(this);
+ if (type == SkType_ARGB) {
+ *fCallBackArray.append() = new SkAnimatorScript_RGB();
+ *fCallBackArray.append() = new SkAnimatorScript_NamedColor();
+ }
+ if (SkDisplayType::IsEnum(&maker, type)) {
+ // !!! for SpiderMonkey, iterate through the enum values, and map them to globals
+ const SkDisplayEnumMap& map = GetEnumValues(type);
+ *fCallBackArray.append() = new SkAnimatorScript_Enum(map.fValues);
+ }
+ *fCallBackArray.append() = new SkAnimatorScript_Eval(this);
+#if 0 // !!! no extra support for now
+ for (SkExtras** extraPtr = maker.fExtras.begin(); extraPtr < maker.fExtras.end(); extraPtr++) {
+ SkExtras* extra = *extraPtr;
+ if (extra->fExtraCallBack)
+ *fCallBackArray.append() = new propertyCallBack(extra->fExtraCallBack, extra->fExtraStorage);
+ }
#endif
}
SkAnimatorScript2::~SkAnimatorScript2() {
- SkScriptCallBack** end = fCallBackArray.end();
- for (SkScriptCallBack** ptr = fCallBackArray.begin(); ptr < end; ptr++)
- delete *ptr;
+ SkScriptCallBack** end = fCallBackArray.end();
+ for (SkScriptCallBack** ptr = fCallBackArray.begin(); ptr < end; ptr++)
+ delete *ptr;
}
-bool SkAnimatorScript2::evalMemberCommon(const SkMemberInfo* info,
- SkDisplayable* displayable, SkOperand2* value) {
- SkDisplayTypes original;
- SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
- if (info->fType == SkType_Array)
- type = SkType_Array;
- switch (type) {
- case SkType_ARGB:
- type = SkType_Int;
- case SkType_Boolean:
- case SkType_Int:
- case SkType_MSec:
- case SkType_Float:
- SkASSERT(info->getCount() == 1);
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
- value->fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
- if (type == SkType_MSec) {
- value->fScalar = SkScalarDiv((SkScalar) value->fS32, 1000); // dividing two ints is the same as dividing two scalars
- type = SkType_Float;
- }
- break;
- case SkType_String: {
- SkString* displayableString;
- if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction) {
- info->getString(displayable, &displayableString);
- value->fString = new SkString(*displayableString);
- }
- } break;
- case SkType_Array: {
- SkASSERT(info->fType != SkType_MemberProperty); // !!! incomplete
- SkTDOperandArray* displayableArray = (SkTDOperandArray*) info->memberData(displayable);
- if (displayable->getType() == SkType_Array) {
- SkDisplayArray* typedArray = (SkDisplayArray*) displayable;
- original = typedArray->values.getType();
- }
- SkASSERT(original != SkType_Unknown);
- SkOpArray* array = value->fArray = new SkOpArray(ToOpType(original));
- track(array);
- int count = displayableArray->count();
- if (count > 0) {
- array->setCount(count);
- memcpy(array->begin(), displayableArray->begin(), count * sizeof(SkOperand2));
- }
- } break;
- default:
- SkASSERT(0); // unimplemented
- }
- return true;
+bool SkAnimatorScript2::evalMemberCommon(const SkMemberInfo* info,
+ SkDisplayable* displayable, SkOperand2* value) {
+ SkDisplayTypes original;
+ SkDisplayTypes type = original = (SkDisplayTypes) info->getType();
+ if (info->fType == SkType_Array)
+ type = SkType_Array;
+ switch (type) {
+ case SkType_ARGB:
+ type = SkType_Int;
+ case SkType_Boolean:
+ case SkType_Int:
+ case SkType_MSec:
+ case SkType_Float:
+ SkASSERT(info->getCount() == 1);
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction)
+ value->fS32 = *(int32_t*) info->memberData(displayable); // OK for SkScalar too
+ if (type == SkType_MSec) {
+ value->fScalar = SkScalarDiv((SkScalar) value->fS32, 1000); // dividing two ints is the same as dividing two scalars
+ type = SkType_Float;
+ }
+ break;
+ case SkType_String: {
+ SkString* displayableString;
+ if (info->fType != SkType_MemberProperty && info->fType != SkType_MemberFunction) {
+ info->getString(displayable, &displayableString);
+ value->fString = new SkString(*displayableString);
+ }
+ } break;
+ case SkType_Array: {
+ SkASSERT(info->fType != SkType_MemberProperty); // !!! incomplete
+ SkTDOperandArray* displayableArray = (SkTDOperandArray*) info->memberData(displayable);
+ if (displayable->getType() == SkType_Array) {
+ SkDisplayArray* typedArray = (SkDisplayArray*) displayable;
+ original = typedArray->values.getType();
+ }
+ SkASSERT(original != SkType_Unknown);
+ SkOpArray* array = value->fArray = new SkOpArray(ToOpType(original));
+ track(array);
+ int count = displayableArray->count();
+ if (count > 0) {
+ array->setCount(count);
+ memcpy(array->begin(), displayableArray->begin(), count * sizeof(SkOperand2));
+ }
+ } break;
+ default:
+ SkASSERT(0); // unimplemented
+ }
+ return true;
}
const SkDisplayEnumMap& SkAnimatorScript2::GetEnumValues(SkDisplayTypes type) {
- int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
- sizeof(SkDisplayEnumMap));
- SkASSERT(index >= 0);
- return gEnumMaps[index];
+ int index = SkTSearch<SkDisplayTypes>(&gEnumMaps[0].fType, gEnumMapCount, type,
+ sizeof(SkDisplayEnumMap));
+ SkASSERT(index >= 0);
+ return gEnumMaps[index];
}
SkDisplayTypes SkAnimatorScript2::ToDisplayType(SkOperand2::OpType type) {
- int val = type;
- switch (val) {
- case SkOperand2::kNoType:
- return SkType_Unknown;
- case SkOperand2::kS32:
- return SkType_Int;
- case SkOperand2::kScalar:
- return SkType_Float;
- case SkOperand2::kString:
- return SkType_String;
- case SkOperand2::kArray:
- return SkType_Array;
- case SkOperand2::kObject:
- return SkType_Displayable;
- default:
- SkASSERT(0);
- return SkType_Unknown;
- }
+ int val = type;
+ switch (val) {
+ case SkOperand2::kNoType:
+ return SkType_Unknown;
+ case SkOperand2::kS32:
+ return SkType_Int;
+ case SkOperand2::kScalar:
+ return SkType_Float;
+ case SkOperand2::kString:
+ return SkType_String;
+ case SkOperand2::kArray:
+ return SkType_Array;
+ case SkOperand2::kObject:
+ return SkType_Displayable;
+ default:
+ SkASSERT(0);
+ return SkType_Unknown;
+ }
}
SkOperand2::OpType SkAnimatorScript2::ToOpType(SkDisplayTypes type) {
- if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
- return SkOperand2::kObject;
- if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
- return SkOperand2::kS32;
- switch (type) {
- case SkType_ARGB:
- case SkType_MSec:
- case SkType_Int:
- return SkOperand2::kS32;
- case SkType_Float:
- case SkType_Point:
- case SkType_3D_Point:
- return SkOperand2::kScalar;
- case SkType_Base64:
- case SkType_DynamicString:
- case SkType_String:
- return SkOperand2::kString;
- case SkType_Array:
- return SkOperand2::kArray;
- case SkType_Unknown:
- return SkOperand2::kNoType;
- default:
- SkASSERT(0);
- return SkOperand2::kNoType;
- }
+ if (SkDisplayType::IsDisplayable(NULL /* fMaker */, type))
+ return SkOperand2::kObject;
+ if (SkDisplayType::IsEnum(NULL /* fMaker */, type))
+ return SkOperand2::kS32;
+ switch (type) {
+ case SkType_ARGB:
+ case SkType_MSec:
+ case SkType_Int:
+ return SkOperand2::kS32;
+ case SkType_Float:
+ case SkType_Point:
+ case SkType_3D_Point:
+ return SkOperand2::kScalar;
+ case SkType_Base64:
+ case SkType_DynamicString:
+ case SkType_String:
+ return SkOperand2::kString;
+ case SkType_Array:
+ return SkOperand2::kArray;
+ case SkType_Unknown:
+ return SkOperand2::kNoType;
+ default:
+ SkASSERT(0);
+ return SkOperand2::kNoType;
+ }
}
bool SkAnimatorScript2::MapEnums(const char* ptr, const char* match, size_t len, int* value) {
- int index = 0;
- bool more = true;
- do {
- const char* last = strchr(ptr, '|');
- if (last == NULL) {
- last = &ptr[strlen(ptr)];
- more = false;
- }
- size_t length = last - ptr;
- if (len == length && strncmp(ptr, match, length) == 0) {
- *value = index;
- return true;
- }
- index++;
- ptr = last + 1;
- } while (more);
- return false;
+ int index = 0;
+ bool more = true;
+ do {
+ const char* last = strchr(ptr, '|');
+ if (last == NULL) {
+ last = &ptr[strlen(ptr)];
+ more = false;
+ }
+ size_t length = last - ptr;
+ if (len == length && strncmp(ptr, match, length) == 0) {
+ *value = index;
+ return true;
+ }
+ index++;
+ ptr = last + 1;
+ } while (more);
+ return false;
}
#if defined SK_DEBUG
#include "SkAnimator.h"
-static const char scriptTestSetup[] =
+static const char scriptTestSetup[] =
"<screenplay>"
- "<apply>"
- "<paint>"
- "<emboss id='emboss' direction='[1,1,1]' />"
- "</paint>"
- "<animateField id='animation' field='direction' target='emboss' from='[1,1,1]' to='[-1,1,1]' dur='1'/>"
- "<set lval='direction[0]' target='emboss' to='-1' />"
- "</apply>"
- "<color id='testColor' color='0 ? rgb(0,0,0) : rgb(255,255,255)' />"
- "<color id='xColor' color='rgb(12,34,56)' />"
- "<typedArray id='emptyArray' />"
- "<typedArray id='intArray' values='[1, 4, 6]' />"
- "<s32 id='idx' value='2' />"
- "<s32 id='idy' value='2' />"
- "<string id='alpha' value='abc' />"
- "<rectangle id='testRect' left='Math.cos(0)' top='2' right='12' bottom='5' />"
- "<event id='evt'>"
- "<input name='x' />"
- "<apply scope='idy'>"
- "<set field='value' to='evt.x.s32' />"
- "</apply>"
- "</event>"
+ "<apply>"
+ "<paint>"
+ "<emboss id='emboss' direction='[1,1,1]' />"
+ "</paint>"
+ "<animateField id='animation' field='direction' target='emboss' from='[1,1,1]' to='[-1,1,1]' dur='1'/>"
+ "<set lval='direction[0]' target='emboss' to='-1' />"
+ "</apply>"
+ "<color id='testColor' color='0 ? rgb(0,0,0) : rgb(255,255,255)' />"
+ "<color id='xColor' color='rgb(12,34,56)' />"
+ "<typedArray id='emptyArray' />"
+ "<typedArray id='intArray' values='[1, 4, 6]' />"
+ "<s32 id='idx' value='2' />"
+ "<s32 id='idy' value='2' />"
+ "<string id='alpha' value='abc' />"
+ "<rectangle id='testRect' left='Math.cos(0)' top='2' right='12' bottom='5' />"
+ "<event id='evt'>"
+ "<input name='x' />"
+ "<apply scope='idy'>"
+ "<set field='value' to='evt.x.s32' />"
+ "</apply>"
+ "</event>"
"</screenplay>";
static const SkScriptNAnswer scriptTests[] = {
- { "alpha+alpha", SkType_String, 0, 0, "abcabc" },
- { "0 ? Math.sin(0) : 1", SkType_Int, 1 },
- { "intArray[4]", SkType_Unknown },
- { "emptyArray[4]", SkType_Unknown },
- { "idx", SkType_Int, 2 },
- { "intArray.length", SkType_Int, 3 },
- { "intArray.values[0]", SkType_Int, 1 },
- { "intArray[0]", SkType_Int, 1 },
- { "idx.value", SkType_Int, 2 },
- { "alpha.value", SkType_String, 0, 0, "abc" },
- { "alpha", SkType_String, 0, 0, "abc" },
- { "alpha.value+alpha.value", SkType_String, 0, 0, "abcabc" },
- { "alpha+idx", SkType_String, 0, 0, "abc2" },
- { "idx+alpha", SkType_String, 0, 0, "2abc" },
- { "intArray[idx]", SkType_Int, 6 },
- { "alpha.slice(1,2)", SkType_String, 0, 0, "b" },
- { "alpha.value.slice(1,2)", SkType_String, 0, 0, "b" },
- { "Math.sin(0)", SkType_Float, 0, SkIntToScalar(0) },
- { "testRect.left+2", SkType_Float, 0, SkIntToScalar(3) },
- { "0 ? intArray[0] : 1", SkType_Int, 1 },
- { "0 ? intArray.values[0] : 1", SkType_Int, 1 },
- { "0 ? idx : 1", SkType_Int, 1 },
- { "0 ? idx.value : 1", SkType_Int, 1 },
- { "0 ? alpha.slice(1,2) : 1", SkType_Int, 1 },
- { "0 ? alpha.value.slice(1,2) : 1", SkType_Int, 1 },
- { "idy", SkType_Int, 3 }
+ { "alpha+alpha", SkType_String, 0, 0, "abcabc" },
+ { "0 ? Math.sin(0) : 1", SkType_Int, 1 },
+ { "intArray[4]", SkType_Unknown },
+ { "emptyArray[4]", SkType_Unknown },
+ { "idx", SkType_Int, 2 },
+ { "intArray.length", SkType_Int, 3 },
+ { "intArray.values[0]", SkType_Int, 1 },
+ { "intArray[0]", SkType_Int, 1 },
+ { "idx.value", SkType_Int, 2 },
+ { "alpha.value", SkType_String, 0, 0, "abc" },
+ { "alpha", SkType_String, 0, 0, "abc" },
+ { "alpha.value+alpha.value", SkType_String, 0, 0, "abcabc" },
+ { "alpha+idx", SkType_String, 0, 0, "abc2" },
+ { "idx+alpha", SkType_String, 0, 0, "2abc" },
+ { "intArray[idx]", SkType_Int, 6 },
+ { "alpha.slice(1,2)", SkType_String, 0, 0, "b" },
+ { "alpha.value.slice(1,2)", SkType_String, 0, 0, "b" },
+ { "Math.sin(0)", SkType_Float, 0, SkIntToScalar(0) },
+ { "testRect.left+2", SkType_Float, 0, SkIntToScalar(3) },
+ { "0 ? intArray[0] : 1", SkType_Int, 1 },
+ { "0 ? intArray.values[0] : 1", SkType_Int, 1 },
+ { "0 ? idx : 1", SkType_Int, 1 },
+ { "0 ? idx.value : 1", SkType_Int, 1 },
+ { "0 ? alpha.slice(1,2) : 1", SkType_Int, 1 },
+ { "0 ? alpha.value.slice(1,2) : 1", SkType_Int, 1 },
+ { "idy", SkType_Int, 3 }
};
-#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
+#define SkScriptNAnswer_testCount SK_ARRAY_COUNT(scriptTests)
void SkAnimatorScript2::UnitTest() {
#if defined(SK_SUPPORT_UNITTEST)
- SkAnimator animator;
- SkASSERT(animator.decodeMemory(scriptTestSetup, sizeof(scriptTestSetup)-1));
- SkEvent evt;
- evt.setString("id", "evt");
- evt.setS32("x", 3);
- animator.doUserEvent(evt);
- // set up animator with memory script above, then run value tests
- for (int index = 0; index < SkScriptNAnswer_testCount; index++) {
- SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType);
- SkScriptValue2 value;
- const char* script = scriptTests[index].fScript;
- bool success = engine.evaluateScript(&script, &value);
- if (success == false) {
- SkASSERT(scriptTests[index].fType == SkType_Unknown);
- continue;
- }
- SkASSERT(value.fType == ToOpType(scriptTests[index].fType));
- SkScalar error;
- switch (value.fType) {
- case SkOperand2::kS32:
- SkASSERT(value.fOperand.fS32 == scriptTests[index].fIntAnswer);
- break;
- case SkOperand2::kScalar:
- error = SkScalarAbs(value.fOperand.fScalar - scriptTests[index].fScalarAnswer);
- SkASSERT(error < SK_Scalar1 / 10000);
- break;
- case SkOperand2::kString:
- SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStringAnswer));
- break;
- default:
- SkASSERT(0);
- }
- }
+ SkAnimator animator;
+ SkASSERT(animator.decodeMemory(scriptTestSetup, sizeof(scriptTestSetup)-1));
+ SkEvent evt;
+ evt.setString("id", "evt");
+ evt.setS32("x", 3);
+ animator.doUserEvent(evt);
+ // set up animator with memory script above, then run value tests
+ for (int index = 0; index < SkScriptNAnswer_testCount; index++) {
+ SkAnimatorScript2 engine(*animator.fMaker, NULL, scriptTests[index].fType);
+ SkScriptValue2 value;
+ const char* script = scriptTests[index].fScript;
+ bool success = engine.evaluateScript(&script, &value);
+ if (success == false) {
+ SkASSERT(scriptTests[index].fType == SkType_Unknown);
+ continue;
+ }
+ SkASSERT(value.fType == ToOpType(scriptTests[index].fType));
+ SkScalar error;
+ switch (value.fType) {
+ case SkOperand2::kS32:
+ SkASSERT(value.fOperand.fS32 == scriptTests[index].fIntAnswer);
+ break;
+ case SkOperand2::kScalar:
+ error = SkScalarAbs(value.fOperand.fScalar - scriptTests[index].fScalarAnswer);
+ SkASSERT(error < SK_Scalar1 / 10000);
+ break;
+ case SkOperand2::kString:
+ SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStringAnswer));
+ break;
+ default:
+ SkASSERT(0);
+ }
+ }
#endif
}
diff --git a/src/animator/SkAnimatorScript2.h b/src/animator/SkAnimatorScript2.h
index e6bf58eb46..c3995f6fd8 100644
--- a/src/animator/SkAnimatorScript2.h
+++ b/src/animator/SkAnimatorScript2.h
@@ -17,33 +17,33 @@ struct SkMemberInfo;
#ifndef SkAnimatorScript_DEFINED
struct SkDisplayEnumMap {
- SkDisplayTypes fType;
- const char* fValues;
+ SkDisplayTypes fType;
+ const char* fValues;
};
#endif
class SkAnimatorScript2 : public SkScriptEngine2 {
public:
- SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
- ~SkAnimatorScript2();
- bool evalMemberCommon(const SkMemberInfo* info,
- SkDisplayable* displayable, SkOperand2* value);
- SkAnimateMaker& getMaker() { return fMaker; }
- SkDisplayable* getWorking() { return fWorking; }
- static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
- static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
- static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
- static SkOperand2::OpType ToOpType(SkDisplayTypes type);
+ SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
+ ~SkAnimatorScript2();
+ bool evalMemberCommon(const SkMemberInfo* info,
+ SkDisplayable* displayable, SkOperand2* value);
+ SkAnimateMaker& getMaker() { return fMaker; }
+ SkDisplayable* getWorking() { return fWorking; }
+ static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
+ static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
+ static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
+ static SkOperand2::OpType ToOpType(SkDisplayTypes type);
private:
- SkAnimateMaker& fMaker;
- SkDisplayable* fWorking;
- friend class SkDump;
- friend struct SkScriptNAnswer;
- // illegal
- SkAnimatorScript2& operator=(const SkAnimatorScript2&);
+ SkAnimateMaker& fMaker;
+ SkDisplayable* fWorking;
+ friend class SkDump;
+ friend struct SkScriptNAnswer;
+ // illegal
+ SkAnimatorScript2& operator=(const SkAnimatorScript2&);
#ifdef SK_DEBUG
public:
- static void UnitTest();
+ static void UnitTest();
#endif
};
diff --git a/src/animator/SkBoundable.cpp b/src/animator/SkBoundable.cpp
index 017b6b8068..7f36218f5c 100644
--- a/src/animator/SkBoundable.cpp
+++ b/src/animator/SkBoundable.cpp
@@ -39,7 +39,7 @@ void SkBoundable::enableBounder() {
}
-SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
+SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
SkAnimateMaker& maker) : fBoundable(boundable), fMaker(maker) {
if (fBoundable->hasBounds()) {
fMaker.fCanvas->setBounder(&maker.fDisplayList);
diff --git a/src/animator/SkBuildCondensedInfo.cpp b/src/animator/SkBuildCondensedInfo.cpp
index 30da67ec38..8fb82c7414 100644
--- a/src/animator/SkBuildCondensedInfo.cpp
+++ b/src/animator/SkBuildCondensedInfo.cpp
@@ -10,7 +10,7 @@
#include "SkTypes.h"
#if defined SK_BUILD_CONDENSED
#include "SkMemberInfo.h"
-#if SK_USE_CONDENSED_INFO == 1
+#if SK_USE_CONDENSED_INFO == 1
#error "SK_USE_CONDENSED_INFO must be zero to build condensed info"
#endif
#if !defined SK_BUILD_FOR_WIN32
@@ -115,7 +115,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
continue;
AddInfo(gTypeNames[index].fType, info, infoCount);
}
- const SkMemberInfo* extraInfo =
+ const SkMemberInfo* extraInfo =
SkDisplayType::GetMembers(maker, SkType_3D_Point, &infoCount);
AddInfo(SkType_Point, extraInfo, infoCount);
AddInfo(SkType_3D_Point, extraInfo, infoCount);
@@ -239,7 +239,7 @@ void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
Get3DName(scratch, gTypeNames[typeNameIndex].fName);
} else
sprintf(scratch, "Unknown%d", unknown++);
- fprintf(condensed, "%d%c // %s\n\t", index,
+ fprintf(condensed, "%d%c // %s\n\t", index,
index < gInfosCounts.count() ? ',' : ' ', scratch);
}
fprintf(condensed, "\n};\n\n");
diff --git a/src/animator/SkCondensedDebug.cpp b/src/animator/SkCondensedDebug.cpp
index c1c7007e75..08764b6649 100644
--- a/src/animator/SkCondensedDebug.cpp
+++ b/src/animator/SkCondensedDebug.cpp
@@ -14,7 +14,7 @@
// To change it, edit the file with the matching debug info.
// Then execute SkDisplayType::BuildCondensedInfo() to regenerate this file.
-static const char gMathStrings[] =
+static const char gMathStrings[] =
"E\0"
"LN10\0"
"LN2\0"
@@ -72,7 +72,7 @@ static const SkMemberInfo gMathInfo[] = {
{123, -18, 66, 98}
};
-static const char gAddStrings[] =
+static const char gAddStrings[] =
"inPlace\0"
"offset\0"
"use\0"
@@ -86,7 +86,7 @@ static const SkMemberInfo gAddInfo[] = {
{19, 28, 37, 1}
};
-static const char gAddCircleStrings[] =
+static const char gAddCircleStrings[] =
"\0"
"radius\0"
"x\0"
@@ -100,7 +100,7 @@ static const SkMemberInfo gAddCircleInfo[] = {
{10, 32, 98, 1}
};
-static const char gUnknown1Strings[] =
+static const char gUnknown1Strings[] =
"direction"
;
@@ -108,7 +108,7 @@ static const SkMemberInfo gUnknown1Info[] = {
{0, 20, 75, 1}
};
-static const char gAddOvalStrings[] =
+static const char gAddOvalStrings[] =
""
;
@@ -116,7 +116,7 @@ static const SkMemberInfo gAddOvalInfo[] = {
{0, 6, 18, 5}
};
-static const char gAddPathStrings[] =
+static const char gAddPathStrings[] =
"matrix\0"
"path"
;
@@ -126,7 +126,7 @@ static const SkMemberInfo gAddPathInfo[] = {
{7, 24, 74, 1}
};
-static const char gAddRectangleStrings[] =
+static const char gAddRectangleStrings[] =
"\0"
"bottom\0"
"left\0"
@@ -142,7 +142,7 @@ static const SkMemberInfo gAddRectangleInfo[] = {
{19, 28, 98, 1}
};
-static const char gAddRoundRectStrings[] =
+static const char gAddRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -154,7 +154,7 @@ static const SkMemberInfo gAddRoundRectInfo[] = {
{4, 44, 98, 1}
};
-static const char gUnknown2Strings[] =
+static const char gUnknown2Strings[] =
"begin\0"
"blend\0"
"dur\0"
@@ -186,7 +186,7 @@ static const SkMemberInfo gUnknown2Info[] = {
{73, -4, 67, 40}
};
-static const char gAnimateFieldStrings[] =
+static const char gAnimateFieldStrings[] =
""
;
@@ -194,7 +194,7 @@ static const SkMemberInfo gAnimateFieldInfo[] = {
{0, 8, 18, 13}
};
-static const char gApplyStrings[] =
+static const char gApplyStrings[] =
"animator\0"
"begin\0"
"dontDraw\0"
@@ -226,7 +226,7 @@ static const SkMemberInfo gApplyInfo[] = {
{88, 56, 14, 1}
};
-static const char gUnknown3Strings[] =
+static const char gUnknown3Strings[] =
"x\0"
"y"
;
@@ -236,7 +236,7 @@ static const SkMemberInfo gUnknown3Info[] = {
{2, 52, 98, 1}
};
-static const char gBitmapStrings[] =
+static const char gBitmapStrings[] =
"\0"
"erase\0"
"format\0"
@@ -254,7 +254,7 @@ static const SkMemberInfo gDrawBitmapInfo[] = {
{30, 68, 96, 1}
};
-static const char gBitmapShaderStrings[] =
+static const char gBitmapShaderStrings[] =
"\0"
"filterType\0"
"image"
@@ -266,7 +266,7 @@ static const SkMemberInfo gDrawBitmapShaderInfo[] = {
{12, 32, 17, 1}
};
-static const char gBlurStrings[] =
+static const char gBlurStrings[] =
"blurStyle\0"
"radius"
;
@@ -276,7 +276,7 @@ static const SkMemberInfo gDrawBlurInfo[] = {
{10, 20, 98, 1}
};
-static const char gBoundsStrings[] =
+static const char gBoundsStrings[] =
"\0"
"inval"
;
@@ -286,7 +286,7 @@ static const SkMemberInfo gDisplayBoundsInfo[] = {
{1, 44, 26, 1}
};
-static const char gClipStrings[] =
+static const char gClipStrings[] =
"path\0"
"rectangle"
;
@@ -296,7 +296,7 @@ static const SkMemberInfo gDrawClipInfo[] = {
{5, 16, 91, 1}
};
-static const char gColorStrings[] =
+static const char gColorStrings[] =
"alpha\0"
"blue\0"
"color\0"
@@ -318,7 +318,7 @@ static const SkMemberInfo gDrawColorInfo[] = {
{42, -7, 67, 98}
};
-static const char gCubicToStrings[] =
+static const char gCubicToStrings[] =
"x1\0"
"x2\0"
"x3\0"
@@ -336,7 +336,7 @@ static const SkMemberInfo gCubicToInfo[] = {
{15, 40, 98, 1}
};
-static const char gDashStrings[] =
+static const char gDashStrings[] =
"intervals\0"
"phase"
;
@@ -346,7 +346,7 @@ static const SkMemberInfo gDashInfo[] = {
{10, 36, 98, 1}
};
-static const char gDataStrings[] =
+static const char gDataStrings[] =
"\0"
"name"
;
@@ -356,7 +356,7 @@ static const SkMemberInfo gDataInfo[] = {
{1, 32, 108, 2}
};
-static const char gDiscreteStrings[] =
+static const char gDiscreteStrings[] =
"deviation\0"
"segLength"
;
@@ -366,7 +366,7 @@ static const SkMemberInfo gDiscreteInfo[] = {
{10, 24, 98, 1}
};
-static const char gDrawToStrings[] =
+static const char gDrawToStrings[] =
"drawOnce\0"
"use"
;
@@ -376,7 +376,7 @@ static const SkMemberInfo gDrawToInfo[] = {
{9, 76, 19, 1}
};
-static const char gDumpStrings[] =
+static const char gDumpStrings[] =
"displayList\0"
"eventList\0"
"events\0"
@@ -394,7 +394,7 @@ static const SkMemberInfo gDumpInfo[] = {
{41, 40, 26, 1}
};
-static const char gEmbossStrings[] =
+static const char gEmbossStrings[] =
"ambient\0"
"direction\0"
"radius\0"
@@ -408,7 +408,7 @@ static const SkMemberInfo gDrawEmbossInfo[] = {
{25, -2, 67, 98}
};
-static const char gEventStrings[] =
+static const char gEventStrings[] =
"code\0"
"disable\0"
"key\0"
@@ -430,7 +430,7 @@ static const SkMemberInfo gDisplayEventInfo[] = {
{36, 40, 98, 1}
};
-static const char gFromPathStrings[] =
+static const char gFromPathStrings[] =
"mode\0"
"offset\0"
"path"
@@ -442,7 +442,7 @@ static const SkMemberInfo gFromPathInfo[] = {
{12, 28, 74, 1}
};
-static const char gUnknown4Strings[] =
+static const char gUnknown4Strings[] =
"\0"
"offsets\0"
"unitMapper"
@@ -454,7 +454,7 @@ static const SkMemberInfo gUnknown4Info[] = {
{9, 44, 108, 2}
};
-static const char gGStrings[] =
+static const char gGStrings[] =
"condition\0"
"enableCondition"
;
@@ -464,7 +464,7 @@ static const SkMemberInfo gGInfo[] = {
{10, 24, 40, 2}
};
-static const char gHitClearStrings[] =
+static const char gHitClearStrings[] =
"targets"
;
@@ -472,7 +472,7 @@ static const SkMemberInfo gHitClearInfo[] = {
{0, 16, 119, 36}
};
-static const char gHitTestStrings[] =
+static const char gHitTestStrings[] =
"bullets\0"
"hits\0"
"targets\0"
@@ -486,7 +486,7 @@ static const SkMemberInfo gHitTestInfo[] = {
{21, 64, 26, 1}
};
-static const char gImageStrings[] =
+static const char gImageStrings[] =
"\0"
"base64\0"
"src"
@@ -498,7 +498,7 @@ static const SkMemberInfo gImageInfo[] = {
{8, 64, 108, 2}
};
-static const char gIncludeStrings[] =
+static const char gIncludeStrings[] =
"src"
;
@@ -506,7 +506,7 @@ static const SkMemberInfo gIncludeInfo[] = {
{0, 16, 108, 2}
};
-static const char gInputStrings[] =
+static const char gInputStrings[] =
"s32\0"
"scalar\0"
"string"
@@ -518,7 +518,7 @@ static const SkMemberInfo gInputInfo[] = {
{11, 24, 108, 2}
};
-static const char gLineStrings[] =
+static const char gLineStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -532,7 +532,7 @@ static const SkMemberInfo gLineInfo[] = {
{9, 36, 98, 1}
};
-static const char gLineToStrings[] =
+static const char gLineToStrings[] =
"x\0"
"y"
;
@@ -542,7 +542,7 @@ static const SkMemberInfo gLineToInfo[] = {
{2, 24, 98, 1}
};
-static const char gLinearGradientStrings[] =
+static const char gLinearGradientStrings[] =
"\0"
"points"
;
@@ -552,7 +552,7 @@ static const SkMemberInfo gLinearGradientInfo[] = {
{1, 88, 77, 4}
};
-static const char gMatrixStrings[] =
+static const char gMatrixStrings[] =
"matrix\0"
"perspectX\0"
"perspectY\0"
@@ -582,7 +582,7 @@ static const SkMemberInfo gDrawMatrixInfo[] = {
{87, -11, 67, 98}
};
-static const char gMoveStrings[] =
+static const char gMoveStrings[] =
""
;
@@ -590,7 +590,7 @@ static const SkMemberInfo gMoveInfo[] = {
{0, 1, 18, 4}
};
-static const char gMoveToStrings[] =
+static const char gMoveToStrings[] =
"x\0"
"y"
;
@@ -600,7 +600,7 @@ static const SkMemberInfo gMoveToInfo[] = {
{2, 24, 98, 1}
};
-static const char gMovieStrings[] =
+static const char gMovieStrings[] =
"src"
;
@@ -608,7 +608,7 @@ static const SkMemberInfo gMovieInfo[] = {
{0, 16, 108, 2}
};
-static const char gOvalStrings[] =
+static const char gOvalStrings[] =
""
;
@@ -616,7 +616,7 @@ static const SkMemberInfo gOvalInfo[] = {
{0, 58, 18, 7}
};
-static const char gPaintStrings[] =
+static const char gPaintStrings[] =
"antiAlias\0"
"ascent\0"
"color\0"
@@ -672,7 +672,7 @@ static const SkMemberInfo gDrawPaintInfo[] = {
{235, 100, 121, 1}
};
-static const char gPathStrings[] =
+static const char gPathStrings[] =
"d\0"
"fillType\0"
"length"
@@ -684,7 +684,7 @@ static const SkMemberInfo gDrawPathInfo[] = {
{11, -2, 67, 98}
};
-static const char gUnknown5Strings[] =
+static const char gUnknown5Strings[] =
"x\0"
"y\0"
"z"
@@ -696,7 +696,7 @@ static const SkMemberInfo gUnknown5Info[] = {
{4, 8, 98, 1}
};
-static const char gPointStrings[] =
+static const char gPointStrings[] =
"x\0"
"y"
;
@@ -706,7 +706,7 @@ static const SkMemberInfo gDrawPointInfo[] = {
{2, 20, 98, 1}
};
-static const char gPolyToPolyStrings[] =
+static const char gPolyToPolyStrings[] =
"destination\0"
"source"
;
@@ -716,7 +716,7 @@ static const SkMemberInfo gPolyToPolyInfo[] = {
{12, 20, 80, 1}
};
-static const char gPolygonStrings[] =
+static const char gPolygonStrings[] =
""
;
@@ -724,7 +724,7 @@ static const SkMemberInfo gPolygonInfo[] = {
{0, 48, 18, 1}
};
-static const char gPolylineStrings[] =
+static const char gPolylineStrings[] =
"points"
;
@@ -732,7 +732,7 @@ static const SkMemberInfo gPolylineInfo[] = {
{0, 88, 119, 98}
};
-static const char gPostStrings[] =
+static const char gPostStrings[] =
"delay\0"
"initialized\0"
"mode\0"
@@ -750,7 +750,7 @@ static const SkMemberInfo gPostInfo[] = {
{35, -3, 67, 108}
};
-static const char gQuadToStrings[] =
+static const char gQuadToStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -764,7 +764,7 @@ static const SkMemberInfo gQuadToInfo[] = {
{9, 32, 98, 1}
};
-static const char gRCubicToStrings[] =
+static const char gRCubicToStrings[] =
""
;
@@ -772,7 +772,7 @@ static const SkMemberInfo gRCubicToInfo[] = {
{0, 18, 18, 6}
};
-static const char gRLineToStrings[] =
+static const char gRLineToStrings[] =
""
;
@@ -780,7 +780,7 @@ static const SkMemberInfo gRLineToInfo[] = {
{0, 35, 18, 2}
};
-static const char gRMoveToStrings[] =
+static const char gRMoveToStrings[] =
""
;
@@ -788,7 +788,7 @@ static const SkMemberInfo gRMoveToInfo[] = {
{0, 39, 18, 2}
};
-static const char gRQuadToStrings[] =
+static const char gRQuadToStrings[] =
""
;
@@ -796,7 +796,7 @@ static const SkMemberInfo gRQuadToInfo[] = {
{0, 50, 18, 4}
};
-static const char gRadialGradientStrings[] =
+static const char gRadialGradientStrings[] =
"\0"
"center\0"
"radius"
@@ -808,7 +808,7 @@ static const SkMemberInfo gRadialGradientInfo[] = {
{8, 96, 98, 1}
};
-static const char gRandomStrings[] =
+static const char gRandomStrings[] =
"blend\0"
"max\0"
"min\0"
@@ -824,7 +824,7 @@ static const SkMemberInfo gDisplayRandomInfo[] = {
{21, -2, 67, 96}
};
-static const char gRectToRectStrings[] =
+static const char gRectToRectStrings[] =
"destination\0"
"source"
;
@@ -834,7 +834,7 @@ static const SkMemberInfo gRectToRectInfo[] = {
{12, 20, 91, 1}
};
-static const char gRectangleStrings[] =
+static const char gRectangleStrings[] =
"bottom\0"
"height\0"
"left\0"
@@ -854,7 +854,7 @@ static const SkMemberInfo gRectangleInfo[] = {
{41, -3, 67, 98}
};
-static const char gRemoveStrings[] =
+static const char gRemoveStrings[] =
"offset\0"
"where"
;
@@ -864,7 +864,7 @@ static const SkMemberInfo gRemoveInfo[] = {
{7, 28, 37, 1}
};
-static const char gReplaceStrings[] =
+static const char gReplaceStrings[] =
""
;
@@ -872,7 +872,7 @@ static const SkMemberInfo gReplaceInfo[] = {
{0, 1, 18, 4}
};
-static const char gRotateStrings[] =
+static const char gRotateStrings[] =
"center\0"
"degrees"
;
@@ -882,7 +882,7 @@ static const SkMemberInfo gRotateInfo[] = {
{7, 20, 98, 1}
};
-static const char gRoundRectStrings[] =
+static const char gRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -894,7 +894,7 @@ static const SkMemberInfo gRoundRectInfo[] = {
{4, 48, 98, 1}
};
-static const char gS32Strings[] =
+static const char gS32Strings[] =
"value"
;
@@ -902,7 +902,7 @@ static const SkMemberInfo gS32Info[] = {
{0, 16, 96, 1}
};
-static const char gScalarStrings[] =
+static const char gScalarStrings[] =
"value"
;
@@ -910,7 +910,7 @@ static const SkMemberInfo gScalarInfo[] = {
{0, 16, 98, 1}
};
-static const char gScaleStrings[] =
+static const char gScaleStrings[] =
"center\0"
"x\0"
"y"
@@ -922,7 +922,7 @@ static const SkMemberInfo gScaleInfo[] = {
{9, 24, 98, 1}
};
-static const char gSetStrings[] =
+static const char gSetStrings[] =
"begin\0"
"dur\0"
"dynamic\0"
@@ -944,7 +944,7 @@ static const SkMemberInfo gSetInfo[] = {
{45, 76, 40, 2}
};
-static const char gShaderStrings[] =
+static const char gShaderStrings[] =
"matrix\0"
"tileMode"
;
@@ -954,7 +954,7 @@ static const SkMemberInfo gShaderInfo[] = {
{7, 24, 116, 1}
};
-static const char gSkewStrings[] =
+static const char gSkewStrings[] =
"center\0"
"x\0"
"y"
@@ -966,7 +966,7 @@ static const SkMemberInfo gSkewInfo[] = {
{9, 24, 98, 1}
};
-static const char g3D_CameraStrings[] =
+static const char g3D_CameraStrings[] =
"axis\0"
"hackHeight\0"
"hackWidth\0"
@@ -986,7 +986,7 @@ static const SkMemberInfo g3D_CameraInfo[] = {
{50, 48, 106, 3}
};
-static const char g3D_PatchStrings[] =
+static const char g3D_PatchStrings[] =
"origin\0"
"rotateDegrees\0"
"u\0"
@@ -1000,7 +1000,7 @@ static const SkMemberInfo g3D_PatchInfo[] = {
{23, 28, 106, 3}
};
-static const char gUnknown6Strings[] =
+static const char gUnknown6Strings[] =
"x\0"
"y\0"
"z"
@@ -1012,7 +1012,7 @@ static const SkMemberInfo gUnknown6Info[] = {
{4, 8, 98, 1}
};
-static const char gSnapshotStrings[] =
+static const char gSnapshotStrings[] =
"filename\0"
"quality\0"
"sequence\0"
@@ -1026,7 +1026,7 @@ static const SkMemberInfo gSnapshotInfo[] = {
{26, 32, 20, 1}
};
-static const char gStringStrings[] =
+static const char gStringStrings[] =
"length\0"
"slice\0"
"value"
@@ -1038,7 +1038,7 @@ static const SkMemberInfo gStringInfo[] = {
{13, 16, 108, 2}
};
-static const char gTextStrings[] =
+static const char gTextStrings[] =
"length\0"
"text\0"
"x\0"
@@ -1052,7 +1052,7 @@ static const SkMemberInfo gTextInfo[] = {
{14, 36, 98, 1}
};
-static const char gTextBoxStrings[] =
+static const char gTextBoxStrings[] =
"\0"
"mode\0"
"spacingAdd\0"
@@ -1070,7 +1070,7 @@ static const SkMemberInfo gTextBoxInfo[] = {
{41, 44, 108, 2}
};
-static const char gTextOnPathStrings[] =
+static const char gTextOnPathStrings[] =
"offset\0"
"path\0"
"text"
@@ -1082,7 +1082,7 @@ static const SkMemberInfo gTextOnPathInfo[] = {
{12, 32, 110, 1}
};
-static const char gTextToPathStrings[] =
+static const char gTextToPathStrings[] =
"path\0"
"text"
;
@@ -1092,7 +1092,7 @@ static const SkMemberInfo gTextToPathInfo[] = {
{5, 20, 110, 1}
};
-static const char gTranslateStrings[] =
+static const char gTranslateStrings[] =
"x\0"
"y"
;
@@ -1102,7 +1102,7 @@ static const SkMemberInfo gTranslateInfo[] = {
{2, 24, 98, 1}
};
-static const char gTypedArrayStrings[] =
+static const char gTypedArrayStrings[] =
"length\0"
"values"
;
@@ -1112,7 +1112,7 @@ static const SkMemberInfo gTypedArrayInfo[] = {
{7, 16, 119, 0}
};
-static const char gTypefaceStrings[] =
+static const char gTypefaceStrings[] =
"fontName"
;
@@ -1294,7 +1294,7 @@ static const unsigned char gTypeIDs[] = {
117, // Translate
119, // TypedArray
120, // Typeface
-
+
};
static const int kTypeIDs = 81;
diff --git a/src/animator/SkCondensedRelease.cpp b/src/animator/SkCondensedRelease.cpp
index 234e67edab..60fa991edf 100644
--- a/src/animator/SkCondensedRelease.cpp
+++ b/src/animator/SkCondensedRelease.cpp
@@ -14,7 +14,7 @@
// To change it, edit the file with the matching debug info.
// Then execute SkDisplayType::BuildCondensedInfo() to regenerate this file.
-static const char gMathStrings[] =
+static const char gMathStrings[] =
"E\0"
"LN10\0"
"LN2\0"
@@ -72,7 +72,7 @@ static const SkMemberInfo gMathInfo[] = {
{123, -18, 66, 98}
};
-static const char gAddStrings[] =
+static const char gAddStrings[] =
"inPlace\0"
"offset\0"
"use\0"
@@ -86,7 +86,7 @@ static const SkMemberInfo gAddInfo[] = {
{19, 16, 37, 1}
};
-static const char gAddCircleStrings[] =
+static const char gAddCircleStrings[] =
"\0"
"radius\0"
"x\0"
@@ -100,7 +100,7 @@ static const SkMemberInfo gAddCircleInfo[] = {
{10, 20, 98, 1}
};
-static const char gUnknown1Strings[] =
+static const char gUnknown1Strings[] =
"direction"
;
@@ -108,7 +108,7 @@ static const SkMemberInfo gUnknown1Info[] = {
{0, 8, 75, 1}
};
-static const char gAddOvalStrings[] =
+static const char gAddOvalStrings[] =
""
;
@@ -116,7 +116,7 @@ static const SkMemberInfo gAddOvalInfo[] = {
{0, 6, 18, 5}
};
-static const char gAddPathStrings[] =
+static const char gAddPathStrings[] =
"matrix\0"
"path"
;
@@ -126,7 +126,7 @@ static const SkMemberInfo gAddPathInfo[] = {
{7, 12, 74, 1}
};
-static const char gAddRectangleStrings[] =
+static const char gAddRectangleStrings[] =
"\0"
"bottom\0"
"left\0"
@@ -142,7 +142,7 @@ static const SkMemberInfo gAddRectangleInfo[] = {
{19, 16, 98, 1}
};
-static const char gAddRoundRectStrings[] =
+static const char gAddRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -154,7 +154,7 @@ static const SkMemberInfo gAddRoundRectInfo[] = {
{4, 32, 98, 1}
};
-static const char gUnknown2Strings[] =
+static const char gUnknown2Strings[] =
"begin\0"
"blend\0"
"dur\0"
@@ -186,7 +186,7 @@ static const SkMemberInfo gUnknown2Info[] = {
{73, -4, 67, 40}
};
-static const char gAnimateFieldStrings[] =
+static const char gAnimateFieldStrings[] =
""
;
@@ -194,7 +194,7 @@ static const SkMemberInfo gAnimateFieldInfo[] = {
{0, 8, 18, 13}
};
-static const char gApplyStrings[] =
+static const char gApplyStrings[] =
"animator\0"
"begin\0"
"dontDraw\0"
@@ -226,7 +226,7 @@ static const SkMemberInfo gApplyInfo[] = {
{88, 40, 14, 1}
};
-static const char gUnknown3Strings[] =
+static const char gUnknown3Strings[] =
"x\0"
"y"
;
@@ -236,7 +236,7 @@ static const SkMemberInfo gUnknown3Info[] = {
{2, 40, 98, 1}
};
-static const char gBitmapStrings[] =
+static const char gBitmapStrings[] =
"\0"
"erase\0"
"format\0"
@@ -254,7 +254,7 @@ static const SkMemberInfo gDrawBitmapInfo[] = {
{30, 56, 96, 1}
};
-static const char gBitmapShaderStrings[] =
+static const char gBitmapShaderStrings[] =
"\0"
"filterType\0"
"image"
@@ -266,7 +266,7 @@ static const SkMemberInfo gDrawBitmapShaderInfo[] = {
{12, 20, 17, 1}
};
-static const char gBlurStrings[] =
+static const char gBlurStrings[] =
"blurStyle\0"
"radius"
;
@@ -276,7 +276,7 @@ static const SkMemberInfo gDrawBlurInfo[] = {
{10, 8, 98, 1}
};
-static const char gBoundsStrings[] =
+static const char gBoundsStrings[] =
"\0"
"inval"
;
@@ -286,7 +286,7 @@ static const SkMemberInfo gDisplayBoundsInfo[] = {
{1, 32, 26, 1}
};
-static const char gClipStrings[] =
+static const char gClipStrings[] =
"path\0"
"rectangle"
;
@@ -296,7 +296,7 @@ static const SkMemberInfo gDrawClipInfo[] = {
{5, 4, 91, 1}
};
-static const char gColorStrings[] =
+static const char gColorStrings[] =
"alpha\0"
"blue\0"
"color\0"
@@ -318,7 +318,7 @@ static const SkMemberInfo gDrawColorInfo[] = {
{42, -7, 67, 98}
};
-static const char gCubicToStrings[] =
+static const char gCubicToStrings[] =
"x1\0"
"x2\0"
"x3\0"
@@ -336,7 +336,7 @@ static const SkMemberInfo gCubicToInfo[] = {
{15, 28, 98, 1}
};
-static const char gDashStrings[] =
+static const char gDashStrings[] =
"intervals\0"
"phase"
;
@@ -346,7 +346,7 @@ static const SkMemberInfo gDashInfo[] = {
{10, 16, 98, 1}
};
-static const char gDataStrings[] =
+static const char gDataStrings[] =
"\0"
"name"
;
@@ -356,7 +356,7 @@ static const SkMemberInfo gDataInfo[] = {
{1, 16, 108, 1}
};
-static const char gDiscreteStrings[] =
+static const char gDiscreteStrings[] =
"deviation\0"
"segLength"
;
@@ -366,7 +366,7 @@ static const SkMemberInfo gDiscreteInfo[] = {
{10, 12, 98, 1}
};
-static const char gDrawToStrings[] =
+static const char gDrawToStrings[] =
"drawOnce\0"
"use"
;
@@ -376,7 +376,7 @@ static const SkMemberInfo gDrawToInfo[] = {
{9, 40, 19, 1}
};
-static const char gEmbossStrings[] =
+static const char gEmbossStrings[] =
"ambient\0"
"direction\0"
"radius\0"
@@ -390,7 +390,7 @@ static const SkMemberInfo gDrawEmbossInfo[] = {
{25, -2, 67, 98}
};
-static const char gEventStrings[] =
+static const char gEventStrings[] =
"code\0"
"disable\0"
"key\0"
@@ -412,7 +412,7 @@ static const SkMemberInfo gDisplayEventInfo[] = {
{36, 24, 98, 1}
};
-static const char gFromPathStrings[] =
+static const char gFromPathStrings[] =
"mode\0"
"offset\0"
"path"
@@ -424,7 +424,7 @@ static const SkMemberInfo gFromPathInfo[] = {
{12, 16, 74, 1}
};
-static const char gUnknown4Strings[] =
+static const char gUnknown4Strings[] =
"\0"
"offsets\0"
"unitMapper"
@@ -436,7 +436,7 @@ static const SkMemberInfo gUnknown4Info[] = {
{9, 24, 108, 1}
};
-static const char gGStrings[] =
+static const char gGStrings[] =
"condition\0"
"enableCondition"
;
@@ -446,7 +446,7 @@ static const SkMemberInfo gGInfo[] = {
{10, 8, 40, 1}
};
-static const char gHitClearStrings[] =
+static const char gHitClearStrings[] =
"targets"
;
@@ -454,7 +454,7 @@ static const SkMemberInfo gHitClearInfo[] = {
{0, 4, 119, 36}
};
-static const char gHitTestStrings[] =
+static const char gHitTestStrings[] =
"bullets\0"
"hits\0"
"targets\0"
@@ -468,7 +468,7 @@ static const SkMemberInfo gHitTestInfo[] = {
{21, 28, 26, 1}
};
-static const char gImageStrings[] =
+static const char gImageStrings[] =
"\0"
"base64\0"
"src"
@@ -480,7 +480,7 @@ static const SkMemberInfo gImageInfo[] = {
{8, 52, 108, 1}
};
-static const char gIncludeStrings[] =
+static const char gIncludeStrings[] =
"src"
;
@@ -488,7 +488,7 @@ static const SkMemberInfo gIncludeInfo[] = {
{0, 4, 108, 1}
};
-static const char gInputStrings[] =
+static const char gInputStrings[] =
"s32\0"
"scalar\0"
"string"
@@ -500,7 +500,7 @@ static const SkMemberInfo gInputInfo[] = {
{11, 12, 108, 1}
};
-static const char gLineStrings[] =
+static const char gLineStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -514,7 +514,7 @@ static const SkMemberInfo gLineInfo[] = {
{9, 24, 98, 1}
};
-static const char gLineToStrings[] =
+static const char gLineToStrings[] =
"x\0"
"y"
;
@@ -524,7 +524,7 @@ static const SkMemberInfo gLineToInfo[] = {
{2, 12, 98, 1}
};
-static const char gLinearGradientStrings[] =
+static const char gLinearGradientStrings[] =
"\0"
"points"
;
@@ -534,7 +534,7 @@ static const SkMemberInfo gLinearGradientInfo[] = {
{1, 48, 77, 4}
};
-static const char gMatrixStrings[] =
+static const char gMatrixStrings[] =
"matrix\0"
"perspectX\0"
"perspectY\0"
@@ -564,7 +564,7 @@ static const SkMemberInfo gDrawMatrixInfo[] = {
{87, -11, 67, 98}
};
-static const char gMoveStrings[] =
+static const char gMoveStrings[] =
""
;
@@ -572,7 +572,7 @@ static const SkMemberInfo gMoveInfo[] = {
{0, 1, 18, 4}
};
-static const char gMoveToStrings[] =
+static const char gMoveToStrings[] =
"x\0"
"y"
;
@@ -582,7 +582,7 @@ static const SkMemberInfo gMoveToInfo[] = {
{2, 12, 98, 1}
};
-static const char gMovieStrings[] =
+static const char gMovieStrings[] =
"src"
;
@@ -590,7 +590,7 @@ static const SkMemberInfo gMovieInfo[] = {
{0, 4, 108, 1}
};
-static const char gOvalStrings[] =
+static const char gOvalStrings[] =
""
;
@@ -598,7 +598,7 @@ static const SkMemberInfo gOvalInfo[] = {
{0, 57, 18, 7}
};
-static const char gPaintStrings[] =
+static const char gPaintStrings[] =
"antiAlias\0"
"ascent\0"
"color\0"
@@ -654,7 +654,7 @@ static const SkMemberInfo gDrawPaintInfo[] = {
{235, 88, 121, 1}
};
-static const char gPathStrings[] =
+static const char gPathStrings[] =
"d\0"
"fillType\0"
"length"
@@ -666,7 +666,7 @@ static const SkMemberInfo gDrawPathInfo[] = {
{11, -2, 67, 98}
};
-static const char gUnknown5Strings[] =
+static const char gUnknown5Strings[] =
"x\0"
"y\0"
"z"
@@ -678,7 +678,7 @@ static const SkMemberInfo gUnknown5Info[] = {
{4, 8, 98, 1}
};
-static const char gPointStrings[] =
+static const char gPointStrings[] =
"x\0"
"y"
;
@@ -688,7 +688,7 @@ static const SkMemberInfo gDrawPointInfo[] = {
{2, 8, 98, 1}
};
-static const char gPolyToPolyStrings[] =
+static const char gPolyToPolyStrings[] =
"destination\0"
"source"
;
@@ -698,7 +698,7 @@ static const SkMemberInfo gPolyToPolyInfo[] = {
{12, 8, 80, 1}
};
-static const char gPolygonStrings[] =
+static const char gPolygonStrings[] =
""
;
@@ -706,7 +706,7 @@ static const SkMemberInfo gPolygonInfo[] = {
{0, 47, 18, 1}
};
-static const char gPolylineStrings[] =
+static const char gPolylineStrings[] =
"points"
;
@@ -714,7 +714,7 @@ static const SkMemberInfo gPolylineInfo[] = {
{0, 56, 119, 98}
};
-static const char gPostStrings[] =
+static const char gPostStrings[] =
"delay\0"
"initialized\0"
"mode\0"
@@ -732,7 +732,7 @@ static const SkMemberInfo gPostInfo[] = {
{35, -3, 67, 108}
};
-static const char gQuadToStrings[] =
+static const char gQuadToStrings[] =
"x1\0"
"x2\0"
"y1\0"
@@ -746,7 +746,7 @@ static const SkMemberInfo gQuadToInfo[] = {
{9, 20, 98, 1}
};
-static const char gRCubicToStrings[] =
+static const char gRCubicToStrings[] =
""
;
@@ -754,7 +754,7 @@ static const SkMemberInfo gRCubicToInfo[] = {
{0, 18, 18, 6}
};
-static const char gRLineToStrings[] =
+static const char gRLineToStrings[] =
""
;
@@ -762,7 +762,7 @@ static const SkMemberInfo gRLineToInfo[] = {
{0, 34, 18, 2}
};
-static const char gRMoveToStrings[] =
+static const char gRMoveToStrings[] =
""
;
@@ -770,7 +770,7 @@ static const SkMemberInfo gRMoveToInfo[] = {
{0, 38, 18, 2}
};
-static const char gRQuadToStrings[] =
+static const char gRQuadToStrings[] =
""
;
@@ -778,7 +778,7 @@ static const SkMemberInfo gRQuadToInfo[] = {
{0, 49, 18, 4}
};
-static const char gRadialGradientStrings[] =
+static const char gRadialGradientStrings[] =
"\0"
"center\0"
"radius"
@@ -790,7 +790,7 @@ static const SkMemberInfo gRadialGradientInfo[] = {
{8, 56, 98, 1}
};
-static const char gRandomStrings[] =
+static const char gRandomStrings[] =
"blend\0"
"max\0"
"min\0"
@@ -806,7 +806,7 @@ static const SkMemberInfo gDisplayRandomInfo[] = {
{21, -2, 67, 96}
};
-static const char gRectToRectStrings[] =
+static const char gRectToRectStrings[] =
"destination\0"
"source"
;
@@ -816,7 +816,7 @@ static const SkMemberInfo gRectToRectInfo[] = {
{12, 8, 91, 1}
};
-static const char gRectangleStrings[] =
+static const char gRectangleStrings[] =
"bottom\0"
"height\0"
"left\0"
@@ -836,7 +836,7 @@ static const SkMemberInfo gRectangleInfo[] = {
{41, -3, 67, 98}
};
-static const char gRemoveStrings[] =
+static const char gRemoveStrings[] =
"offset\0"
"where"
;
@@ -846,7 +846,7 @@ static const SkMemberInfo gRemoveInfo[] = {
{7, 16, 37, 1}
};
-static const char gReplaceStrings[] =
+static const char gReplaceStrings[] =
""
;
@@ -854,7 +854,7 @@ static const SkMemberInfo gReplaceInfo[] = {
{0, 1, 18, 4}
};
-static const char gRotateStrings[] =
+static const char gRotateStrings[] =
"center\0"
"degrees"
;
@@ -864,7 +864,7 @@ static const SkMemberInfo gRotateInfo[] = {
{7, 8, 98, 1}
};
-static const char gRoundRectStrings[] =
+static const char gRoundRectStrings[] =
"\0"
"rx\0"
"ry"
@@ -876,7 +876,7 @@ static const SkMemberInfo gRoundRectInfo[] = {
{4, 36, 98, 1}
};
-static const char gS32Strings[] =
+static const char gS32Strings[] =
"value"
;
@@ -884,7 +884,7 @@ static const SkMemberInfo gS32Info[] = {
{0, 4, 96, 1}
};
-static const char gScalarStrings[] =
+static const char gScalarStrings[] =
"value"
;
@@ -892,7 +892,7 @@ static const SkMemberInfo gScalarInfo[] = {
{0, 4, 98, 1}
};
-static const char gScaleStrings[] =
+static const char gScaleStrings[] =
"center\0"
"x\0"
"y"
@@ -904,7 +904,7 @@ static const SkMemberInfo gScaleInfo[] = {
{9, 12, 98, 1}
};
-static const char gSetStrings[] =
+static const char gSetStrings[] =
"begin\0"
"dur\0"
"dynamic\0"
@@ -926,7 +926,7 @@ static const SkMemberInfo gSetInfo[] = {
{45, 40, 40, 1}
};
-static const char gShaderStrings[] =
+static const char gShaderStrings[] =
"matrix\0"
"tileMode"
;
@@ -936,7 +936,7 @@ static const SkMemberInfo gShaderInfo[] = {
{7, 12, 116, 1}
};
-static const char gSkewStrings[] =
+static const char gSkewStrings[] =
"center\0"
"x\0"
"y"
@@ -948,7 +948,7 @@ static const SkMemberInfo gSkewInfo[] = {
{9, 12, 98, 1}
};
-static const char g3D_CameraStrings[] =
+static const char g3D_CameraStrings[] =
"axis\0"
"hackHeight\0"
"hackWidth\0"
@@ -968,7 +968,7 @@ static const SkMemberInfo g3D_CameraInfo[] = {
{50, 36, 106, 3}
};
-static const char g3D_PatchStrings[] =
+static const char g3D_PatchStrings[] =
"origin\0"
"rotateDegrees\0"
"u\0"
@@ -982,7 +982,7 @@ static const SkMemberInfo g3D_PatchInfo[] = {
{23, 16, 106, 3}
};
-static const char gUnknown6Strings[] =
+static const char gUnknown6Strings[] =
"x\0"
"y\0"
"z"
@@ -994,7 +994,7 @@ static const SkMemberInfo gUnknown6Info[] = {
{4, 8, 98, 1}
};
-static const char gSnapshotStrings[] =
+static const char gSnapshotStrings[] =
"filename\0"
"quality\0"
"sequence\0"
@@ -1008,7 +1008,7 @@ static const SkMemberInfo gSnapshotInfo[] = {
{26, 16, 20, 1}
};
-static const char gStringStrings[] =
+static const char gStringStrings[] =
"length\0"
"slice\0"
"value"
@@ -1020,7 +1020,7 @@ static const SkMemberInfo gStringInfo[] = {
{13, 4, 108, 1}
};
-static const char gTextStrings[] =
+static const char gTextStrings[] =
"length\0"
"text\0"
"x\0"
@@ -1034,7 +1034,7 @@ static const SkMemberInfo gTextInfo[] = {
{14, 20, 98, 1}
};
-static const char gTextBoxStrings[] =
+static const char gTextBoxStrings[] =
"\0"
"mode\0"
"spacingAdd\0"
@@ -1052,7 +1052,7 @@ static const SkMemberInfo gTextBoxInfo[] = {
{41, 32, 108, 1}
};
-static const char gTextOnPathStrings[] =
+static const char gTextOnPathStrings[] =
"offset\0"
"path\0"
"text"
@@ -1064,7 +1064,7 @@ static const SkMemberInfo gTextOnPathInfo[] = {
{12, 20, 110, 1}
};
-static const char gTextToPathStrings[] =
+static const char gTextToPathStrings[] =
"path\0"
"text"
;
@@ -1074,7 +1074,7 @@ static const SkMemberInfo gTextToPathInfo[] = {
{5, 8, 110, 1}
};
-static const char gTranslateStrings[] =
+static const char gTranslateStrings[] =
"x\0"
"y"
;
@@ -1084,7 +1084,7 @@ static const SkMemberInfo gTranslateInfo[] = {
{2, 12, 98, 1}
};
-static const char gTypedArrayStrings[] =
+static const char gTypedArrayStrings[] =
"length\0"
"values"
;
@@ -1094,7 +1094,7 @@ static const SkMemberInfo gTypedArrayInfo[] = {
{7, 4, 119, 0}
};
-static const char gTypefaceStrings[] =
+static const char gTypefaceStrings[] =
"fontName"
;
@@ -1274,7 +1274,7 @@ static const unsigned char gTypeIDs[] = {
117, // Translate
119, // TypedArray
120, // Typeface
-
+
};
static const int kTypeIDs = 80;
diff --git a/src/animator/SkDisplayAdd.cpp b/src/animator/SkDisplayAdd.cpp
index 1cf89a172d..7fd5026584 100644
--- a/src/animator/SkDisplayAdd.cpp
+++ b/src/animator/SkDisplayAdd.cpp
@@ -33,7 +33,7 @@ const SkMemberInfo SkAdd::fInfo[] = {
DEFINE_GET_MEMBER(SkAdd);
-SkAdd::SkAdd() : mode(kMode_indirect),
+SkAdd::SkAdd() : mode(kMode_indirect),
offset(SK_MaxS32), use(NULL), where(NULL) {
}
@@ -119,7 +119,7 @@ bool SkAdd::enable(SkAnimateMaker& maker ) {
parentGroup->markCopySet(index);
useParentList->begin()[index] = use;
break;
- }
+ }
}
*parentList->append() = use;
}
diff --git a/src/animator/SkDisplayAdd.h b/src/animator/SkDisplayAdd.h
index 47948fb7f7..58839630a1 100644
--- a/src/animator/SkDisplayAdd.h
+++ b/src/animator/SkDisplayAdd.h
@@ -16,12 +16,12 @@
class SkAdd : public SkDrawable {
DECLARE_MEMBER_INFO(Add);
SkAdd();
-
+
enum Mode {
kMode_indirect,
kMode_immediate
};
-
+
virtual SkDisplayable* deepCopy(SkAnimateMaker* );
virtual bool draw(SkAnimateMaker& );
#ifdef SK_DUMP_ENABLED
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index d54ee2600f..baa10e7c3f 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -51,13 +51,13 @@ const SkMemberInfo SkApply::fInfo[] = {
SK_MEMBER(transition, ApplyTransition)
};
-#endif
+#endif
DEFINE_GET_MEMBER(SkApply);
SkApply::SkApply() : begin(0), dontDraw(false), interval((SkMSec) -1), mode((Mode) -1), /*pickup(false), */
restore(false), scope(NULL), steps(-1), transition((Transition) -1), fActive(NULL), /*fCurrentScope(NULL),*/
- fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false),
+ fLastTime(0), fAppended(false), fContainsScope(false), fDeleteScope(false), fEmbedded(false),
fEnabled(false), fEnabling(false) {
}
@@ -105,7 +105,7 @@ void SkApply::append(SkApply* apply) {
}
void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
- SkDisplayTypes valuesType, SkMSec time)
+ SkDisplayTypes valuesType, SkMSec time)
{
SkAnimateBase* animator = fActive->fAnimators[animatorIndex];
const SkMemberInfo * info = animator->fFieldInfo;
@@ -149,7 +149,7 @@ void SkApply::applyValues(int animatorIndex, SkOperand* values, int count,
target->setReference(info, values->fDisplayable);
else
info->setValue(target, values, count);
- }
+ }
}
bool SkApply::contains(SkDisplayable* child) {
@@ -178,7 +178,7 @@ void SkApply::disable() {
//!!! this is the right thing to do, but has bad side effects because of other problems
// currently, if an apply is in a g and scopes a statement in another g, it ends up as members
// of both containers. The disabling here incorrectly disables both instances
- // maybe the fEnabled flag needs to be moved to the fActive data so that both
+ // maybe the fEnabled flag needs to be moved to the fActive data so that both
// instances are not affected.
// fEnabled = false;
}
@@ -265,7 +265,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
bool initialized = fActive != NULL;
if (dynamicScope.size() > 0)
enableDynamic(maker);
- if (maker.fError.hasError())
+ if (maker.fError.hasError())
return false;
int animators = fAnimators.count();
int index;
@@ -333,7 +333,7 @@ bool SkApply::enable(SkAnimateMaker& maker) {
}
#endif
// start here;
- // now that one apply might embed another, only the parent apply should replace the scope
+ // now that one apply might embed another, only the parent apply should replace the scope
// or get appended to the display list
// similarly, an apply added by an add immediate has already been located in the display list
// and should not get moved or added again here
@@ -408,7 +408,7 @@ void SkApply::enableCreate(SkAnimateMaker& maker) {
step = steps; // quit
goto next; // resolveIDs failed
}
- if (newID.size() > 0)
+ if (newID.size() > 0)
maker.setID(copyScope, newID);
if (copy->resolveIDs(maker, this, this)) { // fix up all fields, including target
step = steps; // quit
@@ -517,7 +517,7 @@ bool SkApply::hasDelayedAnimator() const {
SkAnimateBase** animEnd = fAnimators.end();
for (SkAnimateBase** animPtr = fAnimators.begin(); animPtr < animEnd; animPtr++) {
SkAnimateBase* animator = *animPtr;
- if (animator->fDelayed)
+ if (animator->fDelayed)
return true;
}
return false;
@@ -548,7 +548,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
SkMSec time = maker.getAppTime();
if (lastTime == (SkMSec) -1)
lastTime = rawTime - 1;
- if (fActive != NULL &&
+ if (fActive != NULL &&
strcmp(id, "a3") == 0 && rawTime > lastTime) {
lastTime += 1000;
SkString debugOut;
@@ -593,7 +593,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
} else
animate->fDelayed = false;
SkMSec innerTime = fLastTime = state.getRelativeTime(time);
- if (restore)
+ if (restore)
fActive->restoreInterpolatorValues(inner);
if (animate->fReset) {
if (transition != SkApply::kTransition_reverse) {
@@ -629,7 +629,7 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) {
fLastTime = animate->dur;
SkTypedArray formulaValues;
formulaValues.setCount(count);
- bool success = animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
+ bool success = animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
if (restore)
@@ -652,7 +652,7 @@ void SkApply::initialize() {
scope->initialize();
}
-void SkApply::onEndElement(SkAnimateMaker& maker)
+void SkApply::onEndElement(SkAnimateMaker& maker)
{
SkDrawable* scopePtr = scope;
while (scopePtr && scopePtr->isApply()) {
@@ -781,7 +781,7 @@ bool SkApply::setProperty(int index, SkScriptValue& scriptValue) {
SkAnimateBase* animate = (SkAnimateBase*) scriptValue.fOperand.fDisplayable;
SkASSERT(animate->isAnimate());
*fAnimators.append() = animate;
- return true;
+ return true;
}
case SK_PROPERTY(steps):
steps = scriptValue.fOperand.fS32;
@@ -792,8 +792,8 @@ bool SkApply::setProperty(int index, SkScriptValue& scriptValue) {
return false;
}
-void SkApply::setSteps(int _steps) {
- steps = _steps;
+void SkApply::setSteps(int _steps) {
+ steps = _steps;
}
#ifdef SK_DEBUG
diff --git a/src/animator/SkDisplayApply.h b/src/animator/SkDisplayApply.h
index 018b894da5..3a066a4397 100644
--- a/src/animator/SkDisplayApply.h
+++ b/src/animator/SkDisplayApply.h
@@ -27,7 +27,7 @@ public:
kTransition_normal,
kTransition_reverse
};
-
+
enum Mode {
kMode_create,
kMode_immediate,
@@ -58,7 +58,7 @@ public:
bool hasDelayedAnimator() const;
virtual bool hasEnable() const;
bool inactivate(SkAnimateMaker& maker);
- virtual void initialize();
+ virtual void initialize();
bool interpolate(SkAnimateMaker& , SkMSec time);
virtual void onEndElement(SkAnimateMaker& );
virtual const SkMemberInfo* preferredChild(SkDisplayTypes type);
diff --git a/src/animator/SkDisplayBounds.cpp b/src/animator/SkDisplayBounds.cpp
index 69ec47ed3c..4c89481b99 100644
--- a/src/animator/SkDisplayBounds.cpp
+++ b/src/animator/SkDisplayBounds.cpp
@@ -36,7 +36,7 @@ bool SkDisplayBounds::draw(SkAnimateMaker& maker) {
maker.fDisplayList.fHasUnion = true;
if (rect.isEmpty())
rect = fBounds;
- else
+ else
rect.join(fBounds);
}
return result;
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index 0eb956a361..303e42c662 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -52,9 +52,9 @@ SkDisplayEvent::~SkDisplayEvent() {
deleteMembers();
}
-bool SkDisplayEvent::add(SkAnimateMaker& , SkDisplayable* child) {
- *fChildren.append() = child;
- return true;
+bool SkDisplayEvent::add(SkAnimateMaker& , SkDisplayable* child) {
+ *fChildren.append() = child;
+ return true;
}
bool SkDisplayEvent::contains(SkDisplayable* match) {
@@ -112,7 +112,7 @@ void SkDisplayEvent::dumpEvent(SkAnimateMaker* maker) {
}
#endif
-bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
+bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
{
maker.fActiveEvent = this;
if (fChildren.count() == 0)
@@ -134,7 +134,7 @@ bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
}
if (displayable->enable(maker))
continue;
- if (maker.hasError())
+ if (maker.hasError())
return true;
if (displayable->isDrawable() == false)
return true; // error
diff --git a/src/animator/SkDisplayEvents.cpp b/src/animator/SkDisplayEvents.cpp
index 38f82a05ba..c42fbdf312 100644
--- a/src/animator/SkDisplayEvents.cpp
+++ b/src/animator/SkDisplayEvents.cpp
@@ -83,7 +83,7 @@ void SkEvents::dump(SkAnimateMaker& maker) {
int count = drawArray.count();
for (index = 0; index < count; index++) {
SkDrawable* drawable = drawArray[index];
- drawable->dumpEvents();
+ drawable->dumpEvents();
}
count = fEvents.count();
for (index = 0; index < count; index++) {
diff --git a/src/animator/SkDisplayInput.cpp b/src/animator/SkDisplayInput.cpp
index 77bc5de51f..7061aa8ea9 100644
--- a/src/animator/SkDisplayInput.cpp
+++ b/src/animator/SkDisplayInput.cpp
@@ -49,7 +49,7 @@ bool SkInput::getProperty(int index, SkScriptValue* value) const {
}
return true;
}
-
+
bool SkInput::hasEnable() const {
return true;
}
diff --git a/src/animator/SkDisplayList.cpp b/src/animator/SkDisplayList.cpp
index 8424b127dd..39465f195d 100644
--- a/src/animator/SkDisplayList.cpp
+++ b/src/animator/SkDisplayList.cpp
@@ -51,7 +51,7 @@ bool SkDisplayList::draw(SkAnimateMaker& maker, SkMSec inTime) {
}
int SkDisplayList::findGroup(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
*parent = NULL;
*list = &fDrawList;
*grandList = &fDrawList;
@@ -69,7 +69,7 @@ bool SkDisplayList::onIRect(const SkIRect& r) {
}
int SkDisplayList::SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
*found = NULL;
for (int index = 0; index < (*list)->count(); index++) {
SkDrawable* draw = (**list)[index];
@@ -88,11 +88,11 @@ int SkDisplayList::SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
return index;
//perhaps should call SearchGroupForMatch here as well (on scope)
}
- }
+ }
}
- if (draw->isGroup() && SearchGroupForMatch(draw, match, list, parent, found, grandList, index))
+ if (draw->isGroup() && SearchGroupForMatch(draw, match, list, parent, found, grandList, index))
return index;
-
+
}
return -1;
}
@@ -120,7 +120,7 @@ void SkDisplayList::reset() {
continue;
SkApply* apply = (SkApply*) draw;
apply->reset();
- }
+ }
}
void SkDisplayList::remove(SkActive* active) {
diff --git a/src/animator/SkDisplayList.h b/src/animator/SkDisplayList.h
index f520b55011..af98aeffc1 100644
--- a/src/animator/SkDisplayList.h
+++ b/src/animator/SkDisplayList.h
@@ -35,8 +35,8 @@ public:
static int fIndent;
static int fDumpIndex;
#endif
- int findGroup(SkDrawable* match, SkTDDrawableArray** list,
- SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
+ int findGroup(SkDrawable* match, SkTDDrawableArray** list,
+ SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
SkDrawable* get(int index) { return fDrawList[index]; }
SkMSec getTime() { return fInTime; }
SkTDDrawableArray* getDrawList() { return &fDrawList; }
@@ -51,8 +51,8 @@ public:
#endif
static int SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList);
- static bool SearchGroupForMatch(SkDrawable* draw, SkDrawable* match,
- SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
+ static bool SearchGroupForMatch(SkDrawable* draw, SkDrawable* match,
+ SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
int &index);
public:
SkIRect fBounds;
diff --git a/src/animator/SkDisplayMath.cpp b/src/animator/SkDisplayMath.cpp
index c4d496d0a7..bdf377b302 100644
--- a/src/animator/SkDisplayMath.cpp
+++ b/src/animator/SkDisplayMath.cpp
@@ -29,7 +29,7 @@ const SkScalar SkDisplayMath::gConstants[] = {
1.442695041f, // LOG2E
3.141592654f, // PI
0.707106781f, // SQRT1_2
- 1.414213562f // SQRT2
+ 1.414213562f // SQRT2
#else
0x2B7E1, // E
0x24D76, // LN10
@@ -139,7 +139,7 @@ const SkMemberInfo SkDisplayMath::fInfo[] = {
DEFINE_GET_MEMBER(SkDisplayMath);
-void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
+void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
if (scriptValue == NULL)
@@ -151,7 +151,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
SkScalar scalarResult;
switch (index) {
case SK_FUNCTION(abs):
- scalarResult = SkScalarAbs(input);
+ scalarResult = SkScalarAbs(input);
break;
case SK_FUNCTION(acos):
scalarResult = SkScalarACos(input);
@@ -166,7 +166,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarATan2(input, parameters[1].fOperand.fScalar);
break;
case SK_FUNCTION(ceil):
- scalarResult = SkIntToScalar(SkScalarCeil(input));
+ scalarResult = SkIntToScalar(SkScalarCeil(input));
break;
case SK_FUNCTION(cos):
scalarResult = SkScalarCos(input);
@@ -175,7 +175,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarExp(input);
break;
case SK_FUNCTION(floor):
- scalarResult = SkIntToScalar(SkScalarFloor(input));
+ scalarResult = SkIntToScalar(SkScalarFloor(input));
break;
case SK_FUNCTION(log):
scalarResult = SkScalarLog(input);
@@ -204,7 +204,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = fRandom.nextUScalar1();
break;
case SK_FUNCTION(round):
- scalarResult = SkIntToScalar(SkScalarRound(input));
+ scalarResult = SkIntToScalar(SkScalarRound(input));
break;
case SK_FUNCTION(sin):
scalarResult = SkScalarSin(input);
@@ -212,7 +212,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
case SK_FUNCTION(sqrt): {
SkASSERT(parameters.count() == 1);
SkASSERT(type == SkType_Float);
- scalarResult = SkScalarSqrt(input);
+ scalarResult = SkScalarSqrt(input);
} break;
case SK_FUNCTION(tan):
scalarResult = SkScalarTan(input);
diff --git a/src/animator/SkDisplayMath.h b/src/animator/SkDisplayMath.h
index e21d03f320..faa929e27d 100644
--- a/src/animator/SkDisplayMath.h
+++ b/src/animator/SkDisplayMath.h
@@ -16,7 +16,7 @@
class SkDisplayMath : public SkDisplayable {
DECLARE_DISPLAY_MEMBER_INFO(Math);
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
@@ -27,6 +27,6 @@ private:
static const SkFunctionParamType fFunctionParameters[];
};
-
+
#endif // SkDisplayMath_DEFINED
diff --git a/src/animator/SkDisplayMovie.cpp b/src/animator/SkDisplayMovie.cpp
index 4fbf3f3f21..33123cb019 100644
--- a/src/animator/SkDisplayMovie.cpp
+++ b/src/animator/SkDisplayMovie.cpp
@@ -78,7 +78,7 @@ bool SkDisplayMovie::draw(SkAnimateMaker& maker) {
enable(maker);
maker.fCanvas->save();
SkPaint local = SkPaint(*maker.fPaint);
- bool result = fMovie.draw(maker.fCanvas, &local,
+ bool result = fMovie.draw(maker.fCanvas, &local,
maker.fDisplayList.getTime()) != SkAnimator::kNotDifferent;
maker.fDisplayList.fInvalBounds.join(fMovie.fMaker->fDisplayList.fInvalBounds);
maker.fCanvas->restore();
diff --git a/src/animator/SkDisplayNumber.h b/src/animator/SkDisplayNumber.h
index 7092e213ae..16c6f4fde4 100644
--- a/src/animator/SkDisplayNumber.h
+++ b/src/animator/SkDisplayNumber.h
@@ -18,5 +18,5 @@ class SkDisplayNumber : public SkDisplayable {
virtual bool getProperty(int index, SkScriptValue* value) const;
private:
};
-
+
#endif // SkDisplayNumber_DEFINED
diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp
index bf89055c28..3c9fa19e46 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -54,12 +54,12 @@ bool SkPost::add(SkAnimateMaker& , SkDisplayable* child) {
return true;
}
-bool SkPost::childrenNeedDisposing() const {
- return false;
+bool SkPost::childrenNeedDisposing() const {
+ return false;
}
-void SkPost::dirty() {
- fDirty = true;
+void SkPost::dirty() {
+ fDirty = true;
}
#ifdef SK_DUMP_ENABLED
@@ -74,7 +74,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
else
SkDebugf("type=\"%s\" ", eventType->c_str());
delete eventType;
-
+
if (delay > 0) {
SkDebugf("delay=\"%g\" ", SkScalarToFloat(SkScalarDiv(delay, 1000)));
}
@@ -99,7 +99,7 @@ void SkPost::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
//this seems to work, but kinda hacky
//for some reason the last part is id, which i don't want
- //and the parts seem to be in the reverse order from the one in which we find the
+ //and the parts seem to be in the reverse order from the one in which we find the
//data itself
//SkDataInput** ptr = fParts.end();
//SkDataInput* data;
@@ -211,7 +211,7 @@ bool SkPost::enable(SkAnimateMaker& maker ) {
SkAnimator* anim = maker.getAnimator();
if (targetID == 0) {
isAnimatorEvent = fEvent.findString("id") != NULL;
- if (isAnimatorEvent)
+ if (isAnimatorEvent)
targetID = anim->getSinkID();
else if (maker.fHostEventSinkID)
targetID = maker.fHostEventSinkID;
@@ -260,7 +260,7 @@ void SkPost::findSinkID() {
SkAnimator* anim = fTargetMaker->getAnimator();
fSinkID = anim->getSinkID();
}
-
+
bool SkPost::hasEnable() const {
return true;
}
@@ -274,8 +274,8 @@ void SkPost::onEndElement(SkAnimateMaker& maker) {
}
}
-void SkPost::setChildHasID() {
- fChildHasID = true;
+void SkPost::setChildHasID() {
+ fChildHasID = true;
}
bool SkPost::setProperty(int index, SkScriptValue& value) {
diff --git a/src/animator/SkDisplayRandom.cpp b/src/animator/SkDisplayRandom.cpp
index 3f77fcb03c..31a20b5dd6 100644
--- a/src/animator/SkDisplayRandom.cpp
+++ b/src/animator/SkDisplayRandom.cpp
@@ -37,7 +37,7 @@ void SkDisplayRandom::dump(SkAnimateMaker* maker) {
dumpBase(maker);
SkDebugf("min=\"%g\" ", SkScalarToFloat(min));
SkDebugf("max=\"%g\" ", SkScalarToFloat(max));
- SkDebugf("blend=\"%g\" ", SkScalarToFloat(blend));
+ SkDebugf("blend=\"%g\" ", SkScalarToFloat(blend));
SkDebugf("/>\n");
}
#endif
diff --git a/src/animator/SkDisplayType.cpp b/src/animator/SkDisplayType.cpp
index 3527517703..dc52f0cacc 100644
--- a/src/animator/SkDisplayType.cpp
+++ b/src/animator/SkDisplayType.cpp
@@ -67,7 +67,7 @@
#else
#define CASE_DEBUG_RETURN_NIL(_class)
#endif
-
+
SkDisplayTypes SkDisplayType::gNewTypes = kNumberOfTypes;
@@ -224,7 +224,7 @@ SkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTyp
info = SkDisplay##_class::fInfo; infoCount = SkDisplay##_class::fInfoCount; \
break
-const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
+const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
SkDisplayTypes type, int* infoCountPtr) {
const SkMemberInfo* info = NULL;
int infoCount = 0;
@@ -355,7 +355,7 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
CASE_GET_DRAW_INFO(Typeface);
// xfermode
// knumberoftypes
- default:
+ default:
if (maker) {
SkExtras** end = maker->fExtras.end();
for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
@@ -370,7 +370,7 @@ const SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
return info;
}
-const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* maker,
+const SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* maker,
SkDisplayTypes type, const char** matchPtr ) {
int infoCount;
const SkMemberInfo* info = GetMembers(maker, type, &infoCount);
@@ -546,7 +546,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
SkASSERT(info);
if (info->fType != SkType_BaseClassInfo)
return SkType_Unknown; // if no base, done
- // !!! could change SK_MEMBER_INHERITED macro to take type, stuff in offset, so that
+ // !!! could change SK_MEMBER_INHERITED macro to take type, stuff in offset, so that
// this (and table builder) could know type without the following steps:
const SkMemberInfo* inherited = info->getInherited();
SkDisplayTypes result = (SkDisplayTypes) (SkType_Unknown + 1);
@@ -560,7 +560,7 @@ SkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes ba
}
SkDisplayTypes SkDisplayType::GetType(SkAnimateMaker* maker, const char match[], size_t len ) {
- int index = SkStrSearch(&gTypeNames[0].fName, kTypeNamesSize, match,
+ int index = SkStrSearch(&gTypeNames[0].fName, kTypeNamesSize, match,
len, sizeof(gTypeNames[0]));
if (index >= 0 && index < kTypeNamesSize)
return gTypeNames[index].fType;
diff --git a/src/animator/SkDisplayType.h b/src/animator/SkDisplayType.h
index 7abde23164..474a65e8e6 100644
--- a/src/animator/SkDisplayType.h
+++ b/src/animator/SkDisplayType.h
@@ -187,7 +187,7 @@ public:
static SkDisplayTypes RegisterNewType();
static SkDisplayTypes Resolve(const char[] , const SkMemberInfo** );
#ifdef SK_DEBUG
- static bool IsAnimate(SkDisplayTypes type ) { return type == SkType_Animate ||
+ static bool IsAnimate(SkDisplayTypes type ) { return type == SkType_Animate ||
type == SkType_Set; }
static const char* GetName(SkAnimateMaker* , SkDisplayTypes );
#endif
diff --git a/src/animator/SkDisplayTypes.cpp b/src/animator/SkDisplayTypes.cpp
index d3bfa101aa..d320fc02d5 100644
--- a/src/animator/SkDisplayTypes.cpp
+++ b/src/animator/SkDisplayTypes.cpp
@@ -11,7 +11,7 @@
#include "SkAnimateBase.h"
bool SkDisplayDepend::canContainDependents() const {
- return true;
+ return true;
}
void SkDisplayDepend::dirty() {
@@ -118,7 +118,7 @@ SkDisplayString::SkDisplayString() {
SkDisplayString::SkDisplayString(SkString& copyFrom) : value(copyFrom) {
}
-void SkDisplayString::executeFunction(SkDisplayable* target, int index,
+void SkDisplayString::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* scriptValue) {
if (scriptValue == NULL)
@@ -150,7 +150,7 @@ const SkFunctionParamType* SkDisplayString::getFunctionsParameters() {
}
bool SkDisplayString::getProperty(int index, SkScriptValue* scriptValue) const {
- switch (index) {
+ switch (index) {
case SK_PROPERTY(length):
scriptValue->fType = SkType_Int;
scriptValue->fOperand.fS32 = (int32_t) value.size();
@@ -201,7 +201,7 @@ SkDisplayArray::~SkDisplayArray() {
}
bool SkDisplayArray::getProperty(int index, SkScriptValue* value) const {
- switch (index) {
+ switch (index) {
case SK_PROPERTY(length):
value->fType = SkType_Int;
value->fOperand.fS32 = values.count();
diff --git a/src/animator/SkDisplayTypes.h b/src/animator/SkDisplayTypes.h
index 75cace65d5..614018f568 100644
--- a/src/animator/SkDisplayTypes.h
+++ b/src/animator/SkDisplayTypes.h
@@ -75,7 +75,7 @@ class SkDisplayString : public SkDisplayDepend {
DECLARE_DISPLAY_MEMBER_INFO(String);
SkDisplayString();
SkDisplayString(SkString& );
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDisplayXMLParser.cpp b/src/animator/SkDisplayXMLParser.cpp
index 68dc259c6c..31be3da80d 100644
--- a/src/animator/SkDisplayXMLParser.cpp
+++ b/src/animator/SkDisplayXMLParser.cpp
@@ -34,7 +34,7 @@ static char const* const gErrorStrings[] = {
"last offset in gradient must be one",
"offsets in gradient must be increasing",
"first offset in gradient must be zero",
- "gradient attribute \"points\" must have length of four",
+ "gradient attribute \"points\" must have length of four",
"in include ",
"in movie ",
"include name unknown or missing ",
@@ -70,7 +70,7 @@ void SkDisplayXMLParserError::setInnerError(SkAnimateMaker* parent, const SkStri
SkDisplayXMLParser::SkDisplayXMLParser(SkAnimateMaker& maker)
- : INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude),
+ : INHERITED(&maker.fError), fMaker(maker), fInInclude(maker.fInInclude),
fInSkia(maker.fInInclude), fCurrDisplayable(NULL)
{
}
@@ -94,7 +94,7 @@ bool SkDisplayXMLParser::onAddAttribute(const char name[], const char value[]) {
return onAddAttributeLen(name, value, strlen(value));
}
-bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
+bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char attrValue[],
size_t attrValueLen)
{
if (fCurrDisplayable == NULL) // this signals we should ignore attributes for this element
@@ -172,16 +172,16 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
SkDisplayable* displayable = container.fDisplayable;
fMaker.fEndDepth = parentIndex;
displayable->onEndElement(fMaker);
- if (fMaker.fError.hasError())
+ if (fMaker.fError.hasError())
return true;
if (parentIndex > 0) {
SkDisplayable* parent = fParents[parentIndex - 1].fDisplayable;
bool result = parent->add(fMaker, displayable);
- if (fMaker.hasError())
+ if (fMaker.hasError())
return true;
if (result == false) {
int infoCount;
- const SkMemberInfo* info =
+ const SkMemberInfo* info =
SkDisplayType::GetMembers(&fMaker, fParents[parentIndex - 1].fType, &infoCount);
const SkMemberInfo* foundInfo;
if ((foundInfo = searchContainer(info, infoCount)) != NULL) {
@@ -213,7 +213,7 @@ bool SkDisplayXMLParser::onEndElement(const char elem[])
SkDebugf("%s\n", debugOut.c_str());
#endif
fMaker.fEvents.doEvent(fMaker, SkDisplayEvent::kOnload, NULL);
- if (fMaker.fError.hasError())
+ if (fMaker.fError.hasError())
return true;
fMaker.fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
@@ -281,7 +281,7 @@ const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* info
}
Parent* container = fParents.end() - 1;
SkDisplayTypes type = (SkDisplayTypes) info->fType;
- if (type == SkType_MemberProperty)
+ if (type == SkType_MemberProperty)
type = info->propertyType();
SkDisplayTypes containerType = container->fType;
if (type == containerType && (type == SkType_Rect || type == SkType_Polygon ||
@@ -296,7 +296,7 @@ const SkMemberInfo* SkDisplayXMLParser::searchContainer(const SkMemberInfo* info
}
return info;
next:
- if (type == SkType_Drawable || (type == SkType_Displayable &&
+ if (type == SkType_Drawable || (type == SkType_Displayable &&
container->fDisplayable->isDrawable())) {
rectNext:
if (fParents.count() > 1) {
diff --git a/src/animator/SkDisplayable.cpp b/src/animator/SkDisplayable.cpp
index 396ce6b769..753764b3f5 100644
--- a/src/animator/SkDisplayable.cpp
+++ b/src/animator/SkDisplayable.cpp
@@ -21,7 +21,7 @@ SkTDDisplayableArray SkDisplayable::fAllocations;
#endif
#ifdef SK_DEBUG
-SkDisplayable::SkDisplayable() {
+SkDisplayable::SkDisplayable() {
id = _id.c_str();
#ifdef SK_FIND_LEAKS
// fAllocationCount++;
@@ -40,20 +40,20 @@ SkDisplayable::~SkDisplayable() {
}
bool SkDisplayable::add(SkAnimateMaker& , SkDisplayable* child) {
- return false;
+ return false;
}
-//void SkDisplayable::apply(SkAnimateMaker& , const SkMemberInfo* ,
-// SkDisplayable* , SkScalar [], int count) {
-// SkASSERT(0);
+//void SkDisplayable::apply(SkAnimateMaker& , const SkMemberInfo* ,
+// SkDisplayable* , SkScalar [], int count) {
+// SkASSERT(0);
//}
bool SkDisplayable::canContainDependents() const {
- return false;
+ return false;
}
-
-bool SkDisplayable::childrenNeedDisposing() const {
- return false;
+
+bool SkDisplayable::childrenNeedDisposing() const {
+ return false;
}
void SkDisplayable::clearBounder() {
@@ -170,18 +170,18 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
//last two are dummies
dumpValues(info, value.fType, value.fOperand, blankValue.fOperand, value.fOperand, blankValue.fOperand);
}
-
+
propIndex++;
continue;
}
if (SkDisplayType::IsDisplayable(maker, info->fType)) {
continue;
}
-
+
if (info->fType == SkType_MemberFunction)
continue;
-
-
+
+
if (info->fType == SkType_Array) {
SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this);
int arrayCount;
@@ -201,14 +201,14 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
case SkType_Displayable:
SkDebugf("%s", op->fDisplayable->id);
break;
- case SkType_Int:
+ case SkType_Int:
SkDebugf("%d", op->fS32);
break;
case SkType_Float:
SkDebugf("%g", SkScalarToFloat(op->fScalar));
break;
case SkType_String:
- case SkType_DynamicString:
+ case SkType_DynamicString:
SkDebugf("%s", op->fString->c_str());
break;
default:
@@ -219,16 +219,16 @@ void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) {
SkDebugf("]\" ");
continue;
}
-
+
if (info->fType == SkType_String || info->fType == SkType_DynamicString) {
SkString* string;
info->getString(this, &string);
if (string->isEmpty() == false)
- SkDebugf("%s=\"%s\"\t", info->fName, string->c_str());
+ SkDebugf("%s=\"%s\"\t", info->fName, string->c_str());
continue;
}
-
-
+
+
blankInfo = blankCopy->getMember(index);
int i = info->fCount;
info->getValue(this, values, i);
@@ -252,7 +252,7 @@ void SkDisplayable::dumpBase(SkAnimateMaker* maker) {
}
void SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) {
-
+
int index = -1;
const SkMemberInfo* info;
index = -1;
@@ -354,7 +354,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_TileMode:
//correct to look at the S32?
- if (op.fS32 != blankOp.fS32)
+ if (op.fS32 != blankOp.fS32)
SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "clamp" : op.fS32 == 1 ? "repeat" : "mirror");
break;
case SkType_Boolean:
@@ -372,7 +372,7 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
break;
case SkType_String:
case SkType_DynamicString:
- if (op.fString->size() > 0)
+ if (op.fString->size() > 0)
SkDebugf("%s=\"%s\" ", info->fName, op.fString->c_str());
break;
case SkType_MSec:
@@ -381,24 +381,24 @@ void SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, Sk
}
default:
SkDebugf("");
- }
+ }
}
#endif
-bool SkDisplayable::enable( SkAnimateMaker& ) {
+bool SkDisplayable::enable( SkAnimateMaker& ) {
return false;
}
void SkDisplayable::enableBounder() {
}
-void SkDisplayable::executeFunction(SkDisplayable* , int index,
+void SkDisplayable::executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& , SkDisplayTypes, SkScriptValue* ) {
- SkASSERT(0);
+ SkASSERT(0);
}
-void SkDisplayable::executeFunction(SkDisplayable* target,
+void SkDisplayable::executeFunction(SkDisplayable* target,
const SkMemberInfo* info, SkTypedArray* values, SkScriptValue* value) {
SkTDArray<SkScriptValue> typedValues;
for (SkOperand* op = values->begin(); op < values->end(); op++) {
@@ -410,9 +410,9 @@ void SkDisplayable::executeFunction(SkDisplayable* target,
executeFunction(target, info->functionIndex(), typedValues, info->getType(), value);
}
-void SkDisplayable::executeFunction2(SkDisplayable* , int index,
+void SkDisplayable::executeFunction2(SkDisplayable* , int index,
SkOpArray* params, SkDisplayTypes, SkOperand2* ) {
- SkASSERT(0);
+ SkASSERT(0);
}
void SkDisplayable::getBounds(SkRect* rect) {
@@ -425,15 +425,15 @@ const SkFunctionParamType* SkDisplayable::getFunctionsParameters() {
return NULL;
}
-const SkMemberInfo* SkDisplayable::getMember(int index) {
- return NULL;
+const SkMemberInfo* SkDisplayable::getMember(int index) {
+ return NULL;
}
-const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
- return NULL;
+const SkMemberInfo* SkDisplayable::getMember(const char name[]) {
+ return NULL;
}
-const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info,
+const SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info,
int* paramCount) {
const SkFunctionParamType* params = getFunctionsParameters();
SkASSERT(params != NULL);
@@ -460,17 +460,17 @@ SkDisplayable* SkDisplayable::getParent() const {
}
bool SkDisplayable::getProperty(int index, SkScriptValue* ) const {
-// SkASSERT(0);
- return false;
+// SkASSERT(0);
+ return false;
}
bool SkDisplayable::getProperty2(int index, SkOperand2* value) const {
- SkASSERT(0);
- return false;
+ SkASSERT(0);
+ return false;
}
-SkDisplayTypes SkDisplayable::getType() const {
- return SkType_Unknown;
+SkDisplayTypes SkDisplayable::getType() const {
+ return SkType_Unknown;
}
bool SkDisplayable::hasEnable() const {
@@ -478,7 +478,7 @@ bool SkDisplayable::hasEnable() const {
}
bool SkDisplayable::isDrawable() const {
- return false;
+ return false;
}
void SkDisplayable::onEndElement(SkAnimateMaker& ) {}
@@ -491,8 +491,8 @@ bool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, S
return false;
}
-//SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) {
-// return this;
+//SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) {
+// return this;
//}
void SkDisplayable::setChildHasID() {
@@ -503,8 +503,8 @@ bool SkDisplayable::setParent(SkDisplayable* ) {
}
bool SkDisplayable::setProperty(int index, SkScriptValue& ) {
- //SkASSERT(0);
- return false;
+ //SkASSERT(0);
+ return false;
}
void SkDisplayable::setReference(const SkMemberInfo* info, SkDisplayable* displayable) {
diff --git a/src/animator/SkDisplayable.h b/src/animator/SkDisplayable.h
index a3db00219b..5fc2d3ef57 100644
--- a/src/animator/SkDisplayable.h
+++ b/src/animator/SkDisplayable.h
@@ -50,30 +50,30 @@ public:
#endif
virtual bool enable( SkAnimateMaker& );
virtual void enableBounder();
- virtual void executeFunction(SkDisplayable* , int functionIndex,
- SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* );
- void executeFunction(SkDisplayable* , const SkMemberInfo* ,
- SkTypedArray* , SkScriptValue* );
- virtual void executeFunction2(SkDisplayable* , int functionIndex,
+ virtual void executeFunction(SkDisplayable* , int functionIndex,
+ SkTDArray<SkScriptValue>& , SkDisplayTypes , SkScriptValue* );
+ void executeFunction(SkDisplayable* , const SkMemberInfo* ,
+ SkTypedArray* , SkScriptValue* );
+ virtual void executeFunction2(SkDisplayable* , int functionIndex,
SkOpArray* params , SkDisplayTypes , SkOperand2* ); // compiled scripting experiment
virtual void getBounds(SkRect* );
virtual const SkFunctionParamType* getFunctionsParameters();
virtual const SkMemberInfo* getMember(int index);
virtual const SkMemberInfo* getMember(const char name[]);
- const SkFunctionParamType* getParameters(const SkMemberInfo* info,
+ const SkFunctionParamType* getParameters(const SkMemberInfo* info,
int* paramCount);
virtual SkDisplayable* getParent() const;
virtual bool getProperty(int index, SkScriptValue* value) const;
virtual bool getProperty2(int index, SkOperand2* value) const; // compiled scripting experiment
virtual SkDisplayTypes getType() const;
virtual bool hasEnable() const;
- bool isAnimate() const {
- SkDisplayTypes type = getType();
+ bool isAnimate() const {
+ SkDisplayTypes type = getType();
return type == SkType_Animate || type == SkType_Set; }
bool isApply() const { return getType() == SkType_Apply; }
bool isColor() const { return getType() == SkType_Color; }
virtual bool isDrawable() const;
- bool isGroup() const { return getType() == SkType_Group ||
+ bool isGroup() const { return getType() == SkType_Group ||
getType() == SkType_Save || getType() == SkType_DrawTo ||
getType() == SkType_SaveLayer; }
bool isMatrix() const { return getType() == SkType_Matrix; }
diff --git a/src/animator/SkDraw3D.cpp b/src/animator/SkDraw3D.cpp
index ce2bec4e4c..6ec178fbd6 100644
--- a/src/animator/SkDraw3D.cpp
+++ b/src/animator/SkDraw3D.cpp
@@ -25,7 +25,7 @@ const SkMemberInfo Sk3D_Point::fInfo[] = {
DEFINE_NO_VIRTUALS_GET_MEMBER(Sk3D_Point);
Sk3D_Point::Sk3D_Point() {
- fPoint.set(0, 0, 0);
+ fPoint.set(0, 0, 0);
}
#if SK_USE_CONDENSED_INFO == 0
@@ -85,7 +85,7 @@ const SkMemberInfo Sk3D_Patch::fInfo[] = {
DEFINE_GET_MEMBER(Sk3D_Patch);
-void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
+void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* ) {
SkASSERT(target == this);
@@ -93,7 +93,7 @@ void Sk3D_Patch::executeFunction(SkDisplayable* target, int index,
case SK_FUNCTION(rotateDegrees):
SkASSERT(parameters.count() == 3);
SkASSERT(type == SkType_Float);
- fPatch.rotateDegrees(parameters[0].fOperand.fScalar,
+ fPatch.rotateDegrees(parameters[0].fOperand.fScalar,
parameters[1].fOperand.fScalar, parameters[2].fOperand.fScalar);
break;
default:
diff --git a/src/animator/SkDraw3D.h b/src/animator/SkDraw3D.h
index e6549ea7a1..f4bd82b541 100644
--- a/src/animator/SkDraw3D.h
+++ b/src/animator/SkDraw3D.h
@@ -38,7 +38,7 @@ private:
class Sk3D_Patch : public SkDisplayable {
DECLARE_MEMBER_INFO(3D_Patch);
private:
- virtual void executeFunction(SkDisplayable* , int index,
+ virtual void executeFunction(SkDisplayable* , int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index 420045ab35..4604a7110c 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -56,7 +56,7 @@ const SkMemberInfo SkDrawBitmap::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBitmap);
-SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
+SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
rowBytes(0), width(-1), fColor(0), fColorSet(false) {
}
@@ -137,7 +137,7 @@ SkImageBaseBitmap::SkImageBaseBitmap() : fDirty(true), fUriBase(NULL) {
}
SkImageBaseBitmap::~SkImageBaseBitmap() {
- delete[] base64.fData;
+ delete[] base64.fData;
}
SkDisplayable* SkImageBaseBitmap::deepCopy(SkAnimateMaker* maker) {
@@ -151,13 +151,13 @@ void SkImageBaseBitmap::dirty() {
}
bool SkImageBaseBitmap::draw(SkAnimateMaker& maker) {
- if (fDirty)
+ if (fDirty)
resolve();
return INHERITED::draw(maker);
}
bool SkImageBaseBitmap::getProperty(int index, SkScriptValue* value) const {
- if (fDirty)
+ if (fDirty)
resolve();
switch (index) {
case SK_PROPERTY(height):
@@ -188,11 +188,11 @@ void SkImageBaseBitmap::resolve() {
return;
fLast.set(src);
fBitmap.reset();
-
+
//SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str());
SkStream* stream = new SkFILEStream(src.c_str());
SkAutoTDelete<SkStream> autoDel(stream);
SkImageDecoder::DecodeStream(stream, &fBitmap);
- }
+ }
}
diff --git a/src/animator/SkDrawBitmap.h b/src/animator/SkDrawBitmap.h
index 927c33b215..f9a92126b5 100644
--- a/src/animator/SkDrawBitmap.h
+++ b/src/animator/SkDrawBitmap.h
@@ -65,7 +65,7 @@ private:
protected:
SkBase64 base64;
SkString src;
- SkString fLast; // cache of src so that stream isn't unnecessarily decoded
+ SkString fLast; // cache of src so that stream isn't unnecessarily decoded
SkBool fDirty;
const char* fUriBase;
typedef SkBaseBitmap INHERITED;
diff --git a/src/animator/SkDrawBlur.cpp b/src/animator/SkDrawBlur.cpp
index 57e8e204b5..68996bcb70 100644
--- a/src/animator/SkDrawBlur.cpp
+++ b/src/animator/SkDrawBlur.cpp
@@ -20,7 +20,7 @@ const SkMemberInfo SkDrawBlur::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBlur);
-SkDrawBlur::SkDrawBlur() : radius(-1),
+SkDrawBlur::SkDrawBlur() : radius(-1),
blurStyle(SkBlurMaskFilter::kNormal_BlurStyle) {
}
diff --git a/src/animator/SkDrawColor.cpp b/src/animator/SkDrawColor.cpp
index 9abc8d06ed..dfe06227ab 100644
--- a/src/animator/SkDrawColor.cpp
+++ b/src/animator/SkDrawColor.cpp
@@ -73,7 +73,7 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
SkScalar fraction = hue / 60 - SkIntToScalar(sextant);
SkScalar p = SkScalarMul(value , SK_Scalar1 - saturation);
SkScalar q = SkScalarMul(value, SK_Scalar1 - SkScalarMul(saturation, fraction));
- SkScalar t = SkScalarMul(value, SK_Scalar1 -
+ SkScalar t = SkScalarMul(value, SK_Scalar1 -
SkScalarMul(saturation, SK_Scalar1 - fraction));
switch (sextant % 6) {
case 0: red = value; green = t; blue = p; break;
@@ -85,11 +85,11 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
}
}
//used to say SkToU8((U8CPU) red) etc
- return SkColorSetARGB(SkColorGetA(color), SkScalarRound(red),
+ return SkColorSetARGB(SkColorGetA(color), SkScalarRound(red),
SkScalarRound(green), SkScalarRound(blue));
}
-#if defined _WIN32 && _MSC_VER >= 1300
+#if defined _WIN32 && _MSC_VER >= 1300
#pragma warning ( pop )
#endif
@@ -120,8 +120,8 @@ const SkMemberInfo SkDrawColor::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawColor);
-SkDrawColor::SkDrawColor() : fDirty(false) {
- color = SK_ColorBLACK;
+SkDrawColor::SkDrawColor() : fDirty(false) {
+ color = SK_ColorBLACK;
fHue = fSaturation = fValue = SK_ScalarNaN;
}
@@ -150,13 +150,13 @@ void SkDrawColor::dirty(){
#ifdef SK_DUMP_ENABLED
void SkDrawColor::dump(SkAnimateMaker* maker) {
dumpBase(maker);
- SkDebugf("alpha=\"%d\" red=\"%d\" green=\"%d\" blue=\"%d\" />\n",
+ SkDebugf("alpha=\"%d\" red=\"%d\" green=\"%d\" blue=\"%d\" />\n",
SkColorGetA(color)/255, SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
}
#endif
-SkColor SkDrawColor::getColor() {
+SkColor SkDrawColor::getColor() {
if (fDirty) {
if (SkScalarIsNaN(fValue) == false)
color = HSV_to_RGB(color, kGetValue, fValue);
@@ -166,7 +166,7 @@ SkColor SkDrawColor::getColor() {
color = HSV_to_RGB(color, kGetHue, fHue);
fDirty = false;
}
- return color;
+ return color;
}
SkDisplayable* SkDrawColor::getParent() const {
@@ -231,17 +231,17 @@ bool SkDrawColor::setProperty(int index, SkScriptValue& value) {
#else
alpha = SkToU8((scalar - (scalar >= SK_ScalarHalf)) >> 8);
#endif
- color = SkColorSetARGB(alpha, SkColorGetR(color),
+ color = SkColorSetARGB(alpha, SkColorGetR(color),
SkColorGetG(color), SkColorGetB(color));
break;
case SK_PROPERTY(blue):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
+ color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
SkColorGetG(color), SkToU8((U8CPU) scalar));
break;
case SK_PROPERTY(green):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
+ color = SkColorSetARGB(SkColorGetA(color), SkColorGetR(color),
SkToU8((U8CPU) scalar), SkColorGetB(color));
break;
case SK_PROPERTY(hue):
@@ -250,7 +250,7 @@ bool SkDrawColor::setProperty(int index, SkScriptValue& value) {
break;
case SK_PROPERTY(red):
scalar = SkScalarClampMax(scalar, 255 * SK_Scalar1);
- color = SkColorSetARGB(SkColorGetA(color), SkToU8((U8CPU) scalar),
+ color = SkColorSetARGB(SkColorGetA(color), SkToU8((U8CPU) scalar),
SkColorGetG(color), SkColorGetB(color));
break;
case SK_PROPERTY(saturation):
diff --git a/src/animator/SkDrawEmboss.cpp b/src/animator/SkDrawEmboss.cpp
index 22845044bd..7e47ec270c 100644
--- a/src/animator/SkDrawEmboss.cpp
+++ b/src/animator/SkDrawEmboss.cpp
@@ -22,7 +22,7 @@ const SkMemberInfo SkDrawEmboss::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawEmboss);
-SkDrawEmboss::SkDrawEmboss() : radius(-1) {
+SkDrawEmboss::SkDrawEmboss() : radius(-1) {
direction.setCount(3);
}
diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp
index 9e29074e79..2e751cadf6 100644
--- a/src/animator/SkDrawGradient.cpp
+++ b/src/animator/SkDrawGradient.cpp
@@ -34,16 +34,16 @@ class SkDrawGradientUnitMapper : public SkUnitMapper {
public:
SkDrawGradientUnitMapper(SkAnimateMaker* maker, const char* script) : fMaker(maker), fScript(script) {
}
-
+
SK_DECLARE_UNFLATTENABLE_OBJECT()
-
+
protected:
virtual uint16_t mapUnit16(uint16_t x) {
fUnit = SkUnitToScalar(x);
SkScriptValue value;
SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
engine.propertyCallBack(GetUnitValue, &fUnit);
- if (engine.evaluate(fScript, &value, SkType_Float))
+ if (engine.evaluate(fScript, &value, SkType_Float))
x = SkScalarToUnit(value.fOperand.fScalar);
return x;
}
@@ -79,7 +79,7 @@ SkDrawGradient::SkDrawGradient() : fUnitMapper(NULL) {
}
SkDrawGradient::~SkDrawGradient() {
- for (int index = 0; index < fDrawColors.count(); index++)
+ for (int index = 0; index < fDrawColors.count(); index++)
delete fDrawColors[index];
delete fUnitMapper;
}
@@ -97,7 +97,7 @@ bool SkDrawGradient::add(SkAnimateMaker& , SkDisplayable* child) {
int SkDrawGradient::addPrelude() {
int count = fDrawColors.count();
fColors.setCount(count);
- for (int index = 0; index < count; index++)
+ for (int index = 0; index < count; index++)
fColors[index] = fDrawColors[index]->color;
return count;
}
@@ -116,7 +116,7 @@ void SkDrawGradient::dumpRest(SkAnimateMaker* maker) {
SkDrawColor* color = *ptr;
color->dump(maker);
}
- SkDisplayList::fIndent -= 4;
+ SkDisplayList::fIndent -= 4;
dumpChildren(maker, closedYet); //dumps the matrix if it has one
}
#endif
@@ -146,7 +146,7 @@ void SkDrawGradient::onEndElement(SkAnimateMaker& maker) {
}
}
}
- if (unitMapper.size() > 0)
+ if (unitMapper.size() > 0)
fUnitMapper = new SkDrawGradientUnitMapper(&maker, unitMapper.c_str());
INHERITED::onEndElement(maker);
}
@@ -162,7 +162,7 @@ const SkMemberInfo SkDrawLinearGradient::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawLinearGradient);
-SkDrawLinearGradient::SkDrawLinearGradient() {
+SkDrawLinearGradient::SkDrawLinearGradient() {
}
void SkDrawLinearGradient::onEndElement(SkAnimateMaker& maker)
@@ -203,8 +203,8 @@ const SkMemberInfo SkDrawRadialGradient::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawRadialGradient);
-SkDrawRadialGradient::SkDrawRadialGradient() : radius(0) {
- center.set(0, 0);
+SkDrawRadialGradient::SkDrawRadialGradient() : radius(0) {
+ center.set(0, 0);
}
#ifdef SK_DUMP_ENABLED
diff --git a/src/animator/SkDrawGradient.h b/src/animator/SkDrawGradient.h
index 09eb405e6b..d01ee7097e 100644
--- a/src/animator/SkDrawGradient.h
+++ b/src/animator/SkDrawGradient.h
@@ -23,7 +23,7 @@ class SkDrawGradient : public SkDrawShader {
virtual bool add(SkAnimateMaker& , SkDisplayable* child);
#ifdef SK_DUMP_ENABLED
virtual void dumpRest(SkAnimateMaker*);
-#endif
+#endif
virtual void onEndElement(SkAnimateMaker& );
protected:
SkTDScalarArray offsets;
@@ -55,7 +55,7 @@ class SkDrawRadialGradient : public SkDrawGradient {
SkDrawRadialGradient();
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker*);
-#endif
+#endif
virtual SkShader* getShader();
protected:
SkPoint center;
diff --git a/src/animator/SkDrawGroup.cpp b/src/animator/SkDrawGroup.cpp
index 939bd9fd3d..806da5eb07 100644
--- a/src/animator/SkDrawGroup.cpp
+++ b/src/animator/SkDrawGroup.cpp
@@ -50,7 +50,7 @@ SkGroup::~SkGroup() {
}
bool SkGroup::add(SkAnimateMaker& , SkDisplayable* child) {
- SkASSERT(child);
+ SkASSERT(child);
// SkASSERT(child->isDrawable());
*fChildren.append() = (SkDrawable*) child;
if (child->isGroup()) {
diff --git a/src/animator/SkDrawLine.cpp b/src/animator/SkDrawLine.cpp
index fe93c4ef3a..d0ae7d9297 100644
--- a/src/animator/SkDrawLine.cpp
+++ b/src/animator/SkDrawLine.cpp
@@ -25,7 +25,7 @@ const SkMemberInfo SkLine::fInfo[] = {
DEFINE_GET_MEMBER(SkLine);
-SkLine::SkLine() : x1(0), x2(0), y1(0), y2(0) {
+SkLine::SkLine() : x1(0), x2(0), y1(0), y2(0) {
}
bool SkLine::draw(SkAnimateMaker& maker) {
diff --git a/src/animator/SkDrawMatrix.cpp b/src/animator/SkDrawMatrix.cpp
index 96e8292008..1d7b3e015e 100644
--- a/src/animator/SkDrawMatrix.cpp
+++ b/src/animator/SkDrawMatrix.cpp
@@ -51,9 +51,9 @@ const SkMemberInfo SkDrawMatrix::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawMatrix);
-SkDrawMatrix::SkDrawMatrix() : fChildHasID(false), fDirty(false) {
+SkDrawMatrix::SkDrawMatrix() : fChildHasID(false), fDirty(false) {
fConcat.reset();
- fMatrix.reset();
+ fMatrix.reset();
}
SkDrawMatrix::~SkDrawMatrix() {
@@ -66,11 +66,11 @@ bool SkDrawMatrix::add(SkAnimateMaker& maker, SkDisplayable* child) {
SkMatrixPart* part = (SkMatrixPart*) child;
*fParts.append() = part;
if (part->add())
- maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToMatrix);
+ maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToMatrix);
return true;
}
-bool SkDrawMatrix::childrenNeedDisposing() const {
+bool SkDrawMatrix::childrenNeedDisposing() const {
return false;
}
@@ -83,8 +83,8 @@ SkDisplayable* SkDrawMatrix::deepCopy(SkAnimateMaker* maker) {
return copy;
}
-void SkDrawMatrix::dirty() {
- fDirty = true;
+void SkDrawMatrix::dirty() {
+ fDirty = true;
}
bool SkDrawMatrix::draw(SkAnimateMaker& maker) {
@@ -207,8 +207,8 @@ setConcat:
}
}
-void SkDrawMatrix::setChildHasID() {
- fChildHasID = true;
+void SkDrawMatrix::setChildHasID() {
+ fChildHasID = true;
}
bool SkDrawMatrix::setProperty(int index, SkScriptValue& scriptValue) {
diff --git a/src/animator/SkDrawPaint.h b/src/animator/SkDrawPaint.h
index a2a893e8b7..db95d345af 100644
--- a/src/animator/SkDrawPaint.h
+++ b/src/animator/SkDrawPaint.h
@@ -32,7 +32,7 @@ class SkDrawPaint : public SkDrawable {
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
#endif
- virtual void executeFunction(SkDisplayable* target, int index,
+ virtual void executeFunction(SkDisplayable* target, int index,
SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
SkScriptValue* );
virtual const SkFunctionParamType* getFunctionsParameters();
diff --git a/src/animator/SkDrawPath.cpp b/src/animator/SkDrawPath.cpp
index 10e92035e4..81cbdb1c24 100644
--- a/src/animator/SkDrawPath.cpp
+++ b/src/animator/SkDrawPath.cpp
@@ -50,17 +50,17 @@ bool SkDrawPath::add(SkAnimateMaker& maker, SkDisplayable* child) {
SkPathPart* part = (SkPathPart*) child;
*fParts.append() = part;
if (part->add())
- maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToPath);
+ maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToPath);
fDirty = false;
return true;
}
-bool SkDrawPath::childrenNeedDisposing() const {
- return false;
+bool SkDrawPath::childrenNeedDisposing() const {
+ return false;
}
-void SkDrawPath::dirty() {
- fDirty = true;
+void SkDrawPath::dirty() {
+ fDirty = true;
fLength = SK_ScalarNaN;
if (fParent)
fParent->dirty();
@@ -115,7 +115,7 @@ SkPath& SkDrawPath::getPath() {
fDirty = false;
return fPath;
}
-
+
void SkDrawPath::onEndElement(SkAnimateMaker& ) {
if (d.size() > 0) {
parseSVG();
@@ -153,8 +153,8 @@ bool SkDrawPath::getProperty(int index, SkScriptValue* value) const {
return true;
}
-void SkDrawPath::setChildHasID() {
- fChildHasID = true;
+void SkDrawPath::setChildHasID() {
+ fChildHasID = true;
}
bool SkDrawPath::setParent(SkDisplayable* parent) {
@@ -189,7 +189,7 @@ const SkMemberInfo SkPolyline::fInfo[] = {
DEFINE_GET_MEMBER(SkPolyline);
bool SkPolyline::add(SkAnimateMaker& , SkDisplayable*) const {
- return false;
+ return false;
}
void SkPolyline::onEndElement(SkAnimateMaker& maker) {
diff --git a/src/animator/SkDrawPoint.cpp b/src/animator/SkDrawPoint.cpp
index 94fe4d2762..66d2b4e766 100644
--- a/src/animator/SkDrawPoint.cpp
+++ b/src/animator/SkDrawPoint.cpp
@@ -34,8 +34,8 @@ const SkMemberInfo SkDrawPoint::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawPoint);
-SkDrawPoint::SkDrawPoint() {
- fPoint.set(0, 0);
+SkDrawPoint::SkDrawPoint() {
+ fPoint.set(0, 0);
}
void SkDrawPoint::getBounds(SkRect* rect ) {
diff --git a/src/animator/SkDrawRectangle.cpp b/src/animator/SkDrawRectangle.cpp
index 19edf50bc3..7587e4b3f9 100644
--- a/src/animator/SkDrawRectangle.cpp
+++ b/src/animator/SkDrawRectangle.cpp
@@ -36,8 +36,8 @@ const SkMemberInfo SkDrawRect::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawRect);
-SkDrawRect::SkDrawRect() : fParent(NULL) {
- fRect.setEmpty();
+SkDrawRect::SkDrawRect() : fParent(NULL) {
+ fRect.setEmpty();
}
void SkDrawRect::dirty() {
diff --git a/src/animator/SkDrawRectangle.h b/src/animator/SkDrawRectangle.h
index 49c9cf4c64..321c4ee657 100644
--- a/src/animator/SkDrawRectangle.h
+++ b/src/animator/SkDrawRectangle.h
@@ -44,7 +44,7 @@ class SkRoundRect : public SkDrawRect {
virtual bool draw(SkAnimateMaker& );
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
-#endif
+#endif
protected:
SkScalar rx;
SkScalar ry;
diff --git a/src/animator/SkDrawSaveLayer.cpp b/src/animator/SkDrawSaveLayer.cpp
index a7592db5b6..43ec5c1b55 100644
--- a/src/animator/SkDrawSaveLayer.cpp
+++ b/src/animator/SkDrawSaveLayer.cpp
@@ -35,7 +35,7 @@ bool SkSaveLayer::draw(SkAnimateMaker& maker)
if (!bounds) {
return false;
}
- SkPaint* save = maker.fPaint;
+ SkPaint* save = maker.fPaint;
//paint is an SkDrawPaint
if (paint)
{
diff --git a/src/animator/SkDrawShader.cpp b/src/animator/SkDrawShader.cpp
index 5019622f47..e3aa4da028 100644
--- a/src/animator/SkDrawShader.cpp
+++ b/src/animator/SkDrawShader.cpp
@@ -24,7 +24,7 @@ const SkMemberInfo SkDrawShader::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawShader);
-SkDrawShader::SkDrawShader() : matrix(NULL),
+SkDrawShader::SkDrawShader() : matrix(NULL),
tileMode(SkShader::kClamp_TileMode) {
}
@@ -66,14 +66,14 @@ bool SkDrawBitmapShader::add() {
SkShader* SkDrawBitmapShader::getShader() {
if (image == NULL)
return NULL;
-
+
// note: bitmap shader now supports independent tile modes for X and Y
// we pass the same to both, but later we should extend this flexibility
// to the xml (e.g. tileModeX="repeat" tileModeY="clmap")
- //
+ //
// oops, bitmapshader no longer takes filterBitmap, but deduces it at
- // draw-time from the paint
- SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
+ // draw-time from the paint
+ SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
(SkShader::TileMode) tileMode,
(SkShader::TileMode) tileMode);
SkAutoTDelete<SkShader> autoDel(shader);
diff --git a/src/animator/SkDrawText.h b/src/animator/SkDrawText.h
index 7dd2e26e6c..3ac2479138 100644
--- a/src/animator/SkDrawText.h
+++ b/src/animator/SkDrawText.h
@@ -21,7 +21,7 @@ class SkText : public SkBoundable {
#ifdef SK_DUMP_ENABLED
virtual void dump(SkAnimateMaker* );
#endif
- virtual bool getProperty(int index, SkScriptValue* value) const ;
+ virtual bool getProperty(int index, SkScriptValue* value) const ;
const char* getText() { return text.c_str(); }
size_t getSize() { return text.size(); }
protected:
diff --git a/src/animator/SkDrawTextBox.cpp b/src/animator/SkDrawTextBox.cpp
index d97dc5c55c..f920e8eaa2 100644
--- a/src/animator/SkDrawTextBox.cpp
+++ b/src/animator/SkDrawTextBox.cpp
@@ -47,7 +47,7 @@ void SkDrawTextBox::dump(SkAnimateMaker* maker)
{
dumpBase(maker);
dumpAttrs(maker);
- if (mode == 0)
+ if (mode == 0)
SkDebugf("mode=\"oneLine\" ");
if (spacingAlign == 1)
SkDebugf("spacingAlign=\"center\" ");
diff --git a/src/animator/SkDrawable.cpp b/src/animator/SkDrawable.cpp
index 8db0333fe6..9e80c9dc27 100644
--- a/src/animator/SkDrawable.cpp
+++ b/src/animator/SkDrawable.cpp
@@ -13,8 +13,8 @@ bool SkDrawable::doEvent(SkDisplayEvent::Kind , SkEventState* ) {
return false;
}
-bool SkDrawable::isDrawable() const {
- return true;
+bool SkDrawable::isDrawable() const {
+ return true;
}
void SkDrawable::initialize() {
diff --git a/src/animator/SkDrawable.h b/src/animator/SkDrawable.h
index 139ce85a2d..6bb9608541 100644
--- a/src/animator/SkDrawable.h
+++ b/src/animator/SkDrawable.h
@@ -19,7 +19,7 @@ struct SkEventState;
class SkDrawable : public SkDisplayable {
public:
virtual bool doEvent(SkDisplayEvent::Kind , SkEventState* state );
- virtual bool draw(SkAnimateMaker& ) = 0;
+ virtual bool draw(SkAnimateMaker& ) = 0;
virtual void initialize();
virtual bool isDrawable() const;
virtual void setSteps(int steps);
diff --git a/src/animator/SkDump.cpp b/src/animator/SkDump.cpp
index bd912774ff..563b0e104c 100644
--- a/src/animator/SkDump.cpp
+++ b/src/animator/SkDump.cpp
@@ -144,7 +144,7 @@ bool SkDump::hasEnable() const {
}
bool SkDump::setProperty(int index, SkScriptValue& ) {
- return index <= SK_PROPERTY(posts);
+ return index <= SK_PROPERTY(posts);
}
#endif
diff --git a/src/animator/SkGetCondensedInfo.cpp b/src/animator/SkGetCondensedInfo.cpp
index a583cef593..6d83b1d10c 100644
--- a/src/animator/SkGetCondensedInfo.cpp
+++ b/src/animator/SkGetCondensedInfo.cpp
@@ -26,7 +26,7 @@ static int _searchByName(const unsigned char* lengths, int count, const char* st
int mid = (hi + lo) >> 1;
if (strcmp(&strings[lengths[mid << 2]], target) < 0)
lo = mid + 1;
- else
+ else
hi = mid;
}
if (strcmp(&strings[lengths[hi << 2]], target) != 0)
diff --git a/src/animator/SkIntArray.h b/src/animator/SkIntArray.h
index 6769a9e89f..4dac75af24 100644
--- a/src/animator/SkIntArray.h
+++ b/src/animator/SkIntArray.h
@@ -36,21 +36,21 @@ typedef SkIntArray(SkDisplayTypes) SkTDDisplayTypesArray;
typedef SkIntArray(SkMSec) SkTDMSecArray;
typedef SkIntArray(SkScalar) SkTDScalarArray;
-typedef SkLongArray(SkActive*) SkTDActiveArray;
-typedef SkLongArray(SkAnimateBase*) SkTDAnimateArray;
-typedef SkLongArray(SkDataInput*) SkTDDataArray;
-typedef SkLongArray(SkDisplayable*) SkTDDisplayableArray;
-typedef SkLongArray(SkDisplayEvent*) SkTDDisplayEventArray;
-typedef SkLongArray(SkDrawable*) SkTDDrawableArray;
-typedef SkLongArray(SkDrawColor*) SkTDDrawColorArray;
-typedef SkLongArray(SkMatrixPart*) SkTDMatrixPartArray;
+typedef SkLongArray(SkActive*) SkTDActiveArray;
+typedef SkLongArray(SkAnimateBase*) SkTDAnimateArray;
+typedef SkLongArray(SkDataInput*) SkTDDataArray;
+typedef SkLongArray(SkDisplayable*) SkTDDisplayableArray;
+typedef SkLongArray(SkDisplayEvent*) SkTDDisplayEventArray;
+typedef SkLongArray(SkDrawable*) SkTDDrawableArray;
+typedef SkLongArray(SkDrawColor*) SkTDDrawColorArray;
+typedef SkLongArray(SkMatrixPart*) SkTDMatrixPartArray;
typedef SkLongArray(const SkMemberInfo*) SkTDMemberInfoArray;
-typedef SkLongArray(SkPaintPart*) SkTDPaintPartArray;
-typedef SkLongArray(SkPathPart*) SkTDPathPartArray;
-typedef SkLongArray(SkTypedArray*) SkTDTypedArrayArray;
-typedef SkLongArray(SkString*) SkTDStringArray;
-typedef SkLongArray(SkOperand) SkTDOperandArray;
-typedef SkLongArray(SkOperand*) SkTDOperandPtrArray;
+typedef SkLongArray(SkPaintPart*) SkTDPaintPartArray;
+typedef SkLongArray(SkPathPart*) SkTDPathPartArray;
+typedef SkLongArray(SkTypedArray*) SkTDTypedArrayArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkOperand) SkTDOperandArray;
+typedef SkLongArray(SkOperand*) SkTDOperandPtrArray;
#endif // SkIntArray_DEFINED
diff --git a/src/animator/SkMatrixParts.cpp b/src/animator/SkMatrixParts.cpp
index f00bb8e6bb..221ac0a510 100644
--- a/src/animator/SkMatrixParts.cpp
+++ b/src/animator/SkMatrixParts.cpp
@@ -16,8 +16,8 @@
SkMatrixPart::SkMatrixPart() : fMatrix(NULL) {
}
-void SkMatrixPart::dirty() {
- fMatrix->dirty();
+void SkMatrixPart::dirty() {
+ fMatrix->dirty();
}
SkDisplayable* SkMatrixPart::getParent() const {
@@ -44,8 +44,8 @@ const SkMemberInfo SkRotate::fInfo[] = {
DEFINE_GET_MEMBER(SkRotate);
-SkRotate::SkRotate() : degrees(0) {
- center.fX = center.fY = 0;
+SkRotate::SkRotate() : degrees(0) {
+ center.fX = center.fY = 0;
}
bool SkRotate::add() {
@@ -66,12 +66,12 @@ const SkMemberInfo SkScale::fInfo[] = {
DEFINE_GET_MEMBER(SkScale);
-SkScale::SkScale() : x(SK_Scalar1), y(SK_Scalar1) {
- center.fX = center.fY = 0;
+SkScale::SkScale() : x(SK_Scalar1), y(SK_Scalar1) {
+ center.fX = center.fY = 0;
}
bool SkScale::add() {
- fMatrix->scale(x, y, center);
+ fMatrix->scale(x, y, center);
return false;
}
@@ -88,12 +88,12 @@ const SkMemberInfo SkSkew::fInfo[] = {
DEFINE_GET_MEMBER(SkSkew);
-SkSkew::SkSkew() : x(0), y(0) {
- center.fX = center.fY = 0;
+SkSkew::SkSkew() : x(0), y(0) {
+ center.fX = center.fY = 0;
}
bool SkSkew::add() {
- fMatrix->skew(x, y, center);
+ fMatrix->skew(x, y, center);
return false;
}
@@ -113,7 +113,7 @@ SkTranslate::SkTranslate() : x(0), y(0) {
}
bool SkTranslate::add() {
- fMatrix->translate(x, y);
+ fMatrix->translate(x, y);
return false;
}
@@ -130,7 +130,7 @@ const SkMemberInfo SkFromPath::fInfo[] = {
DEFINE_GET_MEMBER(SkFromPath);
-SkFromPath::SkFromPath() :
+SkFromPath::SkFromPath() :
mode(0), offset(0), path(NULL) {
}
@@ -166,7 +166,7 @@ const SkMemberInfo SkRectToRect::fInfo[] = {
DEFINE_GET_MEMBER(SkRectToRect);
-SkRectToRect::SkRectToRect() :
+SkRectToRect::SkRectToRect() :
source(NULL), destination(NULL) {
}
@@ -200,7 +200,7 @@ void SkRectToRect::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
destination->dump(maker);
SkDisplayList::fIndent -= 4;
- SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
+ SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
}
SkDisplayList::fIndent -= 4;
dumpEnd(maker);
@@ -268,7 +268,7 @@ void SkPolyToPoly::dump(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
destination->dump(maker);
SkDisplayList::fIndent -= 4;
- SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
+ SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, "");
}
SkDisplayList::fIndent -= 4;
dumpEnd(maker);
diff --git a/src/animator/SkMatrixParts.h b/src/animator/SkMatrixParts.h
index 5f6cd54b19..51c95599b7 100644
--- a/src/animator/SkMatrixParts.h
+++ b/src/animator/SkMatrixParts.h
@@ -114,6 +114,6 @@ protected:
SkPolygon* destination;
};
-// !!! add concat matrix ?
+// !!! add concat matrix ?
#endif // SkMatrixParts_DEFINED
diff --git a/src/animator/SkMemberInfo.cpp b/src/animator/SkMemberInfo.cpp
index 7fae5033fd..582b29ad27 100644
--- a/src/animator/SkMemberInfo.cpp
+++ b/src/animator/SkMemberInfo.cpp
@@ -52,7 +52,7 @@ size_t SkMemberInfo::GetSize(SkDisplayTypes type) { // size of simple types only
case SkType_Displayable:
case SkType_Drawable:
case SkType_Matrix:
- byteSize = sizeof(void*);
+ byteSize = sizeof(void*);
break;
case SkType_MSec:
byteSize = sizeof(SkMSec);
@@ -137,7 +137,7 @@ void SkMemberInfo::getString(const SkDisplayable* displayable, SkString** string
void SkMemberInfo::getValue(const SkDisplayable* displayable, SkOperand value[], int count) const {
SkASSERT(fType != SkType_String && fType != SkType_MemberProperty);
- SkASSERT(count == fCount);
+ SkASSERT(count == fCount);
void* valuePtr = memberData(displayable);
size_t byteSize = getSize(displayable);
SkASSERT(sizeof(value[0].fScalar) == sizeof(value[0])); // no support for 64 bit pointers, yet
@@ -150,7 +150,7 @@ void SkMemberInfo::setString(SkDisplayable* displayable, SkString* value) const
displayable->dirty();
}
-void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[],
+void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[],
int count) const {
SkASSERT(sizeof(values[0].fScalar) == sizeof(values[0])); // no support for 64 bit pointers, yet
char* dst = (char*) memberData(displayable);
@@ -163,7 +163,7 @@ void SkMemberInfo::setValue(SkDisplayable* displayable, const SkOperand values[]
displayable->dirty();
}
-
+
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
@@ -180,9 +180,9 @@ static inline bool is_hex(int c)
}
-bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
+bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
int storageOffset, int maxStorage, SkDisplayable* displayable, SkDisplayTypes outType,
- const char rawValue[], size_t rawValueLen) const
+ const char rawValue[], size_t rawValueLen) const
{
SkString valueStr(rawValue, rawValueLen);
SkScriptValue scriptValue;
@@ -218,7 +218,7 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
}
*(char*) poundPos = '0'; // overwrite '#'
valueStr.insert(offset + 1, "xFF");
- }
+ }
}
if (SkDisplayType::IsDisplayable(&maker, type) || SkDisplayType::IsEnum(&maker, type) || type == SkType_ARGB)
goto scriptCommon;
@@ -226,22 +226,22 @@ bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorag
case SkType_String:
#if 0
if (displayable && displayable->isAnimate()) {
-
+
goto noScriptString;
- }
+ }
if (strncmp(rawValue, "#string:", sizeof("#string:") - 1) == 0) {
SkASSERT(sizeof("string") == sizeof("script"));
char* stringHeader = valueStr.writable_str();
memcpy(&stringHeader[1], "script", sizeof("script") - 1);
rawValue = valueStr.c_str();
goto noScriptString;
- } else
+ } else
#endif
if (strncmp(rawValue, "#script:", sizeof("#script:") - 1) != 0)
goto noScriptString;
valueStr.remove(0, 8);
case SkType_Unknown:
- case SkType_Int:
+ case SkType_Int:
case SkType_MSec: // for the purposes of script, MSec is treated as a Scalar
case SkType_Point:
case SkType_3D_Point:
@@ -331,10 +331,10 @@ scriptCommon: {
SkASSERT(0);
break;
}
-// if (SkDisplayType::IsStruct(type) == false)
+// if (SkDisplayType::IsStruct(type) == false)
{
writeStruct:
- if (writeValue(displayable, arrayStorage, storageOffset, maxStorage,
+ if (writeValue(displayable, arrayStorage, storageOffset, maxStorage,
untypedStorage, outType, scriptValue)) {
maker.setErrorCode(SkDisplayXMLParserError::kUnexpectedType);
return false;
@@ -346,18 +346,18 @@ dirty:
return true;
}
-bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
+bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
int storageOffset, int maxStorage, SkDisplayable* displayable, SkDisplayTypes outType,
SkString& raw) const {
return setValue(maker, arrayStorage, storageOffset, maxStorage, displayable, outType, raw.c_str(),
raw.size());
}
-bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
- int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
+bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
+ int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
SkScriptValue& scriptValue) const
{
- SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ?
+ SkOperand* storage = untypedStorage ? (SkOperand*) untypedStorage : arrayStorage ?
arrayStorage->begin() : NULL;
if (storage)
storage += storageOffset;
@@ -424,7 +424,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
string->set(*scriptValue.fOperand.fString);
} else if (type == SkType_ARGB && outType == SkType_Float) {
SkTypedArray* array = scriptValue.fOperand.fArray;
- SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB ||
+ SkASSERT(scriptValue.fType == SkType_Int || scriptValue.fType == SkType_ARGB ||
scriptValue.fType == SkType_Array);
SkASSERT(scriptValue.fType != SkType_Array || (array != NULL &&
array->getType() == SkType_Int));
@@ -434,7 +434,7 @@ bool SkMemberInfo::writeValue(SkDisplayable* displayable, SkTDOperandArray* arra
if (maxStorage == 0)
arrayStorage->setCount(numberOfComponents);
for (int index = 0; index < numberOfColors; index++) {
- SkColor color = scriptValue.fType == SkType_Array ?
+ SkColor color = scriptValue.fType == SkType_Array ?
(SkColor) array->begin()[index].fS32 : (SkColor) scriptValue.fOperand.fS32;
storage[0].fScalar = SkIntToScalar(SkColorGetA(color));
storage[1].fScalar = SkIntToScalar(SkColorGetR(color));
@@ -528,11 +528,11 @@ const SkMemberInfo* SkMemberInfo::getInherited() const {
#endif // SK_USE_CONDENSED_INFO == 0
#if 0
-bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes type,
+bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes type,
int count) {
switch (type) {
case SkType_Animate:
- case SkType_BaseBitmap:
+ case SkType_BaseBitmap:
case SkType_Bitmap:
case SkType_Dash:
case SkType_Displayable:
@@ -548,7 +548,7 @@ bool SkMemberInfo::SetValue(void* valuePtr, const char value[], SkDisplayTypes t
case SkType_3D_Point:
case SkType_Point:
// case SkType_PointArray:
- case SkType_ScalarArray:
+ case SkType_ScalarArray:
SkParse::FindScalars(value, (SkScalar*) valuePtr, count);
break;
default:
diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h
index f2e690c5f6..007df60ec6 100644
--- a/src/animator/SkMemberInfo.h
+++ b/src/animator/SkMemberInfo.h
@@ -83,15 +83,15 @@ struct SkMemberInfo {
}
void setString(SkDisplayable* , SkString* ) const;
void setValue(SkDisplayable* , const SkOperand values[], int count) const;
- bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
- int storageOffset, int maxStorage, SkDisplayable* ,
+ bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
+ int storageOffset, int maxStorage, SkDisplayable* ,
SkDisplayTypes outType, const char value[], size_t len) const;
- bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
- int storageOffset, int maxStorage, SkDisplayable* ,
+ bool setValue(SkAnimateMaker& , SkTDOperandArray* storage,
+ int storageOffset, int maxStorage, SkDisplayable* ,
SkDisplayTypes outType, SkString& str) const;
// void setValue(SkDisplayable* , const char value[], const char name[]) const;
- bool writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
- int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
+ bool writeValue(SkDisplayable* displayable, SkTDOperandArray* arrayStorage,
+ int storageOffset, int maxStorage, void* untypedStorage, SkDisplayTypes outType,
SkScriptValue& scriptValue) const;
#if SK_USE_CONDENSED_INFO == 0
static const SkMemberInfo* Find(const SkMemberInfo [], int count, int* index);
@@ -119,7 +119,7 @@ struct SkMemberInfo {
#define SK_MEMBER_INHERITED \
{ (const char*) INHERITED::fInfo, 0, SkType_BaseClassInfo, INHERITED::fInfoCount }
-// #define SK_MEMBER_KEY_TYPE(_member, _type)
+// #define SK_MEMBER_KEY_TYPE(_member, _type)
// {#_member, (size_t) -1, SkType_##_type, 0}
#define SK_FUNCTION(_member) \
@@ -184,7 +184,7 @@ public: \
#define DECLARE_EMPTY_MEMBER_INFO(_type) \
public: \
virtual SkDisplayTypes getType() const { return SkType_##_type; }
-
+
#define DECLARE_EXTRAS_MEMBER_INFO(_type) \
public: \
static const SkMemberInfo fInfo[]; \
diff --git a/src/animator/SkOpArray.cpp b/src/animator/SkOpArray.cpp
index 1f14476e20..94298cc83a 100644
--- a/src/animator/SkOpArray.cpp
+++ b/src/animator/SkOpArray.cpp
@@ -14,10 +14,10 @@ SkOpArray::SkOpArray(SkOperand2::OpType type) : fType(type) {
}
bool SkOpArray::getIndex(int index, SkOperand2* operand) {
- if (index >= count()) {
- SkASSERT(0);
- return false;
- }
- *operand = begin()[index];
- return true;
+ if (index >= count()) {
+ SkASSERT(0);
+ return false;
+ }
+ *operand = begin()[index];
+ return true;
}
diff --git a/src/animator/SkOpArray.h b/src/animator/SkOpArray.h
index d5b9fe7df8..260bf78be0 100644
--- a/src/animator/SkOpArray.h
+++ b/src/animator/SkOpArray.h
@@ -11,19 +11,19 @@
#include "SkOperand2.h"
#include "SkTDArray_Experimental.h"
-typedef SkLongArray(SkOperand2) SkTDOperand2Array;
+typedef SkLongArray(SkOperand2) SkTDOperand2Array;
class SkOpArray : public SkTDOperand2Array {
public:
- SkOpArray();
- SkOpArray(SkOperand2::OpType type);
- bool getIndex(int index, SkOperand2* operand);
- SkOperand2::OpType getType() { return fType; }
- void setType(SkOperand2::OpType type) {
- fType = type;
- }
+ SkOpArray();
+ SkOpArray(SkOperand2::OpType type);
+ bool getIndex(int index, SkOperand2* operand);
+ SkOperand2::OpType getType() { return fType; }
+ void setType(SkOperand2::OpType type) {
+ fType = type;
+ }
protected:
- SkOperand2::OpType fType;
+ SkOperand2::OpType fType;
};
#endif // SkOpArray_DEFINED
diff --git a/src/animator/SkOperand2.h b/src/animator/SkOperand2.h
index 4f09a01020..f844b6b4c9 100644
--- a/src/animator/SkOperand2.h
+++ b/src/animator/SkOperand2.h
@@ -14,40 +14,40 @@ class SkOpArray;
class SkString;
union SkOperand2 {
- enum OpType {
- kNoType,
- kS32 = 1,
- kScalar = 2,
- kString = 4,
- kArray = 8,
- kObject = 16
- };
- SkOpArray* fArray;
- void* fObject;
- size_t fReference;
- int32_t fS32;
- SkScalar fScalar;
- SkString* fString;
+ enum OpType {
+ kNoType,
+ kS32 = 1,
+ kScalar = 2,
+ kString = 4,
+ kArray = 8,
+ kObject = 16
+ };
+ SkOpArray* fArray;
+ void* fObject;
+ size_t fReference;
+ int32_t fS32;
+ SkScalar fScalar;
+ SkString* fString;
};
struct SkScriptValue2 {
- enum IsConstant {
- kConstant,
- kVariable
- };
- enum IsWritten {
- kUnwritten,
- kWritten
- };
- SkOperand2 fOperand;
- SkOperand2::OpType fType : 8;
- IsConstant fIsConstant : 8;
- IsWritten fIsWritten : 8;
- SkOpArray* getArray() { SkASSERT(fType == SkOperand2::kArray); return fOperand.fArray; }
- void* getObject() { SkASSERT(fType == SkOperand2::kObject); return fOperand.fObject; }
- int32_t getS32() { SkASSERT(fType == SkOperand2::kS32); return fOperand.fS32; }
- SkScalar getScalar() { SkASSERT(fType == SkOperand2::kScalar); return fOperand.fScalar; }
- SkString* getString() { SkASSERT(fType == SkOperand2::kString); return fOperand.fString; }
+ enum IsConstant {
+ kConstant,
+ kVariable
+ };
+ enum IsWritten {
+ kUnwritten,
+ kWritten
+ };
+ SkOperand2 fOperand;
+ SkOperand2::OpType fType : 8;
+ IsConstant fIsConstant : 8;
+ IsWritten fIsWritten : 8;
+ SkOpArray* getArray() { SkASSERT(fType == SkOperand2::kArray); return fOperand.fArray; }
+ void* getObject() { SkASSERT(fType == SkOperand2::kObject); return fOperand.fObject; }
+ int32_t getS32() { SkASSERT(fType == SkOperand2::kS32); return fOperand.fS32; }
+ SkScalar getScalar() { SkASSERT(fType == SkOperand2::kScalar); return fOperand.fScalar; }
+ SkString* getString() { SkASSERT(fType == SkOperand2::kString); return fOperand.fString; }
bool isConstant() const { return fIsConstant == kConstant; }
};
diff --git a/src/animator/SkOperandIterpolator.cpp b/src/animator/SkOperandIterpolator.cpp
index dcc454d07a..bc7d46be24 100644
--- a/src/animator/SkOperandIterpolator.cpp
+++ b/src/animator/SkOperandIterpolator.cpp
@@ -15,7 +15,7 @@ SkOperandInterpolator::SkOperandInterpolator() {
fType = SkType_Unknown;
}
-SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount,
+SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount,
SkDisplayTypes type)
{
this->reset(elemCount, frameCount, type);
diff --git a/src/animator/SkParseSVGPath.cpp b/src/animator/SkParseSVGPath.cpp
index 1b375aa6f3..f020e2e01a 100644
--- a/src/animator/SkParseSVGPath.cpp
+++ b/src/animator/SkParseSVGPath.cpp
@@ -101,7 +101,7 @@ static const char* find_points(const char str[], SkPoint value[], int count,
return str;
}
-static const char* find_scalar(const char str[], SkScalar* value,
+static const char* find_scalar(const char str[], SkScalar* value,
bool isRelative, SkScalar relative)
{
str = SkParse::FindScalar(str, value);
@@ -146,7 +146,7 @@ void SkDrawPath::parseSVG() {
op = 'L';
c = points[0];
break;
- case 'L':
+ case 'L':
data = find_points(data, points, 1, relative, &c);
fPath.lineTo(points[0]);
c = points[0];
@@ -165,10 +165,10 @@ void SkDrawPath::parseSVG() {
c.fY = y;
}
break;
- case 'C':
+ case 'C':
data = find_points(data, points, 3, relative, &c);
goto cubicCommon;
- case 'S':
+ case 'S':
data = find_points(data, &points[1], 2, relative, &c);
points[0] = c;
if (previousOp == 'C' || previousOp == 'S') {
diff --git a/src/animator/SkPathParts.cpp b/src/animator/SkPathParts.cpp
index 5af8150056..3060bd445f 100644
--- a/src/animator/SkPathParts.cpp
+++ b/src/animator/SkPathParts.cpp
@@ -16,8 +16,8 @@
SkPathPart::SkPathPart() : fPath(NULL) {
}
-void SkPathPart::dirty() {
- fPath->dirty();
+void SkPathPart::dirty() {
+ fPath->dirty();
}
SkDisplayable* SkPathPart::getParent() const {
@@ -86,7 +86,7 @@ SkLineTo::SkLineTo() : x(0), y(0) {
}
bool SkLineTo::add() {
- fPath->fPath.lineTo(x, y);
+ fPath->fPath.lineTo(x, y);
return false;
}
@@ -103,7 +103,7 @@ const SkMemberInfo SkRLineTo::fInfo[] = {
DEFINE_GET_MEMBER(SkRLineTo);
bool SkRLineTo::add() {
- fPath->fPath.rLineTo(x, y);
+ fPath->fPath.rLineTo(x, y);
return false;
}
@@ -225,8 +225,8 @@ const SkMemberInfo SkAddRect::fInfo[] = {
DEFINE_GET_MEMBER(SkAddRect);
-SkAddRect::SkAddRect() {
- fRect.setEmpty();
+SkAddRect::SkAddRect() {
+ fRect.setEmpty();
}
bool SkAddRect::add() {
@@ -309,7 +309,7 @@ SkAddPath::SkAddPath() : matrix(NULL), path(NULL) {
}
bool SkAddPath::add() {
- SkASSERT (path != NULL);
+ SkASSERT (path != NULL);
if (matrix)
fPath->fPath.addPath(path->fPath, matrix->getMatrix());
else
diff --git a/src/animator/SkPostParts.cpp b/src/animator/SkPostParts.cpp
index 4b776a8256..b6549a2890 100644
--- a/src/animator/SkPostParts.cpp
+++ b/src/animator/SkPostParts.cpp
@@ -29,7 +29,7 @@ bool SkDataInput::add() {
fParent->fEvent.setS32(dataName, fInt);
else if (SkScalarIsNaN(fFloat) == false)
fParent->fEvent.setScalar(dataName, fFloat);
- else if (string.size() > 0)
+ else if (string.size() > 0)
fParent->fEvent.setString(dataName, string);
// else
// SkASSERT(0);
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index 3b498fa64b..92e8f3c23e 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -16,7 +16,7 @@
/* things to do
? re-enable support for struct literals (e.g., for initializing points or rects)
{x:1, y:2}
- ? use standard XML / script notation like document.getElementById("canvas");
+ ? use standard XML / script notation like document.getElementById("canvas");
finish support for typed arrays
? allow indexing arrays by string
this could map to the 'name' attribute of a given child of an array
@@ -224,7 +224,7 @@ int SkScriptEngine::arithmeticOp(char ch, char nextChar, bool lastPush) {
if (nextChar == '>') {
op = kShiftRight;
goto twoChar;
- }
+ }
op = kGreaterEqual;
if (nextChar == '=')
goto twoChar;
@@ -253,7 +253,7 @@ int SkScriptEngine::arithmeticOp(char ch, char nextChar, bool lastPush) {
twoChar:
advance++;
break;
- }
+ }
op = kLogicalNot;
break;
case '?':
@@ -298,7 +298,7 @@ twoChar:
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || (topPrecedence == precedence &&
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
gOpAttributes[op].fLeftType == kNoType)) {
break;
}
@@ -327,7 +327,7 @@ void SkScriptEngine::commonCallBack(CallBackType type, UserCallBack& callBack, v
*fUserCallBacks.prepend() = callBack;
}
-bool SkScriptEngine::convertParams(SkTDArray<SkScriptValue>& params,
+bool SkScriptEngine::convertParams(SkTDArray<SkScriptValue>& params,
const SkFunctionParamType* paramTypes, int paramCount) {
if (params.count() > paramCount) {
fError = kTooManyParameters;
@@ -366,7 +366,7 @@ bool SkScriptEngine::convertTo(SkDisplayTypes toType, SkScriptValue* value ) {
return ConvertTo(this, toType, value);
}
-bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
+bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
size_t fieldLength = token_length(++script); // skip dot
if (fieldLength == 0) {
fError = kExpectedFieldName;
@@ -382,8 +382,8 @@ bool SkScriptEngine::evaluateDot(const char*& script, bool suppressed) {
return evaluateDotParam(script, suppressed, field, fieldLength);
}
-bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
- const char* field, size_t fieldLength) {
+bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
+ const char* field, size_t fieldLength) {
void* object;
if (suppressed)
object = NULL;
@@ -397,7 +397,7 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
fOperandStack.pop();
}
char ch; // see if it is a simple member or a function
- while (is_ws(ch = script[0]))
+ while (is_ws(ch = script[0]))
script++;
bool success = true;
if (ch != '(') {
@@ -410,10 +410,10 @@ bool SkScriptEngine::evaluateDotParam(const char*& script, bool suppressed,
*fBraceStack.push() = kFunctionBrace;
success = functionParams(&script, params);
if (success && suppressed == false &&
- (success = handleMemberFunction(field, fieldLength, object, params)) == false)
- fError = kHandleMemberFunctionFailed;
+ (success = handleMemberFunction(field, fieldLength, object, params)) == false)
+ fError = kHandleMemberFunctionFailed;
}
- return success;
+ return success;
}
bool SkScriptEngine::evaluateScript(const char** scriptPtr, SkScriptValue* value) {
@@ -559,15 +559,15 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
if (convertTo(tokenInfo->getType(), &tokenValue) == false)
return false;
}
- tokenInfo->writeValue(fDisplayable, NULL, 0, 0,
+ tokenInfo->writeValue(fDisplayable, NULL, 0, 0,
(void*) ((char*) fInfo->memberData(fDisplayable) + tokenInfo->fOffset + fArrayOffset),
tokenInfo->getType(), tokenValue);
}
}
lastPush = false;
continue;
- } else
-#endif
+ } else
+#endif
if (fBraceStack.top() == kArrayBrace) {
SkScriptValue tokenValue;
success = innerScript(&script, &tokenValue); // terminate and return on comma, close brace
@@ -579,12 +579,12 @@ bool SkScriptEngine::innerScript(const char** scriptPtr, SkScriptValue* value) {
#if 0 // no support for structures for now
if (tokenValue.fType == SkType_Structure) {
fArrayOffset += (int) fInfo->getSize(fDisplayable);
- } else
+ } else
#endif
{
SkDisplayTypes type = ToDisplayType(fReturnType);
if (fReturnType == kNoType) {
- // !!! short sighted; in the future, allow each returned array component to carry
+ // !!! short sighted; in the future, allow each returned array component to carry
// its own type, and let caller do any needed conversions
if (value->fOperand.fArray->count() == 0)
value->fOperand.fArray->setType(type = tokenValue.fType);
@@ -730,11 +730,11 @@ scalarCommon:
if (success == false)
return false;
lastPush = true;
- continue;
+ continue;
}
// get next token, and evaluate immediately
success = evaluateDot(script, SkToBool(suppressed));
- if (success == false)
+ if (success == false)
return false;
lastPush = true;
continue;
@@ -772,7 +772,7 @@ scalarCommon:
}
#endif
if (ch == ')' && fBraceStack.count() > 0) {
- SkBraceStyle braceStyle = fBraceStack.top();
+ SkBraceStyle braceStyle = fBraceStack.top();
if (braceStyle == kFunctionBrace) {
fBraceStack.pop();
break;
@@ -795,7 +795,7 @@ scalarCommon:
int advance = logicalOp(ch, nextChar);
if (advance < 0) // error
return false;
- if (advance == 0)
+ if (advance == 0)
advance = arithmeticOp(ch, nextChar, lastPush);
if (advance == 0) // unknown token
return false;
@@ -814,7 +814,7 @@ scalarCommon:
return false;
if (processOp() == false)
return false;
- }
+ }
SkOpType topType = fTypeStack.count() > 0 ? fTypeStack.top() : kNoType;
if (suppressed == false && topType != fReturnType &&
topType == kString && fReturnType != kNoType) { // if result is a string, give handle property a chance to convert it to the property value
@@ -945,7 +945,7 @@ bool SkScriptEngine::handleFunction(const char** scriptPtr, bool suppressed) {
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kFunction)
continue;
- success = (*callBack->fFunctionCallBack)(functionName.c_str(), functionName.size(), params,
+ success = (*callBack->fFunctionCallBack)(functionName.c_str(), functionName.size(), params,
callBack->fUserStorage, &callbackResult);
if (success) {
fOperandStack.push(callbackResult.fOperand);
@@ -986,7 +986,7 @@ bool SkScriptEngine::handleMemberFunction(const char* field, size_t len, void* o
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kMemberFunction)
continue;
- success = (*callBack->fMemberFunctionCallBack)(field, len, object, params,
+ success = (*callBack->fMemberFunctionCallBack)(field, len, object, params,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String)
@@ -1008,7 +1008,7 @@ bool SkScriptEngine::handleObjectToString(void* object) {
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kObjectToString)
continue;
- success = (*callBack->fObjectToStringCallBack)(object,
+ success = (*callBack->fObjectToStringCallBack)(object,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String)
@@ -1027,14 +1027,14 @@ done:
bool SkScriptEngine::handleProperty(bool suppressed) {
SkScriptValue callbackResult;
bool success = true;
- if (suppressed)
+ if (suppressed)
goto done;
success = false; // note that with standard animator-script plugins, callback never returns false
{
for (UserCallBack* callBack = fUserCallBacks.begin(); callBack < fUserCallBacks.end(); callBack++) {
if (callBack->fCallBackType != kProperty)
continue;
- success = (*callBack->fPropertyCallBack)(fToken, fTokenLength,
+ success = (*callBack->fPropertyCallBack)(fToken, fTokenLength,
callBack->fUserStorage, &callbackResult);
if (success) {
if (callbackResult.fType == SkType_String && callbackResult.fOperand.fString == NULL) {
@@ -1146,7 +1146,7 @@ noMatch:
fError = kMismatchedBrackets;
return -1;
}
- if (match == kParen)
+ if (match == kParen)
fOpStack.pop();
else {
SkOpType indexType;
@@ -1157,7 +1157,7 @@ noMatch:
}
SkOperand indexOperand;
fOperandStack.pop(&indexOperand);
- int index = indexType == kScalar ? SkScalarFloor(indexOperand.fScalar) :
+ int index = indexType == kScalar ? SkScalarFloor(indexOperand.fScalar) :
indexOperand.fS32;
SkOpType arrayType;
fTypeStack.pop(&arrayType);
@@ -1192,7 +1192,7 @@ noMatch:
}
suppress.fSuppress = ifValue.fOperand.fS32 == 0;
suppress.fOperator = kIf;
- suppress.fOpStackDepth = fOpStack.count();
+ suppress.fOpStackDepth = fOpStack.count();
suppress.fElse = false;
fSuppressStack.push(suppress);
// if left is true, do only up to colon
@@ -1218,7 +1218,7 @@ flipSuppress:
if (match == kLogicalOr ? topInt != 0 : topInt == 0) {
suppress.fSuppress = true;
suppress.fOperator = match;
- suppress.fOpStackDepth = fOpStack.count();
+ suppress.fOpStackDepth = fOpStack.count();
suppress.fElse = false;
fSuppressStack.push(suppress);
} else {
@@ -1467,16 +1467,16 @@ void SkScriptEngine::propertyCallBack(_propertyCallBack prop, void* userStorage)
commonCallBack(kProperty, callBack, userStorage);
}
-void SkScriptEngine::track(SkTypedArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *(fTrackArray.end() - 1) = array;
- fTrackArray.appendClear();
+void SkScriptEngine::track(SkTypedArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *(fTrackArray.end() - 1) = array;
+ fTrackArray.appendClear();
}
-void SkScriptEngine::track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *(fTrackString.end() - 1) = string;
- fTrackString.appendClear();
+void SkScriptEngine::track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *(fTrackString.end() - 1) = string;
+ fTrackString.appendClear();
}
void SkScriptEngine::unboxCallBack(_unboxCallBack func, void* userStorage) {
@@ -1494,7 +1494,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
if (toType == SkType_Drawable)
toType = SkType_Displayable;
SkDisplayTypes type = value->fType;
- if (type == toType)
+ if (type == toType)
return true;
SkOperand& operand = value->fOperand;
bool success = true;
@@ -1534,7 +1534,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
engine->track(strPtr);
if (type == SkType_Int)
strPtr->appendS32(operand.fS32);
- else if (type == SkType_Displayable)
+ else if (type == SkType_Displayable)
SkASSERT(0); // must call through instance version instead of static version
else {
if (type != SkType_Float) {
@@ -1665,17 +1665,17 @@ static const SkScriptNAnswer scriptTests[] = {
testInt((6+7)*8),
testInt(0&&1?2:3),
testInt(3*(4+5)),
- testScalar(1.0+2.0),
- testScalar(1.0+5),
- testScalar(3.0-1.0),
- testScalar(6-1.0),
- testScalar(- -5.5- -1.5),
- testScalar(2.5*6.),
- testScalar(0.5*4),
- testScalar(4.5/.5),
- testScalar(9.5/19),
- testRemainder(9.5, 0.5),
- testRemainder(9.,2),
+ testScalar(1.0+2.0),
+ testScalar(1.0+5),
+ testScalar(3.0-1.0),
+ testScalar(6-1.0),
+ testScalar(- -5.5- -1.5),
+ testScalar(2.5*6.),
+ testScalar(0.5*4),
+ testScalar(4.5/.5),
+ testScalar(9.5/19),
+ testRemainder(9.5, 0.5),
+ testRemainder(9.,2),
testRemainder(9,2.5),
testRemainder(-9,2.5),
testTrue(-9==-9.0),
@@ -1854,7 +1854,7 @@ static const SkScriptNAnswer scriptTests[] = {
testInt(0?2?3:4:5),
testInt(1?0?3:4:5),
testInt(0?0?3:4:5),
-
+
testInt(1?2:(3?4:5)),
testInt(0?2:(3?4:5)),
testInt(1?0:(3?4:5)),
diff --git a/src/animator/SkScript.h b/src/animator/SkScript.h
index 95930e81c8..aa8d9a30c8 100644
--- a/src/animator/SkScript.h
+++ b/src/animator/SkScript.h
@@ -63,9 +63,9 @@ public:
typedef bool (*_boxCallBack)(void* userStorage, SkScriptValue* result);
typedef bool (*_functionCallBack)(const char* func, size_t len, SkTDArray<SkScriptValue>& params,
void* userStorage, SkScriptValue* result);
- typedef bool (*_memberCallBack)(const char* member, size_t len, void* object,
+ typedef bool (*_memberCallBack)(const char* member, size_t len, void* object,
void* userStorage, SkScriptValue* result);
- typedef bool (*_memberFunctionCallBack)(const char* member, size_t len, void* object,
+ typedef bool (*_memberFunctionCallBack)(const char* member, size_t len, void* object,
SkTDArray<SkScriptValue>& params, void* userStorage, SkScriptValue* result);
// typedef bool (*_objectToStringCallBack)(void* object, void* userStorage, SkScriptValue* result);
typedef bool (*_propertyCallBack)(const char* prop, size_t len, void* userStorage, SkScriptValue* result);
@@ -169,7 +169,7 @@ public:
kTowardsNumber = 0,
kTowardsString
};
-
+
protected:
struct SkOperatorAttributes {
diff --git a/src/animator/SkScript2.h b/src/animator/SkScript2.h
index 05073e4a72..03eb92cd14 100644
--- a/src/animator/SkScript2.h
+++ b/src/animator/SkScript2.h
@@ -15,274 +15,274 @@
#include "SkTDict.h"
#include "SkTDStack.h"
-typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
class SkAnimateMaker;
class SkScriptCallBack;
class SkScriptEngine2 {
public:
- enum Error {
- kNoError,
- kArrayIndexOutOfBounds,
- kCouldNotFindReferencedID,
- kFunctionCallFailed,
- kMemberOpFailed,
- kPropertyOpFailed
- };
+ enum Error {
+ kNoError,
+ kArrayIndexOutOfBounds,
+ kCouldNotFindReferencedID,
+ kFunctionCallFailed,
+ kMemberOpFailed,
+ kPropertyOpFailed
+ };
- enum Attrs {
- kConstant,
- kVariable
- };
+ enum Attrs {
+ kConstant,
+ kVariable
+ };
- SkScriptEngine2(SkOperand2::OpType returnType);
- ~SkScriptEngine2();
- bool convertTo(SkOperand2::OpType , SkScriptValue2* );
- bool evaluateScript(const char** script, SkScriptValue2* value);
- void forget(SkOpArray* array);
- Error getError() { return fError; }
- SkOperand2::OpType getReturnType() { return fReturnType; }
- void track(SkOpArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *fTrackArray.append() = array; }
- void track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *fTrackString.append() = string;
- }
- static bool ConvertTo(SkScriptEngine2* , SkOperand2::OpType toType, SkScriptValue2* value);
- static SkScalar IntToScalar(int32_t );
- static bool ValueToString(const SkScriptValue2& value, SkString* string);
+ SkScriptEngine2(SkOperand2::OpType returnType);
+ ~SkScriptEngine2();
+ bool convertTo(SkOperand2::OpType , SkScriptValue2* );
+ bool evaluateScript(const char** script, SkScriptValue2* value);
+ void forget(SkOpArray* array);
+ Error getError() { return fError; }
+ SkOperand2::OpType getReturnType() { return fReturnType; }
+ void track(SkOpArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *fTrackArray.append() = array; }
+ void track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *fTrackString.append() = string;
+ }
+ static bool ConvertTo(SkScriptEngine2* , SkOperand2::OpType toType, SkScriptValue2* value);
+ static SkScalar IntToScalar(int32_t );
+ static bool ValueToString(const SkScriptValue2& value, SkString* string);
- enum Op { // used by tokenizer attribute table
- kUnassigned,
- kAdd,
- kBitAnd,
- kBitNot,
- kBitOr,
- kDivide,
- kEqual,
- kFlipOps,
- kGreaterEqual,
- kLogicalAnd,
- kLogicalNot,
- kLogicalOr,
- kMinus,
- kModulo,
- kMultiply,
- kShiftLeft,
- kShiftRight, // signed
- kSubtract,
- kXor,
+ enum Op { // used by tokenizer attribute table
+ kUnassigned,
+ kAdd,
+ kBitAnd,
+ kBitNot,
+ kBitOr,
+ kDivide,
+ kEqual,
+ kFlipOps,
+ kGreaterEqual,
+ kLogicalAnd,
+ kLogicalNot,
+ kLogicalOr,
+ kMinus,
+ kModulo,
+ kMultiply,
+ kShiftLeft,
+ kShiftRight, // signed
+ kSubtract,
+ kXor,
// following not in attribute table
- kArrayOp,
- kElse,
- kIf,
- kParen,
- kLastLogicalOp,
- kArtificialOp = 0x20
- };
+ kArrayOp,
+ kElse,
+ kIf,
+ kParen,
+ kLastLogicalOp,
+ kArtificialOp = 0x20
+ };
- enum TypeOp { // generated by tokenizer
- kNop, // should never get generated
- kAccumulatorPop,
- kAccumulatorPush,
- kAddInt,
- kAddScalar,
- kAddString, // string concat
- kArrayIndex,
- kArrayParam,
- kArrayToken,
- kBitAndInt,
- kBitNotInt,
- kBitOrInt,
- kBoxToken,
- kCallback,
- kDivideInt,
- kDivideScalar,
- kDotOperator,
- kElseOp,
- kEnd,
- kEqualInt,
- kEqualScalar,
- kEqualString,
- kFunctionCall,
- kFlipOpsOp,
- kFunctionToken,
- kGreaterEqualInt,
- kGreaterEqualScalar,
- kGreaterEqualString,
- kIfOp,
- kIntToScalar,
- kIntToScalar2,
- kIntToString,
- kIntToString2,
- kIntegerAccumulator,
- kIntegerOperand,
- kLogicalAndInt,
- kLogicalNotInt,
- kLogicalOrInt,
- kMemberOp,
- kMinusInt,
- kMinusScalar,
- kModuloInt,
- kModuloScalar,
- kMultiplyInt,
- kMultiplyScalar,
- kPropertyOp,
- kScalarAccumulator,
- kScalarOperand,
- kScalarToInt,
- kScalarToInt2,
- kScalarToString,
- kScalarToString2,
- kShiftLeftInt,
- kShiftRightInt, // signed
- kStringAccumulator,
- kStringOperand,
- kStringToInt,
- kStringToScalar,
- kStringToScalar2,
- kStringTrack,
- kSubtractInt,
- kSubtractScalar,
- kToBool,
- kUnboxToken,
- kUnboxToken2,
- kXorInt,
- kLastTypeOp
- };
+ enum TypeOp { // generated by tokenizer
+ kNop, // should never get generated
+ kAccumulatorPop,
+ kAccumulatorPush,
+ kAddInt,
+ kAddScalar,
+ kAddString, // string concat
+ kArrayIndex,
+ kArrayParam,
+ kArrayToken,
+ kBitAndInt,
+ kBitNotInt,
+ kBitOrInt,
+ kBoxToken,
+ kCallback,
+ kDivideInt,
+ kDivideScalar,
+ kDotOperator,
+ kElseOp,
+ kEnd,
+ kEqualInt,
+ kEqualScalar,
+ kEqualString,
+ kFunctionCall,
+ kFlipOpsOp,
+ kFunctionToken,
+ kGreaterEqualInt,
+ kGreaterEqualScalar,
+ kGreaterEqualString,
+ kIfOp,
+ kIntToScalar,
+ kIntToScalar2,
+ kIntToString,
+ kIntToString2,
+ kIntegerAccumulator,
+ kIntegerOperand,
+ kLogicalAndInt,
+ kLogicalNotInt,
+ kLogicalOrInt,
+ kMemberOp,
+ kMinusInt,
+ kMinusScalar,
+ kModuloInt,
+ kModuloScalar,
+ kMultiplyInt,
+ kMultiplyScalar,
+ kPropertyOp,
+ kScalarAccumulator,
+ kScalarOperand,
+ kScalarToInt,
+ kScalarToInt2,
+ kScalarToString,
+ kScalarToString2,
+ kShiftLeftInt,
+ kShiftRightInt, // signed
+ kStringAccumulator,
+ kStringOperand,
+ kStringToInt,
+ kStringToScalar,
+ kStringToScalar2,
+ kStringTrack,
+ kSubtractInt,
+ kSubtractScalar,
+ kToBool,
+ kUnboxToken,
+ kUnboxToken2,
+ kXorInt,
+ kLastTypeOp
+ };
- enum OpBias {
- kNoBias,
- kTowardsNumber = 0,
- kTowardsString
- };
+ enum OpBias {
+ kNoBias,
+ kTowardsNumber = 0,
+ kTowardsString
+ };
protected:
- enum BraceStyle {
- // kStructBrace,
- kArrayBrace,
- kFunctionBrace
- };
+ enum BraceStyle {
+ // kStructBrace,
+ kArrayBrace,
+ kFunctionBrace
+ };
- enum AddTokenRegister {
- kAccumulator,
- kOperand
- };
-
- enum ResultIsBoolean {
- kResultIsNotBoolean,
- kResultIsBoolean
- };
+ enum AddTokenRegister {
+ kAccumulator,
+ kOperand
+ };
- struct OperatorAttributes {
- unsigned int fLeftType : 3; // SkOpType union, but only lower values
- unsigned int fRightType : 3; // SkOpType union, but only lower values
- OpBias fBias : 1;
- ResultIsBoolean fResultIsBoolean : 1;
- };
-
- struct Branch {
- Branch() {
- }
-
- Branch(Op op, int depth, unsigned offset) : fOffset(offset), fOpStackDepth(depth), fOperator(op),
- fPrimed(kIsNotPrimed), fDone(kIsNotDone) {
- }
+ enum ResultIsBoolean {
+ kResultIsNotBoolean,
+ kResultIsBoolean
+ };
- enum Primed {
- kIsNotPrimed,
- kIsPrimed
- };
+ struct OperatorAttributes {
+ unsigned int fLeftType : 3; // SkOpType union, but only lower values
+ unsigned int fRightType : 3; // SkOpType union, but only lower values
+ OpBias fBias : 1;
+ ResultIsBoolean fResultIsBoolean : 1;
+ };
- enum Done {
- kIsNotDone,
- kIsDone,
- };
+ struct Branch {
+ Branch() {
+ }
- unsigned fOffset : 16; // offset in generated stream where branch needs to go
- int fOpStackDepth : 7; // depth when operator was found
- Op fOperator : 6; // operand which generated branch
- mutable Primed fPrimed : 1; // mark when next instruction generates branch
- Done fDone : 1; // mark when branch is complete
- void prime() { fPrimed = kIsPrimed; }
- void resolve(SkDynamicMemoryWStream* , size_t offset);
- };
+ Branch(Op op, int depth, unsigned offset) : fOffset(offset), fOpStackDepth(depth), fOperator(op),
+ fPrimed(kIsNotPrimed), fDone(kIsNotDone) {
+ }
- static const OperatorAttributes gOpAttributes[];
- static const signed char gPrecedence[];
- static const TypeOp gTokens[];
- void addToken(TypeOp );
- void addTokenConst(SkScriptValue2* , AddTokenRegister , SkOperand2::OpType , TypeOp );
- void addTokenInt(int );
- void addTokenScalar(SkScalar );
- void addTokenString(const SkString& );
- void addTokenValue(const SkScriptValue2& , AddTokenRegister );
- int arithmeticOp(char ch, char nextChar, bool lastPush);
- bool convertParams(SkTDArray<SkScriptValue2>* ,
- const SkOperand2::OpType* paramTypes, int paramTypeCount);
- void convertToString(SkOperand2* operand, SkOperand2::OpType type) {
- SkScriptValue2 scriptValue;
- scriptValue.fOperand = *operand;
- scriptValue.fType = type;
- convertTo(SkOperand2::kString, &scriptValue);
- *operand = scriptValue.fOperand;
- }
- bool evaluateDot(const char*& script);
- bool evaluateDotParam(const char*& script, const char* field, size_t fieldLength);
- bool functionParams(const char** scriptPtr, SkTDArray<SkScriptValue2>* params);
- size_t getTokenOffset();
- SkOperand2::OpType getUnboxType(SkOperand2 scriptValue);
- bool handleArrayIndexer(const char** scriptPtr);
- bool handleFunction(const char** scriptPtr);
- bool handleMember(const char* field, size_t len, void* object);
- bool handleMemberFunction(const char* field, size_t len, void* object,
- SkTDArray<SkScriptValue2>* params);
- bool handleProperty();
- bool handleUnbox(SkScriptValue2* scriptValue);
- bool innerScript(const char** scriptPtr, SkScriptValue2* value);
- int logicalOp(char ch, char nextChar);
- void processLogicalOp(Op op);
- bool processOp();
- void resolveBranch(Branch& );
-// void setAnimateMaker(SkAnimateMaker* maker) { fMaker = maker; }
- SkDynamicMemoryWStream fStream;
- SkDynamicMemoryWStream* fActiveStream;
- SkTDStack<BraceStyle> fBraceStack; // curly, square, function paren
- SkTDStack<Branch> fBranchStack; // logical operators, slot to store forward branch
- SkLongArray(SkScriptCallBack*) fCallBackArray;
- SkTDStack<Op> fOpStack;
- SkTDStack<SkScriptValue2> fValueStack;
-// SkAnimateMaker* fMaker;
- SkLongArray(SkOpArray*) fTrackArray;
- SkTDStringArray fTrackString;
- const char* fToken; // one-deep stack
- size_t fTokenLength;
- SkOperand2::OpType fReturnType;
- Error fError;
- SkOperand2::OpType fAccumulatorType; // tracking for code generation
- SkBool fBranchPopAllowed;
- SkBool fConstExpression;
- SkBool fOperandInUse;
+ enum Primed {
+ kIsNotPrimed,
+ kIsPrimed
+ };
+
+ enum Done {
+ kIsNotDone,
+ kIsDone,
+ };
+
+ unsigned fOffset : 16; // offset in generated stream where branch needs to go
+ int fOpStackDepth : 7; // depth when operator was found
+ Op fOperator : 6; // operand which generated branch
+ mutable Primed fPrimed : 1; // mark when next instruction generates branch
+ Done fDone : 1; // mark when branch is complete
+ void prime() { fPrimed = kIsPrimed; }
+ void resolve(SkDynamicMemoryWStream* , size_t offset);
+ };
+
+ static const OperatorAttributes gOpAttributes[];
+ static const signed char gPrecedence[];
+ static const TypeOp gTokens[];
+ void addToken(TypeOp );
+ void addTokenConst(SkScriptValue2* , AddTokenRegister , SkOperand2::OpType , TypeOp );
+ void addTokenInt(int );
+ void addTokenScalar(SkScalar );
+ void addTokenString(const SkString& );
+ void addTokenValue(const SkScriptValue2& , AddTokenRegister );
+ int arithmeticOp(char ch, char nextChar, bool lastPush);
+ bool convertParams(SkTDArray<SkScriptValue2>* ,
+ const SkOperand2::OpType* paramTypes, int paramTypeCount);
+ void convertToString(SkOperand2* operand, SkOperand2::OpType type) {
+ SkScriptValue2 scriptValue;
+ scriptValue.fOperand = *operand;
+ scriptValue.fType = type;
+ convertTo(SkOperand2::kString, &scriptValue);
+ *operand = scriptValue.fOperand;
+ }
+ bool evaluateDot(const char*& script);
+ bool evaluateDotParam(const char*& script, const char* field, size_t fieldLength);
+ bool functionParams(const char** scriptPtr, SkTDArray<SkScriptValue2>* params);
+ size_t getTokenOffset();
+ SkOperand2::OpType getUnboxType(SkOperand2 scriptValue);
+ bool handleArrayIndexer(const char** scriptPtr);
+ bool handleFunction(const char** scriptPtr);
+ bool handleMember(const char* field, size_t len, void* object);
+ bool handleMemberFunction(const char* field, size_t len, void* object,
+ SkTDArray<SkScriptValue2>* params);
+ bool handleProperty();
+ bool handleUnbox(SkScriptValue2* scriptValue);
+ bool innerScript(const char** scriptPtr, SkScriptValue2* value);
+ int logicalOp(char ch, char nextChar);
+ void processLogicalOp(Op op);
+ bool processOp();
+ void resolveBranch(Branch& );
+// void setAnimateMaker(SkAnimateMaker* maker) { fMaker = maker; }
+ SkDynamicMemoryWStream fStream;
+ SkDynamicMemoryWStream* fActiveStream;
+ SkTDStack<BraceStyle> fBraceStack; // curly, square, function paren
+ SkTDStack<Branch> fBranchStack; // logical operators, slot to store forward branch
+ SkLongArray(SkScriptCallBack*) fCallBackArray;
+ SkTDStack<Op> fOpStack;
+ SkTDStack<SkScriptValue2> fValueStack;
+// SkAnimateMaker* fMaker;
+ SkLongArray(SkOpArray*) fTrackArray;
+ SkTDStringArray fTrackString;
+ const char* fToken; // one-deep stack
+ size_t fTokenLength;
+ SkOperand2::OpType fReturnType;
+ Error fError;
+ SkOperand2::OpType fAccumulatorType; // tracking for code generation
+ SkBool fBranchPopAllowed;
+ SkBool fConstExpression;
+ SkBool fOperandInUse;
private:
#ifdef SK_DEBUG
public:
- void decompile(const unsigned char* , size_t );
- static void UnitTest();
- static void ValidateDecompileTable();
+ void decompile(const unsigned char* , size_t );
+ static void UnitTest();
+ static void ValidateDecompileTable();
#endif
};
#ifdef SK_DEBUG
struct SkScriptNAnswer2 {
- const char* fScript;
- SkOperand2::OpType fType;
- int32_t fIntAnswer;
- SkScalar fScalarAnswer;
- const char* fStringAnswer;
+ const char* fScript;
+ SkOperand2::OpType fType;
+ int32_t fIntAnswer;
+ SkScalar fScalarAnswer;
+ const char* fStringAnswer;
};
#endif
diff --git a/src/animator/SkScriptCallBack.h b/src/animator/SkScriptCallBack.h
index b2a1958517..dcbaf11886 100644
--- a/src/animator/SkScriptCallBack.h
+++ b/src/animator/SkScriptCallBack.h
@@ -13,53 +13,53 @@
class SkScriptCallBack {
public:
- enum Type {
- kBox,
- kFunction,
- kMember,
- kMemberFunction,
- kProperty,
- kUnbox
- };
+ enum Type {
+ kBox,
+ kFunction,
+ kMember,
+ kMemberFunction,
+ kProperty,
+ kUnbox
+ };
- virtual bool getReference(const char* , size_t len, SkScriptValue2* result) { return false; }
- virtual SkOperand2::OpType getReturnType(size_t ref, SkOperand2*) {
- return SkOperand2::kS32; }
- virtual Type getType() const = 0;
+ virtual bool getReference(const char* , size_t len, SkScriptValue2* result) { return false; }
+ virtual SkOperand2::OpType getReturnType(size_t ref, SkOperand2*) {
+ return SkOperand2::kS32; }
+ virtual Type getType() const = 0;
};
class SkScriptCallBackConvert : public SkScriptCallBack {
public:
- virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) = 0;
+ virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) = 0;
};
class SkScriptCallBackFunction : public SkScriptCallBack {
public:
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
- virtual Type getType() const { return kFunction; }
- virtual bool invoke(size_t ref, SkOpArray* params, SkOperand2* value) = 0;
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
+ virtual Type getType() const { return kFunction; }
+ virtual bool invoke(size_t ref, SkOpArray* params, SkOperand2* value) = 0;
};
class SkScriptCallBackMember: public SkScriptCallBack {
public:
- bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
- virtual Type getType() const { return kMember; }
- virtual bool invoke(size_t ref, void* object, SkOperand2* value) = 0;
+ bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
+ virtual Type getType() const { return kMember; }
+ virtual bool invoke(size_t ref, void* object, SkOperand2* value) = 0;
};
class SkScriptCallBackMemberFunction : public SkScriptCallBack {
public:
- bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
- virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
- virtual Type getType() const { return kMemberFunction; }
- virtual bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value) = 0;
+ bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
+ virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
+ virtual Type getType() const { return kMemberFunction; }
+ virtual bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value) = 0;
};
class SkScriptCallBackProperty : public SkScriptCallBack {
public:
- virtual bool getConstValue(const char* name, size_t len, SkOperand2* value) { return false; }
- virtual bool getResult(size_t ref, SkOperand2* answer) { return false; }
- virtual Type getType() const { return kProperty; }
+ virtual bool getConstValue(const char* name, size_t len, SkOperand2* value) { return false; }
+ virtual bool getResult(size_t ref, SkOperand2* answer) { return false; }
+ virtual Type getType() const { return kProperty; }
};
#endif // SkScriptCallBack_DEFINED
diff --git a/src/animator/SkScriptDecompile.cpp b/src/animator/SkScriptDecompile.cpp
index 26b678c79d..995da874cb 100644
--- a/src/animator/SkScriptDecompile.cpp
+++ b/src/animator/SkScriptDecompile.cpp
@@ -99,7 +99,7 @@ static const struct OperName {
OperandName(kString),
OperandName(kArray),
OperandName(kObject)
-};
+};
static size_t gOperandNamesSize = sizeof(gOperandNames) / sizeof(gOperandNames[0]);
@@ -135,7 +135,7 @@ void SkScriptEngine2::decompile(const unsigned char* start, size_t length) {
opCode += sizeof(index);
SkDebugf(" index: %d", index);
} break;
- case SkScriptEngine2::kFunctionCall:
+ case SkScriptEngine2::kFunctionCall:
case SkScriptEngine2::kMemberOp:
case SkScriptEngine2::kPropertyOp: {
size_t ref;
diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp
index 6a96633ba1..b211a71c12 100644
--- a/src/animator/SkScriptRuntime.cpp
+++ b/src/animator/SkScriptRuntime.cpp
@@ -27,326 +27,326 @@
// replace script string with script tokens preceeded by special value
// need second version of script plugins that return private index of found value?
- // then would need in script index of plugin, private index
+ // then would need in script index of plugin, private index
// encode brace stack push/pop as opcodes
// should token script enocde type where possible?
// current flow:
- // strip whitespace
- // if in array brace [ recurse, continue
- // if token, handle function, or array, or property (continue)
- // parse number, continue
- // parse token, continue
- // parse string literal, continue
- // if dot operator, handle dot, continue
- // if [ , handle array literal or accessor, continue
- // if ), pop (if function, break)
- // if ], pop ; if ',' break
- // handle logical ops
- // or, handle arithmetic ops
- // loop
+ // strip whitespace
+ // if in array brace [ recurse, continue
+ // if token, handle function, or array, or property (continue)
+ // parse number, continue
+ // parse token, continue
+ // parse string literal, continue
+ // if dot operator, handle dot, continue
+ // if [ , handle array literal or accessor, continue
+ // if ), pop (if function, break)
+ // if ], pop ; if ',' break
+ // handle logical ops
+ // or, handle arithmetic ops
+ // loop
// !!! things to do
- // add separate processing loop to advance while suppressed
- // or, include jump offset to skip suppressed code?
+ // add separate processing loop to advance while suppressed
+ // or, include jump offset to skip suppressed code?
SkScriptRuntime::~SkScriptRuntime() {
- for (SkString** stringPtr = fTrackString.begin(); stringPtr < fTrackString.end(); stringPtr++)
- delete *stringPtr;
- for (SkOpArray** arrayPtr = fTrackArray.begin(); arrayPtr < fTrackArray.end(); arrayPtr++)
- delete *arrayPtr;
+ for (SkString** stringPtr = fTrackString.begin(); stringPtr < fTrackString.end(); stringPtr++)
+ delete *stringPtr;
+ for (SkOpArray** arrayPtr = fTrackArray.begin(); arrayPtr < fTrackArray.end(); arrayPtr++)
+ delete *arrayPtr;
}
bool SkScriptRuntime::executeTokens(unsigned char* opCode) {
- SkOperand2 operand[2]; // 1=accumulator and 2=operand
- SkScriptEngine2::TypeOp op;
- size_t ref;
- int index, size;
- int registerLoad;
- SkScriptCallBack* callBack SK_INIT_TO_AVOID_WARNING;
- do {
- switch ((op = (SkScriptEngine2::TypeOp) *opCode++)) {
- case SkScriptEngine2::kArrayToken: // create an array
- operand[0].fArray = new SkOpArray(SkOperand2::kNoType /*fReturnType*/);
- break;
- case SkScriptEngine2::kArrayIndex: // array accessor
- index = operand[1].fS32;
- if (index >= operand[0].fArray->count()) {
- fError = kArrayIndexOutOfBounds;
- return false;
- }
- operand[0] = operand[0].fArray->begin()[index];
- break;
- case SkScriptEngine2::kArrayParam: // array initializer, or function param
- *operand[0].fArray->append() = operand[1];
- break;
- case SkScriptEngine2::kCallback:
- memcpy(&index, opCode, sizeof(index));
- opCode += sizeof(index);
- callBack = fCallBackArray[index];
- break;
- case SkScriptEngine2::kFunctionCall: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackFunction* callBackFunction = (SkScriptCallBackFunction*) callBack;
- if (callBackFunction->invoke(ref, operand[0].fArray, /* params */
- &operand[0] /* result */) == false) {
- fError = kFunctionCallFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kMemberOp: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackMember* callBackMember = (SkScriptCallBackMember*) callBack;
- if (callBackMember->invoke(ref, operand[0].fObject, &operand[0]) == false) {
- fError = kMemberOpFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kPropertyOp: {
- memcpy(&ref, opCode, sizeof(ref));
- opCode += sizeof(ref);
- SkScriptCallBackProperty* callBackProperty = (SkScriptCallBackProperty*) callBack;
- if (callBackProperty->getResult(ref, &operand[0])== false) {
- fError = kPropertyOpFailed;
- return false;
- }
- } break;
- case SkScriptEngine2::kAccumulatorPop:
- fRunStack.pop(&operand[0]);
- break;
- case SkScriptEngine2::kAccumulatorPush:
- *fRunStack.push() = operand[0];
- break;
- case SkScriptEngine2::kIntegerAccumulator:
- case SkScriptEngine2::kIntegerOperand:
- registerLoad = op - SkScriptEngine2::kIntegerAccumulator;
- memcpy(&operand[registerLoad].fS32, opCode, sizeof(int32_t));
- opCode += sizeof(int32_t);
- break;
- case SkScriptEngine2::kScalarAccumulator:
- case SkScriptEngine2::kScalarOperand:
- registerLoad = op - SkScriptEngine2::kScalarAccumulator;
- memcpy(&operand[registerLoad].fScalar, opCode, sizeof(SkScalar));
- opCode += sizeof(SkScalar);
- break;
- case SkScriptEngine2::kStringAccumulator:
- case SkScriptEngine2::kStringOperand: {
- SkString* strPtr = new SkString();
- track(strPtr);
- registerLoad = op - SkScriptEngine2::kStringAccumulator;
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- strPtr->set((char*) opCode, size);
- opCode += size;
- operand[registerLoad].fString = strPtr;
- } break;
- case SkScriptEngine2::kStringTrack: // call after kObjectToValue
- track(operand[0].fString);
- break;
- case SkScriptEngine2::kBoxToken: {
- SkOperand2::OpType type;
- memcpy(&type, opCode, sizeof(type));
- opCode += sizeof(type);
- SkScriptCallBackConvert* callBackBox = (SkScriptCallBackConvert*) callBack;
- if (callBackBox->convert(type, &operand[0]) == false)
- return false;
- } break;
- case SkScriptEngine2::kUnboxToken:
- case SkScriptEngine2::kUnboxToken2: {
- SkScriptCallBackConvert* callBackUnbox = (SkScriptCallBackConvert*) callBack;
- if (callBackUnbox->convert(SkOperand2::kObject, &operand[0]) == false)
- return false;
- } break;
- case SkScriptEngine2::kIfOp:
- case SkScriptEngine2::kLogicalAndInt:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- if (operand[0].fS32 == 0)
- opCode += size; // skip to else (or end of if predicate)
- break;
- case SkScriptEngine2::kElseOp:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- opCode += size; // if true: after predicate, always skip to end of else
- break;
- case SkScriptEngine2::kLogicalOrInt:
- memcpy(&size, opCode, sizeof(size));
- opCode += sizeof(size);
- if (operand[0].fS32 != 0)
- opCode += size; // skip to kToBool opcode after || predicate
- break;
- // arithmetic conversion ops
- case SkScriptEngine2::kFlipOpsOp:
- SkTSwap(operand[0], operand[1]);
- break;
- case SkScriptEngine2::kIntToString:
- case SkScriptEngine2::kIntToString2:
- case SkScriptEngine2::kScalarToString:
- case SkScriptEngine2::kScalarToString2:{
- SkString* strPtr = new SkString();
- track(strPtr);
- if (op == SkScriptEngine2::kIntToString || op == SkScriptEngine2::kIntToString2)
- strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS32);
- else
- strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToString].fScalar);
- operand[0].fString = strPtr;
- } break;
- case SkScriptEngine2::kIntToScalar:
- case SkScriptEngine2::kIntToScalar2:
- operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32);
- break;
- case SkScriptEngine2::kStringToInt:
- if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == false)
- return false;
- break;
- case SkScriptEngine2::kStringToScalar:
- case SkScriptEngine2::kStringToScalar2:
- if (SkParse::FindScalar(operand[0].fString->c_str(),
- &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == false)
- return false;
- break;
- case SkScriptEngine2::kScalarToInt:
- operand[0].fS32 = SkScalarFloor(operand[0].fScalar);
- break;
- // arithmetic ops
- case SkScriptEngine2::kAddInt:
- operand[0].fS32 += operand[1].fS32;
- break;
- case SkScriptEngine2::kAddScalar:
- operand[0].fScalar += operand[1].fScalar;
- break;
- case SkScriptEngine2::kAddString:
-// if (fTrackString.find(operand[1].fString) < 0) {
-// operand[1].fString = SkNEW_ARGS(SkString, (*operand[1].fString));
-// track(operand[1].fString);
-// }
- operand[0].fString->append(*operand[1].fString);
- break;
- case SkScriptEngine2::kBitAndInt:
- operand[0].fS32 &= operand[1].fS32;
- break;
- case SkScriptEngine2::kBitNotInt:
- operand[0].fS32 = ~operand[0].fS32;
- break;
- case SkScriptEngine2::kBitOrInt:
- operand[0].fS32 |= operand[1].fS32;
- break;
- case SkScriptEngine2::kDivideInt:
- SkASSERT(operand[1].fS32 != 0);
- if (operand[1].fS32 == 0)
- operand[0].fS32 = operand[0].fS32 == 0 ? SK_NaN32 :
- operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32;
- else
- if (operand[1].fS32 != 0) // throw error on divide by zero?
- operand[0].fS32 /= operand[1].fS32;
- break;
- case SkScriptEngine2::kDivideScalar:
- if (operand[1].fScalar == 0)
- operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN :
- operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax;
- else
- operand[0].fScalar = SkScalarDiv(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kEqualInt:
- operand[0].fS32 = operand[0].fS32 == operand[1].fS32;
- break;
- case SkScriptEngine2::kEqualScalar:
- operand[0].fS32 = operand[0].fScalar == operand[1].fScalar;
- break;
- case SkScriptEngine2::kEqualString:
- operand[0].fS32 = *operand[0].fString == *operand[1].fString;
- break;
- case SkScriptEngine2::kGreaterEqualInt:
- operand[0].fS32 = operand[0].fS32 >= operand[1].fS32;
- break;
- case SkScriptEngine2::kGreaterEqualScalar:
- operand[0].fS32 = operand[0].fScalar >= operand[1].fScalar;
- break;
- case SkScriptEngine2::kGreaterEqualString:
- operand[0].fS32 = strcmp(operand[0].fString->c_str(), operand[1].fString->c_str()) >= 0;
- break;
- case SkScriptEngine2::kToBool:
- operand[0].fS32 = !! operand[0].fS32;
- break;
- case SkScriptEngine2::kLogicalNotInt:
- operand[0].fS32 = ! operand[0].fS32;
- break;
- case SkScriptEngine2::kMinusInt:
- operand[0].fS32 = -operand[0].fS32;
- break;
- case SkScriptEngine2::kMinusScalar:
- operand[0].fScalar = -operand[0].fScalar;
- break;
- case SkScriptEngine2::kModuloInt:
- operand[0].fS32 %= operand[1].fS32;
- break;
- case SkScriptEngine2::kModuloScalar:
- operand[0].fScalar = SkScalarMod(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kMultiplyInt:
- operand[0].fS32 *= operand[1].fS32;
- break;
- case SkScriptEngine2::kMultiplyScalar:
- operand[0].fScalar = SkScalarMul(operand[0].fScalar, operand[1].fScalar);
- break;
- case SkScriptEngine2::kShiftLeftInt:
- operand[0].fS32 <<= operand[1].fS32;
- break;
- case SkScriptEngine2::kShiftRightInt:
- operand[0].fS32 >>= operand[1].fS32;
- break;
- case SkScriptEngine2::kSubtractInt:
- operand[0].fS32 -= operand[1].fS32;
- break;
- case SkScriptEngine2::kSubtractScalar:
- operand[0].fScalar -= operand[1].fScalar;
- break;
- case SkScriptEngine2::kXorInt:
- operand[0].fS32 ^= operand[1].fS32;
- break;
- case SkScriptEngine2::kEnd:
- goto done;
- case SkScriptEngine2::kNop:
- SkASSERT(0);
+ SkOperand2 operand[2]; // 1=accumulator and 2=operand
+ SkScriptEngine2::TypeOp op;
+ size_t ref;
+ int index, size;
+ int registerLoad;
+ SkScriptCallBack* callBack SK_INIT_TO_AVOID_WARNING;
+ do {
+ switch ((op = (SkScriptEngine2::TypeOp) *opCode++)) {
+ case SkScriptEngine2::kArrayToken: // create an array
+ operand[0].fArray = new SkOpArray(SkOperand2::kNoType /*fReturnType*/);
+ break;
+ case SkScriptEngine2::kArrayIndex: // array accessor
+ index = operand[1].fS32;
+ if (index >= operand[0].fArray->count()) {
+ fError = kArrayIndexOutOfBounds;
+ return false;
+ }
+ operand[0] = operand[0].fArray->begin()[index];
+ break;
+ case SkScriptEngine2::kArrayParam: // array initializer, or function param
+ *operand[0].fArray->append() = operand[1];
+ break;
+ case SkScriptEngine2::kCallback:
+ memcpy(&index, opCode, sizeof(index));
+ opCode += sizeof(index);
+ callBack = fCallBackArray[index];
+ break;
+ case SkScriptEngine2::kFunctionCall: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackFunction* callBackFunction = (SkScriptCallBackFunction*) callBack;
+ if (callBackFunction->invoke(ref, operand[0].fArray, /* params */
+ &operand[0] /* result */) == false) {
+ fError = kFunctionCallFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kMemberOp: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackMember* callBackMember = (SkScriptCallBackMember*) callBack;
+ if (callBackMember->invoke(ref, operand[0].fObject, &operand[0]) == false) {
+ fError = kMemberOpFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kPropertyOp: {
+ memcpy(&ref, opCode, sizeof(ref));
+ opCode += sizeof(ref);
+ SkScriptCallBackProperty* callBackProperty = (SkScriptCallBackProperty*) callBack;
+ if (callBackProperty->getResult(ref, &operand[0])== false) {
+ fError = kPropertyOpFailed;
+ return false;
+ }
+ } break;
+ case SkScriptEngine2::kAccumulatorPop:
+ fRunStack.pop(&operand[0]);
+ break;
+ case SkScriptEngine2::kAccumulatorPush:
+ *fRunStack.push() = operand[0];
+ break;
+ case SkScriptEngine2::kIntegerAccumulator:
+ case SkScriptEngine2::kIntegerOperand:
+ registerLoad = op - SkScriptEngine2::kIntegerAccumulator;
+ memcpy(&operand[registerLoad].fS32, opCode, sizeof(int32_t));
+ opCode += sizeof(int32_t);
+ break;
+ case SkScriptEngine2::kScalarAccumulator:
+ case SkScriptEngine2::kScalarOperand:
+ registerLoad = op - SkScriptEngine2::kScalarAccumulator;
+ memcpy(&operand[registerLoad].fScalar, opCode, sizeof(SkScalar));
+ opCode += sizeof(SkScalar);
+ break;
+ case SkScriptEngine2::kStringAccumulator:
+ case SkScriptEngine2::kStringOperand: {
+ SkString* strPtr = new SkString();
+ track(strPtr);
+ registerLoad = op - SkScriptEngine2::kStringAccumulator;
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ strPtr->set((char*) opCode, size);
+ opCode += size;
+ operand[registerLoad].fString = strPtr;
+ } break;
+ case SkScriptEngine2::kStringTrack: // call after kObjectToValue
+ track(operand[0].fString);
+ break;
+ case SkScriptEngine2::kBoxToken: {
+ SkOperand2::OpType type;
+ memcpy(&type, opCode, sizeof(type));
+ opCode += sizeof(type);
+ SkScriptCallBackConvert* callBackBox = (SkScriptCallBackConvert*) callBack;
+ if (callBackBox->convert(type, &operand[0]) == false)
+ return false;
+ } break;
+ case SkScriptEngine2::kUnboxToken:
+ case SkScriptEngine2::kUnboxToken2: {
+ SkScriptCallBackConvert* callBackUnbox = (SkScriptCallBackConvert*) callBack;
+ if (callBackUnbox->convert(SkOperand2::kObject, &operand[0]) == false)
+ return false;
+ } break;
+ case SkScriptEngine2::kIfOp:
+ case SkScriptEngine2::kLogicalAndInt:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ if (operand[0].fS32 == 0)
+ opCode += size; // skip to else (or end of if predicate)
+ break;
+ case SkScriptEngine2::kElseOp:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ opCode += size; // if true: after predicate, always skip to end of else
+ break;
+ case SkScriptEngine2::kLogicalOrInt:
+ memcpy(&size, opCode, sizeof(size));
+ opCode += sizeof(size);
+ if (operand[0].fS32 != 0)
+ opCode += size; // skip to kToBool opcode after || predicate
+ break;
+ // arithmetic conversion ops
+ case SkScriptEngine2::kFlipOpsOp:
+ SkTSwap(operand[0], operand[1]);
+ break;
+ case SkScriptEngine2::kIntToString:
+ case SkScriptEngine2::kIntToString2:
+ case SkScriptEngine2::kScalarToString:
+ case SkScriptEngine2::kScalarToString2:{
+ SkString* strPtr = new SkString();
+ track(strPtr);
+ if (op == SkScriptEngine2::kIntToString || op == SkScriptEngine2::kIntToString2)
+ strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS32);
+ else
+ strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToString].fScalar);
+ operand[0].fString = strPtr;
+ } break;
+ case SkScriptEngine2::kIntToScalar:
+ case SkScriptEngine2::kIntToScalar2:
+ operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScriptEngine2::kIntToScalar].fS32);
+ break;
+ case SkScriptEngine2::kStringToInt:
+ if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32) == false)
+ return false;
+ break;
+ case SkScriptEngine2::kStringToScalar:
+ case SkScriptEngine2::kStringToScalar2:
+ if (SkParse::FindScalar(operand[0].fString->c_str(),
+ &operand[op - SkScriptEngine2::kStringToScalar].fScalar) == false)
+ return false;
+ break;
+ case SkScriptEngine2::kScalarToInt:
+ operand[0].fS32 = SkScalarFloor(operand[0].fScalar);
+ break;
+ // arithmetic ops
+ case SkScriptEngine2::kAddInt:
+ operand[0].fS32 += operand[1].fS32;
+ break;
+ case SkScriptEngine2::kAddScalar:
+ operand[0].fScalar += operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kAddString:
+// if (fTrackString.find(operand[1].fString) < 0) {
+// operand[1].fString = SkNEW_ARGS(SkString, (*operand[1].fString));
+// track(operand[1].fString);
+// }
+ operand[0].fString->append(*operand[1].fString);
+ break;
+ case SkScriptEngine2::kBitAndInt:
+ operand[0].fS32 &= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kBitNotInt:
+ operand[0].fS32 = ~operand[0].fS32;
+ break;
+ case SkScriptEngine2::kBitOrInt:
+ operand[0].fS32 |= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kDivideInt:
+ SkASSERT(operand[1].fS32 != 0);
+ if (operand[1].fS32 == 0)
+ operand[0].fS32 = operand[0].fS32 == 0 ? SK_NaN32 :
+ operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32;
+ else
+ if (operand[1].fS32 != 0) // throw error on divide by zero?
+ operand[0].fS32 /= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kDivideScalar:
+ if (operand[1].fScalar == 0)
+ operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN :
+ operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax;
+ else
+ operand[0].fScalar = SkScalarDiv(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kEqualInt:
+ operand[0].fS32 = operand[0].fS32 == operand[1].fS32;
+ break;
+ case SkScriptEngine2::kEqualScalar:
+ operand[0].fS32 = operand[0].fScalar == operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kEqualString:
+ operand[0].fS32 = *operand[0].fString == *operand[1].fString;
+ break;
+ case SkScriptEngine2::kGreaterEqualInt:
+ operand[0].fS32 = operand[0].fS32 >= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kGreaterEqualScalar:
+ operand[0].fS32 = operand[0].fScalar >= operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kGreaterEqualString:
+ operand[0].fS32 = strcmp(operand[0].fString->c_str(), operand[1].fString->c_str()) >= 0;
+ break;
+ case SkScriptEngine2::kToBool:
+ operand[0].fS32 = !! operand[0].fS32;
+ break;
+ case SkScriptEngine2::kLogicalNotInt:
+ operand[0].fS32 = ! operand[0].fS32;
+ break;
+ case SkScriptEngine2::kMinusInt:
+ operand[0].fS32 = -operand[0].fS32;
+ break;
+ case SkScriptEngine2::kMinusScalar:
+ operand[0].fScalar = -operand[0].fScalar;
+ break;
+ case SkScriptEngine2::kModuloInt:
+ operand[0].fS32 %= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kModuloScalar:
+ operand[0].fScalar = SkScalarMod(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kMultiplyInt:
+ operand[0].fS32 *= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kMultiplyScalar:
+ operand[0].fScalar = SkScalarMul(operand[0].fScalar, operand[1].fScalar);
+ break;
+ case SkScriptEngine2::kShiftLeftInt:
+ operand[0].fS32 <<= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kShiftRightInt:
+ operand[0].fS32 >>= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kSubtractInt:
+ operand[0].fS32 -= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kSubtractScalar:
+ operand[0].fScalar -= operand[1].fScalar;
+ break;
+ case SkScriptEngine2::kXorInt:
+ operand[0].fS32 ^= operand[1].fS32;
+ break;
+ case SkScriptEngine2::kEnd:
+ goto done;
+ case SkScriptEngine2::kNop:
+ SkASSERT(0);
default:
break;
- }
- } while (true);
+ }
+ } while (true);
done:
- fRunStack.push(operand[0]);
- return true;
+ fRunStack.push(operand[0]);
+ return true;
}
bool SkScriptRuntime::getResult(SkOperand2* result) {
- if (fRunStack.count() == 0)
- return false;
- fRunStack.pop(result);
- return true;
+ if (fRunStack.count() == 0)
+ return false;
+ fRunStack.pop(result);
+ return true;
}
-void SkScriptRuntime::track(SkOpArray* array) {
- SkASSERT(fTrackArray.find(array) < 0);
- *fTrackArray.append() = array;
+void SkScriptRuntime::track(SkOpArray* array) {
+ SkASSERT(fTrackArray.find(array) < 0);
+ *fTrackArray.append() = array;
}
-void SkScriptRuntime::track(SkString* string) {
- SkASSERT(fTrackString.find(string) < 0);
- *fTrackString.append() = string;
+void SkScriptRuntime::track(SkString* string) {
+ SkASSERT(fTrackString.find(string) < 0);
+ *fTrackString.append() = string;
}
void SkScriptRuntime::untrack(SkOpArray* array) {
- int index = fTrackArray.find(array);
- SkASSERT(index >= 0);
- fTrackArray.begin()[index] = NULL;
+ int index = fTrackArray.find(array);
+ SkASSERT(index >= 0);
+ fTrackArray.begin()[index] = NULL;
}
void SkScriptRuntime::untrack(SkString* string) {
- int index = fTrackString.find(string);
- SkASSERT(index >= 0);
- fTrackString.begin()[index] = NULL;
+ int index = fTrackString.find(string);
+ SkASSERT(index >= 0);
+ fTrackString.begin()[index] = NULL;
}
diff --git a/src/animator/SkScriptRuntime.h b/src/animator/SkScriptRuntime.h
index 7721bd2c3f..3e73801148 100644
--- a/src/animator/SkScriptRuntime.h
+++ b/src/animator/SkScriptRuntime.h
@@ -14,37 +14,37 @@
class SkScriptCallBack;
-typedef SkLongArray(SkString*) SkTDStringArray;
-typedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
+typedef SkLongArray(SkString*) SkTDStringArray;
+typedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
class SkScriptRuntime {
public:
- enum SkError {
- kNoError,
- kArrayIndexOutOfBounds,
- kCouldNotFindReferencedID,
- kFunctionCallFailed,
- kMemberOpFailed,
- kPropertyOpFailed
- };
+ enum SkError {
+ kNoError,
+ kArrayIndexOutOfBounds,
+ kCouldNotFindReferencedID,
+ kFunctionCallFailed,
+ kMemberOpFailed,
+ kPropertyOpFailed
+ };
- SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
- { }
- ~SkScriptRuntime();
- bool executeTokens(unsigned char* opCode);
- bool getResult(SkOperand2* result);
- void untrack(SkOpArray* array);
- void untrack(SkString* string);
+ SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
+ { }
+ ~SkScriptRuntime();
+ bool executeTokens(unsigned char* opCode);
+ bool getResult(SkOperand2* result);
+ void untrack(SkOpArray* array);
+ void untrack(SkString* string);
private:
- void track(SkOpArray* array);
- void track(SkString* string);
- SkTDScriptCallBackArray& fCallBackArray;
- SkError fError;
- SkTDStack<SkOperand2> fRunStack;
- SkLongArray(SkOpArray*) fTrackArray;
- SkTDStringArray fTrackString;
- // illegal
- SkScriptRuntime& operator=(const SkScriptRuntime&);
+ void track(SkOpArray* array);
+ void track(SkString* string);
+ SkTDScriptCallBackArray& fCallBackArray;
+ SkError fError;
+ SkTDStack<SkOperand2> fRunStack;
+ SkLongArray(SkOpArray*) fTrackArray;
+ SkTDStringArray fTrackString;
+ // illegal
+ SkScriptRuntime& operator=(const SkScriptRuntime&);
};
#endif // SkScriptRuntime_DEFINED
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 90a50b6666..9547a988b2 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -17,31 +17,31 @@
const SkScriptEngine2::OperatorAttributes SkScriptEngine2::gOpAttributes[] = {
{ SkOperand2::kNoType, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean },
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsString, kResultIsNotBoolean }, // kAdd
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitAnd
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitNot
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitOr
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kDivide
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar |SkOperand2:: kString), kTowardsNumber,
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar |SkOperand2:: kString), kTowardsNumber,
kResultIsBoolean }, // kEqual
{ SkOperand2::kS32, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean }, // kFlipOps
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsNumber,
kResultIsBoolean }, // kGreaterEqual
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalAnd (really, ToBool)
{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalNot
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalOr
{ SkOperand2::kNoType, SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMinus
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 |SkOperand2:: kScalar), kNoBias, kResultIsNotBoolean }, // kModulo
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMultiply
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftLeft
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftRight
-{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
+{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kSubtract
{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean } // kXor
};
@@ -120,7 +120,7 @@ static int token_length(const char* start) {
}
SkScriptEngine2::SkScriptEngine2(SkOperand2::OpType returnType) : fActiveStream(&fStream),
-fTokenLength(0), fReturnType(returnType), fError(kNoError),
+fTokenLength(0), fReturnType(returnType), fError(kNoError),
fAccumulatorType(SkOperand2::kNoType),
fBranchPopAllowed(true), fConstExpression(true), fOperandInUse(false)
{
@@ -151,7 +151,7 @@ void SkScriptEngine2::addToken(SkScriptEngine2::TypeOp op) {
fActiveStream->write(&charOp, sizeof(charOp));
}
-void SkScriptEngine2::addTokenConst(SkScriptValue2* value, AddTokenRegister reg,
+void SkScriptEngine2::addTokenConst(SkScriptValue2* value, AddTokenRegister reg,
SkOperand2::OpType toType, SkScriptEngine2::TypeOp op) {
if (value->fIsConstant == SkScriptValue2::kConstant && convertTo(toType, value))
return;
@@ -243,7 +243,7 @@ int SkScriptEngine2::arithmeticOp(char ch, char nextChar, bool lastPush) {
if (nextChar == '>') {
op = kShiftRight;
goto twoChar;
- }
+ }
op = kGreaterEqual;
if (nextChar == '=')
goto twoChar;
@@ -272,7 +272,7 @@ int SkScriptEngine2::arithmeticOp(char ch, char nextChar, bool lastPush) {
twoChar:
advance++;
break;
- }
+ }
op = kLogicalNot;
break;
case '?':
@@ -316,7 +316,7 @@ twoChar:
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || (topPrecedence == precedence &&
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
gOpAttributes[op].fLeftType == SkOperand2::kNoType)) {
break;
}
@@ -331,14 +331,14 @@ twoChar:
return advance;
}
-bool SkScriptEngine2::convertParams(SkTDArray<SkScriptValue2>* params,
+bool SkScriptEngine2::convertParams(SkTDArray<SkScriptValue2>* params,
const SkOperand2::OpType* paramTypes, int paramCount) {
int count = params->count();
if (count > paramCount) {
SkASSERT(0);
return false; // too many parameters passed
}
- for (int index = 0; index < count; index++)
+ for (int index = 0; index < count; index++)
convertTo(paramTypes[index], &(*params)[index]);
return true;
}
@@ -355,7 +355,7 @@ bool SkScriptEngine2::convertTo(SkOperand2::OpType toType, SkScriptValue2* value
return ConvertTo(this, toType, value);
}
-bool SkScriptEngine2::evaluateDot(const char*& script) {
+bool SkScriptEngine2::evaluateDot(const char*& script) {
size_t fieldLength = token_length(++script); // skip dot
SkASSERT(fieldLength > 0); // !!! add error handling
const char* field = script;
@@ -370,14 +370,14 @@ error:
return false;
}
-bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, size_t fieldLength) {
+bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, size_t fieldLength) {
SkScriptValue2& top = fValueStack.top();
if (top.fType != SkOperand2::kObject)
return false;
void* object = top.fOperand.fObject;
fValueStack.pop();
char ch; // see if it is a simple member or a function
- while (is_ws(ch = script[0]))
+ while (is_ws(ch = script[0]))
script++;
bool success = true;
if (ch != '(')
@@ -389,7 +389,7 @@ bool SkScriptEngine2::evaluateDotParam(const char*& script, const char* field, s
if (success)
success = handleMemberFunction(field, fieldLength, object, &params);
}
- return success;
+ return success;
}
bool SkScriptEngine2::evaluateScript(const char** scriptPtr, SkScriptValue2* value) {
@@ -492,7 +492,7 @@ bool SkScriptEngine2::innerScript(const char** scriptPtr, SkScriptValue2* value)
{
SkOperand2::OpType type = fReturnType;
if (fReturnType == SkOperand2::kNoType) {
- // !!! short sighted; in the future, allow each returned array component to carry
+ // !!! short sighted; in the future, allow each returned array component to carry
// its own type, and let caller do any needed conversions
if (value->fOperand.fArray->count() == 0)
value->fOperand.fArray->setType(type = tokenValue.fType);
@@ -513,7 +513,7 @@ bool SkScriptEngine2::innerScript(const char** scriptPtr, SkScriptValue2* value)
if (ch == '(') {
*fBraceStack.push() = kFunctionBrace;
SkString functionName(fToken, fTokenLength);
-
+
if (handleFunction(&script) == false)
return false;
lastPush = true;
@@ -611,7 +611,7 @@ scalarCommon:
SkASSERT(fValueStack.count() > 0); // !!! add error handling
SkScriptValue2 top;
fValueStack.pop(&top);
-
+
addTokenInt(top.fType);
addToken(kBoxToken);
top.fType = SkOperand2::kObject;
@@ -621,7 +621,7 @@ scalarCommon:
success = evaluateDotParam(script, token, tokenLength);
SkASSERT(success);
lastPush = true;
- continue;
+ continue;
}
// get next token, and evaluate immediately
success = evaluateDot(script);
@@ -638,7 +638,7 @@ scalarCommon:
*fBraceStack.push() = kArrayBrace;
operand.fOperand.fArray = value->fOperand.fArray = new SkOpArray(fReturnType);
track(value->fOperand.fArray);
-
+
operand.fType = SkOperand2::kArray;
operand.fIsConstant = SkScriptValue2::kVariable;
fValueStack.push(operand);
@@ -663,7 +663,7 @@ scalarCommon:
}
#endif
if (ch == ')' && fBraceStack.count() > 0) {
- BraceStyle braceStyle = fBraceStack.top();
+ BraceStyle braceStyle = fBraceStack.top();
if (braceStyle == kFunctionBrace) {
fBraceStack.pop();
break;
@@ -681,7 +681,7 @@ scalarCommon:
}
char nextChar = script[1];
int advance = logicalOp(ch, nextChar);
- if (advance == 0)
+ if (advance == 0)
advance = arithmeticOp(ch, nextChar, lastPush);
if (advance == 0) // unknown token
return false;
@@ -760,7 +760,7 @@ scalarCommon:
if (fValueStack.count() == 0)
return false;
fValueStack.pop(value);
- if (value->fType != fReturnType && value->fType == SkOperand2::kObject &&
+ if (value->fType != fReturnType && value->fType == SkOperand2::kObject &&
fReturnType != SkOperand2::kNoType)
convertTo(fReturnType, value);
}
@@ -850,7 +850,7 @@ done:
return success;
}
-bool SkScriptEngine2::handleMemberFunction(const char* field, size_t len, void* object,
+bool SkScriptEngine2::handleMemberFunction(const char* field, size_t len, void* object,
SkTDArray<SkScriptValue2>* params) {
bool success = true;
for (SkScriptCallBack** callBack = fCallBackArray.begin(); callBack < fCallBackArray.end(); callBack++) {
@@ -980,13 +980,13 @@ void SkScriptEngine2::processLogicalOp(Op op) {
case kParen:
case kArrayOp:
SkASSERT(fOpStack.count() > 1 && fOpStack.top() == op); // !!! add error handling
- if (op == kParen)
+ if (op == kParen)
fOpStack.pop();
else {
SkScriptValue2 value;
fValueStack.pop(&value);
SkASSERT(value.fType == SkOperand2::kS32 || value.fType == SkOperand2::kScalar); // !!! add error handling (although, could permit strings eventually)
- int index = value.fType == SkOperand2::kScalar ? SkScalarFloor(value.fOperand.fScalar) :
+ int index = value.fType == SkOperand2::kScalar ? SkScalarFloor(value.fOperand.fScalar) :
value.fOperand.fS32;
SkScriptValue2 arrayValue;
fValueStack.pop(&arrayValue);
@@ -1046,7 +1046,7 @@ void SkScriptEngine2::processLogicalOp(Op op) {
// if 'or', write bne goto to bool
addToken(op == kLogicalAnd ? kLogicalAndInt : kLogicalOrInt);
Branch branch(op, fOpStack.count(), getTokenOffset());
- addTokenInt(0); // placeholder for future branch
+ addTokenInt(0); // placeholder for future branch
oldTop.fPrimed = wasPrime;
oldTop.fDone = wasDone;
*fBranchStack.push() = branch;
@@ -1073,7 +1073,7 @@ bool SkScriptEngine2::processOp() {
bool constantOperands = value2.fIsConstant == SkScriptValue2::kConstant;
if (attributes->fLeftType != SkOperand2::kNoType) {
fValueStack.pop(&value1);
- constantOperands &= value1.fIsConstant == SkScriptValue2::kConstant;
+ constantOperands &= value1.fIsConstant == SkScriptValue2::kConstant;
value1.fIsWritten = SkScriptValue2::kUnwritten;
if (op == kFlipOps) {
SkTSwap(value1, value2);
@@ -1094,17 +1094,17 @@ bool SkScriptEngine2::processOp() {
}
if (attributes->fLeftType != SkOperand2::kNoType) {
if (value1.fType != value2.fType) {
- if ((attributes->fLeftType & SkOperand2::kString) && attributes->fBias & kTowardsString &&
+ if ((attributes->fLeftType & SkOperand2::kString) && attributes->fBias & kTowardsString &&
((value1.fType | value2.fType) & SkOperand2::kString)) {
if (value1.fType == SkOperand2::kS32 || value1.fType == SkOperand2::kScalar) {
- addTokenConst(&value1, kAccumulator, SkOperand2::kString,
+ addTokenConst(&value1, kAccumulator, SkOperand2::kString,
value1.fType == SkOperand2::kS32 ? kIntToString : kScalarToString);
}
if (value2.fType == SkOperand2::kS32 || value2.fType == SkOperand2::kScalar) {
- addTokenConst(&value2, kOperand, SkOperand2::kString,
+ addTokenConst(&value2, kOperand, SkOperand2::kString,
value2.fType == SkOperand2::kS32 ? kIntToString2 : kScalarToString2);
}
- } else if (attributes->fLeftType & SkOperand2::kScalar && ((value1.fType | value2.fType) &
+ } else if (attributes->fLeftType & SkOperand2::kScalar && ((value1.fType | value2.fType) &
SkOperand2::kScalar)) {
if (value1.fType == SkOperand2::kS32)
addTokenConst(&value1, kAccumulator, SkOperand2::kScalar, kIntToScalar);
@@ -1115,7 +1115,7 @@ bool SkScriptEngine2::processOp() {
if ((value1.fType & attributes->fLeftType) == 0 || value1.fType != value2.fType) {
if (value1.fType == SkOperand2::kString)
addTokenConst(&value1, kAccumulator, SkOperand2::kScalar, kStringToScalar);
- if (value1.fType == SkOperand2::kScalar && (attributes->fLeftType == SkOperand2::kS32 ||
+ if (value1.fType == SkOperand2::kScalar && (attributes->fLeftType == SkOperand2::kS32 ||
value2.fType == SkOperand2::kS32))
addTokenConst(&value1, kAccumulator, SkOperand2::kS32, kScalarToInt);
}
@@ -1125,7 +1125,7 @@ bool SkScriptEngine2::processOp() {
if ((value2.fType & attributes->fRightType) == 0 || value1.fType != value2.fType) {
if (value2.fType == SkOperand2::kString)
addTokenConst(&value2, rhRegister, SkOperand2::kScalar, kStringToScalar2);
- if (value2.fType == SkOperand2::kScalar && (attributes->fRightType == SkOperand2::kS32 ||
+ if (value2.fType == SkOperand2::kScalar && (attributes->fRightType == SkOperand2::kS32 ||
value1.fType == SkOperand2::kS32))
addTokenConst(&value2, rhRegister, SkOperand2::kS32, kScalarToInt2);
}
@@ -1154,7 +1154,7 @@ bool SkScriptEngine2::processOp() {
if (constantOperands) {
addToken(kEnd);
SkAutoDataUnref data(fStream.copyToData());
-#ifdef SK_DEBUG
+#ifdef SK_DEBUG
decompile(data->bytes(), data->size());
#endif
SkScriptRuntime runtime(fCallBackArray);
@@ -1195,7 +1195,7 @@ void SkScriptEngine2::resolveBranch(SkScriptEngine2::Branch& branch) {
bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toType, SkScriptValue2* value ) {
SkASSERT(value);
SkOperand2::OpType type = value->fType;
- if (type == toType)
+ if (type == toType)
return true;
SkOperand2& operand = value->fOperand;
bool success = true;
@@ -1288,18 +1288,18 @@ bool SkScriptEngine2::ValueToString(const SkScriptValue2& value, SkString* strin
static const SkScriptNAnswer2 scriptTests[] = {
testInt(1||(0&&3)),
testScalar(- -5.5- -1.5),
- testScalar(1.0+5),
+ testScalar(1.0+5),
testInt((6+7)*8),
testInt(3*(4+5)),
testScalar(1.0+2.0),
- testScalar(3.0-1.0),
- testScalar(6-1.0),
- testScalar(2.5*6.),
- testScalar(0.5*4),
- testScalar(4.5/.5),
- testScalar(9.5/19),
- testRemainder(9.5, 0.5),
- testRemainder(9.,2),
+ testScalar(3.0-1.0),
+ testScalar(6-1.0),
+ testScalar(2.5*6.),
+ testScalar(0.5*4),
+ testScalar(4.5/.5),
+ testScalar(9.5/19),
+ testRemainder(9.5, 0.5),
+ testRemainder(9.,2),
testRemainder(9,2.5),
testRemainder(-9,2.5),
testTrue(-9==-9.0),
diff --git a/src/animator/SkTDArray_Experimental.h b/src/animator/SkTDArray_Experimental.h
index e598a6dad6..094d106bb6 100644
--- a/src/animator/SkTDArray_Experimental.h
+++ b/src/animator/SkTDArray_Experimental.h
@@ -38,9 +38,9 @@ protected:
int32_t* append() { return this->append(1, NULL); }
int32_t* append(U16CPU count, const int32_t* src = NULL);
- int32_t* appendClear()
- {
- int32_t* result = this->append();
+ int32_t* appendClear()
+ {
+ int32_t* result = this->append();
*result = 0;
return result;
}
@@ -108,9 +108,9 @@ public:
SkTDS32Array(const SkTDS32Array<T>& src) : SkDS32Array(src) {}
~SkTDS32Array() { sk_free(fArray); }
T& operator[](int index) const { SYNC(); SkASSERT((unsigned)index < fCount); return ((T*) fArray)[index]; }
- SkTDS32Array<T>& operator=(const SkTDS32Array<T>& src) {
+ SkTDS32Array<T>& operator=(const SkTDS32Array<T>& src) {
return (SkTDS32Array<T>&) SkDS32Array::operator=(src); }
- friend int operator==(const SkTDS32Array<T>& a, const SkTDS32Array<T>& b) {
+ friend int operator==(const SkTDS32Array<T>& a, const SkTDS32Array<T>& b) {
return operator==((const SkDS32Array&) a, (const SkDS32Array&) b); }
T* append() { return (T*) SkDS32Array::append(); }
T* appendClear() { return (T*) SkDS32Array::appendClear(); }
diff --git a/src/animator/SkTextOnPath.cpp b/src/animator/SkTextOnPath.cpp
index e7f7651fad..7bdb7fd977 100644
--- a/src/animator/SkTextOnPath.cpp
+++ b/src/animator/SkTextOnPath.cpp
@@ -33,7 +33,7 @@ bool SkTextOnPath::draw(SkAnimateMaker& maker) {
SkASSERT(text);
SkASSERT(path);
SkBoundableAuto boundable(this, maker);
- maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
+ maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
path->getPath(), offset, 0, *maker.fPaint);
return false;
}
diff --git a/src/animator/SkTextToPath.cpp b/src/animator/SkTextToPath.cpp
index cf78ff5d95..b38daff7ec 100644
--- a/src/animator/SkTextToPath.cpp
+++ b/src/animator/SkTextToPath.cpp
@@ -42,7 +42,7 @@ void SkTextToPath::onEndElement(SkAnimateMaker& maker) {
}
SkPaint realPaint;
paint->setupPaint(&realPaint);
- realPaint.getTextPath(text->getText(), text->getSize(), text->x,
+ realPaint.getTextPath(text->getText(), text->getSize(), text->x,
text->y, &path->getPath());
}
diff --git a/src/animator/SkTime.cpp b/src/animator/SkTime.cpp
index 35c7eb8f84..06ad9bd44b 100644
--- a/src/animator/SkTime.cpp
+++ b/src/animator/SkTime.cpp
@@ -51,7 +51,7 @@ void SkTime::GetDateTime(DateTime* t)
{
tm syst;
time_t tm;
-
+
time(&tm);
localtime_r(&tm, &syst);
t->fYear = SkToU16(syst.tm_year);
diff --git a/src/animator/SkTypedArray.h b/src/animator/SkTypedArray.h
index 222c8df667..e93b106702 100644
--- a/src/animator/SkTypedArray.h
+++ b/src/animator/SkTypedArray.h
@@ -20,7 +20,7 @@ public:
bool getIndex(int index, SkOperand* operand);
SkDisplayTypes getType() { return fType; }
SkScriptEngine::SkOpType getOpType() { return SkScriptEngine::ToOpType(fType); }
- void setType(SkDisplayTypes type) {
+ void setType(SkDisplayTypes type) {
// SkASSERT(count() == 0);
fType = type;
}
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index cf8b8d3037..c04d0626ca 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -28,7 +28,7 @@ protected:
const GrVec* translate,
GrDrawTarget* target,
bool antiAlias) SK_OVERRIDE;
-
+
private:
GrAAHairLinePathRenderer(const GrContext* context,
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 652adcb47c..36f37abf40 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -88,7 +88,7 @@ int GrAARectRenderer::aaStrokeRectIndexCount() {
GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu) {
if (NULL == fAAStrokeRectIndexBuffer) {
- fAAStrokeRectIndexBuffer =
+ fAAStrokeRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gStrokeAARectIdx), false);
if (NULL != fAAStrokeRectIndexBuffer) {
#if GR_DEBUG
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index ae456cd170..dc4c3de281 100755
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -55,8 +55,8 @@ public:
} else if (fOwnFirstBlock) {
fBlocks[0] = GrMalloc(fBlockSize);
}
- }
- void* ret = (char*)fBlocks[fCount/fItemsPerBlock] +
+ }
+ void* ret = (char*)fBlocks[fCount/fItemsPerBlock] +
fItemSize * indexInBlock;
++fCount;
return ret;
@@ -65,8 +65,8 @@ public:
/**
* removes all added items
*/
- void reset() {
- int blockCount = GrMax((unsigned)1,
+ void reset() {
+ int blockCount = GrMax((unsigned)1,
GrUIDivRoundUp(fCount, fItemsPerBlock));
for (int i = 1; i < blockCount; ++i) {
GrFree(fBlocks[i]);
@@ -85,12 +85,12 @@ public:
int count() const {
return fCount;
}
-
+
/**
* is the count 0
*/
bool empty() const { return fCount == 0; }
-
+
/**
* access last item, only call if count() != 0
*/
@@ -98,7 +98,7 @@ public:
GrAssert(fCount);
return (*this)[fCount-1];
}
-
+
/**
* access last item, only call if count() != 0
*/
@@ -106,28 +106,28 @@ public:
GrAssert(fCount);
return (*this)[fCount-1];
}
-
+
/**
* access item by index.
- */
+ */
void* operator[] (int i) {
GrAssert(i >= 0 && i < fCount);
- return (char*)fBlocks[i / fItemsPerBlock] +
+ return (char*)fBlocks[i / fItemsPerBlock] +
fItemSize * (i % fItemsPerBlock);
}
/**
* access item by index.
- */
+ */
const void* operator[] (int i) const {
GrAssert(i >= 0 && i < fCount);
- return (const char*)fBlocks[i / fItemsPerBlock] +
+ return (const char*)fBlocks[i / fItemsPerBlock] +
fItemSize * (i % fItemsPerBlock);
}
private:
static const int NUM_INIT_BLOCK_PTRS = 8;
-
+
SkSTArray<NUM_INIT_BLOCK_PTRS, void*> fBlocks;
size_t fBlockSize;
size_t fItemSize;
@@ -184,19 +184,19 @@ public:
}
fAllocator.reset();
}
-
+
/**
* count of items
*/
int count() const {
return fAllocator.count();
}
-
+
/**
* is the count 0
*/
bool empty() const { return fAllocator.empty(); }
-
+
/**
* access last item, only call if count() != 0
*/
@@ -213,11 +213,11 @@ public:
/**
* access item by index.
- */
+ */
T& operator[] (int i) {
return *(T*)(fAllocator[i]);
}
-
+
/**
* access item by index.
*/
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 1187a0816c..fe56ded5fa 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -216,7 +216,7 @@ private:
}
void acquireMask(GrContext* context,
- const SkClipStack& clip,
+ const SkClipStack& clip,
const GrTextureDesc& desc,
const GrIRect& bound) {
@@ -237,11 +237,11 @@ private:
}
SkClipStack fLastClip;
- // The mask's width & height values are used in setupDrawStateAAClip to
+ // The mask's width & height values are used in setupDrawStateAAClip to
// correctly scale the uvs for geometry drawn with this mask
GrAutoScratchTexture fLastMask;
- // fLastBound stores the bounding box of the clip mask in canvas
- // space. The left and top fields are used to offset the uvs for
+ // fLastBound stores the bounding box of the clip mask in canvas
+ // space. The left and top fields are used to offset the uvs for
// geometry drawn with this mask (in setupDrawStateAAClip)
GrIRect fLastBound;
};
@@ -253,9 +253,9 @@ private:
};
/**
- * The clip mask creator handles the generation of the clip mask. If anti
- * aliasing is requested it will (in the future) generate a single channel
- * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
+ * The clip mask creator handles the generation of the clip mask. If anti
+ * aliasing is requested it will (in the future) generate a single channel
+ * (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
* mask in the stencil buffer. In the non anti-aliasing case, if the clip
* mask can be represented as a rectangle then scissoring is used. In all
* cases scissoring is used to bound the range of the clip mask.
@@ -299,7 +299,7 @@ public:
return fAACache.getContext();
}
- void setGpu(GrGpu* gpu) {
+ void setGpu(GrGpu* gpu) {
fGpu = gpu;
}
@@ -330,7 +330,7 @@ private:
kStencil_ClipMaskType,
kAlpha_ClipMaskType,
} fCurrClipMaskType;
-
+
GrClipMaskCache fAACache; // cache for the AA path
bool createStencilClipMask(const GrClipData& clipDataIn,
@@ -356,7 +356,7 @@ private:
void getTemp(const GrIRect& bounds, GrAutoScratchTexture* temp);
- void setupCache(const SkClipStack& clip,
+ void setupCache(const SkClipStack& clip,
const GrIRect& bounds);
/**
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index cc68aede70..1db2e4afa3 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -24,7 +24,7 @@
class GrDrawState : public GrRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawState)
-
+
/**
* Number of texture stages. Each stage takes as input a color and
* 2D texture coordinates. The color input to the first enabled stage is the
@@ -40,8 +40,8 @@ public:
* or not.
*
* Stages 0 through GrPaint::kTotalStages-1 are reserved for setting up
- * the draw (i.e., textures and filter masks). Stages GrPaint::kTotalStages
- * through kNumStages-1 are earmarked for use by GrTextContext and
+ * the draw (i.e., textures and filter masks). Stages GrPaint::kTotalStages
+ * through kNumStages-1 are earmarked for use by GrTextContext and
* GrPathRenderer-derived classes.
*/
enum {
@@ -49,13 +49,13 @@ public:
kMaxTexCoords = kNumStages
};
- GrDrawState()
+ GrDrawState()
: fRenderTarget(NULL) {
this->reset();
}
- GrDrawState(const GrDrawState& state)
+ GrDrawState(const GrDrawState& state)
: fRenderTarget(NULL) {
*this = state;
@@ -70,7 +70,7 @@ public:
* Resets to the default state.
* Sampler states *will* be modified: textures or CustomStage objects
* will be released.
- */
+ */
void reset() {
this->disableStages();
@@ -147,7 +147,7 @@ public:
////
/**
- * Sets a constant fractional coverage to be applied to the draw. The
+ * Sets a constant fractional coverage to be applied to the draw. The
* initial value (after construction or reset()) is 0xff. The constant
* coverage is ignored when per-vertex coverage is provided.
*/
@@ -280,22 +280,22 @@ public:
/**
* A common pattern is to compute a color with the initial stages and then
* modulate that color by a coverage value in later stage(s) (AA, mask-
- * filters, glyph mask, etc). Color-filters, xfermodes, etc should be
- * computed based on the pre-coverage-modulated color. The division of
- * stages between color-computing and coverage-computing is specified by
+ * filters, glyph mask, etc). Color-filters, xfermodes, etc should be
+ * computed based on the pre-coverage-modulated color. The division of
+ * stages between color-computing and coverage-computing is specified by
* this method. Initially this is kNumStages (all stages
* are color-computing).
*/
void setFirstCoverageStage(int firstCoverageStage) {
GrAssert((unsigned)firstCoverageStage <= kNumStages);
- fFirstCoverageStage = firstCoverageStage;
+ fFirstCoverageStage = firstCoverageStage;
}
/**
* Gets the index of the first coverage-computing stage.
*/
int getFirstCoverageStage() const {
- return fFirstCoverageStage;
+ return fFirstCoverageStage;
}
///@}
@@ -495,7 +495,7 @@ public:
*
* @param target The render target to set.
*/
- void setRenderTarget(GrRenderTarget* target) {
+ void setRenderTarget(GrRenderTarget* target) {
GrSafeAssign(fRenderTarget, target);
}
@@ -607,7 +607,7 @@ public:
/* 1-pixel wide line
2D implicit line eq (a*x + b*y +c = 0). 4th component unused */
kHairLine_EdgeType,
- /* Quadratic specified by u^2-v canonical coords (only 2
+ /* Quadratic specified by u^2-v canonical coords (only 2
components used). Coverage based on signed distance with negative
being inside, positive outside. Edge specified in window space
(y-down) */
@@ -623,7 +623,7 @@ public:
};
/**
- * Determines the interpretation per-vertex edge data when the
+ * Determines the interpretation per-vertex edge data when the
* kEdge_VertexLayoutBit is set (see GrDrawTarget). When per-vertex edges
* are not specified the value of this setting has no effect.
*/
@@ -753,7 +753,7 @@ public:
* @return the current draw face(s).
*/
DrawFace getDrawFace() const { return fDrawFace; }
-
+
/// @}
///////////////////////////////////////////////////////////////////////////
@@ -795,7 +795,7 @@ public:
}
bool operator !=(const GrDrawState& s) const { return !(*this == s); }
- // Most stages are usually not used, so conditionals here
+ // Most stages are usually not used, so conditionals here
// reduce the expected number of bytes touched by 50%.
GrDrawState& operator =(const GrDrawState& s) {
memcpy(this->podStart(), s.podStart(), this->podSize());
@@ -843,7 +843,7 @@ private:
GrColor fPodStartMarker;
};
GrColor fColorFilterColor;
- DrawFace fDrawFace;
+ DrawFace fDrawFace;
VertexEdgeType fVertexEdgeType;
GrStencilSettings fStencilSettings;
union {
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5b90480cba..a567699560 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -26,7 +26,7 @@ namespace {
* generate the new masks. (We attempted to force the compiler to generate the
* masks using recursive templates but always wound up with static initializers
* under gcc, even if they were just a series of immediate->memory moves.)
- *
+ *
*/
void gen_mask_arrays(GrVertexLayout* stageTexCoordMasks,
GrVertexLayout* texCoordMasks) {
@@ -44,14 +44,14 @@ void gen_mask_arrays(GrVertexLayout* stageTexCoordMasks,
}
}
-/**
+/**
* Run this function to generate the code that declares the global masks.
*/
void gen_globals() {
GrVertexLayout stageTexCoordMasks[GrDrawState::kNumStages];
GrVertexLayout texCoordMasks[GrDrawState::kMaxTexCoords];
gen_mask_arrays(stageTexCoordMasks, texCoordMasks);
-
+
GrPrintf("const GrVertexLayout gStageTexCoordMasks[] = {\n");
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
GrPrintf(" 0x%x,\n", stageTexCoordMasks[s]);
@@ -136,7 +136,7 @@ size_t GrDrawTarget::VertexSize(GrVertexLayout vertexLayout) {
/**
* Functions for computing offsets of various components from the layout
* bitfield.
- *
+ *
* Order of vertex components:
* Position
* Tex Coord 0
@@ -529,7 +529,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
GrAssert(NULL != indices);
this->releasePreviousIndexSource();
geoSrc.fIndexSrc = kNone_GeometrySrcType;
-
+
acquired = this->onReserveIndexSpace(indexCount, indices);
}
if (acquired) {
@@ -539,7 +539,7 @@ bool GrDrawTarget::reserveIndexSpace(int indexCount,
*indices = NULL;
}
return acquired;
-
+
}
bool GrDrawTarget::StageUsesTexCoords(GrVertexLayout layout, int stage) {
@@ -695,7 +695,7 @@ void GrDrawTarget::pushGeometrySource() {
void GrDrawTarget::popGeometrySource() {
// if popping last element then pops are unbalanced with pushes
GrAssert(fGeoSrcStateStack.count() > 1);
-
+
this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1));
this->releasePreviousVertexSource();
this->releasePreviousIndexSource();
@@ -902,7 +902,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// stenciling is enabled. Having color writes disabled is effectively
// (0,1). The same applies when coverage is known to be 0.
if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) ||
- (!(layout & kCoverage_VertexLayoutBit) &&
+ (!(layout & kCoverage_VertexLayoutBit) &&
0 == drawState.getCoverage())) {
if (drawState.getStencil().doesWrite()) {
return kDisableBlend_BlendOptFlag |
@@ -915,7 +915,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// check for coverage due to constant coverage, per-vertex coverage,
// edge aa or coverage texture stage
bool hasCoverage = forceCoverage ||
- 0xffffffff != drawState.getCoverage() ||
+ 0xffffffff != drawState.getCoverage() ||
(layout & kCoverage_VertexLayoutBit) ||
(layout & kEdge_VertexLayoutBit);
for (int s = drawState.getFirstCoverageStage();
@@ -959,7 +959,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
} else if (srcAIsOne) {
// the dst coeff is effectively zero so blend works out to:
// cS + (c)(0)D + (1-c)D = cS + (1-c)D.
- // If Sa is 1 then we can replace Sa with c
+ // If Sa is 1 then we can replace Sa with c
// and set dst coeff to 1-Sa.
*dstCoeff = kISA_GrBlendCoeff;
return kCoverageAsAlpha_BlendOptFlag;
@@ -1026,7 +1026,7 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
////////////////////////////////////////////////////////////////////////////////
-void GrDrawTarget::drawRect(const GrRect& rect,
+void GrDrawTarget::drawRect(const GrRect& rect,
const GrMatrix* matrix,
const GrRect* srcRects[],
const GrMatrix* srcMatrices[]) {
@@ -1038,7 +1038,7 @@ void GrDrawTarget::drawRect(const GrRect& rect,
return;
}
- SetRectVertices(rect, matrix, srcRects,
+ SetRectVertices(rect, matrix, srcRects,
srcMatrices, layout, geo.vertices());
drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4);
@@ -1061,10 +1061,10 @@ GrVertexLayout GrDrawTarget::GetRectVertexLayout(const GrRect* srcRects[]) {
}
void GrDrawTarget::SetRectVertices(const GrRect& rect,
- const GrMatrix* matrix,
- const GrRect* srcRects[],
+ const GrMatrix* matrix,
+ const GrRect* srcRects[],
const GrMatrix* srcMatrices[],
- GrVertexLayout layout,
+ GrVertexLayout layout,
void* vertices) {
#if GR_DEBUG
// check that the layout and srcRects agree
@@ -1189,7 +1189,7 @@ GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry(
fTarget = NULL;
this->set(target, vertexLayout, vertexCount, indexCount);
}
-
+
GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry() {
fTarget = NULL;
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 030b0921d5..5f241a6bff 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -114,7 +114,7 @@ public:
* 1. The caller intends to somehow specify coverage. This can be
* specified either by enabling a coverage stage on the GrDrawState or
* via the vertex layout.
- * 2. Other than enabling coverage stages, the current configuration of
+ * 2. Other than enabling coverage stages, the current configuration of
* the target's GrDrawState is as it will be at draw time.
* 3. If a vertex source has not yet been specified then all stages with
* non-NULL textures will be referenced by the vertex layout.
@@ -131,7 +131,7 @@ public:
bool canTweakAlphaForCoverage() const;
/**
- * Given the current draw state and hw support, will HW AA lines be used
+ * Given the current draw state and hw support, will HW AA lines be used
* (if line primitive type is drawn)? If a vertex source has not yet been
* specified then the function assumes that all stages with non-NULL
* textures will be referenced by the vertex layout.
@@ -143,7 +143,7 @@ public:
* Flags that indicate the layout of vertex data. Vertices always contain
* positions and may also contain up to GrDrawState::kMaxTexCoords sets
* of 2D texture coordinates, per-vertex colors, and per-vertex coverage.
- * Each stage can
+ * Each stage can
* use any of the texture coordinates as its input texture coordinates or it
* may use the positions as texture coordinates.
*
@@ -154,8 +154,8 @@ public:
* example StageTexCoordVertexLayoutBit(0, 2) and
* StagePosAsTexCoordVertexLayoutBit(0) cannot both be specified.
*
- * The order in memory is always (position, texture coord 0, ..., color,
- * coverage) with any unused fields omitted. Note that this means that if
+ * The order in memory is always (position, texture coord 0, ..., color,
+ * coverage) with any unused fields omitted. Note that this means that if
* only texture coordinates 1 is referenced then there is no texture
* coordinates 0 and the order would be (position, texture coordinate 1
* [, color][, coverage]).
@@ -238,7 +238,7 @@ public:
* that the draw target make room for some amount of vertex and/or index
* data. The target provides ptrs to hold the vertex and/or index data.
*
- * The data is writable up until the next drawIndexed, drawNonIndexed,
+ * The data is writable up until the next drawIndexed, drawNonIndexed,
* drawIndexedInstances, or pushGeometrySource. At this point the data is
* frozen and the ptrs are no longer valid.
*
@@ -247,7 +247,7 @@ public:
*
* 3. Vertex and Index Buffers. This is most useful for geometry that will
* is long-lived. When the data in the buffer is consumed depends on the
- * GrDrawTarget subclass. For deferred subclasses the caller has to
+ * GrDrawTarget subclass. For deferred subclasses the caller has to
* guarantee that the data is still available in the buffers at playback.
* (TODO: Make this more automatic as we have done for read/write pixels)
*/
@@ -255,7 +255,7 @@ public:
/**
* Reserves space for vertices and/or indices. Zero can be specifed as
* either the vertex or index count if the caller desires to only reserve
- * space for only indices or only vertices. If zero is specifed for
+ * space for only indices or only vertices. If zero is specifed for
* vertexCount then the vertex source will be unmodified and likewise for
* indexCount.
*
@@ -276,7 +276,7 @@ public:
* 0.
* @param indexCount the number of indices to reserve space for. Can be 0.
* @param vertices will point to reserved vertex space if vertexCount is
- * non-zero. Illegal to pass NULL if vertexCount > 0.
+ * non-zero. Illegal to pass NULL if vertexCount > 0.
* @param indices will point to reserved index space if indexCount is
* non-zero. Illegal to pass NULL if indexCount > 0.
*/
@@ -352,7 +352,7 @@ public:
* before indexed draw call.
*/
void setIndexSourceToBuffer(const GrIndexBuffer* buffer);
-
+
/**
* Resets vertex source. Drawing from reset vertices is illegal. Set vertex
* source to reserved, array, or buffer before next draw. May be able to free
@@ -360,7 +360,7 @@ public:
* reserveVertexSpace.
*/
void resetVertexSource();
-
+
/**
* Resets index source. Indexed Drawing from reset indices is illegal. Set
* index source to reserved, array, or buffer before next indexed draw. May
@@ -368,7 +368,7 @@ public:
* or reserveIndexSpace.
*/
void resetIndexSource();
-
+
/**
* Query to find out if the vertex or index source is reserved.
*/
@@ -497,11 +497,11 @@ public:
}
/**
- * Clear the current render target if one isn't passed in. Ignores the
- * clip and all other draw state (blend mode, stages, etc). Clears the
+ * Clear the current render target if one isn't passed in. Ignores the
+ * clip and all other draw state (blend mode, stages, etc). Clears the
* whole thing if rect is NULL, otherwise just the rect.
*/
- virtual void clear(const GrIRect* rect,
+ virtual void clear(const GrIRect* rect,
GrColor color,
GrRenderTarget* renderTarget = NULL) = 0;
@@ -534,7 +534,7 @@ public:
* // Therefore, rt is set on the GrDrawState
* // that will be restored after asr's
* // destructor rather than target's current
- * // GrDrawState.
+ * // GrDrawState.
*/
class AutoStateRestore : ::GrNoncopyable {
public:
@@ -573,7 +573,7 @@ public:
////////////////////////////////////////////////////////////////////////////
- /**
+ /**
* Sets the view matrix to I and preconcats all stage matrices enabled in
* mask by the view inverse. Destructor undoes these changes.
*/
@@ -622,7 +622,7 @@ public:
private:
void reset();
-
+
GrDrawTarget* fTarget;
void* fVertices;
void* fIndices;
@@ -644,9 +644,9 @@ public:
GrDrawTarget* fTarget;
const GrClipData* fClip;
};
-
+
////////////////////////////////////////////////////////////////////////////
-
+
class AutoGeometryPush : ::GrNoncopyable {
public:
AutoGeometryPush(GrDrawTarget* target) {
@@ -906,7 +906,7 @@ protected:
kArray_GeometrySrcType, //<! src was set using set*SourceToArray
kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer
};
-
+
struct GeometrySrcState {
GeometrySrcType fVertexSrc;
union {
@@ -915,7 +915,7 @@ protected:
// valid if src type is reserved or array
int fVertexCount;
};
-
+
GeometrySrcType fIndexSrc;
union {
// valid if src type is buffer
@@ -923,7 +923,7 @@ protected:
// valid if src type is reserved or array
int fIndexCount;
};
-
+
GrVertexLayout fVertexLayout;
};
@@ -952,7 +952,7 @@ protected:
virtual void willReserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
int vertexCount,
int indexCount) {}
-
+
// implemented by subclass to allocate space for reserved geom
virtual bool onReserveVertexSpace(GrVertexLayout vertexLayout,
@@ -1021,7 +1021,7 @@ protected:
Caps fCaps;
// subclasses must call this in their destructors to ensure all vertex
- // and index sources have been released (including those held by
+ // and index sources have been released (including those held by
// pushGeometrySource())
void releaseGeometry();
@@ -1031,7 +1031,7 @@ private:
int vertexCount,
void** vertices);
bool reserveIndexSpace(int indexCount, void** indices);
-
+
// called by drawIndexed and drawNonIndexed. Use a negative indexCount to
// indicate non-indexed drawing.
bool checkDraw(GrPrimitiveType type, int startVertex,
@@ -1040,11 +1040,11 @@ private:
// called when setting a new vert/idx source to unref prev vb/ib
void releasePreviousVertexSource();
void releasePreviousIndexSource();
-
+
enum {
kPreallocGeoSrcStateStackCnt = 4,
};
- SkSTArray<kPreallocGeoSrcStateStackCnt,
+ SkSTArray<kPreallocGeoSrcStateStackCnt,
GeometrySrcState, true> fGeoSrcStateStack;
typedef GrRefCnt INHERITED;
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 923f711cc7..f38b819556 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -147,7 +147,7 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
const void* srcData, size_t rowBytes) {
this->handleDirtyContext();
GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes);
- if (NULL != tex &&
+ if (NULL != tex &&
(kRenderTarget_GrTextureFlagBit & desc.fFlags) &&
!(kNoStencil_GrTextureFlagBit & desc.fFlags)) {
GrAssert(NULL != tex->asRenderTarget());
@@ -162,7 +162,7 @@ GrTexture* GrGpu::createTexture(const GrTextureDesc& desc,
bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
GrAssert(NULL == rt->getStencilBuffer());
- GrStencilBuffer* sb =
+ GrStencilBuffer* sb =
this->getContext()->findStencilBuffer(rt->width(),
rt->height(),
rt->numSamples());
@@ -233,11 +233,11 @@ GrPath* GrGpu::createPath(const SkPath& path) {
return this->onCreatePath(path);
}
-void GrGpu::clear(const GrIRect* rect,
- GrColor color,
+void GrGpu::clear(const GrIRect* rect,
+ GrColor color,
GrRenderTarget* renderTarget) {
GrRenderTarget* oldRT = NULL;
- if (NULL != renderTarget &&
+ if (NULL != renderTarget &&
renderTarget != this->drawState()->getRenderTarget()) {
oldRT = this->drawState()->getRenderTarget();
this->drawState()->setRenderTarget(renderTarget);
@@ -489,12 +489,12 @@ bool GrGpu::onReserveVertexSpace(GrVertexLayout vertexLayout,
int vertexCount,
void** vertices) {
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-
+
GrAssert(vertexCount > 0);
GrAssert(NULL != vertices);
-
+
this->prepareVertexPool();
-
+
*vertices = fVertexPool->makeSpace(vertexLayout,
vertexCount,
&geomPoolState.fPoolVertexBuffer,
@@ -508,7 +508,7 @@ bool GrGpu::onReserveVertexSpace(GrVertexLayout vertexLayout,
bool GrGpu::onReserveIndexSpace(int indexCount, void** indices) {
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-
+
GrAssert(indexCount > 0);
GrAssert(NULL != indices);
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index f502dba23d..d700de506e 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -57,7 +57,7 @@ public:
// The GrContext sets itself as the owner of this Gpu object
void setContext(GrContext* context) {
- GrAssert(NULL == fContext);
+ GrAssert(NULL == fContext);
fContext = context;
fClipMaskManager.setContext(context);
}
@@ -197,7 +197,7 @@ public:
* However, the caller (GrContext) may have transformations to apply and can
* simply fold in the y-flip for free. On the other hand, the subclass may
* be able to do it for free itself. For example, the subclass may have to
- * do memcpys to handle rowBytes that aren't tight. It could do the y-flip
+ * do memcpys to handle rowBytes that aren't tight. It could do the y-flip
* concurrently.
*
* This function returns true if a y-flip is required to put the pixels in
@@ -290,7 +290,7 @@ public:
void removeResource(GrResource* resource);
// GrDrawTarget overrides
- virtual void clear(const GrIRect* rect,
+ virtual void clear(const GrIRect* rect,
GrColor color,
GrRenderTarget* renderTarget = NULL) SK_OVERRIDE;
@@ -321,7 +321,7 @@ public:
* Can the provided configuration act as a color render target?
*/
bool isConfigRenderable(GrPixelConfig config) const {
- GrAssert(kGrPixelConfigCount > config);
+ GrAssert(kGrPixelConfigCount > config);
return fConfigRenderSupport[config];
}
@@ -406,12 +406,12 @@ protected:
struct GeometryPoolState {
const GrVertexBuffer* fPoolVertexBuffer;
int fPoolStartVertex;
-
+
const GrIndexBuffer* fPoolIndexBuffer;
int fPoolStartIndex;
};
- const GeometryPoolState& getGeomPoolState() {
- return fGeomPoolStateStack.back();
+ const GeometryPoolState& getGeomPoolState() {
+ return fGeomPoolStateStack.back();
}
// The state of the scissor is controlled by the clip manager
@@ -453,7 +453,7 @@ protected:
// assumed 3D context state and dirty any state cache.
virtual void onResetContext() = 0;
-
+
// overridden by API-specific derived class to create objects.
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
const void* srcData,
@@ -466,7 +466,7 @@ protected:
bool dynamic) = 0;
virtual GrPath* onCreatePath(const SkPath& path) = 0;
- // overridden by API-specific derivated class to perform the clear and
+ // overridden by API-specific derivated class to perform the clear and
// clearRect. NULL rect means clear whole target.
virtual void onClear(const GrIRect* rect, GrColor color) = 0;
@@ -522,7 +522,7 @@ protected:
// Should attach the SB to the RT. Returns false if compatible sb could
// not be created.
virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,
- int width,
+ int width,
int height) = 0;
// attaches an existing SB to an existing RT.
@@ -540,23 +540,23 @@ protected:
private:
GrContext* fContext; // not reffed (context refs gpu)
-
+
ResetTimestamp fResetTimestamp;
GrVertexBufferAllocPool* fVertexPool;
GrIndexBufferAllocPool* fIndexPool;
-
+
// counts number of uses of vertex/index pool in the geometry stack
int fVertexPoolUseCnt;
int fIndexPoolUseCnt;
-
+
enum {
kPreallocGeomPoolStateStackCnt = 4,
};
SkSTArray<kPreallocGeomPoolStateStackCnt,
GeometryPoolState, true> fGeomPoolStateStack;
-
+
mutable GrIndexBuffer* fQuadIndexBuffer; // mutable so it can be
// created on-demand
diff --git a/src/gpu/GrGpuVertex.h b/src/gpu/GrGpuVertex.h
index d093e2d068..570a77c885 100644
--- a/src/gpu/GrGpuVertex.h
+++ b/src/gpu/GrGpuVertex.h
@@ -15,7 +15,7 @@
#include "GrPoint.h"
#if GR_TEXT_SCALAR_IS_USHORT
- typedef uint16_t GrTextScalar;
+ typedef uint16_t GrTextScalar;
#define GrIntToTextScalar(x) ((uint16_t)x)
#define GrFixedToTextScalar(x) (x)
#elif GR_TEXT_SCALAR_IS_FIXED
@@ -23,7 +23,7 @@
#define GrIntToTextScalar(x) GrIntToFixed(x)
#define GrFixedToTextScalar(x) (x)
#elif GR_TEXT_SCALAR_IS_FLOAT
- typedef float GrTextScalar;
+ typedef float GrTextScalar;
#define GrIntToTextScalar(x) ((GrTextScalar)x)
#define GrFixedToTextScalar(x) GrFixedToFloat(x)
#else
@@ -45,12 +45,12 @@ struct GrGpuTextVertex {
fX = GrIntToTextScalar(x);
fY = GrIntToTextScalar(y);
}
-
+
void setX(GrFixed x, GrFixed y) {
fX = GrFixedToTextScalar(x);
fY = GrFixedToTextScalar(y);
}
-
+
// rect fan is counter-clockwise
void setRectFan(GrTextScalar l, GrTextScalar t, GrTextScalar r,
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index de7f253a21..5cbaab1693 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -22,7 +22,7 @@ struct GrPoint;
/**
* Base class for drawing paths into a GrDrawTarget.
*
- * Derived classes can use stages GrPaint::kTotalStages through
+ * Derived classes can use stages GrPaint::kTotalStages through
* GrDrawState::kNumStages-1. The stages before GrPaint::kTotalStages
* are reserved for setting up the draw (i.e., textures and filter masks).
*/
@@ -75,7 +75,7 @@ public:
/**
* Returns true if this path renderer is able to render the path.
- * Returning false allows the caller to fallback to another path renderer
+ * Returning false allows the caller to fallback to another path renderer
* This function is called when searching for a path renderer capable of
* rendering a path.
*
@@ -92,7 +92,7 @@ public:
bool antiAlias) const = 0;
/**
* Draws the path into the draw target. If requiresStencilBuffer returned
- * false then the target may be setup for stencil rendering (since the
+ * false then the target may be setup for stencil rendering (since the
* path renderer didn't claim that it needs to use the stencil internally).
*
* @param path the path to draw.
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 2d4abe0610..e0ddea868f 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -201,13 +201,13 @@ void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) {
// We invert the control pt matrix and post concat to both sides to get M.
UVpts.setAll(0, GR_ScalarHalf, GR_Scalar1,
0, 0, GR_Scalar1,
- SkScalarToPersp(GR_Scalar1),
- SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
SkScalarToPersp(GR_Scalar1));
m.setAll(qPts[0].fX, qPts[1].fX, qPts[2].fX,
qPts[0].fY, qPts[1].fY, qPts[2].fY,
- SkScalarToPersp(GR_Scalar1),
- SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
SkScalarToPersp(GR_Scalar1));
if (!m.invert(&m)) {
// The quad is degenerate. Hopefully this is rare. Find the pts that are
@@ -348,7 +348,7 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
// When the ab and cd tangents are nearly parallel with vector from d to a the constraint that
// the quad point falls between the tangents becomes hard to enforce and we are likely to hit
// the max subdivision count. However, in this case the cubic is approaching a line and the
- // accuracy of the quad point isn't so important. We check if the two middle cubic control
+ // accuracy of the quad point isn't so important. We check if the two middle cubic control
// points are very close to the baseline vector. If so then we just pick quadratic points on the
// control polygon.
diff --git a/src/gpu/GrPlotMgr.h b/src/gpu/GrPlotMgr.h
index 38589f361c..6dd7114c06 100644
--- a/src/gpu/GrPlotMgr.h
+++ b/src/gpu/GrPlotMgr.h
@@ -32,7 +32,7 @@ public:
delete[] fBusy;
}
}
-
+
void reset() {
Gr_bzero(fBusy, fDim.fX * fDim.fY);
}
diff --git a/src/gpu/GrRectanizer.cpp b/src/gpu/GrRectanizer.cpp
index 8df3b05121..87ea92e27a 100644
--- a/src/gpu/GrRectanizer.cpp
+++ b/src/gpu/GrRectanizer.cpp
@@ -38,7 +38,7 @@ public:
struct Row {
GrIPoint16 fLoc;
int fRowHeight;
-
+
bool canAddWidth(int width, int containerWidth) const {
return fLoc.fX + width <= containerWidth;
}
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index 44b15e20aa..c7807691d4 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -39,22 +39,22 @@ class GrDrawTarget;
*/
class GrSWMaskHelper : public GrNoncopyable {
public:
- GrSWMaskHelper(GrContext* context)
+ GrSWMaskHelper(GrContext* context)
: fContext(context) {
}
// set up the internal state in preparation for draws. Since many masks
- // may be accumulated in the helper during creation, "resultBounds"
- // allows the caller to specify the region of interest - to limit the
+ // may be accumulated in the helper during creation, "resultBounds"
+ // allows the caller to specify the region of interest - to limit the
// amount of work.
bool init(const GrIRect& resultBounds, const GrMatrix* matrix);
// Draw a single rect into the accumulation bitmap using the specified op
- void draw(const GrRect& rect, SkRegion::Op op,
+ void draw(const GrRect& rect, SkRegion::Op op,
bool antiAlias, uint8_t alpha);
// Draw a single path into the accumuation bitmap using the specified op
- void draw(const SkPath& path, SkRegion::Op op,
+ void draw(const SkPath& path, SkRegion::Op op,
GrPathFill fill, bool antiAlias, uint8_t alpha);
// Helper function to get a scratch texture suitable for capturing the
@@ -80,14 +80,14 @@ public:
GrMatrix* matrix);
// This utility routine is used to add a path's mask to some other draw.
- // The ClipMaskManager uses it to accumulate clip masks while the
+ // The ClipMaskManager uses it to accumulate clip masks while the
// GrSoftwarePathRenderer uses it to fulfill a drawPath call.
- // It draws with "texture" as a path mask into "target" using "rect" as
+ // It draws with "texture" as a path mask into "target" using "rect" as
// geometry and the current drawState. The current drawState is altered to
// accommodate the mask.
- // Note that this method assumes that the GrPaint::kTotalStages slot in
+ // Note that this method assumes that the GrPaint::kTotalStages slot in
// the draw state can be used to hold the mask texture stage.
- // This method is really only intended to be used with the
+ // This method is really only intended to be used with the
// output of DrawPathMaskToTexture.
static void DrawToTargetWithPathMask(GrTexture* texture,
GrDrawTarget* target,
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 16b859fef1..edac161c91 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -19,7 +19,7 @@ bool GrSoftwarePathRenderer::canDrawPath(const SkPath& path,
// TODO: We could allow the SW path to also handle non-AA paths but
// this would mean that GrDefaultPathRenderer would never be called
// (since it appears after the SW renderer in the path renderer
- // chain). Some testing would need to be done r.e. performance
+ // chain). Some testing would need to be done r.e. performance
// and consistency of the resulting images before removing
// the "!antiAlias" clause from the above test
return false;
@@ -32,7 +32,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
// gets device coord bounds of path (not considering the fill) and clip. The
-// path bounds will be a subset of the clip bounds. returns false if
+// path bounds will be a subset of the clip bounds. returns false if
// path bounds would be empty.
bool get_path_and_clip_bounds(const GrDrawTarget* target,
const SkPath& path,
@@ -48,7 +48,7 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
target->getClip()->getConservativeBounds(rt, devClipBounds);
- // TODO: getConservativeBounds already intersects with the
+ // TODO: getConservativeBounds already intersects with the
// render target's bounding box. Remove this next line
if (!devPathBounds->intersect(*devClipBounds)) {
return false;
@@ -81,22 +81,22 @@ void draw_around_inv_path(GrDrawTarget* target,
}
GrRect rect;
if (devClipBounds.fTop < devPathBounds.fTop) {
- rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
+ rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
+ rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
- rect.iset(devPathBounds.fRight, devPathBounds.fTop,
+ rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
- rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
+ rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
target->drawSimpleRect(rect, NULL);
}
@@ -133,8 +133,8 @@ bool GrSoftwarePathRenderer::onDrawPath(const SkPath& path,
}
SkAutoTUnref<GrTexture> texture(
- GrSWMaskHelper::DrawPathMaskToTexture(fContext, path,
- devPathBounds, fill,
+ GrSWMaskHelper::DrawPathMaskToTexture(fContext, path,
+ devPathBounds, fill,
antiAlias, &vm));
if (NULL == texture) {
return false;
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 6e18b5907c..7884cbb35b 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -20,7 +20,7 @@ class GrAutoScratchTexture;
*/
class GrSoftwarePathRenderer : public GrPathRenderer {
public:
- GrSoftwarePathRenderer(GrContext* context)
+ GrSoftwarePathRenderer(GrContext* context)
: fContext(context) {
}
@@ -34,7 +34,7 @@ protected:
const GrVec* translate,
GrDrawTarget* target,
bool antiAlias) SK_OVERRIDE;
-
+
private:
GrContext* fContext;
diff --git a/src/gpu/GrStencil.h b/src/gpu/GrStencil.h
index b4aa70e554..1af98e6a8b 100644
--- a/src/gpu/GrStencil.h
+++ b/src/gpu/GrStencil.h
@@ -274,7 +274,7 @@ public:
fFlags |= writes ? kDoesWrite_StencilFlag : kDoesNotWrite_StencilFlag;
return writes;
}
-
+
void invalidate() {
// write an illegal value to the first member
fPassOps[0] = (GrStencilOp)(uint8_t)-1;
@@ -284,18 +284,18 @@ public:
bool operator == (const GrStencilSettings& s) const {
static const size_t gCompareSize = sizeof(GrStencilSettings) -
sizeof(fFlags);
- GrAssert((const char*)&fFlags + sizeof(fFlags) ==
+ GrAssert((const char*)&fFlags + sizeof(fFlags) ==
(const char*)this + sizeof(GrStencilSettings));
if (this->isDisabled() & s.isDisabled()) { // using & not &&
return true;
}
return 0 == memcmp(this, &s, gCompareSize);
}
-
+
bool operator != (const GrStencilSettings& s) const {
return !(*this == s);
}
-
+
GrStencilSettings& operator =(const GrStencilSettings& s) {
memcpy(this, &s, sizeof(GrStencilSettings));
return *this;
@@ -305,7 +305,7 @@ private:
friend class GrClipMaskManager;
enum {
- kMaxStencilClipPasses = 2 // maximum number of passes to add a clip
+ kMaxStencilClipPasses = 2 // maximum number of passes to add a clip
// element to the stencil buffer.
};
@@ -316,15 +316,15 @@ private:
* needs to be drawn to the client portion of the stencil first.
* 2. How many passes are needed.
* 3. What those passes are.
- * 4. The fill rule that should actually be used to render (will
+ * 4. The fill rule that should actually be used to render (will
* always be non-inverted).
*
- * @param op the set op to combine this element with the
+ * @param op the set op to combine this element with the
* existing clip
* @param stencilClipMask mask with just the stencil bit used for clipping
* enabled.
* @param invertedFill is this path inverted
- * @param numPasses out: the number of passes needed to add the
+ * @param numPasses out: the number of passes needed to add the
* element to the clip.
* @param settings out: the stencil settings to use for each pass
*
@@ -332,7 +332,7 @@ private:
* stencil clip bit. Will only be true if canBeDirect is true.
* numPasses will be 1 if return value is true.
*/
- static bool GetClipPasses(SkRegion::Op op,
+ static bool GetClipPasses(SkRegion::Op op,
bool canBeDirect,
unsigned int stencilClipMask,
bool invertedFill,
diff --git a/src/gpu/GrStencilBuffer.cpp b/src/gpu/GrStencilBuffer.cpp
index 7f733f4f0f..bf14f4864e 100644
--- a/src/gpu/GrStencilBuffer.cpp
+++ b/src/gpu/GrStencilBuffer.cpp
@@ -62,7 +62,7 @@ void GrStencilBuffer::unlockInCache() {
namespace {
// we should never have more than one stencil buffer with same combo of
// (width,height,samplecount)
-void gen_stencil_key_values(int width,
+void gen_stencil_key_values(int width,
int height,
int sampleCnt,
GrCacheID* cacheID) {
@@ -77,8 +77,8 @@ void gen_stencil_key_values(int width,
}
}
-GrResourceKey GrStencilBuffer::ComputeKey(int width,
- int height,
+GrResourceKey GrStencilBuffer::ComputeKey(int width,
+ int height,
int sampleCnt) {
GrCacheID id(GrStencilBuffer::GetResourceType());
gen_stencil_key_values(width, height, sampleCnt, &id);
diff --git a/src/gpu/GrTBSearch.h b/src/gpu/GrTBSearch.h
index 2697f3733b..1d77c958c1 100644
--- a/src/gpu/GrTBSearch.h
+++ b/src/gpu/GrTBSearch.h
@@ -18,7 +18,7 @@ int GrTBSearch(const ELEM array[], int count, KEY target) {
// we should insert it at 0
return ~0;
}
-
+
int high = count - 1;
int low = 0;
while (high > low) {
@@ -29,12 +29,12 @@ int GrTBSearch(const ELEM array[], int count, KEY target) {
high = index;
}
}
-
+
// check if we found it
if (EQ(array[high], target)) {
return high;
}
-
+
// now return the ~ of where we should insert it
if (LT(array[high], target)) {
high += 1;
diff --git a/src/gpu/GrTDArray.h b/src/gpu/GrTDArray.h
index 731001a8c9..0e5b6bb987 100644
--- a/src/gpu/GrTDArray.h
+++ b/src/gpu/GrTDArray.h
@@ -72,7 +72,7 @@ public:
T* begin() const { return fArray; }
T* end() const { return fArray + fCount; }
- T* back() const { GrAssert(fCount); return fArray + (fCount - 1); }
+ T* back() const { GrAssert(fCount); return fArray + (fCount - 1); }
T* prepend() {
this->growAt(0);
diff --git a/src/gpu/GrTLList.h b/src/gpu/GrTLList.h
index ea310ac20e..e875118d2d 100644
--- a/src/gpu/GrTLList.h
+++ b/src/gpu/GrTLList.h
@@ -30,7 +30,7 @@ public:
T* head() const { return fHead; }
T* tail() const { return fTail; }
-
+
void addToHead(T*);
void addToTail(T*);
void removeFromList(T*);
diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h
index 4378d70949..69720dc111 100644
--- a/src/gpu/GrTemplates.h
+++ b/src/gpu/GrTemplates.h
@@ -40,20 +40,20 @@ template <typename Dst, typename Src> Dst GrTCast(Src src) {
template <typename T> class GrAutoTRestore : public GrNoncopyable {
public:
GrAutoTRestore() : fPtr(NULL), fVal() {}
-
+
GrAutoTRestore(T* ptr) {
fPtr = ptr;
if (NULL != ptr) {
fVal = *ptr;
}
}
-
+
~GrAutoTRestore() {
if (NULL != fPtr) {
*fPtr = fVal;
}
}
-
+
// restores previously saved value (if any) and saves value for passed T*
void reset(T* ptr) {
if (NULL != fPtr) {
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 23b16dd3ae..edd92db088 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -111,10 +111,10 @@ GrTextContext::GrTextContext(GrContext* context,
/*
We need to call preConcatMatrix with our viewmatrix's inverse, for each
- texture and mask in the paint. However, computing the inverse can be
+ texture and mask in the paint. However, computing the inverse can be
expensive, and its possible we may not have any textures or masks, so these
two loops are written such that we only compute the inverse (once) if we
- need it. We do this on our copy of the paint rather than directly on the
+ need it. We do this on our copy of the paint rather than directly on the
draw target because we re-provide the paint to the context when we have
to flush our glyphs or draw a glyph as a path midstream.
*/
@@ -142,7 +142,7 @@ GrTextContext::GrTextContext(GrContext* context,
fVertices = NULL;
fMaxVertices = 0;
- fVertexLayout =
+ fVertexLayout =
GrDrawTarget::kTextFormat_VertexLayoutBit |
GrDrawTarget::StageTexCoordVertexLayoutBit(kGlyphMaskStage, 0);
}
@@ -272,7 +272,7 @@ HAS_ATLAS:
fMaxVertices = maxQuadVertices;
}
bool success = fDrawTarget->reserveVertexAndIndexSpace(
- fVertexLayout,
+ fVertexLayout,
fMaxVertices,
0,
GrTCast<void**>(&fVertices),
diff --git a/src/gpu/GrTextStrike_impl.h b/src/gpu/GrTextStrike_impl.h
index 1b6392c1fe..a3f37b3a7b 100644
--- a/src/gpu/GrTextStrike_impl.h
+++ b/src/gpu/GrTextStrike_impl.h
@@ -16,16 +16,16 @@ public:
Key(GrFontScaler* scaler) {
fFontScalerKey = scaler->getKey();
}
-
+
uint32_t getHash() const { return fFontScalerKey->getHash(); }
-
+
static bool LT(const GrTextStrike& strike, const Key& key) {
return *strike.getFontScalerKey() < *key.fFontScalerKey;
}
static bool EQ(const GrTextStrike& strike, const Key& key) {
return *strike.getFontScalerKey() == *key.fFontScalerKey;
}
-
+
private:
const GrKey* fFontScalerKey;
};
@@ -50,7 +50,7 @@ void GrFontCache::detachStrikeFromList(GrTextStrike* strike) {
GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
this->validate();
-
+
Key key(scaler);
GrTextStrike* strike = fCache.find(key);
if (NULL == strike) {
@@ -79,16 +79,16 @@ GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
class GrTextStrike::Key {
public:
Key(GrGlyph::PackedID id) : fPackedID(id) {}
-
+
uint32_t getHash() const { return fPackedID; }
-
+
static bool LT(const GrGlyph& glyph, const Key& key) {
return glyph.fPackedID < key.fPackedID;
}
static bool EQ(const GrGlyph& glyph, const Key& key) {
return glyph.fPackedID == key.fPackedID;
}
-
+
private:
GrGlyph::PackedID fPackedID;
};
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 182c90e5d2..ce6109bf4a 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -17,7 +17,7 @@
SK_DEFINE_INST_COUNT(GrTexture)
GR_DEFINE_RESOURCE_CACHE_TYPE(GrTexture)
-/**
+/**
* This method allows us to interrupt the normal deletion process and place
* textures back in the texture cache when their ref count goes to zero.
*/
@@ -31,7 +31,7 @@ void GrTexture::internal_dispose() const {
nonConstThis->resetFlag((GrTextureFlags) kReturnToCache_FlagBit);
nonConstThis->INHERITED::getContext()->addExistingTextureToCache(nonConstThis);
- // Note: "this" texture might be freed inside addExistingTextureToCache
+ // Note: "this" texture might be freed inside addExistingTextureToCache
// if it is purged.
return;
}
@@ -117,7 +117,7 @@ void GrTexture::validateDesc() const {
enum TextureBits {
/*
* The kNPOT bit is set when the texture is NPOT and is being repeated
- * but the hardware doesn't support that feature.
+ * but the hardware doesn't support that feature.
*/
kNPOT_TextureBit = 0x1,
/*
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index f7e5152482..556608659b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -59,7 +59,7 @@ enum {
// all the blur tests.
#define BLUR_SIGMA_SCALE 0.6f
// This constant represents the screen alignment criterion in texels for
-// requiring texture domain clamping to prevent color bleeding when drawing
+// requiring texture domain clamping to prevent color bleeding when drawing
// a sub region of a larger source image.
#define COLOR_BLEED_TOLERANCE SkFloatToScalar(0.001f)
@@ -84,7 +84,7 @@ public:
SkAutoCachedTexture()
: fDevice(NULL)
, fTexture(NULL) {
- }
+ }
SkAutoCachedTexture(SkGpuDevice* device,
const SkBitmap& bitmap,
@@ -118,7 +118,7 @@ public:
}
return result;
}
-
+
private:
SkGpuDevice* fDevice;
GrTexture* fTexture;
@@ -199,7 +199,7 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context,
// if this RT is also a texture, hold a ref on it
fTexture = fRenderTarget->asTexture();
SkSafeRef(fTexture);
-
+
// Create a pixel ref for the underlying SkBitmap. We prefer a texture pixel
// ref to a render target pixel reft. The pixel ref may get ref'ed outside
// the device via accessBitmap. This external ref may outlive the device.
@@ -267,7 +267,7 @@ SkGpuDevice::~SkGpuDevice() {
}
// The SkGpuDevice gives the context the render target (e.g., in gainFocus)
- // This call gives the context a chance to relinquish it
+ // This call gives the context a chance to relinquish it
fContext->setRenderTarget(NULL);
SkSafeUnref(fTexture);
@@ -599,7 +599,7 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
constantColor,
&textures[kColorFilterTextureIdx],
grPaint);
- } else if (!skPaint2GrPaintNoShader(dev, skPaint, true, false,
+ } else if (!skPaint2GrPaintNoShader(dev, skPaint, true, false,
&textures[kColorFilterTextureIdx], grPaint)) {
return false;
}
@@ -1120,7 +1120,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
if (!drawWithGPUMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
&grPaint, pathFillType)) {
- SkPaint::Style style = doFill ? SkPaint::kFill_Style :
+ SkPaint::Style style = doFill ? SkPaint::kFill_Style :
SkPaint::kStroke_Style;
drawWithMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
@@ -1371,7 +1371,7 @@ bool hasAlignedSamples(const SkRect& srcRect, const SkRect& transformedRect) {
// detect pixel disalignment
if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) -
transformedRect.left()) < COLOR_BLEED_TOLERANCE &&
- SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) -
+ SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) -
transformedRect.top()) < COLOR_BLEED_TOLERANCE &&
SkScalarAbs(transformedRect.width() - srcRect.width()) <
COLOR_BLEED_TOLERANCE &&
@@ -1387,7 +1387,7 @@ bool mayColorBleed(const SkRect& srcRect, const SkRect& transformedRect,
// Only gets called if hasAlignedSamples returned false.
// So we can assume that sampling is axis aligned but not texel aligned.
GrAssert(!hasAlignedSamples(srcRect, transformedRect));
- SkRect innerSrcRect(srcRect), innerTransformedRect,
+ SkRect innerSrcRect(srcRect), innerTransformedRect,
outerTransformedRect(transformedRect);
innerSrcRect.inset(SK_ScalarHalf, SK_ScalarHalf);
m.mapRect(&innerTransformedRect, innerSrcRect);
@@ -1453,7 +1453,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
SkFloatToScalar(srcRect.fRight * wInv),
SkFloatToScalar(srcRect.fBottom * hInv));
- bool needsTextureDomain = false;
+ bool needsTextureDomain = false;
if (sampler->textureParams()->isBilerp()) {
// Need texture domain if drawing a sub rect.
needsTextureDomain = srcRect.width() < bitmap.width() || srcRect.height() < bitmap.height();
@@ -1464,7 +1464,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
SkMatrix srcToDeviceMatrix(m);
srcToDeviceMatrix.postConcat(*draw.fMatrix);
srcToDeviceMatrix.mapRect(&transformedRect, floatSrcRect);
-
+
if (hasAlignedSamples(floatSrcRect, transformedRect)) {
// Samples are texel-aligned, so filtering is futile
sampler->textureParams()->setBilerp(false);
@@ -1474,7 +1474,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
mayColorBleed(floatSrcRect, transformedRect, m);
}
}
- }
+ }
GrRect textureDomain = GrRect::MakeEmpty();
@@ -1495,7 +1495,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
} else {
top = bottom = GrScalarHalf(paintRect.top() + paintRect.bottom());
}
- textureDomain.setLTRB(left, top, right, bottom);
+ textureDomain.setLTRB(left, top, right, bottom);
sampler->setCustomStage(SkNEW_ARGS(GrTextureDomainEffect,
(texture,
textureDomain)))->unref();
@@ -1589,7 +1589,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
filteredTexture->unref();
}
}
-
+
fContext->drawRectToRect(grPaint,
GrRect::MakeXYWH(GrIntToScalar(left),
GrIntToScalar(top),
@@ -1633,7 +1633,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
filteredTexture->unref();
}
}
-
+
const SkBitmap& bm = dev->accessBitmap(false);
int w = bm.width();
int h = bm.height();
@@ -1682,7 +1682,7 @@ bool SkGpuDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
SkAutoCachedTexture act(this, src, sampler->textureParams(), &texture);
result->setConfig(src.config(), src.width(), src.height());
- GrRect rect = GrRect::MakeWH(SkIntToScalar(src.width()),
+ GrRect rect = GrRect::MakeWH(SkIntToScalar(src.width()),
SkIntToScalar(src.height()));
GrTexture* resultTexture = filter_texture(fContext, texture, filter, rect);
if (resultTexture) {
diff --git a/src/gpu/gl/GrGLPath.h b/src/gpu/gl/GrGLPath.h
index f9febb46b6..dfe3405443 100644
--- a/src/gpu/gl/GrGLPath.h
+++ b/src/gpu/gl/GrGLPath.h
@@ -26,7 +26,7 @@ public:
GrGLPath(GrGpuGL* gpu, const SkPath& path);
virtual ~GrGLPath();
GrGLuint pathID() const { return fPathID; }
- // TODO: Figure out how to get an approximate size of the path in Gpu
+ // TODO: Figure out how to get an approximate size of the path in Gpu
// memory.
virtual size_t sizeInBytes() const SK_OVERRIDE { return 100; }
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 989b7c67b4..b755f7571d 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -127,17 +127,17 @@ public:
/**
Smear alpha across all four channels. This is incompatible with
- kSwapRAndB, kMulRGBByAlpha* and kSmearRed. It is prefereable
- to perform the smear outside the shader using
- GL_ARB_texture_swizzle if possible rather than setting this
+ kSwapRAndB, kMulRGBByAlpha* and kSmearRed. It is prefereable
+ to perform the smear outside the shader using
+ GL_ARB_texture_swizzle if possible rather than setting this
flag.
*/
kSmearAlpha_InConfigFlag = 0x02,
/**
- Smear the red channel across all four channels. This flag is
- incompatible with kSwapRAndB, kMulRGBByAlpha*and kSmearAlpha.
- It is preferable to use GL_ARB_texture_swizzle instead of this
+ Smear the red channel across all four channels. This flag is
+ incompatible with kSwapRAndB, kMulRGBByAlpha*and kSmearAlpha.
+ It is preferable to use GL_ARB_texture_swizzle instead of this
flag.
*/
kSmearRed_InConfigFlag = 0x04,
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index 1095d53ca3..2e9ee173c8 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -83,7 +83,7 @@ public:
virtual void invalidateCachedState() SK_OVERRIDE { fTexParams.invalidate(); }
- // these functions
+ // these functions
const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const {
*timestamp = fTexParamsTimestamp;
return fTexParams;
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index ae19b2ef13..2cfdd0d5f5 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -27,7 +27,7 @@ public:
GrGpuGL(const GrGLContextInfo& ctxInfo);
virtual ~GrGpuGL();
- const GrGLInterface* glInterface() const {
+ const GrGLInterface* glInterface() const {
return fGLContextInfo.interface();
}
GrGLBinding glBinding() const { return fGLContextInfo.binding(); }
@@ -84,9 +84,9 @@ protected:
virtual void onForceRenderTargetFlush() SK_OVERRIDE;
virtual bool onReadPixels(GrRenderTarget* target,
- int left, int top,
+ int left, int top,
int width, int height,
- GrPixelConfig,
+ GrPixelConfig,
void* buffer,
size_t rowBytes,
bool invertY) SK_OVERRIDE;
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index 4b55a5d031..ef8eccc2b9 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -25,7 +25,7 @@
const GrGLInterface* GrGLCreateNativeInterface() {
// wglGetProcAddress requires a context.
// GL Function pointers retrieved in one context may not be valid in another
- // context. For that reason we create a new GrGLInterface each time we're
+ // context. For that reason we create a new GrGLInterface each time we're
// called.
if (NULL != wglGetCurrentContext()) {
const char* versionString = (const char*) glGetString(GL_VERSION);
@@ -118,7 +118,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GR_GL_GET_PROC(GetQueryiv);
GR_GL_GET_PROC(GetQueryObjectiv);
GR_GL_GET_PROC(GetQueryObjectuiv);
- if (glVer > GR_GL_VER(3,3) ||
+ if (glVer > GR_GL_VER(3,3) ||
GrGLHasExtensionFromString("GL_ARB_timer_query", extString)) {
GR_GL_GET_PROC(GetQueryObjecti64v);
GR_GL_GET_PROC(GetQueryObjectui64v);
@@ -166,7 +166,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (glVer > GR_GL_VER(3,0) ||
+ if (glVer > GR_GL_VER(3,0) ||
GrGLHasExtensionFromString("GL_ARB_framebuffer_object", extString)) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
diff --git a/src/gpu/gl/win/SkNativeGLContext_win.cpp b/src/gpu/gl/win/SkNativeGLContext_win.cpp
index 9650bc1199..00829207ac 100644
--- a/src/gpu/gl/win/SkNativeGLContext_win.cpp
+++ b/src/gpu/gl/win/SkNativeGLContext_win.cpp
@@ -84,7 +84,7 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
this->destroyGLContext();
return NULL;
}
-
+
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory(&pfd, sizeof(pfd));
pfd.nSize = sizeof(pfd);
@@ -95,20 +95,20 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
pfd.cDepthBits = 0;
pfd.cStencilBits = 0;
pfd.iLayerType = PFD_MAIN_PLANE;
-
+
int pixelFormat = 0;
if (!(pixelFormat = ChoosePixelFormat(fDeviceContext, &pfd))) {
SkDebugf("No matching pixel format descriptor.\n");
this->destroyGLContext();
return NULL;
}
-
+
if (!SetPixelFormat(fDeviceContext, pixelFormat, &pfd)) {
SkDebugf("Could not set the pixel format %d.\n", pixelFormat);
this->destroyGLContext();
return NULL;
}
-
+
if (!(fGlRenderContext = wglCreateContext(fDeviceContext))) {
SkDebugf("Could not create rendering context.\n");
this->destroyGLContext();
diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp
index 4d11721c3f..a0f0c183e1 100644
--- a/src/gpu/gr_unittests.cpp
+++ b/src/gpu/gr_unittests.cpp
@@ -101,7 +101,7 @@ static void test_binHashKey()
GrTBinHashKey<BogusEntry, kDataLenUsedForKey> keyB;
keyB.setKeyData(testStringB);
GrAssert(keyA.compare(keyB) < 0);
- GrAssert(keyA.getHash() != keyB.getHash());
+ GrAssert(keyA.getHash() != keyB.getHash());
}
diff --git a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
index 19d7ae0726..ae43d982c0 100644
--- a/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
+++ b/src/gpu/ios/GrGLDefaultInterface_iOS.cpp
@@ -123,18 +123,18 @@ const GrGLInterface* GrGLDefaultInterface() {
interface->fDeleteRenderbuffers = glDeleteRenderbuffers;
interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer;
interface->fBindRenderbuffer = glBindRenderbuffer;
-
+
#if GL_OES_mapbuffer
interface->fMapBuffer = glMapBufferOES;
interface->fUnmapBuffer = glUnmapBufferOES;
#endif
-
+
#if GL_APPLE_framebuffer_multisample
interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleAPPLE;
interface->fResolveMultisampleFramebuffer = glResolveMultisampleFramebufferAPPLE;
#endif
interface->fBindFragDataLocationIndexed = NULL;
-
+
interface->fBindingsExported = kES2_GrGLBinding;
}
glInterface.get()->ref();
diff --git a/src/images/SkFlipPixelRef.cpp b/src/images/SkFlipPixelRef.cpp
index 4e42d6c909..f3f54e85c8 100644
--- a/src/images/SkFlipPixelRef.cpp
+++ b/src/images/SkFlipPixelRef.cpp
@@ -86,7 +86,7 @@ static void copyRect(const SkBitmap& dst, const SkIRect& rect,
const char* srcP = static_cast<const char*>(srcAddr) + offset;
const size_t rb = dst.rowBytes();
const size_t bytes = rect.width() << shift;
-
+
int height = rect.height();
while (--height >= 0) {
memcpy(dstP, srcP, bytes);
@@ -116,10 +116,10 @@ void SkFlipPixelRef::CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip,
if (shift < 0) {
return;
}
-
+
const SkIRect bounds = {0, 0, dst.width(), dst.height()};
SkRegion::Cliperator iter(clip, bounds);
-
+
while (!iter.done()) {
copyRect(dst, iter.rect(), srcAddr, shift);
iter.next();
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index d3bb871111..2cbdcc33f0 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
-
+
#include "bmpdecoderhelper.h"
#include "SkImageDecoder.h"
#include "SkScaledBitmapSampler.h"
@@ -18,7 +18,7 @@
class SkBMPImageDecoder : public SkImageDecoder {
public:
SkBMPImageDecoder() {}
-
+
virtual Format getFormat() const {
return kBMP_Format;
}
@@ -33,10 +33,10 @@ DEFINE_DECODER_CREATOR(BMPImageDecoder);
static SkImageDecoder* sk_libbmp_dfactory(SkStream* stream) {
static const char kBmpMagic[] = { 'B', 'M' };
-
+
size_t len = stream->getLength();
char buffer[sizeof(kBmpMagic)];
-
+
if (len > sizeof(kBmpMagic) &&
stream->read(buffer, sizeof(kBmpMagic)) == sizeof(kBmpMagic) &&
!memcmp(buffer, kBmpMagic, sizeof(kBmpMagic))) {
@@ -61,7 +61,7 @@ public:
if (fJustBounds) {
return NULL;
}
-
+
fRGB.setCount(width * height * 3); // 3 == r, g, b
return fRGB.begin();
}
@@ -81,11 +81,11 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
size_t length = stream->getLength();
SkAutoMalloc storage(length);
-
+
if (stream->read(storage.get(), length) != length) {
return false;
}
-
+
const bool justBounds = SkImageDecoder::kDecodeBounds_Mode == mode;
SkBmpDecoderCallback callback(justBounds);
@@ -98,11 +98,11 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
}
-
+
// we don't need this anymore, so free it now (before we try to allocate
// the bitmap's pixels) rather than waiting for its destructor
storage.free();
-
+
int width = callback.width();
int height = callback.height();
SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false);
@@ -124,9 +124,9 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
if (!this->allocPixelRef(bm, NULL)) {
return false;
}
-
+
SkAutoLockPixels alp(*bm);
-
+
if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, getDitherImage())) {
return false;
}
@@ -134,7 +134,7 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
const int srcRowBytes = width * 3;
const int dstHeight = sampler.scaledHeight();
const uint8_t* srcRow = callback.rgb();
-
+
srcRow += sampler.srcY0() * srcRowBytes;
for (int y = 0; y < dstHeight; y++) {
sampler.next(srcRow);
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index cd4ee223f5..3008130545 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -21,7 +21,7 @@ public:
virtual Format getFormat() const {
return kGIF_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode);
};
@@ -48,7 +48,7 @@ public:
fCurrY = *fStartYPtr++;
fDeltaY = *fDeltaYPtr++;
}
-
+
int currY() const {
SkASSERT(fStartYPtr);
SkASSERT(fDeltaYPtr);
@@ -77,7 +77,7 @@ public:
}
fCurrY = y;
}
-
+
private:
const int fHeight;
int fCurrY;
@@ -167,22 +167,22 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
GifRecordType recType;
GifByteType *extData;
int transpIndex = -1; // -1 means we don't have it (yet)
-
+
do {
if (DGifGetRecordType(gif, &recType) == GIF_ERROR) {
return error_return(gif, *bm, "DGifGetRecordType");
}
-
+
switch (recType) {
case IMAGE_DESC_RECORD_TYPE: {
if (DGifGetImageDesc(gif) == GIF_ERROR) {
return error_return(gif, *bm, "IMAGE_DESC_RECORD_TYPE");
}
-
+
if (gif->ImageCount < 1) { // sanity check
return error_return(gif, *bm, "ImageCount < 1");
}
-
+
width = gif->SWidth;
height = gif->SHeight;
if (width <= 0 || height <= 0 ||
@@ -190,21 +190,21 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
width, height)) {
return error_return(gif, *bm, "chooseFromOneChoice");
}
-
+
bm->setConfig(SkBitmap::kIndex8_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode)
return true;
SavedImage* image = &gif->SavedImages[gif->ImageCount-1];
const GifImageDesc& desc = image->ImageDesc;
-
+
// check for valid descriptor
if ( (desc.Top | desc.Left) < 0 ||
desc.Left + desc.Width > width ||
desc.Top + desc.Height > height) {
return error_return(gif, *bm, "TopLeft");
}
-
+
// now we decode the colortable
int colorCount = 0;
{
@@ -218,7 +218,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
SkPMColor* colorPtr = ctable->lockColors();
for (int index = 0; index < colorCount; index++)
colorPtr[index] = SkPackARGB32(0xFF,
- cmap->Colors[index].Red,
+ cmap->Colors[index].Red,
cmap->Colors[index].Green,
cmap->Colors[index].Blue);
@@ -234,7 +234,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
return error_return(gif, *bm, "allocPixelRef");
}
}
-
+
SkAutoLockPixels alp(*bm);
// time to decode the scanlines
@@ -268,7 +268,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
// bump our starting address
scanline += desc.Top * rowBytes + desc.Left;
}
-
+
// now decode each scanline
if (gif->Image.Interlace)
{
@@ -294,7 +294,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
}
goto DONE;
} break;
-
+
case EXTENSION_RECORD_TYPE:
if (DGifGetExtension(gif, &temp_save.Function,
&extData) == GIF_ERROR) {
@@ -313,11 +313,11 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
temp_save.Function = 0;
}
break;
-
+
case TERMINATE_RECORD_TYPE:
break;
-
- default: /* Should be trapped by DGifGetRecordType */
+
+ default: /* Should be trapped by DGifGetRecordType */
break;
}
} while (recType != TERMINATE_RECORD_TYPE);
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index 30611cbd33..5167fe1adb 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -15,7 +15,7 @@
class SkICOImageDecoder : public SkImageDecoder {
public:
SkICOImageDecoder();
-
+
virtual Format getFormat() const {
return kICO_Format;
}
@@ -46,23 +46,23 @@ SkICOImageDecoder::SkICOImageDecoder()
}
//helpers - my function pointer will call one of these, depending on the bitCount, each time through the inner loop
-static void editPixelBit1(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit1(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
-static void editPixelBit4(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit4(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
-static void editPixelBit8(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit8(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
-static void editPixelBit24(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit24(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
-static void editPixelBit32(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit32(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
-
-
+
+
static int calculateRowBytesFor8888(int w, int bitCount)
{
// Default rowBytes is w << 2 for kARGB_8888
@@ -84,7 +84,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
if (stream->read((void*)buf, length) != length) {
return false;
}
-
+
//these should always be the same - should i use for error checking? - what about files that have some
//incorrect values, but still decode properly?
int reserved = read2Bytes(buf, 0); // 0
@@ -92,11 +92,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
if (reserved != 0 || type != 1)
return false;
int count = read2Bytes(buf, 4);
-
+
//need to at least have enough space to hold the initial table of info
if (length < (size_t)(6 + count*16))
return false;
-
+
int choice;
Chooser* chooser = this->getChooser();
//FIXME:if no chooser, consider providing the largest color image
@@ -120,7 +120,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
case 1:
case 4:
// In reality, at least for the moment, these will be decoded into kARGB_8888 bitmaps.
- // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
+ // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
// images and the higher quality images.
c = SkBitmap::kIndex8_Config;
break;
@@ -137,11 +137,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
}
choice = chooser->choose();
}
-
+
//you never know what the chooser is going to supply
- if (choice >= count || choice < 0)
+ if (choice >= count || choice < 0)
return false;
-
+
//skip ahead to the correct header
//commented out lines are not used, but if i switch to other read method, need to know how many to skip
//otherwise, they could be used for error checking
@@ -160,9 +160,9 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//int height = read4Bytes(buf, offset+8); //should == 2*h
//int planesToo = read2Bytes(buf, offset+12); //should == 1 (does it?)
int bitCount = read2Bytes(buf, offset+14);
-
- void (*placePixel)(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+
+ void (*placePixel)(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors) = NULL;
switch (bitCount)
{
@@ -190,7 +190,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
SkDEBUGF(("Decoding %ibpp is unimplemented\n", bitCount));
return false;
}
-
+
//these should all be zero, but perhaps are not - need to check
//int compression = read4Bytes(buf, offset+16); //0
//int imageSize = read4Bytes(buf, offset+20); //0 - sometimes has a value
@@ -198,13 +198,13 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//int yPixels = read4Bytes(buf, offset+28); //0
//int colorsUsed = read4Bytes(buf, offset+32) //0 - might have an actual value though
//int colorsImportant = read4Bytes(buf, offset+36); //0
-
+
int begin = offset + 40;
//this array represents the colortable
//if i allow other types of bitmaps, it may actually be used as a part of the bitmap
SkPMColor* colors = NULL;
int blue, green, red;
- if (colorCount)
+ if (colorCount)
{
colors = new SkPMColor[colorCount];
for (int j = 0; j < colorCount; j++)
@@ -221,11 +221,11 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
int mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
int lineBitWidth = (bitWidth & 0xFFFFFFE0) + (0x20 & mask);
int lineWidth = lineBitWidth/bitCount;
-
+
int xorOffset = begin + colorCount*4; //beginning of the color bitmap
//other read method means we will just be here already
int andOffset = xorOffset + ((lineWidth*h*bitCount) >> 3);
-
+
/*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next 32 (2^5)
/*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask);
@@ -236,7 +236,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
//however, with small images with large colortables, maybe it's better to still do argb_8888
bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
delete[] colors;
return true;
@@ -247,7 +247,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
delete[] colors;
return false;
}
-
+
SkAutoLockPixels alp(*bm);
for (int y = 0; y < h; y++)
@@ -255,7 +255,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
for (int x = 0; x < w; x++)
{
//U32* address = bm->getAddr32(x, y);
-
+
//check the alpha bit first, but pass it along to the function to figure out how to deal with it
int andPixelNo = andLineWidth*(h-y-1)+x;
//only need to get a new alphaByte when x %8 == 0
@@ -264,7 +264,7 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
int alphaByte = readByte(buf, andOffset + (andPixelNo >> 3));
int shift = 7 - (andPixelNo & 0x7);
int m = 1 << shift;
-
+
int pixelNo = lineWidth*(h-y-1)+x;
placePixel(pixelNo, buf, xorOffset, x, y, w, bm, alphaByte, m, shift, colors);
@@ -279,8 +279,8 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
} //onDecode
//function to place the pixel, determined by the bitCount
-static void editPixelBit1(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit1(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
{
// note that this should be the same as/similar to the AND bitmap
@@ -288,15 +288,15 @@ static void editPixelBit1(const int pixelNo, const unsigned char* buf,
int byte = readByte(buf, xorOffset + (pixelNo >> 3));
int colorBit;
int alphaBit;
- // Read all of the bits in this byte.
+ // Read all of the bits in this byte.
int i = x + 8;
- // Pin to the width so we do not write outside the bounds of
+ // Pin to the width so we do not write outside the bounds of
// our color table.
i = i > w ? w : i;
// While loop to check all 8 bits individually.
while (x < i)
{
-
+
colorBit = (byte & m) >> shift;
alphaBit = (alphaByte & m) >> shift;
*address = (alphaBit-1)&(colors[colorBit]);
@@ -308,8 +308,8 @@ static void editPixelBit1(const int pixelNo, const unsigned char* buf,
}
x--;
}
-static void editPixelBit4(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit4(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
{
SkPMColor* address = bm->getAddr32(x, y);
@@ -328,18 +328,18 @@ static void editPixelBit4(const int pixelNo, const unsigned char* buf,
*address = (alphaBit-1)&(colors[pixel]);
}
-static void editPixelBit8(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit8(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
{
SkPMColor* address = bm->getAddr32(x, y);
int pixel = readByte(buf, xorOffset + pixelNo);
int alphaBit = (alphaByte & m) >> shift;
*address = (alphaBit-1)&(colors[pixel]);
-}
+}
-static void editPixelBit24(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit24(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
{
SkPMColor* address = bm->getAddr32(x, y);
@@ -349,11 +349,11 @@ static void editPixelBit24(const int pixelNo, const unsigned char* buf,
int alphaBit = (alphaByte & m) >> shift;
//alphaBit == 1 => alpha = 0
int alpha = (alphaBit-1) & 0xFF;
- *address = SkPreMultiplyARGB(alpha, red, green, blue);
+ *address = SkPreMultiplyARGB(alpha, red, green, blue);
}
-static void editPixelBit32(const int pixelNo, const unsigned char* buf,
- const int xorOffset, int& x, int y, const int w,
+static void editPixelBit32(const int pixelNo, const unsigned char* buf,
+ const int xorOffset, int& x, int y, const int w,
SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
{
SkPMColor* address = bm->getAddr32(x, y);
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 8989d35d58..6bae965e42 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -147,7 +147,7 @@ static bool return_false(const jpeg_decompress_struct& cinfo,
// method moves the "scanline" pointer in its processing
static void convert_CMYK_to_RGB(uint8_t* scanline, unsigned int width) {
// At this point we've received CMYK pixels from libjpeg. We
- // perform a crude conversion to RGB (based on the formulae
+ // perform a crude conversion to RGB (based on the formulae
// from easyrgb.com):
// CMYK -> CMY
// C = ( C * (1 - K) + K ) // for each CMY component
@@ -294,9 +294,9 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
a significant performance boost.
*/
if (sampleSize == 1 &&
- ((config == SkBitmap::kARGB_8888_Config &&
+ ((config == SkBitmap::kARGB_8888_Config &&
cinfo.out_color_space == JCS_RGBA_8888) ||
- (config == SkBitmap::kRGB_565_Config &&
+ (config == SkBitmap::kRGB_565_Config &&
cinfo.out_color_space == JCS_RGB_565)))
{
bm->setConfig(config, cinfo.output_width, cinfo.output_height);
@@ -310,7 +310,7 @@ bool SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
SkAutoLockPixels alp(*bm);
JSAMPLE* rowptr = (JSAMPLE*)bm->getPixels();
INT32 const bpr = bm->rowBytes();
-
+
while (cinfo.output_scanline < cinfo.output_height) {
int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1);
// if row_count == 0, then we didn't get a scanline, so abort.
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 8fe342301a..d48bce51f8 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -27,7 +27,7 @@ public:
virtual Format getFormat() const {
return kPNG_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
@@ -85,7 +85,7 @@ static bool pos_le(int value, int max) {
static bool substituteTranspColor(SkBitmap* bm, SkPMColor match) {
SkASSERT(bm->config() == SkBitmap::kARGB_8888_Config);
-
+
bool reallyHasAlpha = false;
for (int y = bm->height() - 1; y >= 0; --y) {
@@ -195,18 +195,18 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
png_set_expand_gray_1_2_4_to_8(png_ptr);
}
-
+
/* Make a grayscale image into RGB. */
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
png_set_gray_to_rgb(png_ptr);
}
-
+
SkBitmap::Config config;
bool hasAlpha = false;
bool doDither = this->getDitherImage();
SkPMColor theTranspColor = 0; // 0 tells us not to try to match
-
+
// check for sBIT chunk data, in case we should disable dithering because
// our data is not truely 8bits per component
if (doDither) {
@@ -226,7 +226,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
doDither = false;
}
}
-
+
if (color_type == PNG_COLOR_TYPE_PALETTE) {
bool paletteHasAlpha = hasTransparencyInPalette(png_ptr, info_ptr);
config = this->getPrefConfig(kIndex_SrcDepth, paletteHasAlpha);
@@ -237,11 +237,11 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
png_color_16p transpColor = NULL;
int numTransp = 0;
-
+
png_get_tRNS(png_ptr, info_ptr, NULL, &numTransp, &transpColor);
-
+
bool valid = png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS);
-
+
if (valid && numTransp == 1 && transpColor != NULL) {
/* Compute our transparent color, which we'll match against later.
We don't really handle 16bit components properly here, since we
@@ -304,7 +304,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (!this->chooseFromOneChoice(config, origWidth, origHeight)) {
return false;
}
-
+
const int sampleSize = this->getSampleSize();
SkScaledBitmapSampler sampler(origWidth, origHeight, sampleSize);
@@ -313,7 +313,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
-
+
// from here down we are concerned with colortables and pixels
// we track if we actually see a non-opaque pixels, since sometimes a PNG sets its colortype
@@ -329,9 +329,9 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
int num_trans;
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
-
+
/* BUGGY IMAGE WORKAROUND
-
+
We hit some images (e.g. fruit_.png) who contain bytes that are == colortable_count
which is a problem since we use the byte as an index. To work around this we grow
the colortable by 1 (if its < 256) and duplicate the last color into that slot.
@@ -347,7 +347,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
num_trans = 0;
colorTable->setFlags(colorTable->getFlags() | SkColorTable::kColorsAreOpaque_Flag);
- }
+ }
// check for bad images that might make us crash
if (num_trans > num_palette) {
num_trans = num_palette;
@@ -374,7 +374,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
}
colorTable->unlockColors(true);
}
-
+
SkAutoUnref aur(colorTable);
if (!this->allocPixelRef(decodedBitmap,
@@ -382,7 +382,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
colorTable : NULL)) {
return false;
}
-
+
SkAutoLockPixels alp(*decodedBitmap);
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
@@ -401,7 +401,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
* png_read_image(). To see how to handle interlacing passes,
* see the png_read_row() method below:
*/
- const int number_passes = interlace_type != PNG_INTERLACE_NONE ?
+ const int number_passes = interlace_type != PNG_INTERLACE_NONE ?
png_set_interlace_handling(png_ptr) : 1;
/* Optional call to gamma correct and add the background to the palette
@@ -420,7 +420,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
} else {
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
-
+
if (colorTable != NULL) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
@@ -508,7 +508,7 @@ typedef void (*transform_scanline_proc)(const char* SK_RESTRICT src,
static void transform_scanline_565(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const uint16_t* SK_RESTRICT srcP = (const uint16_t*)src;
+ const uint16_t* SK_RESTRICT srcP = (const uint16_t*)src;
for (int i = 0; i < width; i++) {
unsigned c = *srcP++;
*dst++ = SkPacked16ToR32(c);
@@ -519,7 +519,7 @@ static void transform_scanline_565(const char* SK_RESTRICT src, int width,
static void transform_scanline_888(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
+ const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
for (int i = 0; i < width; i++) {
SkPMColor c = *srcP++;
*dst++ = SkGetPackedR32(c);
@@ -530,7 +530,7 @@ static void transform_scanline_888(const char* SK_RESTRICT src, int width,
static void transform_scanline_444(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
- const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
+ const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
for (int i = 0; i < width; i++) {
SkPMColor16 c = *srcP++;
*dst++ = SkPacked4444ToR32(c);
@@ -542,7 +542,7 @@ static void transform_scanline_444(const char* SK_RESTRICT src, int width,
static void transform_scanline_8888(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
const SkPMColor* SK_RESTRICT srcP = (const SkPMColor*)src;
- const SkUnPreMultiply::Scale* SK_RESTRICT table =
+ const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
for (int i = 0; i < width; i++) {
@@ -568,7 +568,7 @@ static void transform_scanline_8888(const char* SK_RESTRICT src, int width,
static void transform_scanline_4444(const char* SK_RESTRICT src, int width,
char* SK_RESTRICT dst) {
const SkPMColor16* SK_RESTRICT srcP = (const SkPMColor16*)src;
- const SkUnPreMultiply::Scale* SK_RESTRICT table =
+ const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
for (int i = 0; i < width; i++) {
@@ -603,7 +603,7 @@ static transform_scanline_proc choose_proc(SkBitmap::Config config,
if (SkBitmap::kIndex8_Config == config) {
hasAlpha = false; // we store false in the table entries for kIndex8
}
-
+
static const struct {
SkBitmap::Config fConfig;
bool fHasAlpha;
@@ -644,7 +644,7 @@ static int computeBitDepth(int colorCount) {
/* Pack palette[] with the corresponding colors, and if hasAlpha is true, also
pack trans[] and return the number of trans[] entries written. If hasAlpha
is false, the return value will always be 0.
-
+
Note: this routine takes care of unpremultiplying the RGB values when we
have alpha in the colortable, since png doesn't support premul colors
*/
@@ -672,7 +672,7 @@ static inline int pack_palette(SkColorTable* ctable,
}
num_trans -= 1;
}
-
+
const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
@@ -684,11 +684,11 @@ static inline int pack_palette(SkColorTable* ctable,
palette[i].red = SkUnPreMultiply::ApplyScale(s, SkGetPackedR32(c));
palette[i].green = SkUnPreMultiply::ApplyScale(s,SkGetPackedG32(c));
palette[i].blue = SkUnPreMultiply::ApplyScale(s, SkGetPackedB32(c));
- }
+ }
// now fall out of this if-block to use common code for the trailing
// opaque entries
}
-
+
// these (remaining) entries are opaque
for (i = num_trans; i < ctCount; i++) {
SkPMColor c = *colors++;
@@ -743,7 +743,7 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
default:
return false;
}
-
+
if (hasAlpha) {
// don't specify alpha if we're a palette, even if our ctable has alpha
if (!(colorType & PNG_COLOR_MASK_PALETTE)) {
@@ -752,7 +752,7 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
} else {
sig_bit.alpha = 0;
}
-
+
SkAutoLockPixels alp(bitmap);
// readyToDraw checks for pixels (and colortable if that is required)
if (!bitmap.readyToDraw()) {
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index fedeedbab1..175a444008 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -20,7 +20,7 @@ public:
virtual Format getFormat() const {
return kWBMP_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
@@ -40,7 +40,7 @@ static bool read_mbf(SkStream* stream, int* value)
}
n = (n << 7) | (data & 0x7F);
} while (data & 0x80);
-
+
*value = n;
return true;
}
@@ -48,11 +48,11 @@ static bool read_mbf(SkStream* stream, int* value)
struct wbmp_head {
int fWidth;
int fHeight;
-
+
bool init(SkStream* stream)
{
uint8_t data;
-
+
if (!read_byte(stream, &data) || data != 0) { // unknown type
return false;
}
@@ -68,11 +68,11 @@ struct wbmp_head {
return fWidth != 0 && fHeight != 0;
}
};
-
+
static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
{
int bytes = bits >> 3;
-
+
for (int i = 0; i < bytes; i++) {
unsigned mask = *src++;
dst[0] = (mask >> 7) & 1;
@@ -85,14 +85,14 @@ static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
dst[7] = (mask >> 0) & 1;
dst += 8;
}
-
+
bits &= 7;
if (bits > 0) {
unsigned mask = *src;
do {
*dst++ = (mask >> 7) & 1;;
mask <<= 1;
- } while (--bits != 0);
+ } while (--bits != 0);
}
}
@@ -100,21 +100,21 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
Mode mode)
{
wbmp_head head;
-
+
if (!head.init(stream)) {
return false;
}
-
+
int width = head.fWidth;
int height = head.fHeight;
-
+
// assign these directly, in case we return kDimensions_Result
decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
decodedBitmap->setIsOpaque(true);
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode)
return true;
-
+
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
SkAutoUnref aur(ct);
diff --git a/src/images/SkImageRefPool.cpp b/src/images/SkImageRefPool.cpp
index c24dba0da8..b8bbfd2f6e 100644
--- a/src/images/SkImageRefPool.cpp
+++ b/src/images/SkImageRefPool.cpp
@@ -56,7 +56,7 @@ void SkImageRefPool::purgeIfNeeded() {
void SkImageRefPool::setRAMUsed(size_t limit) {
SkImageRef* ref = fTail;
-
+
while (NULL != ref && fRAMUsed > limit) {
// only purge it if its pixels are unlocked
if (!ref->isLocked() && ref->fBitmap.getPixels()) {
@@ -71,7 +71,7 @@ void SkImageRefPool::setRAMUsed(size_t limit) {
ref->fBitmap.bytesPerPixel(),
(int)size, (int)fRAMUsed);
#endif
-
+
// remember the bitmap config (don't call reset),
// just clear the pixel memory
ref->fBitmap.setPixels(NULL);
@@ -86,44 +86,44 @@ void SkImageRefPool::setRAMUsed(size_t limit) {
void SkImageRefPool::addToHead(SkImageRef* ref) {
ref->fNext = fHead;
ref->fPrev = NULL;
-
+
if (fHead) {
SkASSERT(NULL == fHead->fPrev);
fHead->fPrev = ref;
}
fHead = ref;
-
+
if (NULL == fTail) {
fTail = ref;
}
fCount += 1;
SkASSERT(computeCount() == fCount);
-
+
fRAMUsed += ref->ramUsed();
}
void SkImageRefPool::addToTail(SkImageRef* ref) {
ref->fNext = NULL;
ref->fPrev = fTail;
-
+
if (fTail) {
SkASSERT(NULL == fTail->fNext);
fTail->fNext = ref;
}
fTail = ref;
-
+
if (NULL == fHead) {
fHead = ref;
}
fCount += 1;
SkASSERT(computeCount() == fCount);
-
+
fRAMUsed += ref->ramUsed();
}
void SkImageRefPool::detach(SkImageRef* ref) {
SkASSERT(fCount > 0);
-
+
if (fHead == ref) {
fHead = ref->fNext;
}
@@ -136,12 +136,12 @@ void SkImageRefPool::detach(SkImageRef* ref) {
if (ref->fNext) {
ref->fNext->fPrev = ref->fPrev;
}
-
+
ref->fNext = ref->fPrev = NULL;
-
+
fCount -= 1;
SkASSERT(computeCount() == fCount);
-
+
SkASSERT(fRAMUsed >= ref->ramUsed());
fRAMUsed -= ref->ramUsed();
}
@@ -149,23 +149,23 @@ void SkImageRefPool::detach(SkImageRef* ref) {
int SkImageRefPool::computeCount() const {
SkImageRef* ref = fHead;
int count = 0;
-
+
while (ref != NULL) {
count += 1;
ref = ref->fNext;
}
-
+
#ifdef SK_DEBUG
ref = fTail;
int count2 = 0;
-
+
while (ref != NULL) {
count2 += 1;
ref = ref->fPrev;
}
SkASSERT(count2 == count);
#endif
-
+
return count;
}
@@ -177,15 +177,15 @@ void SkImageRefPool::dump() const {
#if defined(SK_DEBUG) || defined(DUMP_IMAGEREF_LIFECYCLE)
SkDebugf("ImagePool dump: bugdet: %d used: %d count: %d\n",
(int)fRAMBudget, (int)fRAMUsed, fCount);
-
+
SkImageRef* ref = fHead;
-
+
while (ref != NULL) {
SkDebugf(" [%3d %3d %d] ram=%d data=%d locked=%d %s\n", ref->fBitmap.width(),
ref->fBitmap.height(), ref->fBitmap.config(),
ref->ramUsed(), (int)ref->fStream->getLength(),
ref->isLocked(), ref->getURI());
-
+
ref = ref->fNext;
}
#endif
diff --git a/src/images/SkImageRefPool.h b/src/images/SkImageRefPool.h
index d29b8dbc61..08633ee39f 100644
--- a/src/images/SkImageRefPool.h
+++ b/src/images/SkImageRefPool.h
@@ -17,30 +17,30 @@ class SkImageRefPool {
public:
SkImageRefPool();
~SkImageRefPool();
-
+
size_t getRAMBudget() const { return fRAMBudget; }
void setRAMBudget(size_t);
-
+
size_t getRAMUsed() const { return fRAMUsed; }
void setRAMUsed(size_t limit);
-
+
void addToHead(SkImageRef*);
void addToTail(SkImageRef*);
void detach(SkImageRef*);
void dump() const;
-
+
private:
size_t fRAMBudget;
size_t fRAMUsed;
-
+
int fCount;
SkImageRef* fHead, *fTail;
-
+
int computeCount() const;
-
+
friend class SkImageRef_GlobalPool;
-
+
void justAddedPixels(SkImageRef*);
void canLosePixels(SkImageRef*);
void purgeIfNeeded();
diff --git a/src/images/SkImageRef_GlobalPool.cpp b/src/images/SkImageRef_GlobalPool.cpp
index bd63f729be..a5a71a3d9d 100644
--- a/src/images/SkImageRef_GlobalPool.cpp
+++ b/src/images/SkImageRef_GlobalPool.cpp
@@ -56,10 +56,10 @@ bool SkImageRef_GlobalPool::onDecode(SkImageDecoder* codec, SkStream* stream,
}
return true;
}
-
+
void SkImageRef_GlobalPool::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
-
+
// by design, onUnlockPixels() already is inside the mutex-lock
GetGlobalPool()->canLosePixels(this);
}
@@ -87,7 +87,7 @@ void SkImageRef_GlobalPool::SetRAMBudget(size_t size) {
}
size_t SkImageRef_GlobalPool::GetRAMUsed() {
- SkAutoMutexAcquire ac(gImageRefMutex);
+ SkAutoMutexAcquire ac(gImageRefMutex);
return GetGlobalPool()->getRAMUsed();
}
diff --git a/src/images/SkMovie.cpp b/src/images/SkMovie.cpp
index 978cd16f6a..e671950bb9 100644
--- a/src/images/SkMovie.cpp
+++ b/src/images/SkMovie.cpp
@@ -57,7 +57,7 @@ bool SkMovie::setTime(SkMSec time)
SkMSec dur = this->duration();
if (time > dur)
time = dur;
-
+
bool changed = false;
if (time != fCurrTime)
{
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index 91d359169e..9cebc0fc8b 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -25,7 +25,7 @@ protected:
virtual bool onGetInfo(Info*);
virtual bool onSetTime(SkMSec);
virtual bool onGetBitmap(SkBitmap*);
-
+
private:
GifFileType* fGIF;
int fCurrIndex;
diff --git a/src/images/SkPageFlipper.cpp b/src/images/SkPageFlipper.cpp
index 8e51e637a6..4fd8632574 100644
--- a/src/images/SkPageFlipper.cpp
+++ b/src/images/SkPageFlipper.cpp
@@ -32,7 +32,7 @@ SkPageFlipper::SkPageFlipper(int width, int height) {
void SkPageFlipper::resize(int width, int height) {
fWidth = width;
fHeight = height;
-
+
// this is the opposite of the constructors
fDirty1->setRect(0, 0, width, height);
fDirty0->setEmpty();
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index 15633d3a63..25b32fd9b8 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -302,7 +302,7 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
if (width <= 0 || height <= 0) {
sk_throw();
}
-
+
if (sampleSize <= 1) {
fScaledWidth = width;
fScaledHeight = height;
@@ -310,25 +310,25 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
fDX = fDY = 1;
return;
}
-
+
int dx = SkMin32(sampleSize, width);
int dy = SkMin32(sampleSize, height);
-
+
fScaledWidth = width / dx;
fScaledHeight = height / dy;
-
+
SkASSERT(fScaledWidth > 0);
SkASSERT(fScaledHeight > 0);
-
+
fX0 = dx >> 1;
fY0 = dy >> 1;
-
+
SkASSERT(fX0 >= 0 && fX0 < width);
SkASSERT(fY0 >= 0 && fY0 < height);
-
+
fDX = dx;
fDY = dy;
-
+
SkASSERT(fDX > 0 && (fX0 + fDX * (fScaledWidth - 1)) < width);
SkASSERT(fDY > 0 && (fY0 + fDY * (fScaledHeight - 1)) < height);
}
@@ -413,7 +413,7 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc, bool dither,
default:
return false;
}
-
+
fRowProc = gProcs[index];
fDstRow = (char*)dst->getPixels();
fDstRowBytes = dst->rowBytes();
diff --git a/src/images/SkScaledBitmapSampler.h b/src/images/SkScaledBitmapSampler.h
index 8a735dfdba..f6de4ccc10 100644
--- a/src/images/SkScaledBitmapSampler.h
+++ b/src/images/SkScaledBitmapSampler.h
@@ -16,10 +16,10 @@ class SkBitmap;
class SkScaledBitmapSampler {
public:
SkScaledBitmapSampler(int origWidth, int origHeight, int cellSize);
-
+
int scaledWidth() const { return fScaledWidth; }
int scaledHeight() const { return fScaledHeight; }
-
+
int srcY0() const { return fY0; }
int srcDY() const { return fDY; }
@@ -59,7 +59,7 @@ private:
char* fDstRow; // points into bitmap's pixels
int fDstRowBytes;
int fCurrY; // used for dithering
- int fSrcPixelSize; // 1, 3, 4
+ int fSrcPixelSize; // 1, 3, 4
RowProc fRowProc;
// optional reference to the src colors if the src is a palette model
diff --git a/src/images/bmpdecoderhelper.h b/src/images/bmpdecoderhelper.h
index f3324eeaf5..f2f410941e 100644
--- a/src/images/bmpdecoderhelper.h
+++ b/src/images/bmpdecoderhelper.h
@@ -32,14 +32,14 @@ public:
~scoped_array() {
delete[] ptr_;
}
-
+
void reset(T* p = 0) {
if (p != ptr_) {
delete[] ptr_;
ptr_ = p;
}
}
-
+
T& operator[](int i) const {
return ptr_[i];
}
@@ -53,7 +53,7 @@ class BmpDecoderCallback {
public:
BmpDecoderCallback() { }
virtual ~BmpDecoderCallback() {}
-
+
/**
* This is called once for an image. It is passed the width and height and
* should return the address of a buffer that is large enough to store
@@ -62,7 +62,7 @@ class BmpDecoderCallback {
* valid dimensions.
*/
virtual uint8* SetSize(int width, int height) = 0;
-
+
private:
DISALLOW_EVIL_CONSTRUCTORS(BmpDecoderCallback);
};
@@ -110,7 +110,7 @@ class BmpDecoderHelper {
uint8* output_;
bool inverted_;
};
-
+
} // namespace
#endif
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 9f0177e669..5cb801feca 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -469,7 +469,7 @@ static void append_bfrange_section(const SkTDArray<BFRange>& bfrange,
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap);
-
+
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap) {
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 09a4352110..e6f1d7f108 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -275,14 +275,14 @@ static SkString twoPointRadialCode(const SkShader::GradientInfo& info) {
}
/* Conical gradient shader, based on the Canvas spec for radial gradients
- See: http://www.w3.org/TR/2dcontext/#dom-context-2d-createradialgradient
+ See: http://www.w3.org/TR/2dcontext/#dom-context-2d-createradialgradient
*/
static SkString twoPointConicalCode(const SkShader::GradientInfo& info) {
SkScalar dx = info.fPoint[1].fX - info.fPoint[0].fX;
SkScalar dy = info.fPoint[1].fY - info.fPoint[0].fY;
SkScalar r0 = info.fRadius[0];
SkScalar dr = info.fRadius[1] - info.fRadius[0];
- SkScalar a = SkScalarMul(dx, dx) + SkScalarMul(dy, dy) -
+ SkScalar a = SkScalarMul(dx, dx) + SkScalarMul(dy, dy) -
SkScalarMul(dr, dr);
// First compute t, if the pixel falls outside the cone, then we'll end
@@ -327,7 +327,7 @@ static SkString twoPointConicalCode(const SkShader::GradientInfo& info) {
// quadratic case: the Canvas spec wants the largest
// root t for which radius(t) > 0
-
+
// compute the discriminant (b^2 - 4ac)
function.appendScalar(SkScalarMul(SkIntToScalar(4), a));
function.append(" mul sub dup\n");
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 7d249408d1..28034ef405 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -113,7 +113,7 @@ public:
private:
SkRefPtr<SkPDFObject> fObj;
-
+
typedef SkPDFObject INHERITED;
};
@@ -137,7 +137,7 @@ public:
private:
int32_t fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -162,7 +162,7 @@ public:
private:
bool fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -188,7 +188,7 @@ public:
private:
SkScalar fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -262,7 +262,7 @@ private:
const SkString fValue;
static SkString FormatName(const SkString& input);
-
+
typedef SkPDFObject INHERITED;
};
@@ -329,7 +329,7 @@ public:
private:
static const int kMaxLen = 8191;
SkTDArray<SkPDFObject*> fValue;
-
+
typedef SkPDFObject INHERITED;
};
@@ -427,7 +427,7 @@ private:
static const int kMaxLen = 4095;
SkTDArray<struct Rec> fValue;
-
+
typedef SkPDFObject INHERITED;
};
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h
index edfe2b6edd..207a3bdc8a 100644
--- a/src/pipe/SkGPipePriv.h
+++ b/src/pipe/SkGPipePriv.h
@@ -212,7 +212,7 @@ static inline bool shouldFlattenBitmaps(uint32_t flags) {
enum PaintOps {
kReset_PaintOp, // no arg
-
+
kFlags_PaintOp, // arg inline
kColor_PaintOp, // arg 32
kStyle_PaintOp, // arg inline
@@ -220,7 +220,7 @@ enum PaintOps {
kCap_PaintOp, // arg inline
kWidth_PaintOp, // arg scalar
kMiter_PaintOp,// arg scalar
-
+
kEncoding_PaintOp, // arg inline - text
kHinting_PaintOp, // arg inline - text
kAlign_PaintOp, // arg inline - text
@@ -254,14 +254,14 @@ static inline unsigned PaintOp_unpackData(uint32_t op32) {
static inline uint32_t PaintOp_packOp(PaintOps op) {
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
-
+
return op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS);
}
static inline uint32_t PaintOp_packOpData(PaintOps op, unsigned data) {
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK));
-
+
return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | data;
}
@@ -269,7 +269,7 @@ static inline uint32_t PaintOp_packOpFlagData(PaintOps op, unsigned flags, unsig
SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK));
SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK));
-
+
return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) |
(flags << PAINTOPS_DATA_BITS) |
data;
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index d217aeb85d..ce83c83e83 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -85,7 +85,7 @@ public:
const SkPaint& paint() const { return fPaint; }
SkPaint* editPaint() { return &fPaint; }
-
+
SkFlattenable* getFlat(unsigned index) const {
if (0 == index) {
return NULL;
@@ -151,12 +151,12 @@ public:
const void* data = fReader->skip(SkAlign4(size));
SkMemoryStream stream(data, size, false);
*fTypefaces.append() = SkTypeface::Deserialize(&stream);
- }
+ }
void setTypeface(SkPaint* paint, unsigned id) {
paint->setTypeface(id ? fTypefaces[id - 1] : NULL);
}
-
+
private:
void updateReader() {
if (NULL == fReader) {
@@ -720,7 +720,7 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
uint32_t op32 = reader.readUInt();
unsigned op = DrawOp_unpackOp(op32);
// SkDEBUGCODE(DrawOps drawOp = (DrawOps)op;)
-
+
if (op >= SK_ARRAY_COUNT(gReadTable)) {
SkDebugf("---- bad op during GPipeState::playback\n");
status = kError_Status;
@@ -731,7 +731,7 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
break;
}
table[op](canvas, reader.getReader32(), op32, fState);
- if (readAtom &&
+ if (readAtom &&
(table[op] != paintOp_rp &&
table[op] != def_Typeface_rp &&
table[op] != def_PaintFlat_rp &&
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 42f82c9bcd..b41ebb72fd 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -84,7 +84,7 @@ public:
void setBitmapStorage(SkBitmapHeap* heap) {
this->setBitmapHeap(heap);
}
-
+
const SkFlatData* flatToReplace() const;
// Mark an SkFlatData as one that should not be returned by flatToReplace.
@@ -385,11 +385,11 @@ int SkGPipeCanvas::flattenToIndex(SkFlattenable* obj, PaintFlats paintflat) {
class BitmapShuttle : public SkBitmapHeap::ExternalStorage {
public:
BitmapShuttle(SkGPipeCanvas*);
-
+
~BitmapShuttle();
-
+
virtual bool insert(const SkBitmap& bitmap, int32_t slot) SK_OVERRIDE;
-
+
private:
SkGPipeCanvas* fCanvas;
};
@@ -401,7 +401,7 @@ private:
#define FLATTENABLES_TO_KEEP 10
SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
- SkWriter32* writer, uint32_t flags,
+ SkWriter32* writer, uint32_t flags,
uint32_t width, uint32_t height)
: fFactorySet(isCrossProcess(flags) ? SkNEW(SkNamedFactorySet) : NULL)
, fWriter(*writer)
@@ -426,7 +426,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
if (this->needOpBytes()) {
this->writeOp(kReportFlags_DrawOp, fFlags, 0);
}
-
+
if (shouldFlattenBitmaps(flags)) {
BitmapShuttle* shuttle = SkNEW_ARGS(BitmapShuttle, (this));
fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (shuttle, BITMAPS_TO_KEEP));
@@ -744,7 +744,7 @@ void SkGPipeCanvas::drawBitmapRect(const SkBitmap& bm, const SkIRect* src,
} else {
flags = 0;
}
-
+
if (this->commonDrawBitmap(bm, kDrawBitmapRect_DrawOp, flags, opBytesNeeded, paint)) {
if (hasSrc) {
fWriter.write32(src->fLeft);
@@ -760,7 +760,7 @@ void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix,
const SkPaint* paint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = matrix.writeToMemory(NULL);
-
+
if (this->commonDrawBitmap(bm, kDrawBitmapMatrix_DrawOp, 0, opBytesNeeded, paint)) {
fWriter.writeMatrix(matrix);
}
@@ -939,7 +939,7 @@ void SkGPipeCanvas::flushRecording(bool detachCurrentBlock) {
doNotify();
if (detachCurrentBlock) {
// force a new block to be requested for the next recorded command
- fBlockSize = 0;
+ fBlockSize = 0;
}
}
diff --git a/src/ports/SkFontDescriptor.cpp b/src/ports/SkFontDescriptor.cpp
index 34f4f17e88..7679d92a14 100644
--- a/src/ports/SkFontDescriptor.cpp
+++ b/src/ports/SkFontDescriptor.cpp
@@ -13,7 +13,7 @@ enum {
kFontFamilyName = 0x01,
kFullName = 0x04,
kPostscriptName = 0x06,
-
+
// These count backwards from 0xFF, so as not to collide with the SFNT
// defines for names in its 'name' table.
kFontFileName = 0xFE,
diff --git a/src/ports/SkFontDescriptor.h b/src/ports/SkFontDescriptor.h
index b2260299bb..5febfd81a3 100644
--- a/src/ports/SkFontDescriptor.h
+++ b/src/ports/SkFontDescriptor.h
@@ -28,7 +28,7 @@ public:
const char* getFullName() { return fFullName.c_str(); }
const char* getPostscriptName() { return fPostscriptName.c_str(); }
const char* getFontFileName() { return fFontFileName.c_str(); }
-
+
void setFamilyName(const char* name) { fFamilyName.set(name); }
void setFullName(const char* name) { fFullName.set(name); }
void setPostscriptName(const char* name) { fPostscriptName.set(name); }
diff --git a/src/ports/SkFontHost_FONTPATH.cpp b/src/ports/SkFontHost_FONTPATH.cpp
index 04e49345f1..69e73f536d 100644
--- a/src/ports/SkFontHost_FONTPATH.cpp
+++ b/src/ports/SkFontHost_FONTPATH.cpp
@@ -14,14 +14,14 @@
#include <stdio.h>
/* define this if we can use mmap() to access fonts from the filesystem */
-#define SK_CAN_USE_MMAP
+#define SK_CAN_USE_MMAP
#ifndef SK_FONTPATH
#define SK_FONTPATH "the complete path for a font file"
#endif
struct FontFaceRec {
- const char* fFileName;
+ const char* fFileName;
uint8_t fFamilyIndex;
SkBool8 fBold;
SkBool8 fItalic;
@@ -39,7 +39,7 @@ const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count,
int isBold, int isItalic)
{
SkASSERT(count > 0);
-
+
int i;
// look for an exact match
@@ -63,7 +63,7 @@ const FontFaceRec& FontFaceRec::FindFace(const FontFaceRec rec[], int count,
enum {
DEFAULT_FAMILY_INDEX,
-
+
FAMILY_INDEX_COUNT
};
@@ -236,7 +236,7 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
SkTypeface::Style style)
{
const FontFamilyRec* family;
-
+
if (familyFace)
family = &gFamilies[
((FontFaceRec_Typeface*)familyFace)->fFace.fFamilyIndex];
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 550fae01b2..45ae7ecffc 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -610,7 +610,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
if (rec->fTextSize > SkIntToScalar(1 << 14)) {
rec->fTextSize = SkIntToScalar(1 << 14);
}
-
+
if (!gLCDSupportValid) {
InitFreetype();
FT_Done_FreeType(gFTLibrary);
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 91f172b440..332b8c47b8 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -89,7 +89,7 @@ static void copyFT2LCD16(const SkGlyph& glyph, const FT_Bitmap& bitmap,
SkTSwap(srcR, srcB);
}
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(*srcR++, tableR),
sk_apply_lut_if<APPLY_PREBLEND>(*srcG++, tableG),
sk_apply_lut_if<APPLY_PREBLEND>(*srcB++, tableB));
}
@@ -98,14 +98,14 @@ static void copyFT2LCD16(const SkGlyph& glyph, const FT_Bitmap& bitmap,
const uint8_t* triple = src;
if (lcdIsBGR) {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableB));
triple += 3;
}
} else {
for (int x = 0; x < width; x++) {
- dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
+ dst[x] = packTriple(sk_apply_lut_if<APPLY_PREBLEND>(triple[0], tableR),
sk_apply_lut_if<APPLY_PREBLEND>(triple[1], tableG),
sk_apply_lut_if<APPLY_PREBLEND>(triple[2], tableB));
triple += 3;
@@ -302,7 +302,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face,
if (SkMask::kA8_Format == glyph.fMaskFormat && maskPreBlend) {
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
unsigned rowBytes = glyph.rowBytes();
-
+
for (int y = glyph.fHeight - 1; y >= 0; --y) {
for (int x = glyph.fWidth - 1; x >= 0; --x) {
dst[x] = tableG[dst[x]];
diff --git a/src/ports/SkFontHost_ascender.cpp b/src/ports/SkFontHost_ascender.cpp
index ccfedefeb5..067d474357 100644
--- a/src/ports/SkFontHost_ascender.cpp
+++ b/src/ports/SkFontHost_ascender.cpp
@@ -52,20 +52,20 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
{
int size = aca_Get_FontHandleRec_Size();
fHandle = (aca_FontHandle)sk_malloc_throw(size);
-
+
// get the pointer to the font
-
+
fFontStream = new SkMMAPStream("/UcsGB2312-Hei-H.FDL");
fHintStream = new SkMMAPStream("/genv6-23.bin");
-
+
void* hints = sk_malloc_throw(fHintStream->getLength());
memcpy(hints, fHintStream->getMemoryBase(), fHintStream->getLength());
-
+
aca_Create_Font_Handle(fHandle,
(void*)fFontStream->getMemoryBase(), fFontStream->getLength(),
"fred",
hints, fHintStream->getLength());
-
+
// compute our factors from the record
SkMatrix m;
@@ -75,17 +75,17 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
// now compute our scale factors
SkScalar sx = m.getScaleX();
SkScalar sy = m.getScaleY();
-
+
int ppemX = SkScalarRound(sx);
int ppemY = SkScalarRound(sy);
-
+
size = aca_Find_Font_Memory_Required(fHandle, ppemX, ppemY);
size *= 8; // Jeff suggests this :)
fWorkspace = sk_malloc_throw(size);
aca_Set_Font_Memory(fHandle, (uint8_t*)fWorkspace, size);
aca_GlyphAttribsRec rec;
-
+
memset(&rec, 0, sizeof(rec));
rec.xSize = ppemX;
rec.ySize = ppemY;
@@ -95,7 +95,7 @@ SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
rec.doInterpolate = true;
rec.grayMode = 2;
aca_Set_Font_Attributes(fHandle, &rec, &size);
-
+
fGlyphWorkspace = sk_malloc_throw(size);
aca_Set_Glyph_Memory(fHandle, fGlyphWorkspace);
}
@@ -123,10 +123,10 @@ void SkScalerContext_Ascender::generateMetrics(SkGlyph* glyph)
{
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
int adv = aca_Get_Adv_Width(fHandle, glyph->getGlyphID());
if (aca_GLYPH_NOT_PRESENT == adv)
goto ERROR;
@@ -144,7 +144,7 @@ ERROR:
glyph->fAdvanceY = 0;
return;
}
-
+
glyph->fWidth = rec.width;
glyph->fHeight = rec.rows;
glyph->fRowBytes = rec.width;
@@ -158,13 +158,13 @@ void SkScalerContext_Ascender::generateImage(const SkGlyph& glyph)
{
aca_GlyphImageRec rec;
aca_Vector topLeft;
-
+
aca_Rasterize(glyph.getGlyphID(), fHandle, &rec, &topLeft);
-
+
const uint8_t* src = (const uint8_t*)rec.buffer;
uint8_t* dst = (uint8_t*)glyph.fImage;
int height = glyph.fHeight;
-
+
src += rec.y0 * rec.pitch + rec.x0;
while (--height >= 0)
{
@@ -179,7 +179,7 @@ void SkScalerContext_Ascender::generateImage(const SkGlyph& glyph)
void SkScalerContext_Ascender::generatePath(const SkGlyph& glyph, SkPath* path)
{
SkRect r;
-
+
r.set(0, 0, SkIntToScalar(4), SkIntToScalar(4));
path->reset();
path->addRect(r);
diff --git a/src/ports/SkFontHost_freetype_mac.cpp b/src/ports/SkFontHost_freetype_mac.cpp
index 8b1272aef6..652fb463db 100644
--- a/src/ports/SkFontHost_freetype_mac.cpp
+++ b/src/ports/SkFontHost_freetype_mac.cpp
@@ -22,7 +22,7 @@ public:
fStream->unref();
}
- SkStream* fStream;
+ SkStream* fStream;
};
static FTMacTypeface* create_from_path(const char path[]) {
@@ -42,7 +42,7 @@ static SkTypeface* ref_default_typeface() {
if (NULL == gDef) {
gDef = create_from_path(FONT_PATH);
}
-
+
gDef->ref();
return gDef;
}
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index 91fb92c0b9..52ac1cf61b 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -46,7 +46,7 @@ class AutoCFRelease : SkNoncopyable {
public:
AutoCFRelease(CFTypeRef obj) : fObj(obj) {}
~AutoCFRelease() { CFSafeRelease(fObj); }
-
+
private:
CFTypeRef fObj;
};
@@ -180,7 +180,7 @@ static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) {
static const char FONT_DEFAULT_NAME[] = "Lucida Sans";
-// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
+// see Source/WebKit/chromium/base/mac/mac_util.mm DarwinMajorVersionInternal
// for original source
static int readVersion() {
struct utsname info;
@@ -303,7 +303,7 @@ public:
CGRGBPixel* getCG(const SkScalerContext_Mac& context, const SkGlyph& glyph,
CGGlyph glyphID, size_t* rowBytesPtr);
-
+
private:
enum {
kSize = 32 * 32 * sizeof(CGRGBPixel)
@@ -352,8 +352,8 @@ static SkTypeface::Style computeStyleBits(CTFontRef font, bool* isMonospace) {
class AutoCFDataRelease {
public:
AutoCFDataRelease(CFDataRef obj) : fObj(obj) {}
- const uint16_t* getShortPtr() {
- return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
+ const uint16_t* getShortPtr() {
+ return fObj ? (const uint16_t*) CFDataGetBytePtr(fObj) : NULL;
}
~AutoCFDataRelease() { CFSafeRelease(fObj); }
private:
@@ -367,7 +367,7 @@ static SkFontID CTFontRef_to_SkFontID(CTFontRef fontRef) {
id &= 0x3FFFFFFF; // make top two bits 00
return id;
}
- // CTFontGetPlatformFont returns NULL if the font is local
+ // CTFontGetPlatformFont returns NULL if the font is local
// (e.g., was created by a CSS3 @font-face rule).
CGFontRef cgFont = CTFontCopyGraphicsFont(fontRef, NULL);
AutoCFDataRelease headRef(CGFontCopyTableForTag(cgFont, 'head'));
@@ -777,11 +777,11 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
CGContextSetAllowsFontSubpixelPositioning(fCG, context.fDoSubPosition);
CGContextSetShouldSubpixelPositionFonts(fCG, context.fDoSubPosition);
-
+
// Draw white on black to create mask.
// TODO: Draw black on white and invert, CG has a special case codepath.
CGContextSetGrayFillColor(fCG, 1.0f, 1.0f);
-
+
// force our checks below to happen
fDoAA = !doAA;
fDoLCD = !doLCD;
@@ -848,9 +848,9 @@ void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkIPoint* offset) c
* field. The choice of long or short offsets is dependent on the maximum
* possible offset distance.
*
- * 'loca' short version: The actual local offset divided by 2 is stored.
+ * 'loca' short version: The actual local offset divided by 2 is stored.
* 'loca' long version: The actual local offset is stored.
- *
+ *
* The result is a offset into a table of 2 byte (16 bit) entries.
*/
static uint32_t getLocaTableEntry(const uint16_t*& locaPtr, int locaFormat) {
@@ -982,7 +982,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
if (!isSnowLeopard()) {
// Lion and Leopard respect the vertical font metrics.
CTFontGetBoundingRectsForGlyphs(fCTVerticalFont,
- kCTFontVerticalOrientation,
+ kCTFontVerticalOrientation,
&cgGlyph, &theBounds, 1);
} else {
// Snow Leopard and earlier respect the vertical font metrics for
@@ -1013,7 +1013,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
CGPathRelease(path);
}
}
-
+
glyph->zeroMetrics();
glyph->fAdvanceX = SkFloatToFixed(theAdvance.width);
glyph->fAdvanceY = -SkFloatToFixed(theAdvance.height);
@@ -1021,7 +1021,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
if (CGRectIsEmpty_inline(theBounds)) {
return;
}
-
+
if (isLeopard() && !fVertical) {
// Leopard does not consider the matrix skew in its bounds.
// Run the bounding rectangle through the skew matrix to determine
@@ -1048,7 +1048,7 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
// Get the metrics
bool lionAdjustedMetrics = false;
if (isLion() || isMountainLion()) {
- if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
+ if (cgGlyph < fGlyphCount && cgGlyph >= getAdjustStart()
&& generateBBoxes()) {
lionAdjustedMetrics = true;
SkRect adjust;
@@ -1131,7 +1131,7 @@ static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes,
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; ++i) {
dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8);
@@ -1156,7 +1156,7 @@ static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt
const int width = glyph.fWidth;
size_t dstRB = glyph.rowBytes();
uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage;
-
+
for (int y = 0; y < glyph.fHeight; y++) {
for (int i = 0; i < width; i++) {
dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, tableB);
@@ -1203,7 +1203,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
if (cgPixels == NULL) {
return;
}
-
+
//TODO: see if drawing black on white and inverting is faster (at least in
//lcd case) as core graphics appears to have special case code for drawing
//black text.
@@ -1229,7 +1229,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
addr = SkTAddByteOffset(addr, cgRowBytes);
}
}
-
+
// Must be careful not to use these if maskPreBlend == NULL
const uint8_t* tableR = NULL;
const uint8_t* tableG = NULL;
@@ -1239,7 +1239,7 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBl
tableG = maskPreBlend->fG;
tableB = maskPreBlend->fB;
}
-
+
// Convert glyph to mask
switch (glyph.fMaskFormat) {
case SkMask::kLCD32_Format: {
@@ -1322,7 +1322,7 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
// need to release font when we're done
font = CTFontCreateCopyWithAttributes(fCTFont, 1, &xform, NULL);
}
-
+
CGGlyph cgGlyph = (CGGlyph)glyph.getGlyphID(fBaseGlyphCount);
CGPathRef cgPath = CTFontCreatePathForGlyph(font, cgGlyph, NULL);
@@ -1423,7 +1423,7 @@ class AutoCGDataProviderRelease : SkNoncopyable {
public:
AutoCGDataProviderRelease(CGDataProviderRef provider) : fProvider(provider) {}
~AutoCGDataProviderRelease() { CGDataProviderRelease(fProvider); }
-
+
private:
CGDataProviderRef fProvider;
};
@@ -1550,13 +1550,13 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
ctFont = CTFontCreateCopyWithAttributes(ctFont, CTFontGetUnitsPerEm(ctFont),
NULL, NULL);
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
-
+
{
CFStringRef fontName = CTFontCopyPostScriptName(ctFont);
CFStringToSkString(fontName, &info->fFontName);
CFRelease(fontName);
}
-
+
info->fMultiMaster = false;
CFIndex glyphCount = CTFontGetGlyphCount(ctFont);
info->fLastGlyphID = SkToU16(glyphCount - 1);
@@ -1571,7 +1571,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
// If it's not a truetype font, mark it as 'other'. Assume that TrueType
// fonts always have both glyf and loca tables. At the least, this is what
// sfntly needs to subset the font. CTFontCopyAttribute() does not always
- // succeed in determining this directly.
+ // succeed in determining this directly.
if (!GetTableSize(fontID, 'glyf') || !GetTableSize(fontID, 'loca')) {
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
info->fItalicAngle = 0;
@@ -1768,7 +1768,7 @@ void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
desc.setPostscriptName(get_str(CTFontCopyPostScriptName(ctFont), &tmpStr));
desc.serialize(stream);
-
+
// by convention, we also write out the actual sfnt data, preceeded by
// a packed-length. For now we skip that, so we just write the zero.
stream->writePackedUInt(0);
@@ -1815,7 +1815,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
h = SkPaint::kNormal_Hinting;
}
rec->setHinting(h);
-
+
bool lcdSupport = supports_LCD();
if (isLCDFormat(rec->fMaskFormat)) {
if (lcdSupport) {
@@ -1825,7 +1825,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
rec->fMaskFormat = SkMask::kA8_Format;
}
}
-
+
if (lcdSupport) {
//CoreGraphics dialates smoothed text as needed.
rec->setContrast(0);
@@ -1845,7 +1845,7 @@ int SkFontHost::CountTables(SkFontID fontID) {
if (NULL == cfArray) {
return 0;
}
-
+
AutoCFRelease ar(cfArray);
return CFArrayGetCount(cfArray);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 7ea3d49681..b9f1cdc7e7 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1514,7 +1514,7 @@ SK_COMPILE_ASSERT(BASE64_GUID_ID_LEN < LF_FACESIZE, GUID_longer_than_facesize);
The following need not be any standard base64 encoding.
The encoded value is never decoded.
*/
-static const char postscript_safe_base64_encode[] =
+static const char postscript_safe_base64_encode[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-_=";
@@ -1576,7 +1576,7 @@ SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
if (FAILED(create_unique_font_name(familyName, familyNameSize))) {
return NULL;
}
-
+
// Change the name of the font.
SkAutoTUnref<SkData> rewrittenFontData(SkOTUtils::RenameFont(stream, familyName, familyNameSize-1));
if (NULL == rewrittenFontData.get()) {
diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp
index c3a13a020e..288ee4ce05 100644
--- a/src/ports/SkFontHost_win_dw.cpp
+++ b/src/ports/SkFontHost_win_dw.cpp
@@ -90,7 +90,7 @@ static HRESULT get_dwrite_factory(IDWriteFactory** factory) {
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory")
)
;
-
+
if (!dWriteCreateFactoryProc) {
return E_UNEXPECTED;
}
@@ -99,7 +99,7 @@ static HRESULT get_dwrite_factory(IDWriteFactory** factory) {
__uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&gDWriteFactory)),
"Could not create DirectWrite factory.");
-
+
*factory = gDWriteFactory;
return S_OK;
}
@@ -162,7 +162,7 @@ const void* DWriteOffscreen::draw(const SkGlyph& glyph, bool isBW) {
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
//NOTE: this assumes that the glyph has already been measured
//with an exact same glyph run analysis.
RECT bbox;
@@ -296,7 +296,7 @@ static HRESULT get_default_font(IDWriteFont** font) {
SkDEBUGF(("The hard coded font family does not exist."));
return E_UNEXPECTED;
}
-
+
SkTScopedComPtr<IDWriteFontFamily> fontFamily;
HRM(sysFonts->GetFontFamily(index, &fontFamily),
"Could not load the requested font family.");
@@ -518,7 +518,7 @@ void SkScalerContext_Windows::generateAdvance(SkGlyph* glyph) {
//DirectWrite does not provide this information.
glyph->fRsbDelta = 0;
glyph->fLsbDelta = 0;
-
+
glyph->fAdvanceX = 0;
glyph->fAdvanceY = 0;
@@ -533,7 +533,7 @@ void SkScalerContext_Windows::generateAdvance(SkGlyph* glyph) {
SkScalar advanceX = SkScalarMulDiv(fRec.fTextSize,
SkIntToScalar(gm.advanceWidth),
SkIntToScalar(dwfm.designUnitsPerEm));
-
+
if (!(fRec.fFlags & kSubpixelPositioning_Flag)) {
advanceX = SkScalarRoundToScalar(advanceX);
}
@@ -600,7 +600,7 @@ void SkScalerContext_Windows::generateMetrics(SkGlyph* glyph) {
0.0f, // baselineOriginY,
&glyphRunAnalysis),
"Could not create glyph run analysis.");
-
+
RECT bbox;
HRVM(glyphRunAnalysis->GetAlphaTextureBounds(textureType, &bbox),
"Could not get texture bounds.");
@@ -1236,7 +1236,7 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
float gamma = defaultRenderingParams->GetGamma();
rec->setDeviceGamma(SkFloatToScalar(gamma));
rec->setPaintGamma(SkFloatToScalar(gamma));
-
+
rec->setContrast(SkFloatToScalar(defaultRenderingParams->GetEnhancedContrast()));
}
}
@@ -1491,7 +1491,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
}
}
*/
-
+
// If Restricted, the font may not be embedded in a document.
// If not Restricted, the font can be embedded.
// If PreviewPrint, the embedding is read-only.
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index c0dfd39149..e9235a8375 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#include "SkTypes.h"
#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 4e2bcc96f0..26f574494f 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -31,7 +31,7 @@ static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) {
size_t len = stream->getLength();
void* data = sk_malloc_throw(len);
stream->read(data, len);
-
+
return CGDataProviderCreateWithData(data, data, len, malloc_release_proc);
}
@@ -56,24 +56,24 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
-
+
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL);
if (NULL == image) {
return false;
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
-
+
const int width = CGImageGetWidth(image);
const int height = CGImageGetHeight(image);
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
-
+
if (!this->allocPixelRef(bm, NULL)) {
return false;
}
-
+
bm->lockPixels();
bm->eraseColor(0);
@@ -127,7 +127,7 @@ static CGImageDestinationRef SkStreamToImageDestination(SkWStream* stream,
return NULL;
}
SkAutoTCallVProc<const void, CFRelease> arconsumer(consumer);
-
+
return CGImageDestinationCreateWithDataConsumer(consumer, type, 1, NULL);
}
@@ -137,7 +137,7 @@ public:
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
-
+
private:
Type fType;
};
@@ -159,7 +159,7 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm,
default:
return false;
}
-
+
CGImageDestinationRef dst = SkStreamToImageDestination(stream, type);
if (NULL == dst) {
return false;
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index a69ed4a0f1..79d107adec 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -29,9 +29,9 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -42,19 +42,19 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert SkStream to IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkIStream::CreateFromSkStream(stream, false, &piStream);
}
-
+
//Make sure we're at the beginning of the stream.
if (SUCCEEDED(hr)) {
LARGE_INTEGER liBeginning = { 0 };
hr = piStream->Seek(liBeginning, STREAM_SEEK_SET, NULL);
}
-
+
//Create the decoder from the stream content.
SkTScopedComPtr<IWICBitmapDecoder> piBitmapDecoder;
if (SUCCEEDED(hr)) {
@@ -65,13 +65,13 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, &piBitmapDecoder //Pointer to the decoder
);
}
-
+
//Get the first frame from the decoder.
SkTScopedComPtr<IWICBitmapFrameDecode> piBitmapFrameDecode;
if (SUCCEEDED(hr)) {
hr = piBitmapDecoder->GetFrame(0, &piBitmapFrameDecode);
}
-
+
//Get the BitmapSource interface of the frame.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceOriginal;
if (SUCCEEDED(hr)) {
@@ -79,14 +79,14 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
IID_PPV_ARGS(&piBitmapSourceOriginal)
);
}
-
+
//Get the size of the bitmap.
UINT width;
UINT height;
if (SUCCEEDED(hr)) {
hr = piBitmapSourceOriginal->GetSize(&width, &height);
}
-
+
//Exit early if we're only looking for the bitmap bounds.
if (SUCCEEDED(hr)) {
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
@@ -97,13 +97,13 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
return false;
}
}
-
+
//Create a format converter.
SkTScopedComPtr<IWICFormatConverter> piFormatConverter;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateFormatConverter(&piFormatConverter);
}
-
+
if (SUCCEEDED(hr)) {
hr = piFormatConverter->Initialize(
piBitmapSourceOriginal.get() //Input bitmap to convert
@@ -114,7 +114,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
, WICBitmapPaletteTypeCustom //Palette translation type
);
}
-
+
//Get the BitmapSource interface of the format converter.
SkTScopedComPtr<IWICBitmapSource> piBitmapSourceConverted;
if (SUCCEEDED(hr)) {
@@ -122,7 +122,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
IID_PPV_ARGS(&piBitmapSourceConverted)
);
}
-
+
//Copy the pixels into the bitmap.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bm);
@@ -135,7 +135,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
reinterpret_cast<BYTE *>(bm->getPixels())
);
}
-
+
return SUCCEEDED(hr);
}
@@ -197,9 +197,9 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
if (!scopedCo.succeeded()) {
return false;
}
-
+
HRESULT hr = S_OK;
-
+
//Create Windows Imaging Component ImagingFactory.
SkTScopedComPtr<IWICImagingFactory> piImagingFactory;
if (SUCCEEDED(hr)) {
@@ -210,41 +210,41 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
, IID_PPV_ARGS(&piImagingFactory)
);
}
-
+
//Convert the SkWStream to an IStream.
SkTScopedComPtr<IStream> piStream;
if (SUCCEEDED(hr)) {
hr = SkWIStream::CreateFromSkWStream(stream, &piStream);
}
-
+
//Create an encode of the appropriate type.
SkTScopedComPtr<IWICBitmapEncoder> piEncoder;
if (SUCCEEDED(hr)) {
hr = piImagingFactory->CreateEncoder(type, NULL, &piEncoder);
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Initialize(piStream.get(), WICBitmapEncoderNoCache);
}
-
+
//Create a the frame.
SkTScopedComPtr<IWICBitmapFrameEncode> piBitmapFrameEncode;
SkTScopedComPtr<IPropertyBag2> piPropertybag;
if (SUCCEEDED(hr)) {
hr = piEncoder->CreateNewFrame(&piBitmapFrameEncode, &piPropertybag);
}
-
+
if (SUCCEEDED(hr)) {
PROPBAG2 name = { 0 };
name.dwType = PROPBAG2_TYPE_DATA;
name.vt = VT_R4;
name.pstrName = L"ImageQuality";
-
+
VARIANT value;
VariantInit(&value);
value.vt = VT_R4;
value.fltVal = (FLOAT)(quality / 100.0);
-
+
//Ignore result code.
// This returns E_FAIL if the named property is not in the bag.
//TODO(bungeman) enumerate the properties,
@@ -254,14 +254,14 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Initialize(piPropertybag.get());
}
-
+
//Set the size of the frame.
const UINT width = bitmap->width();
const UINT height = bitmap->height();
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->SetSize(width, height);
}
-
+
//Set the pixel format of the frame.
const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA;
WICPixelFormatGUID formatGUID = formatDesired;
@@ -272,7 +272,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
//Be sure the image format is the one requested.
hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL;
}
-
+
//Write the pixels into the frame.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bitmap);
@@ -282,15 +282,15 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
, bitmap->rowBytes()*height
, reinterpret_cast<BYTE*>(bitmap->getPixels()));
}
-
+
if (SUCCEEDED(hr)) {
hr = piBitmapFrameEncode->Commit();
}
-
+
if (SUCCEEDED(hr)) {
hr = piEncoder->Commit();
}
-
+
return SUCCEEDED(hr);
}
diff --git a/src/ports/SkImageRef_ashmem.cpp b/src/ports/SkImageRef_ashmem.cpp
index 81f24dd630..01b950e576 100644
--- a/src/ports/SkImageRef_ashmem.cpp
+++ b/src/ports/SkImageRef_ashmem.cpp
@@ -34,14 +34,14 @@ SkImageRef_ashmem::SkImageRef_ashmem(SkStream* stream,
SkBitmap::Config config,
int sampleSize)
: SkImageRef(stream, config, sampleSize) {
-
+
fRec.fFD = -1;
fRec.fAddr = NULL;
fRec.fSize = 0;
fRec.fPinned = false;
-
+
fCT = NULL;
-
+
this->useDefaultMutex(); // we don't need/want the shared imageref mutex
}
@@ -80,7 +80,7 @@ public:
if (-1 == fd) {
SkASSERT(NULL == addr);
SkASSERT(0 == fRec->fSize);
-
+
fd = ashmem_create_region(fName, size);
#ifdef DUMP_ASHMEM_LIFECYCLE
SkDebugf("=== ashmem_create_region %s size=%d fd=%d\n", fName, size, fd);
@@ -90,7 +90,7 @@ public:
fName, size);
return false;
}
-
+
int err = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
if (err) {
SkDebugf("------ ashmem_set_prot_region(%d) failed %d\n",
@@ -98,7 +98,7 @@ public:
close(fd);
return false;
}
-
+
addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (-1 == (long)addr) {
SkDebugf("---------- mmap failed for imageref_ashmem size=%d\n",
@@ -106,7 +106,7 @@ public:
close(fd);
return false;
}
-
+
fRec->fFD = fd;
fRec->fAddr = addr;
fRec->fSize = size;
@@ -120,7 +120,7 @@ public:
fRec->fPinned = true;
return true;
}
-
+
private:
// we just point to our caller's memory, these are not copies
SkAshmemRec* fRec;
@@ -130,13 +130,13 @@ private:
bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode) {
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return this->INHERITED::onDecode(codec, stream, bitmap, config, mode);
}
AshmemAllocator alloc(&fRec, this->getURI());
-
+
codec->setAllocator(&alloc);
bool success = this->INHERITED::onDecode(codec, stream, bitmap, config,
mode);
@@ -192,21 +192,21 @@ void* SkImageRef_ashmem::onLockPixels(SkColorTable** ct) {
} else {
// no FD, will create an ashmem region in allocator
}
-
+
return this->INHERITED::onLockPixels(ct);
}
void SkImageRef_ashmem::onUnlockPixels() {
this->INHERITED::onUnlockPixels();
-
+
if (-1 != fRec.fFD) {
SkASSERT(fRec.fAddr);
SkASSERT(fRec.fPinned);
-
+
ashmem_unpin_region(fRec.fFD, 0, 0);
fRec.fPinned = false;
}
-
+
// we clear this with or without an error, since we've either closed or
// unpinned the region
fBitmap.setPixels(NULL, NULL);
diff --git a/src/ports/SkImageRef_ashmem.h b/src/ports/SkImageRef_ashmem.h
index 5b4e8142dc..f98507aabc 100644
--- a/src/ports/SkImageRef_ashmem.h
+++ b/src/ports/SkImageRef_ashmem.h
@@ -21,7 +21,7 @@ class SkImageRef_ashmem : public SkImageRef {
public:
SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
virtual ~SkImageRef_ashmem();
-
+
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)
protected:
@@ -31,10 +31,10 @@ protected:
virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
SkBitmap* bitmap, SkBitmap::Config config,
SkImageDecoder::Mode mode);
-
+
virtual void* onLockPixels(SkColorTable**);
virtual void onUnlockPixels();
-
+
private:
void closeFD();
diff --git a/src/ports/SkThread_pthread.cpp b/src/ports/SkThread_pthread.cpp
index ad243b9e3a..b430dd9551 100644
--- a/src/ports/SkThread_pthread.cpp
+++ b/src/ports/SkThread_pthread.cpp
@@ -15,7 +15,7 @@
/**
We prefer the GCC intrinsic implementation of the atomic operations over the
- SkMutex-based implementation. The SkMutex version suffers from static
+ SkMutex-based implementation. The SkMutex version suffers from static
destructor ordering problems.
Note clang also defines the GCC version macros and implements the intrinsics.
TODO: Verify that gcc-style __sync_* intrinsics work on ARM
@@ -82,7 +82,7 @@ int32_t sk_atomic_inc(int32_t* addr)
int32_t sk_atomic_add(int32_t* addr, int32_t inc)
{
SkAutoMutexAcquire ac(gAtomicMutex);
-
+
int32_t value = *addr;
*addr = value + inc;
return value;
@@ -166,7 +166,7 @@ SkMutex::SkMutex() {
status = pthread_mutexattr_init(&attr);
print_pthread_error(status);
SkASSERT(0 == status);
-
+
status = pthread_mutex_init((pthread_mutex_t*)fStorage, &attr);
print_pthread_error(status);
SkASSERT(0 == status);
diff --git a/src/ports/SkXMLParser_expat.cpp b/src/ports/SkXMLParser_expat.cpp
index c78dc35073..8c1c2bfd1c 100644
--- a/src/ports/SkXMLParser_expat.cpp
+++ b/src/ports/SkXMLParser_expat.cpp
@@ -28,7 +28,7 @@ inline size_t sk_wcslen(const short* char16) {
inline const char* ConvertUnicodeToChar(const short* ch16, size_t len, SkAutoMalloc& ch8Malloc) {
char* ch8 = (char*) ch8Malloc.get();
int index;
- for (index = 0; index < len; index++)
+ for (index = 0; index < len; index++)
ch8[index] = (char) ch16[index];
ch8[index] = '\0';
return ch8;
diff --git a/src/ports/SkXMLParser_tinyxml.cpp b/src/ports/SkXMLParser_tinyxml.cpp
index 2e308aa45b..de1fbe57bc 100644
--- a/src/ports/SkXMLParser_tinyxml.cpp
+++ b/src/ports/SkXMLParser_tinyxml.cpp
@@ -22,12 +22,12 @@ static void walk_elem(SkXMLParser* parser, const TiXmlElement* elem)
while (attr)
{
//printf("walk_elem_attr(%s=\"%s\") ", attr->Name(), attr->Value());
-
+
parser->addAttribute(attr->Name(), attr->Value());
attr = attr->Next();
}
//printf("\n");
-
+
const TiXmlNode* node = elem->FirstChild();
while (node)
{
@@ -37,7 +37,7 @@ static void walk_elem(SkXMLParser* parser, const TiXmlElement* elem)
parser->text(node->Value(), strlen(node->Value()));
node = node->NextSibling();
}
-
+
parser->endElement(elem->Value());
}
@@ -51,7 +51,7 @@ static bool load_buf(SkXMLParser* parser, const char buf[])
printf("tinyxml error: <%s> row[%d] col[%d]\n", doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
return false;
}
-
+
walk_elem(parser, doc.RootElement());
return true;
}
@@ -59,13 +59,13 @@ static bool load_buf(SkXMLParser* parser, const char buf[])
bool SkXMLParser::parse(SkStream& stream)
{
size_t size = stream.read(NULL, 0);
-
+
SkAutoMalloc buffer(size + 1);
char* buf = (char*)buffer.get();
-
+
stream.read(buf, size);
buf[size] = 0;
-
+
return load_buf(this, buf);
}
@@ -73,10 +73,10 @@ bool SkXMLParser::parse(const char doc[], size_t len)
{
SkAutoMalloc buffer(len + 1);
char* buf = (char*)buffer.get();
-
+
memcpy(buf, doc, len);
buf[len] = 0;
-
+
return load_buf(this, buf);
}
diff --git a/src/ports/SkXMLPullParser_expat.cpp b/src/ports/SkXMLPullParser_expat.cpp
index 825ca68d4e..5fcdff372c 100644
--- a/src/ports/SkXMLPullParser_expat.cpp
+++ b/src/ports/SkXMLPullParser_expat.cpp
@@ -18,8 +18,8 @@ static inline char* dupstr(SkChunkAlloc& chunk, const char src[], size_t len)
{
SkASSERT(src);
char* dst = (char*)chunk.alloc(len + 1, SkChunkAlloc::kThrow_AllocFailType);
-
- memcpy(dst, src, len);
+
+ memcpy(dst, src, len);
dst[len] = 0;
return dst;
}
@@ -37,11 +37,11 @@ static inline int count_pairs(const char** p)
struct Data {
Data() : fAlloc(2048), fState(NORMAL) {}
-
+
XML_Parser fParser;
SkXMLPullParser::Curr* fCurr;
SkChunkAlloc fAlloc;
-
+
enum State {
NORMAL,
MISSED_START_TAG,
@@ -58,7 +58,7 @@ static void XMLCALL start_proc(void *data, const char *el, const char **attr)
SkChunkAlloc& alloc = p->fAlloc;
c->fName = dupstr(alloc, el, strlen(el));
-
+
int n = count_pairs(attr);
SkXMLPullParser::AttrInfo* info = (SkXMLPullParser::AttrInfo*)alloc.alloc(n * sizeof(SkXMLPullParser::AttrInfo),
SkChunkAlloc::kThrow_AllocFailType);
@@ -88,7 +88,7 @@ static void XMLCALL end_proc(void *data, const char *el)
so we set a flag to notify them of the missed start_tag
*/
p->fState = Data::MISSED_START_TAG;
-
+
SkASSERT(c->fName != NULL);
SkASSERT(strcmp(c->fName, el) == 0);
}
@@ -134,7 +134,7 @@ static void reportError(XML_Parser parser)
XML_Error code = XML_GetErrorCode(parser);
int lineNumber = XML_GetCurrentLineNumber(parser);
const char* msg = XML_ErrorString(code);
-
+
printf("-------- XML error [%d] on line %d, %s\n", code, lineNumber, msg);
}
@@ -183,7 +183,7 @@ SkXMLPullParser::EventType SkXMLPullParser::onNextToken()
XML_Status status;
status = XML_ResumeParser(p);
-
+
CHECK_STATUS:
switch (status) {
case XML_STATUS_OK:
@@ -204,7 +204,7 @@ CHECK_STATUS:
// return a start_tag, and clear the flag so we return end_tag next
SkASSERT(SkXMLPullParser::END_TAG == fCurr.fEventType);
fImpl->fData.fState = Data::RETURN_END_TAG;
- fImpl->fData.fEndTag = fCurr.fName; // save this pointer
+ fImpl->fData.fEndTag = fCurr.fName; // save this pointer
return SkXMLPullParser::START_TAG;
}
break;
diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp
index 61edabd02d..6e94437e2a 100644
--- a/src/sfnt/SkOTUtils.cpp
+++ b/src/sfnt/SkOTUtils.cpp
@@ -73,7 +73,7 @@ SkData* SkOTUtils::RenameFont(SkStream* fontData,
//originalDataSize is the size of the original data without the name table.
size_t originalDataSize = fontData->getLength() - oldNameTablePhysicalSize;
size_t newDataSize = originalDataSize + nameTablePhysicalSize;
-
+
SK_OT_BYTE* data = static_cast<SK_OT_BYTE*>(sk_malloc_throw(newDataSize));
SkAutoTUnref<SkData> rewrittenFontData(SkData::NewFromMalloc(data, newDataSize));
diff --git a/src/sfnt/SkTypedEnum.h b/src/sfnt/SkTypedEnum.h
index ce1a93996c..73d7314885 100644
--- a/src/sfnt/SkTypedEnum.h
+++ b/src/sfnt/SkTypedEnum.h
@@ -40,7 +40,7 @@
SK_PAIR_FIRST(elem) = SK_PAIR_SECOND(elem),
#define SK_TYPED_ENUM_IDS(data, elem) \
- elem,
+ elem,
#define SK_TYPED_ENUM_IDS_L(data, elem) \
elem
diff --git a/src/svg/SkSVGClipPath.cpp b/src/svg/SkSVGClipPath.cpp
index 0a41764f84..fa3a79918d 100644
--- a/src/svg/SkSVGClipPath.cpp
+++ b/src/svg/SkSVGClipPath.cpp
@@ -32,7 +32,7 @@ void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) {
const char* refStr = &use->f_xlink_href.c_str()[1];
SkASSERT(parser.getIDs().find(refStr, &ref));
SkASSERT(ref);
- if (ref->getType() == SkSVGType_Rect)
+ if (ref->getType() == SkSVGType_Rect)
parser._addAttribute("rectangle", refStr);
else
parser._addAttribute("path", refStr);
diff --git a/src/svg/SkSVGElements.cpp b/src/svg/SkSVGElements.cpp
index 0096fc055e..66dcd4e9c9 100644
--- a/src/svg/SkSVGElements.cpp
+++ b/src/svg/SkSVGElements.cpp
@@ -13,7 +13,7 @@
SkSVGBase::~SkSVGBase() {
}
-void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
SkString* first = (SkString*) ((char*) this + sizeof(SkSVGElement));
first += attrIndex;
@@ -82,7 +82,7 @@ void SkSVGElement::setIsDef() {
//}
void SkSVGElement::write(SkSVGParser& , SkString& ) {
- SkASSERT(0);
+ SkASSERT(0);
}
diff --git a/src/svg/SkSVGGradient.cpp b/src/svg/SkSVGGradient.cpp
index 27964e7328..d5f76394eb 100644
--- a/src/svg/SkSVGGradient.cpp
+++ b/src/svg/SkSVGGradient.cpp
@@ -84,7 +84,7 @@ void SkSVGGradient::write(SkSVGParser& parser, SkString& baseColor) {
parser.fSuppressPaint = true;
SkString originalID(f_id);
f_id.set("mask"); // write out gradient named given name + color (less initial #)
- f_id.append(baseColor.c_str() + 1);
+ f_id.append(baseColor.c_str() + 1);
SkString originalColors;
for (SkSVGElement** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkSVGStop* colorElement = (SkSVGStop*) *ptr;
diff --git a/src/svg/SkSVGPaintState.cpp b/src/svg/SkSVGPaintState.cpp
index 1a30cb8a24..db3090074c 100644
--- a/src/svg/SkSVGPaintState.cpp
+++ b/src/svg/SkSVGPaintState.cpp
@@ -49,7 +49,7 @@ SkString* SkSVGPaint::operator[](int index) {
return result;
}
-void SkSVGPaint::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGPaint::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
SkString* attr = (*this)[attrIndex];
switch(attrIndex) {
@@ -221,7 +221,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
sum.setConcat(matrix, sum);
continue;
}
- if ( index == kClipPath)
+ if ( index == kClipPath)
*clips.insert(0) = lastAttr;
}
walking = walking->fNext;
@@ -267,7 +267,7 @@ void SkSVGPaint::setSave(SkSVGParser& parser) {
#endif
}
-bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
+bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
SkSVGPaint& current, bool* changed) {
SkSVGPaint& lastState = parser.fLastFlush;
for (int index = kInitial + 1; index < kTerminal; index++) {
@@ -285,7 +285,7 @@ bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
case kEnableBackground:
break;
case kFill:
- if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
+ if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
parser._addAttribute("stroke", "false");
goto fillStrokeAttrCommon;
case kFillRule:
@@ -307,7 +307,7 @@ bool SkSVGPaint::writeChangedAttributes(SkSVGParser& parser,
case kStopOpacity:
break;
case kStroke:
- if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
+ if (topAttr->equals("none") == false && lastAttr->equals("none") == true)
parser._addAttribute("stroke", "true");
fillStrokeAttrCommon:
if (strncmp(attrValue, "url(", 4) == 0) {
@@ -442,7 +442,7 @@ addColor:
}
return true;
}
-
+
void SkSVGPaint::Push(SkSVGPaint** head, SkSVGPaint* newRecord) {
newRecord->fNext = *head;
*head = newRecord;
diff --git a/src/svg/SkSVGParser.cpp b/src/svg/SkSVGParser.cpp
index c8712b4796..74ea0236e0 100644
--- a/src/svg/SkSVGParser.cpp
+++ b/src/svg/SkSVGParser.cpp
@@ -35,9 +35,9 @@
static int gGeneratedMatrixID = 0;
-SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
- SkXMLParser(errHandler),
- fHead(&fEmptyPaint), fIDs(256),
+SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
+ SkXMLParser(errHandler),
+ fHead(&fEmptyPaint), fIDs(256),
fXMLWriter(&fStream), fCurrElement(NULL), fInSVG(false), fSuppressPaint(false) {
fLastTransform.reset();
fEmptyPaint.f_fill.set("black");
@@ -72,7 +72,7 @@ int SkSVGParser::findAttribute(SkSVGBase* element, const char* attrValue,
size_t result = 0;
while (result < count) {
if (strncmp(attributes->fName, attrValue, len) == 0 && strlen(attributes->fName) == len) {
- SkASSERT(result == (attributes->fOffset -
+ SkASSERT(result == (attributes->fOffset -
(isPaint ? sizeof(SkString) : sizeof(SkSVGElement))) / sizeof(SkString));
return result;
}
@@ -199,9 +199,9 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
SkSVGTypes type = GetType(name, len);
// SkASSERT(type >= 0);
if (type < 0) {
- type = SkSVGType_G;
+ type = SkSVGType_G;
// return true;
- }
+ }
SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
SkSVGElement* element = CreateElement(type, parent);
bool result = false;
@@ -219,7 +219,7 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
bool SkSVGParser::onText(const char text[], int len) {
if (fInSVG == false)
return false;
- SkSVGTypes type = fCurrElement->getType();
+ SkSVGTypes type = fCurrElement->getType();
if (type != SkSVGType_Text && type != SkSVGType_Tspan)
return false;
SkSVGText* textElement = (SkSVGText*) fCurrElement;
@@ -310,7 +310,7 @@ void SkSVGParser::translateMatrix(SkString& string, SkString* stringID) {
string.append(elems[index], end - elems[index] + 1);
}
string.remove(string.size() - 1, 1);
- string.append(",0,0,1]");
+ string.append(",0,0,1]");
_addAttribute("matrix", string);
_endElement(); // matrix
}
@@ -434,8 +434,8 @@ const SkSVGTypeName gSVGTypeNames[] = {
const int kSVGTypeNamesSize = SK_ARRAY_COUNT(gSVGTypeNames);
SkSVGTypes SkSVGParser::GetType(const char match[], size_t len ) {
- int index = SkStrSearch(&gSVGTypeNames[0].fName, kSVGTypeNamesSize, match,
+ int index = SkStrSearch(&gSVGTypeNames[0].fName, kSVGTypeNamesSize, match,
len, sizeof(gSVGTypeNames[0]));
- return index >= 0 && index < kSVGTypeNamesSize ? gSVGTypeNames[index].fType :
+ return index >= 0 && index < kSVGTypeNamesSize ? gSVGTypeNames[index].fType :
(SkSVGTypes) -1;
}
diff --git a/src/svg/SkSVGPath.cpp b/src/svg/SkSVGPath.cpp
index 92f5b14887..ab18a65a7b 100644
--- a/src/svg/SkSVGPath.cpp
+++ b/src/svg/SkSVGPath.cpp
@@ -29,7 +29,7 @@ void SkSVGPath::translate(SkSVGParser& parser, bool defState) {
}
if (hasMultiplePaths) {
SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule);
- if (fillRule.size() > 0)
+ if (fillRule.size() > 0)
parser._addAttribute("fillType", fillRule.equals("evenodd") ? "evenOdd" : "winding");
}
SVG_ADD_ATTRIBUTE(d);
diff --git a/src/svg/SkSVGPolygon.cpp b/src/svg/SkSVGPolygon.cpp
index 97cf5e06b5..4b458db9e7 100644
--- a/src/svg/SkSVGPolygon.cpp
+++ b/src/svg/SkSVGPolygon.cpp
@@ -18,7 +18,7 @@ const SkSVGAttribute SkSVGPolygon::gAttributes[] = {
DEFINE_SVG_INFO(Polygon)
-void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex,
+void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex,
const char* attrValue, size_t attrLength) {
INHERITED::addAttribute(parser, attrIndex, attrValue, attrLength);
}
@@ -27,7 +27,7 @@ void SkSVGPolygon::translate(SkSVGParser& parser, bool defState) {
parser._startElement("polygon");
SkSVGElement::translate(parser, defState);
SVG_ADD_ATTRIBUTE(points);
- if (f_fillRule.size() > 0)
+ if (f_fillRule.size() > 0)
parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
parser._endElement();
}
diff --git a/src/svg/SkSVGPolygon.h b/src/svg/SkSVGPolygon.h
index d353764896..b2848d064b 100644
--- a/src/svg/SkSVGPolygon.h
+++ b/src/svg/SkSVGPolygon.h
@@ -14,7 +14,7 @@
class SkSVGPolygon : public SkSVGPolyline {
DECLARE_SVG_INFO(Polygon);
- virtual void addAttribute(SkSVGParser& , int attrIndex,
+ virtual void addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength);
private:
typedef SkSVGPolyline INHERITED;
diff --git a/src/svg/SkSVGPolyline.cpp b/src/svg/SkSVGPolyline.cpp
index fe83c04655..83dad488a5 100644
--- a/src/svg/SkSVGPolyline.cpp
+++ b/src/svg/SkSVGPolyline.cpp
@@ -24,7 +24,7 @@ const SkSVGAttribute SkSVGPolyline::gAttributes[] = {
DEFINE_SVG_INFO(Polyline)
-void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex,
+void SkSVGPolyline::addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength) {
if (attrIndex != kPoints)
return;
@@ -37,7 +37,7 @@ void SkSVGPolyline::translate(SkSVGParser& parser, bool defState) {
parser._startElement("polyline");
INHERITED::translate(parser, defState);
SVG_ADD_ATTRIBUTE(points);
- if (f_fillRule.size() > 0)
+ if (f_fillRule.size() > 0)
parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
parser._endElement();
}
diff --git a/src/svg/SkSVGPolyline.h b/src/svg/SkSVGPolyline.h
index 62dc417427..b8d5af45a8 100644
--- a/src/svg/SkSVGPolyline.h
+++ b/src/svg/SkSVGPolyline.h
@@ -15,7 +15,7 @@
class SkSVGPolyline : public SkSVGElement {
DECLARE_SVG_INFO(Polyline);
- virtual void addAttribute(SkSVGParser& , int attrIndex,
+ virtual void addAttribute(SkSVGParser& , int attrIndex,
const char* attrValue, size_t attrLength);
protected:
SkString f_clipRule;
diff --git a/src/svg/SkSVGSVG.cpp b/src/svg/SkSVGSVG.cpp
index a072d09f69..fcce62de9e 100644
--- a/src/svg/SkSVGSVG.cpp
+++ b/src/svg/SkSVGSVG.cpp
@@ -48,8 +48,8 @@ void SkSVGSVG::translate(SkSVGParser& parser, bool defState) {
box.fTop = SkScalarDiv(viewBox[1], height);
box.fRight = SkScalarDiv(viewBox[2], width);
box.fBottom = SkScalarDiv(viewBox[3], height);
- if (box.fLeft == 0 && box.fTop == 0 &&
- box.fRight == SK_Scalar1 && box.fBottom == SK_Scalar1)
+ if (box.fLeft == 0 && box.fTop == 0 &&
+ box.fRight == SK_Scalar1 && box.fBottom == SK_Scalar1)
return;
parser._startElement("matrix");
if (box.fLeft != 0) {
@@ -72,5 +72,5 @@ void SkSVGSVG::translate(SkSVGParser& parser, bool defState) {
y.appendScalar(box.fBottom);
parser._addAttributeLen("scaleY", y.c_str(), y.size());
}
- parser._endElement();
+ parser._endElement();
}
diff --git a/src/svg/SkSVGSVG.h b/src/svg/SkSVGSVG.h
index 7d1e16ad41..155f9a9bab 100644
--- a/src/svg/SkSVGSVG.h
+++ b/src/svg/SkSVGSVG.h
@@ -22,11 +22,11 @@ private:
SkString f_width;
SkString f_version;
SkString f_viewBox;
- SkString f_x;
+ SkString f_x;
SkString f_xml_space;
SkString f_xmlns;
SkString f_xml_xlink;
- SkString f_y;
+ SkString f_y;
typedef SkSVGElement INHERITED;
};
diff --git a/src/svg/SkSVGSymbol.cpp b/src/svg/SkSVGSymbol.cpp
index a98846719a..ce341e6492 100644
--- a/src/svg/SkSVGSymbol.cpp
+++ b/src/svg/SkSVGSymbol.cpp
@@ -18,5 +18,5 @@ DEFINE_SVG_INFO(Symbol)
void SkSVGSymbol::translate(SkSVGParser& parser, bool defState) {
INHERITED::translate(parser, defState);
- // !!! children need to be written into document
+ // !!! children need to be written into document
}
diff --git a/src/utils/SkBase64.cpp b/src/utils/SkBase64.cpp
index a8d4e8727f..8e1f2237ac 100644
--- a/src/utils/SkBase64.cpp
+++ b/src/utils/SkBase64.cpp
@@ -12,7 +12,7 @@
#define DecodePad -2
#define EncodePad 64
-static const char default_encode[] =
+static const char default_encode[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/=";
@@ -55,7 +55,7 @@ SkBase64::Error SkBase64::decode(const void* srcPtr, size_t size, bool writeDest
signed char decoded = decodeData[srcByte - '+'];
bytes[byte] = decoded;
if (decoded < 0) {
- if (decoded == DecodePad)
+ if (decoded == DecodePad)
goto handlePad;
return kBadCharError;
} else
@@ -89,7 +89,7 @@ handlePad:
*dst = (unsigned char) one;
}
dst++;
- if (padTwo)
+ if (padTwo)
break;
if (writeDestination)
*dst = (unsigned char) two;
@@ -105,7 +105,7 @@ goHome:
return kNoError;
}
-#if defined _WIN32 && _MSC_VER >= 1300
+#if defined _WIN32 && _MSC_VER >= 1300
#pragma warning ( pop )
#endif
@@ -126,7 +126,7 @@ size_t SkBase64::Encode(const void* srcPtr, size_t length, void* dstPtr, const c
unsigned b = *src++;
unsigned c = *src++;
int d = c & 0x3F;
- c = (c >> 6 | b << 2) & 0x3F;
+ c = (c >> 6 | b << 2) & 0x3F;
b = (b >> 4 | a << 4) & 0x3F;
a = a >> 2;
*dst++ = encode[a];
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
index c305c8b7f5..afc76b5c70 100644
--- a/src/utils/SkBoundaryPatch.cpp
+++ b/src/utils/SkBoundaryPatch.cpp
@@ -50,7 +50,7 @@ bool SkBoundaryPatch::evalPatch(SkPoint verts[], int rows, int cols) {
const SkScalar invR = SkScalarInvert(SkIntToScalar(rows - 1));
const SkScalar invC = SkScalarInvert(SkIntToScalar(cols - 1));
-
+
for (int y = 0; y < cols; y++) {
SkScalar yy = y * invC;
for (int x = 0; x < rows; x++) {
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index ac6fa0fb83..7d6963ce9a 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -369,7 +369,7 @@ void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
fCamera.fLocation.set(x * SkFloatToScalar(72.0f), y * SkFloatToScalar(72.0f), lz);
fCamera.fObserver.set(0, 0, lz);
fCamera.update();
-
+
}
SkScalar Sk3DView::getCameraLocationX() {
@@ -419,7 +419,7 @@ void Sk3DView::getMatrix(SkMatrix* matrix) const {
void Sk3DView::applyToCanvas(SkCanvas* canvas) const {
SkMatrix matrix;
-
+
this->getMatrix(&matrix);
canvas->concat(matrix);
}
diff --git a/src/utils/SkCubicInterval.cpp b/src/utils/SkCubicInterval.cpp
index 6c6b0a96e5..904f26bd23 100644
--- a/src/utils/SkCubicInterval.cpp
+++ b/src/utils/SkCubicInterval.cpp
@@ -59,7 +59,7 @@ SkScalar SkEvalCubicInterval(SkScalar x1, SkScalar y1,
// now search for t given unitX
SkScalar t = find_cubic_t(x1, x2 - 2*x1, x1 - x2 + SK_Scalar1, unitX);
-
+
// now evaluate the cubic in Y
y1 *= 3;
y2 *= 3;
diff --git a/src/utils/SkCullPoints.cpp b/src/utils/SkCullPoints.cpp
index 3e3082f0c0..e76679daaa 100644
--- a/src/utils/SkCullPoints.cpp
+++ b/src/utils/SkCullPoints.cpp
@@ -15,7 +15,7 @@ static bool cross_product_is_neg(const SkIPoint& v, int dx, int dy) {
return v.fX * dy - v.fY * dx < 0;
#else
Sk64 tmp0, tmp1;
-
+
tmp0.setMul(v.fX, dy);
tmp1.setMul(dx, v.fY);
tmp0.sub(tmp1);
@@ -33,7 +33,7 @@ bool SkCullPoints::sect_test(int x0, int y0, int x1, int y1) const {
return false;
}
- // since the crossprod test is a little expensive, check for easy-in cases first
+ // since the crossprod test is a little expensive, check for easy-in cases first
if (r.contains(x0, y0) || r.contains(x1, y1)) {
return true;
}
@@ -41,7 +41,7 @@ bool SkCullPoints::sect_test(int x0, int y0, int x1, int y1) const {
// At this point we're not sure, so we do a crossprod test
SkIPoint vec;
const SkIPoint* rAsQuad = fAsQuad;
-
+
vec.set(x1 - x0, y1 - y0);
bool isNeg = cross_product_is_neg(vec, x0 - rAsQuad[0].fX, y0 - rAsQuad[0].fY);
for (int i = 1; i < 4; i++) {
@@ -89,14 +89,14 @@ SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) {
LineToResult result = kNo_Result;
int x0 = fPrevPt.fX;
int y0 = fPrevPt.fY;
-
+
// need to upgrade sect_test to chop the result
// and to correctly return kLineTo_Result when the result is connected
// to the previous call-out
if (this->sect_test(x0, y0, x, y)) {
line[0].set(x0, y0);
line[1].set(x, y);
-
+
if (fPrevResult != kNo_Result && fPrevPt.equals(x0, y0)) {
result = kLineTo_Result;
} else {
@@ -133,7 +133,7 @@ void SkCullPointsPath::moveTo(int x, int y) {
void SkCullPointsPath::lineTo(int x, int y) {
SkIPoint pts[2];
-
+
switch (fCP.lineTo(x, y, pts)) {
case SkCullPoints::kMoveToLineTo_Result:
fPath->moveTo(SkIntToScalar(pts[0].fX), SkIntToScalar(pts[0].fY));
@@ -184,7 +184,7 @@ bool SkHitTestPath(const SkPath& path, SkRect& target, bool hires) {
if (hires) {
const SkScalar coordLimit = SkIntToScalar(16384);
const SkRect limit = { 0, 0, coordLimit, coordLimit };
-
+
SkMatrix matrix;
matrix.setRectToRect(bounds, limit, SkMatrix::kFill_ScaleToFit);
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 661e017bfa..81ebcbdc80 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -35,7 +35,7 @@ bool shouldDrawImmediately(const SkBitmap* bitmap, const SkPaint* paint) {
// code may need to be revised if that assumption is ever broken.
if (shader && !shader->asAGradient(NULL)) {
SkBitmap bm;
- if (shader->asABitmap(&bm, NULL, NULL) &&
+ if (shader->asABitmap(&bm, NULL, NULL) &&
NULL != bm.getTexture()) {
return true;
}
@@ -47,7 +47,7 @@ bool shouldDrawImmediately(const SkBitmap* bitmap, const SkPaint* paint) {
class AutoImmediateDrawIfNeeded {
public:
- AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap,
+ AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap,
const SkPaint* paint) {
this->init(canvas, bitmap, paint);
}
@@ -77,7 +77,7 @@ private:
namespace {
-bool isPaintOpaque(const SkPaint* paint,
+bool isPaintOpaque(const SkPaint* paint,
const SkBitmap* bmpReplacesShader = NULL) {
// TODO: SkXfermode should have a virtual isOpaque method, which would
// make it possible to test modes that do not have a Coeff representation.
@@ -102,7 +102,7 @@ bool isPaintOpaque(const SkPaint* paint,
} else if (paint->getShader() && !paint->getShader()->isOpaque()) {
break;
}
- if (paint->getColorFilter() &&
+ if (paint->getColorFilter() &&
((paint->getColorFilter()->getFlags() &
SkColorFilter::kAlphaUnchanged_Flag) == 0)) {
break;
@@ -112,7 +112,7 @@ bool isPaintOpaque(const SkPaint* paint,
if (paint->getAlpha() != 0) {
break;
}
- if (paint->getColorFilter() &&
+ if (paint->getColorFilter() &&
((paint->getColorFilter()->getFlags() &
SkColorFilter::kAlphaUnchanged_Flag) == 0)) {
break;
@@ -203,7 +203,7 @@ void DeferredPipeController::notifyWritten(size_t bytes) {
}
void DeferredPipeController::playback() {
-
+
for (int currentBlock = 0; currentBlock < fBlockList.count(); currentBlock++ ) {
fReader.playback(fBlockList[currentBlock].fBlock, fBlockList[currentBlock].fSize);
}
@@ -376,10 +376,10 @@ void DeferredDevice::endRecording() {
void DeferredDevice::beginRecording() {
SkASSERT(NULL == fRecordingCanvas);
- fRecordingCanvas = fPipeWriter.startRecording(&fPipeController, 0,
+ fRecordingCanvas = fPipeWriter.startRecording(&fPipeController, 0,
fImmediateDevice->width(), fImmediateDevice->height());
}
-
+
void DeferredDevice::setNotificationClient(
SkDeferredCanvas::NotificationClient* notificationClient) {
fNotificationClient = notificationClient;
@@ -409,7 +409,7 @@ void DeferredDevice::contentsCleared() {
// Restore pre-purge state
if (!clipRegion.isEmpty()) {
- fRecordingCanvas->clipRegion(clipRegion,
+ fRecordingCanvas->clipRegion(clipRegion,
SkRegion::kReplace_Op);
}
if (!matrix.isIdentity()) {
@@ -475,7 +475,7 @@ void DeferredDevice::recordedDrawCommand() {
storageAllocated = this->storageAllocatedForRecording();
}
- if (fNotificationClient &&
+ if (fNotificationClient &&
storageAllocated != fPreviousStorageAllocated) {
fPreviousStorageAllocated = storageAllocated;
fNotificationClient->storageAllocatedForRecordingChanged(storageAllocated);
@@ -486,16 +486,16 @@ SkCanvas* DeferredDevice::recordingCanvas() {
return fRecordingCanvas;
}
-uint32_t DeferredDevice::getDeviceCapabilities() {
+uint32_t DeferredDevice::getDeviceCapabilities() {
return fImmediateDevice->getDeviceCapabilities();
}
-int DeferredDevice::width() const {
+int DeferredDevice::width() const {
return fImmediateDevice->width();
}
int DeferredDevice::height() const {
- return fImmediateDevice->height();
+ return fImmediateDevice->height();
}
SkGpuRenderTarget* DeferredDevice::accessRenderTarget() {
@@ -661,7 +661,7 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
if (paint) {
SkPaint::Style paintStyle = paint->getStyle();
- if (!(paintStyle == SkPaint::kFill_Style ||
+ if (!(paintStyle == SkPaint::kFill_Style ||
paintStyle == SkPaint::kStrokeAndFill_Style)) {
return false;
}
@@ -673,8 +673,8 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
// The following test holds with AA enabled, and is conservative
// by a 0.5 pixel margin with AA disabled
- if (transformedRect.fLeft > SkIntToScalar(0) ||
- transformedRect.fTop > SkIntToScalar(0) ||
+ if (transformedRect.fLeft > SkIntToScalar(0) ||
+ transformedRect.fTop > SkIntToScalar(0) ||
transformedRect.fRight < SkIntToScalar(canvasSize.fWidth) ||
transformedRect.fBottom < SkIntToScalar(canvasSize.fHeight)) {
return false;
@@ -686,8 +686,8 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
{
SkIRect bounds;
canvas->getClipDeviceBounds(&bounds);
- if (bounds.fLeft > 0 || bounds.fTop > 0 ||
- bounds.fRight < canvasSize.fWidth ||
+ if (bounds.fLeft > 0 || bounds.fTop > 0 ||
+ bounds.fRight < canvasSize.fWidth ||
bounds.fBottom < canvasSize.fHeight)
return false;
}
@@ -808,7 +808,7 @@ void SkDeferredCanvas::clear(SkColor color) {
}
void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
- if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
+ if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->contentsCleared();
}
@@ -825,7 +825,7 @@ void SkDeferredCanvas::drawPoints(PointMode mode, size_t count,
}
void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
- if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
+ if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->contentsCleared();
}
@@ -845,7 +845,7 @@ void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
SkScalar top, const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(left, top,
SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()));
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&bitmapRect, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -856,11 +856,11 @@ void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawBitmapRect(const SkBitmap& bitmap,
+void SkDeferredCanvas::drawBitmapRect(const SkBitmap& bitmap,
const SkIRect* src,
const SkRect& dst,
const SkPaint* paint) {
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&dst, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -896,10 +896,10 @@ void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(
SkIntToScalar(left),
- SkIntToScalar(top),
+ SkIntToScalar(top),
SkIntToScalar(bitmap.width()),
SkIntToScalar(bitmap.height()));
- if (fDeferredDrawing &&
+ if (fDeferredDrawing &&
this->isFullFrame(&bitmapRect, paint) &&
isPaintOpaque(paint, &bitmap)) {
this->getDeferredDevice()->contentsCleared();
@@ -966,10 +966,10 @@ SkBounder* SkDeferredCanvas::setBounder(SkBounder* bounder) {
}
SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
- this->drawingCanvas()->setDrawFilter(filter);
+ this->drawingCanvas()->setDrawFilter(filter);
this->INHERITED::setDrawFilter(filter);
this->recordedDrawCommand();
- return filter;
+ return filter;
}
SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
diff --git a/src/utils/SkInterpolator.cpp b/src/utils/SkInterpolator.cpp
index d43792f77b..2ef27020d6 100644
--- a/src/utils/SkInterpolator.cpp
+++ b/src/utils/SkInterpolator.cpp
@@ -165,7 +165,7 @@ static const SkScalar gIdentityBlend[4] = {
bool SkInterpolator::setKeyFrame(int index, SkMSec time,
const SkScalar values[], const SkScalar blend[4]) {
SkASSERT(values != NULL);
-
+
if (blend == NULL) {
blend = gIdentityBlend;
}
@@ -237,13 +237,13 @@ SkScalar SkUnitCubicInterp(SkScalar value, SkScalar bx, SkScalar by,
SkScalar cx, SkScalar cy) {
// pin to the unit-square, and convert to 2.14
Dot14 x = pin_and_convert(value);
-
+
if (x == 0) return 0;
if (x == Dot14_ONE) return SK_Scalar1;
-
+
Dot14 b = pin_and_convert(bx);
Dot14 c = pin_and_convert(cx);
-
+
// Now compute our coefficients from the control points
// t -> 3b
// t^2 -> 3c - 6b
@@ -264,7 +264,7 @@ SkScalar SkUnitCubicInterp(SkScalar value, SkScalar bx, SkScalar by,
t += dt;
}
}
-
+
// Now we have t, so compute the coeff for Y and evaluate
b = pin_and_convert(by);
c = pin_and_convert(cy);
diff --git a/src/utils/SkJSON.cpp b/src/utils/SkJSON.cpp
index c55d46483e..06989f3148 100644
--- a/src/utils/SkJSON.cpp
+++ b/src/utils/SkJSON.cpp
@@ -56,7 +56,7 @@ struct SkJSON::Object::Slot {
SkASSERT(name);
fNext = NULL;
-
+
size_t len = strlen(name);
// extra 1 for str[0] which stores the type
char* str = alloc_string(1 + len);
@@ -64,14 +64,14 @@ struct SkJSON::Object::Slot {
// str[1] skips the type, len+1 includes the terminating 0 byte.
memcpy(&str[1], name, len + 1);
fName = str;
-
+
// fValue is uninitialized
}
~Slot();
-
+
Type type() const { return (Type)fName[0]; }
const char* name() const { return &fName[1]; }
-
+
Slot* fNext;
char* fName; // fName[0] is the type, &fName[1] is the "name"
union {
@@ -378,7 +378,7 @@ void SkJSON::Object::toDebugf() const {
void SkJSON::Object::dumpLevel(int level) const {
for (Slot* slot = fHead; slot; slot = slot->fNext) {
- Type t = slot->type();
+ Type t = slot->type();
tabForLevel(level + 1);
SkDebugf("\"%s\" : ", slot->name());
switch (slot->type()) {
@@ -507,11 +507,11 @@ static const uint8_t gBytesPerType[] = {
};
typedef void* (*DupProc)(const void*);
-
+
static void* dup_object(const void* src) {
return SkNEW_ARGS(SkJSON::Object, (*(SkJSON::Object*)src));
}
-
+
static void* dup_array(const void* src) {
return SkNEW_ARGS(SkJSON::Array, (*(SkJSON::Array*)src));
}
@@ -561,7 +561,7 @@ SkJSON::Array::Array(Type type, int count) {
SkJSON::Array::Array(const int32_t values[], int count) {
this->init(kInt, count, values);
}
-
+
SkJSON::Array::Array(const float values[], int count) {
this->init(kFloat, count, values);
}
diff --git a/src/utils/SkMeshUtils.cpp b/src/utils/SkMeshUtils.cpp
index f7af3834d5..7970ba1af4 100644
--- a/src/utils/SkMeshUtils.cpp
+++ b/src/utils/SkMeshUtils.cpp
@@ -55,11 +55,11 @@ bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[],
*idx++ = index;
*idx++ = index + rows + 1;
*idx++ = index + 1;
-
+
*idx++ = index + 1;
*idx++ = index + rows + 1;
*idx++ = index + rows + 2;
-
+
index += 1;
}
index += 1;
@@ -89,7 +89,7 @@ void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap,
int rows, int cols, const SkPoint verts[],
const SkColor colors[], const SkPaint& paint) {
SkMeshIndices idx;
-
+
if (idx.init(bitmap.width(), bitmap.height(), rows, cols)) {
SkPaint p(paint);
p.setShader(SkShader::CreateBitmapShader(bitmap,
diff --git a/src/utils/SkNinePatch.cpp b/src/utils/SkNinePatch.cpp
index 26ae8ebe65..9dc8bd26cd 100644
--- a/src/utils/SkNinePatch.cpp
+++ b/src/utils/SkNinePatch.cpp
@@ -15,11 +15,11 @@ static const uint16_t g3x3Indices[] = {
0, 5, 1, 0, 4, 5,
1, 6, 2, 1, 5, 6,
2, 7, 3, 2, 6, 7,
-
+
4, 9, 5, 4, 8, 9,
5, 10, 6, 5, 9, 10,
6, 11, 7, 6, 10, 11,
-
+
8, 13, 9, 8, 12, 13,
9, 14, 10, 9, 13, 14,
10, 15, 11, 10, 14, 15
@@ -27,18 +27,18 @@ static const uint16_t g3x3Indices[] = {
static int fillIndices(uint16_t indices[], int xCount, int yCount) {
uint16_t* startIndices = indices;
-
+
int n = 0;
for (int y = 0; y < yCount; y++) {
for (int x = 0; x < xCount; x++) {
*indices++ = n;
*indices++ = n + xCount + 2;
*indices++ = n + 1;
-
+
*indices++ = n;
*indices++ = n + xCount + 1;
*indices++ = n + xCount + 2;
-
+
n += 1;
}
n += 1;
@@ -108,14 +108,14 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
if (bounds.isEmpty() || bitmap.width() == 0 || bitmap.height() == 0) {
return;
}
-
+
// should try a quick-reject test before calling lockPixels
SkAutoLockPixels alp(bitmap);
// after the lock, it is valid to check
if (!bitmap.readyToDraw()) {
return;
}
-
+
// check for degenerate divs (just an optimization, not required)
{
int i;
@@ -129,17 +129,17 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
numYDivs -= 1;
}
}
-
+
Mesh mesh;
-
+
const int numXStretch = (numXDivs + 1) >> 1;
const int numYStretch = (numYDivs + 1) >> 1;
-
+
if (numXStretch < 1 && numYStretch < 1) {
canvas->drawBitmapRect(bitmap, NULL, bounds, paint);
return;
}
-
+
if (false) {
int i;
for (i = 0; i < numXDivs; i++) {
@@ -149,9 +149,9 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkDebugf("--- ydivs[%d] %d\n", i, yDivs[i]);
}
}
-
+
SkScalar stretchX = 0, stretchY = 0;
-
+
if (numXStretch > 0) {
int stretchSize = 0;
for (int i = 1; i < numXDivs; i += 2) {
@@ -163,7 +163,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
else // reuse stretchX, but keep it negative as a signal
stretchX = SkScalarDiv(-bounds.width(), fixed);
}
-
+
if (numYStretch > 0) {
int stretchSize = 0;
for (int i = 1; i < numYDivs; i += 2) {
@@ -175,7 +175,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
else // reuse stretchX, but keep it negative as a signal
stretchY = SkScalarDiv(-bounds.height(), fixed);
}
-
+
#if 0
SkDebugf("---- drawasamesh [%d %d] -> [%g %g] <%d %d> (%g %g)\n",
bitmap.width(), bitmap.height(),
@@ -193,12 +193,12 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkPoint* verts = (SkPoint*)storage.get();
SkPoint* texs = verts + vCount;
uint16_t* indices = (uint16_t*)(texs + vCount);
-
+
mesh.fVerts = verts;
mesh.fTexs = texs;
mesh.fColors = NULL;
mesh.fIndices = NULL;
-
+
// we use <= for YDivs, since the prebuild indices work for 3x2 and 3x1 too
if (numXDivs == 2 && numYDivs <= 2) {
mesh.fIndices = g3x3Indices;
@@ -207,7 +207,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
SkASSERT(n == indexCount);
mesh.fIndices = indices;
}
-
+
SkScalar vy = bounds.fTop;
fillRow(verts, texs, vy, 0, bounds, xDivs, numXDivs,
stretchX, bitmap.width());
@@ -235,7 +235,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
}
fillRow(verts, texs, bounds.fBottom, SkIntToScalar(bitmap.height()),
bounds, xDivs, numXDivs, stretchX, bitmap.width());
-
+
SkShader* shader = SkShader::CreateBitmapShader(bitmap,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode);
@@ -310,7 +310,7 @@ void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
if (false /* is our canvas backed by a gpu?*/) {
int32_t xDivs[2];
int32_t yDivs[2];
-
+
xDivs[0] = margins.fLeft;
xDivs[1] = bitmap.width() - margins.fRight;
yDivs[0] = margins.fTop;
@@ -326,7 +326,7 @@ void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
(margins.fTop + margins.fBottom);
yDivs[1] = yDivs[0];
}
-
+
SkNinePatch::DrawMesh(canvas, bounds, bitmap,
xDivs, 2, yDivs, 2, paint);
} else {
diff --git a/src/utils/SkParse.cpp b/src/utils/SkParse.cpp
index cb265c383f..9609ddc568 100644
--- a/src/utils/SkParse.cpp
+++ b/src/utils/SkParse.cpp
@@ -62,7 +62,7 @@ static const char* skip_sep(const char str[])
return str;
}
-int SkParse::Count(const char str[])
+int SkParse::Count(const char str[])
{
char c;
int count = 0;
@@ -83,7 +83,7 @@ goHome:
return count;
}
-int SkParse::Count(const char str[], char separator)
+int SkParse::Count(const char str[], char separator)
{
char c;
int count = 0;
@@ -234,7 +234,7 @@ const char* SkParse::FindScalar(const char str[], SkScalar* value) {
if (*str == '.')
{
- static const int gFractions[] = { (1 << 24) / 10, (1 << 24) / 100, (1 << 24) / 1000,
+ static const int gFractions[] = { (1 << 24) / 10, (1 << 24) / 100, (1 << 24) / 1000,
(1 << 24) / 10000, (1 << 24) / 100000 };
str += 1;
int d = 0;
@@ -330,7 +330,7 @@ int SkParse::FindList(const char target[], const char list[])
}
#ifdef SK_SUPPORT_UNITTEST
-void SkParse::UnitTest()
+void SkParse::UnitTest()
{
// !!! additional parse tests go here
SkParse::TestColor();
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 22433e6b7d..18ea5e023b 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -58,7 +58,7 @@ static const char* find_points(const char str[], SkPoint value[], int count,
return str;
}
-static const char* find_scalar(const char str[], SkScalar* value,
+static const char* find_scalar(const char str[], SkScalar* value,
bool isRelative, SkScalar relative) {
str = SkParse::FindScalar(str, value);
if (isRelative) {
@@ -103,7 +103,7 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
op = 'L';
c = points[0];
break;
- case 'L':
+ case 'L':
data = find_points(data, points, 1, relative, &c);
path.lineTo(points[0]);
c = points[0];
@@ -120,10 +120,10 @@ bool SkParsePath::FromSVGString(const char data[], SkPath* result) {
path.lineTo(c.fX, y);
c.fY = y;
} break;
- case 'C':
+ case 'C':
data = find_points(data, points, 3, relative, &c);
goto cubicCommon;
- case 'S':
+ case 'S':
data = find_points(data, &points[1], 2, relative, &c);
points[0] = c;
if (previousOp == 'C' || previousOp == 'S') {
@@ -191,7 +191,7 @@ static void write_scalar(SkWStream* stream, SkScalar value) {
#ifdef SK_SCALAR_IS_FLOAT
char buffer[64];
#ifdef SK_BUILD_FOR_WIN32
- int len = _snprintf(buffer, sizeof(buffer), "%g", value);
+ int len = _snprintf(buffer, sizeof(buffer), "%g", value);
#else
int len = snprintf(buffer, sizeof(buffer), "%g", value);
#endif
diff --git a/src/utils/SkThreadUtils.h b/src/utils/SkThreadUtils.h
index b0c5044618..8963981596 100644
--- a/src/utils/SkThreadUtils.h
+++ b/src/utils/SkThreadUtils.h
@@ -13,32 +13,32 @@
class SkThread : SkNoncopyable {
public:
typedef void (*entryPointProc)(void*);
-
+
SkThread(entryPointProc entryPoint, void* data = NULL);
-
+
/**
* Non-virtual, do not subclass.
*/
~SkThread();
-
+
/**
* Starts the thread. Returns false if the thread could not be started.
*/
bool start();
-
+
/**
* Waits for the thread to finish.
* If the thread has not started, returns immediately.
*/
void join();
-
+
/**
* SkThreads with an affinity for the same processor will attempt to run cache
* locally with each other. SkThreads with an affinity for different processors
* will attempt to run on different cores. Returns false if the request failed.
*/
bool setProcessorAffinity(unsigned int processor);
-
+
private:
void* fData;
};
diff --git a/src/utils/mac/SkBitmap_Mac.cpp b/src/utils/mac/SkBitmap_Mac.cpp
index a99513135d..1f73f0f423 100644
--- a/src/utils/mac/SkBitmap_Mac.cpp
+++ b/src/utils/mac/SkBitmap_Mac.cpp
@@ -20,7 +20,7 @@
static void convertGL32_to_Mac32(uint32_t dst[], const SkBitmap& bm) {
memcpy(dst, bm.getPixels(), bm.getSize());
return;
-
+
uint32_t* stop = dst + (bm.getSize() >> 2);
const uint8_t* src = (const uint8_t*)bm.getPixels();
while (dst < stop) {
@@ -38,7 +38,7 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) {
unsigned r = SkPacked16ToR32(c);
unsigned g = SkPacked16ToG32(c);
unsigned b = SkPacked16ToB32(c);
-
+
*dst++ = (b << 24) | (g << 16) | (r << 8) | 0xFF;
}
}
@@ -47,11 +47,11 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) {
static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count)
{
const uint16_t* stop = src + count;
-
+
while (src < stop)
{
unsigned c = *src++;
-
+
unsigned r = SkGetPackedR4444(c);
unsigned g = SkGetPackedG4444(c);
unsigned b = SkGetPackedB4444(c);
@@ -61,7 +61,7 @@ static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count)
b = (b << 1) | (b >> 3);
// build the 555
c = (r << 10) | (g << 5) | b;
-
+
#ifdef SWAP_16BIT
c = (c >> 8) | (c << 8);
#endif
@@ -111,10 +111,10 @@ static CGImageRef bitmap2imageref(const SkBitmap& bm) {
}
void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const {
- if (fPixels == NULL || fWidth == 0 || fHeight == 0) {
- return;
+ if (fPixels == NULL || fWidth == 0 || fHeight == 0) {
+ return;
}
-
+
bool useQD = false;
if (NULL == cg) {
SetPortWindowPort(wind);
@@ -136,7 +136,7 @@ void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const {
rect.origin.x = rect.origin.y = 0;
rect.size.width = bm.width();
rect.size.height = bm.height();
-
+
CGContextDrawImage(cg, rect, image);
CGImageRelease(image);
}
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index e5f7c69cb8..df20ba930d 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -18,14 +18,14 @@ static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size)
(SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
&& SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
-static bool getBitmapInfo(const SkBitmap& bm,
+static bool getBitmapInfo(const SkBitmap& bm,
size_t* bitsPerComponent,
CGBitmapInfo* info,
bool* upscaleTo32) {
if (upscaleTo32) {
*upscaleTo32 = false;
}
-
+
switch (bm.config()) {
case SkBitmap::kRGB_565_Config:
if (upscaleTo32) {
@@ -105,11 +105,11 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
const size_t s = bitmap->getSize();
// our provider "owns" the bitmap*, and will take care of deleting it
- // we initially lock it, so we can access the pixels. The bitmap will be deleted in the release
- // proc, which will in turn unlock the pixels
- bitmap->lockPixels();
+ // we initially lock it, so we can access the pixels. The bitmap will be deleted in the release
+ // proc, which will in turn unlock the pixels
+ bitmap->lockPixels();
CGDataProviderRef dataRef = CGDataProviderCreateWithData(bitmap, bitmap->getPixels(), s,
- SkBitmap_ReleaseInfo);
+ SkBitmap_ReleaseInfo);
bool releaseColorSpace = false;
if (NULL == colorSpace) {
@@ -177,7 +177,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
if (NULL == data) {
return false;
}
-
+
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
CGDataProviderRelease(data);
if (NULL == pdf) {
@@ -189,12 +189,12 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
if (NULL == page) {
return false;
}
-
+
CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
-
+
int w = (int)CGRectGetWidth(bounds);
int h = (int)CGRectGetHeight(bounds);
-
+
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
bitmap.allocPixels();
@@ -202,7 +202,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
size_t bitsPerComponent;
CGBitmapInfo info;
- getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
+ getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL);
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
diff --git a/src/utils/win/SkDWriteFontFileStream.h b/src/utils/win/SkDWriteFontFileStream.h
index cd5787eb4f..b214858e57 100644
--- a/src/utils/win/SkDWriteFontFileStream.h
+++ b/src/utils/win/SkDWriteFontFileStream.h
@@ -23,7 +23,7 @@ class SkDWriteFontFileStream : public SkStream {
public:
explicit SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream);
virtual ~SkDWriteFontFileStream();
-
+
virtual bool rewind() SK_OVERRIDE;
virtual size_t read(void* buffer, size_t size) SK_OVERRIDE;
virtual const void* getMemoryBase() SK_OVERRIDE;
diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp
index 4aec3bb778..5455e669ef 100644
--- a/src/utils/win/SkDWriteGeometrySink.cpp
+++ b/src/utils/win/SkDWriteGeometrySink.cpp
@@ -28,7 +28,7 @@ HRESULT STDMETHODCALLTYPE SkDWriteGeometrySink::QueryInterface(REFIID iid, void
return S_OK;
} else {
*object = NULL;
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
}
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 3d463f8607..8b6b79f61d 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -13,7 +13,7 @@ void SkTraceHR(const char* file, unsigned long line,
HRESULT hr, const char* msg) {
SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg)));
SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr));
-
+
LPSTR errorText = NULL;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -25,7 +25,7 @@ void SkTraceHR(const char* file, unsigned long line,
0,
NULL
);
-
+
if (NULL == errorText) {
SkDEBUGF(("<unknown>\n"));
} else {
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index fce015cf21..1d00611f79 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -34,7 +34,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::QueryInterface(REFIID iid
return S_OK;
} else {
*ppvObject = NULL;
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
}
@@ -62,7 +62,7 @@ HRESULT STDMETHODCALLTYPE SkBaseIStream::Write(void const* pv
{ return E_NOTIMPL; }
// IStream Interface
-HRESULT STDMETHODCALLTYPE SkBaseIStream::SetSize(ULARGE_INTEGER)
+HRESULT STDMETHODCALLTYPE SkBaseIStream::SetSize(ULARGE_INTEGER)
{ return E_NOTIMPL; }
HRESULT STDMETHODCALLTYPE SkBaseIStream::CopyTo(IStream*
@@ -190,7 +190,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
hr = STG_E_INVALIDFUNCTION;
break;
}
-
+
if (NULL != lpNewFilePointer) {
lpNewFilePointer->QuadPart = this->fLocation.QuadPart;
}
diff --git a/src/views/SkBGViewArtist.cpp b/src/views/SkBGViewArtist.cpp
index d9a45b8ffb..ffc410aea6 100644
--- a/src/views/SkBGViewArtist.cpp
+++ b/src/views/SkBGViewArtist.cpp
@@ -11,7 +11,7 @@
SkBGViewArtist::SkBGViewArtist(SkColor c)
{
- fPaint.setColor(c);
+ fPaint.setColor(c);
}
SkBGViewArtist::~SkBGViewArtist()
@@ -20,12 +20,12 @@ SkBGViewArtist::~SkBGViewArtist()
void SkBGViewArtist::onDraw(SkView*, SkCanvas* canvas)
{
- // only works for views that are clipped their bounds.
- canvas->drawPaint(fPaint);
+ // only works for views that are clipped their bounds.
+ canvas->drawPaint(fPaint);
}
void SkBGViewArtist::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkPaint_Inflate(&fPaint, dom, node);
+ SkPaint_Inflate(&fPaint, dom, node);
}
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 0149215b2c..151317039b 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -59,9 +59,9 @@ static size_t makeCharArray(char* buffer, size_t compact)
return strlen(buffer);
}
-void SkEvent::getType(SkString* str) const
-{
- if (str)
+void SkEvent::getType(SkString* str) const
+{
+ if (str)
{
if ((size_t) fType & 1) // not a pointer
{
@@ -74,13 +74,13 @@ void SkEvent::getType(SkString* str) const
}
}
-bool SkEvent::isType(const SkString& str) const
+bool SkEvent::isType(const SkString& str) const
{
- return this->isType(str.c_str(), str.size());
+ return this->isType(str.c_str(), str.size());
}
-bool SkEvent::isType(const char type[], size_t typeLen) const
-{
+bool SkEvent::isType(const char type[], size_t typeLen) const
+{
if (typeLen == 0)
typeLen = strlen(type);
if ((size_t) fType & 1) { // not a pointer
@@ -88,7 +88,7 @@ bool SkEvent::isType(const char type[], size_t typeLen) const
size_t len = makeCharArray(chars, (size_t) fType);
return len == typeLen && strncmp(chars, type, typeLen) == 0;
}
- return strncmp(fType, type, typeLen) == 0 && fType[typeLen] == 0;
+ return strncmp(fType, type, typeLen) == 0 && fType[typeLen] == 0;
}
void SkEvent::setType(const char type[], size_t typeLen)
@@ -183,7 +183,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
if (title)
SkDebugf("%s ", title);
-
+
SkString etype;
this->getType(&etype);
SkDebugf("event<%s> fast32=%d", etype.c_str(), this->getFast32());
@@ -193,7 +193,7 @@ void SkEvent::inflate(const SkDOM& dom, const SkDOM::Node* node)
SkMetaData::Type mtype;
int count;
const char* name;
-
+
while ((name = iter.next(&mtype, &count)) != NULL)
{
SkASSERT(count > 0);
@@ -296,7 +296,7 @@ void SkEvent::postDelay(SkMSec delay) {
delete this;
return;
}
-
+
if (delay) {
this->postTime(SkTime::GetMSecs() + delay);
return;
@@ -307,7 +307,7 @@ void SkEvent::postDelay(SkMSec delay) {
globals.fEventMutex.acquire();
bool wasEmpty = SkEvent::Enqueue(this);
globals.fEventMutex.release();
-
+
// call outside of us holding the mutex
if (wasEmpty) {
SkEvent::SignalNonEmptyQueue();
@@ -321,11 +321,11 @@ void SkEvent::postTime(SkMSec time) {
}
SkEvent_Globals& globals = getGlobals();
-
+
globals.fEventMutex.acquire();
SkMSec queueDelay = SkEvent::EnqueueTime(this, time);
globals.fEventMutex.release();
-
+
// call outside of us holding the mutex
if ((int32_t)queueDelay != ~0) {
SkEvent::SignalQueueTimer(queueDelay);
@@ -473,7 +473,7 @@ void SkEvent::ServiceQueueTimer()
int SkEvent::CountEventsOnQueue() {
SkEvent_Globals& globals = getGlobals();
globals.fEventMutex.acquire();
-
+
int count = 0;
const SkEvent* evt = globals.fEventQHead;
while (evt) {
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 8f39156c51..b6a3a6ee82 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -163,7 +163,7 @@ void SkEventSink::addListenerID(SkEventSinkID id)
this->addTagList(next);
}
-void SkEventSink::copyListeners(const SkEventSink& sink)
+void SkEventSink::copyListeners(const SkEventSink& sink)
{
SkListenersTagList* sinkList = (SkListenersTagList*)sink.findTagList(kListeners_SkTagList);
if (sinkList == NULL)
@@ -226,7 +226,7 @@ SkEventSink::EventResult SkEventSink::DoEvent(const SkEvent& evt) {
if (proc) {
return proc(evt) ? kHandled_EventResult : kNotHandled_EventResult;
}
-
+
SkEventSink* sink = SkEventSink::FindSink(evt.getTargetID());
if (sink) {
return sink->doEvent(evt) ? kHandled_EventResult : kNotHandled_EventResult;
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index ed37541438..3de0a9eb77 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -11,7 +11,7 @@
static int gOSMenuCmd = 7000;
SkOSMenu::SkOSMenu(const char title[]) {
- fTitle.set(title);
+ fTitle.set(title);
}
SkOSMenu::~SkOSMenu() {
@@ -46,7 +46,7 @@ void SkOSMenu::assignKeyEquivalentToItem(int itemID, SkUnichar key) {
}
}
-bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
+bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
int value = 0, size = 0;
bool state;
SkOSMenu::TriState tristate;
@@ -89,7 +89,7 @@ bool SkOSMenu::handleKeyEquivalent(SkUnichar key) {
////////////////////////////////////////////////////////////////////////////////
-SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
+SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
const char slotName[], SkEvent* evt) {
fLabel.set(label);
fSlotName.set(slotName);
@@ -133,7 +133,7 @@ static const char* gDelimiter = "|";
static const char* gList_Items_Str = "SkOSMenuList_Items";
static const char* gList_ItemCount_S32 = "SkOSMenuList_ItemCount";
-int SkOSMenu::appendItem(const char label[], Type type, const char slotName[],
+int SkOSMenu::appendItem(const char label[], Type type, const char slotName[],
SkEvent* evt) {
SkOSMenu::Item* item = new Item(label, type, slotName, evt);
fItems.append(1, &item);
@@ -147,7 +147,7 @@ int SkOSMenu::appendAction(const char label[], SkEventSinkID target) {
return appendItem(label, SkOSMenu::kAction_Type, "", evt);
}
-int SkOSMenu::appendList(const char label[], const char slotName[],
+int SkOSMenu::appendList(const char label[], const char slotName[],
SkEventSinkID target, int index, const char option[], ...) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
va_list args;
@@ -168,8 +168,8 @@ int SkOSMenu::appendList(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kList_Type, slotName, evt);
}
-int SkOSMenu::appendSlider(const char label[], const char slotName[],
- SkEventSinkID target, SkScalar min, SkScalar max,
+int SkOSMenu::appendSlider(const char label[], const char slotName[],
+ SkEventSinkID target, SkScalar min, SkScalar max,
SkScalar defaultValue) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setScalar(gSlider_Min_Scalar, min);
@@ -178,7 +178,7 @@ int SkOSMenu::appendSlider(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kSlider_Type, slotName, evt);
}
-int SkOSMenu::appendSwitch(const char label[], const char slotName[],
+int SkOSMenu::appendSwitch(const char label[], const char slotName[],
SkEventSinkID target, bool defaultState) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setBool(slotName, defaultState);
@@ -192,7 +192,7 @@ int SkOSMenu::appendTriState(const char label[], const char slotName[],
return appendItem(label, SkOSMenu::kTriState_Type, slotName, evt);
}
-int SkOSMenu::appendTextField(const char label[], const char slotName[],
+int SkOSMenu::appendTextField(const char label[], const char slotName[],
SkEventSinkID target, const char placeholder[]) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
evt->setString(slotName, placeholder);
@@ -234,7 +234,7 @@ bool SkOSMenu::FindAction(const SkEvent& evt, const char label[]) {
}
bool SkOSMenu::FindListIndex(const SkEvent& evt, const char slotName[], int* value) {
- return evt.isType(gMenuEventType) && evt.findS32(slotName, value);
+ return evt.isType(gMenuEventType) && evt.findS32(slotName, value);
}
bool SkOSMenu::FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value) {
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
index 4839439bb8..7a305f2867 100644
--- a/src/views/SkParsePaint.cpp
+++ b/src/views/SkParsePaint.cpp
@@ -13,98 +13,98 @@
static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
{
- if ((node = dom.getFirstChild(node, "shader")) == NULL)
- return NULL;
-
- const char* str;
-
- if (dom.hasAttr(node, "type", "linear-gradient"))
- {
- SkColor colors[2];
- SkPoint pts[2];
-
- colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
- if ((str = dom.findAttr(node, "c0")) != NULL &&
- SkParse::FindColor(str, &colors[0]) &&
- (str = dom.findAttr(node, "c1")) != NULL &&
- SkParse::FindColor(str, &colors[1]) &&
- dom.findScalars(node, "p0", &pts[0].fX, 2) &&
- dom.findScalars(node, "p1", &pts[1].fX, 2))
- {
- SkShader::TileMode mode = SkShader::kClamp_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
- }
- }
- else if (dom.hasAttr(node, "type", "bitmap"))
- {
- if ((str = dom.findAttr(node, "src")) == NULL)
- return NULL;
-
- SkBitmap bm;
-
- if (SkImageDecoder::DecodeFile(str, &bm))
- {
- SkShader::TileMode mode = SkShader::kRepeat_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
-
- return SkShader::CreateBitmapShader(bm, mode, mode);
- }
- }
- return NULL;
+ if ((node = dom.getFirstChild(node, "shader")) == NULL)
+ return NULL;
+
+ const char* str;
+
+ if (dom.hasAttr(node, "type", "linear-gradient"))
+ {
+ SkColor colors[2];
+ SkPoint pts[2];
+
+ colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
+ if ((str = dom.findAttr(node, "c0")) != NULL &&
+ SkParse::FindColor(str, &colors[0]) &&
+ (str = dom.findAttr(node, "c1")) != NULL &&
+ SkParse::FindColor(str, &colors[1]) &&
+ dom.findScalars(node, "p0", &pts[0].fX, 2) &&
+ dom.findScalars(node, "p1", &pts[1].fX, 2))
+ {
+ SkShader::TileMode mode = SkShader::kClamp_TileMode;
+ int index;
+
+ if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
+ mode = (SkShader::TileMode)index;
+ return SkGradientShader::CreateLinear(pts, colors, NULL, 2, mode);
+ }
+ }
+ else if (dom.hasAttr(node, "type", "bitmap"))
+ {
+ if ((str = dom.findAttr(node, "src")) == NULL)
+ return NULL;
+
+ SkBitmap bm;
+
+ if (SkImageDecoder::DecodeFile(str, &bm))
+ {
+ SkShader::TileMode mode = SkShader::kRepeat_TileMode;
+ int index;
+
+ if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
+ mode = (SkShader::TileMode)index;
+
+ return SkShader::CreateBitmapShader(bm, mode, mode);
+ }
+ }
+ return NULL;
}
void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(paint);
- SkASSERT(&dom);
- SkASSERT(node);
-
- SkScalar x;
-
- if (dom.findScalar(node, "stroke-width", &x))
- paint->setStrokeWidth(x);
- if (dom.findScalar(node, "text-size", &x))
- paint->setTextSize(x);
-
- bool b;
-
- SkASSERT("legacy: use is-stroke" && !dom.findBool(node, "is-frame", &b));
-
- if (dom.findBool(node, "is-stroke", &b))
- paint->setStyle(b ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
- if (dom.findBool(node, "is-antialias", &b))
- paint->setAntiAlias(b);
- if (dom.findBool(node, "is-lineartext", &b))
- paint->setLinearText(b);
-
- const char* str = dom.findAttr(node, "color");
- if (str)
- {
- SkColor c = paint->getColor();
- if (SkParse::FindColor(str, &c))
- paint->setColor(c);
- }
-
- // do this AFTER parsing for the color
- if (dom.findScalar(node, "opacity", &x))
- {
- x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
- paint->setAlpha(SkScalarRound(x * 255));
- }
-
- int index = dom.findList(node, "text-anchor", "left,center,right");
- if (index >= 0)
- paint->setTextAlign((SkPaint::Align)index);
-
- SkShader* shader = inflate_shader(dom, node);
- if (shader)
- paint->setShader(shader)->unref();
+ SkASSERT(paint);
+ SkASSERT(&dom);
+ SkASSERT(node);
+
+ SkScalar x;
+
+ if (dom.findScalar(node, "stroke-width", &x))
+ paint->setStrokeWidth(x);
+ if (dom.findScalar(node, "text-size", &x))
+ paint->setTextSize(x);
+
+ bool b;
+
+ SkASSERT("legacy: use is-stroke" && !dom.findBool(node, "is-frame", &b));
+
+ if (dom.findBool(node, "is-stroke", &b))
+ paint->setStyle(b ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
+ if (dom.findBool(node, "is-antialias", &b))
+ paint->setAntiAlias(b);
+ if (dom.findBool(node, "is-lineartext", &b))
+ paint->setLinearText(b);
+
+ const char* str = dom.findAttr(node, "color");
+ if (str)
+ {
+ SkColor c = paint->getColor();
+ if (SkParse::FindColor(str, &c))
+ paint->setColor(c);
+ }
+
+ // do this AFTER parsing for the color
+ if (dom.findScalar(node, "opacity", &x))
+ {
+ x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
+ paint->setAlpha(SkScalarRound(x * 255));
+ }
+
+ int index = dom.findList(node, "text-anchor", "left,center,right");
+ if (index >= 0)
+ paint->setTextAlign((SkPaint::Align)index);
+
+ SkShader* shader = inflate_shader(dom, node);
+ if (shader)
+ paint->setShader(shader)->unref();
}
diff --git a/src/views/SkProgressView.cpp b/src/views/SkProgressView.cpp
index d82b48ee24..edb78bdcf6 100644
--- a/src/views/SkProgressView.cpp
+++ b/src/views/SkProgressView.cpp
@@ -14,120 +14,120 @@
SkProgressView::SkProgressView(uint32_t flags) : SkView(flags), fOnShader(NULL), fOffShader(NULL)
{
- fValue = 0;
- fMax = 0;
- fInterp = NULL;
- fDoInterp = false;
+ fValue = 0;
+ fMax = 0;
+ fInterp = NULL;
+ fDoInterp = false;
}
SkProgressView::~SkProgressView()
{
- delete fInterp;
- SkSafeUnref(fOnShader);
- SkSafeUnref(fOffShader);
+ delete fInterp;
+ SkSafeUnref(fOnShader);
+ SkSafeUnref(fOffShader);
}
void SkProgressView::setMax(U16CPU max)
{
- if (fMax != max)
- {
- fMax = SkToU16(max);
- if (fValue > 0)
- this->inval(NULL);
- }
+ if (fMax != max)
+ {
+ fMax = SkToU16(max);
+ if (fValue > 0)
+ this->inval(NULL);
+ }
}
void SkProgressView::setValue(U16CPU value)
{
- if (fValue != value)
- {
- if (fDoInterp)
- {
- if (fInterp)
- delete fInterp;
- fInterp = new SkInterpolator(1, 2);
- SkScalar x = (SkScalar)(fValue << 8);
- fInterp->setKeyFrame(0, SkTime::GetMSecs(), &x, 0);
- x = (SkScalar)(value << 8);
- fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
- }
- fValue = SkToU16(value);
- this->inval(NULL);
- }
+ if (fValue != value)
+ {
+ if (fDoInterp)
+ {
+ if (fInterp)
+ delete fInterp;
+ fInterp = new SkInterpolator(1, 2);
+ SkScalar x = (SkScalar)(fValue << 8);
+ fInterp->setKeyFrame(0, SkTime::GetMSecs(), &x, 0);
+ x = (SkScalar)(value << 8);
+ fInterp->setKeyFrame(1, SkTime::GetMSecs() + 333, &x);
+ }
+ fValue = SkToU16(value);
+ this->inval(NULL);
+ }
}
void SkProgressView::onDraw(SkCanvas* canvas)
{
- if (fMax == 0)
- return;
-
- SkFixed percent;
-
- if (fInterp)
- {
- SkScalar x;
- if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
- {
- delete fInterp;
- fInterp = NULL;
- }
- percent = (SkFixed)x; // now its 16.8
- percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
- percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
- this->inval(NULL);
- }
- else
- {
- U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
- percent = SkFixedDiv(value, fMax);
- }
-
-
- SkRect r;
- SkPaint p;
-
- r.set(0, 0, this->width(), this->height());
- p.setAntiAlias(true);
-
- r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
- p.setStyle(SkPaint::kFill_Style);
-
- p.setColor(SK_ColorDKGRAY);
- p.setShader(fOnShader);
- canvas->drawRect(r, p);
-
- p.setColor(SK_ColorWHITE);
- p.setShader(fOffShader);
- r.fLeft = r.fRight;
- r.fRight = this->width() - SK_Scalar1;
- if (r.width() > 0)
- canvas->drawRect(r, p);
+ if (fMax == 0)
+ return;
+
+ SkFixed percent;
+
+ if (fInterp)
+ {
+ SkScalar x;
+ if (fInterp->timeToValues(SkTime::GetMSecs(), &x) == SkInterpolator::kFreezeEnd_Result)
+ {
+ delete fInterp;
+ fInterp = NULL;
+ }
+ percent = (SkFixed)x; // now its 16.8
+ percent = SkMax32(0, SkMin32(percent, fMax << 8)); // now its pinned
+ percent = SkFixedDiv(percent, fMax << 8); // now its 0.16
+ this->inval(NULL);
+ }
+ else
+ {
+ U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
+ percent = SkFixedDiv(value, fMax);
+ }
+
+
+ SkRect r;
+ SkPaint p;
+
+ r.set(0, 0, this->width(), this->height());
+ p.setAntiAlias(true);
+
+ r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
+ p.setStyle(SkPaint::kFill_Style);
+
+ p.setColor(SK_ColorDKGRAY);
+ p.setShader(fOnShader);
+ canvas->drawRect(r, p);
+
+ p.setColor(SK_ColorWHITE);
+ p.setShader(fOffShader);
+ r.fLeft = r.fRight;
+ r.fRight = this->width() - SK_Scalar1;
+ if (r.width() > 0)
+ canvas->drawRect(r, p);
}
#include "SkImageDecoder.h"
static SkShader* inflate_shader(const char file[])
{
- SkBitmap bm;
+ SkBitmap bm;
- return SkImageDecoder::DecodeFile(file, &bm) ?
- SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
- NULL;
+ return SkImageDecoder::DecodeFile(file, &bm) ?
+ SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode) :
+ NULL;
}
void SkProgressView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* s;
+ const char* s;
- SkASSERT(fOnShader == NULL);
- SkASSERT(fOffShader == NULL);
+ SkASSERT(fOnShader == NULL);
+ SkASSERT(fOffShader == NULL);
- if ((s = dom.findAttr(node, "src-on")) != NULL)
- fOnShader = inflate_shader(s);
- if ((s = dom.findAttr(node, "src-off")) != NULL)
- fOffShader = inflate_shader(s);
- (void)dom.findBool(node, "do-interp", &fDoInterp);
+ if ((s = dom.findAttr(node, "src-on")) != NULL)
+ fOnShader = inflate_shader(s);
+ if ((s = dom.findAttr(node, "src-off")) != NULL)
+ fOffShader = inflate_shader(s);
+ (void)dom.findBool(node, "do-interp", &fDoInterp);
}
diff --git a/src/views/SkStackViewLayout.cpp b/src/views/SkStackViewLayout.cpp
index bf6f36339e..e4fbb80ea8 100644
--- a/src/views/SkStackViewLayout.cpp
+++ b/src/views/SkStackViewLayout.cpp
@@ -9,51 +9,51 @@
SkStackViewLayout::SkStackViewLayout()
{
- fMargin.set(0, 0, 0, 0);
- fSpacer = 0;
- fOrient = kHorizontal_Orient;
- fPack = kStart_Pack;
- fAlign = kStart_Align;
- fRound = false;
+ fMargin.set(0, 0, 0, 0);
+ fSpacer = 0;
+ fOrient = kHorizontal_Orient;
+ fPack = kStart_Pack;
+ fAlign = kStart_Align;
+ fRound = false;
}
void SkStackViewLayout::setOrient(Orient ori)
{
- SkASSERT((unsigned)ori < kOrientCount);
- fOrient = SkToU8(ori);
+ SkASSERT((unsigned)ori < kOrientCount);
+ fOrient = SkToU8(ori);
}
void SkStackViewLayout::getMargin(SkRect* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStackViewLayout::setMargin(const SkRect& margin)
{
- fMargin = margin;
+ fMargin = margin;
}
void SkStackViewLayout::setSpacer(SkScalar spacer)
{
- fSpacer = spacer;
+ fSpacer = spacer;
}
void SkStackViewLayout::setPack(Pack pack)
{
- SkASSERT((unsigned)pack < kPackCount);
- fPack = SkToU8(pack);
+ SkASSERT((unsigned)pack < kPackCount);
+ fPack = SkToU8(pack);
}
void SkStackViewLayout::setAlign(Align align)
{
- SkASSERT((unsigned)align < kAlignCount);
- fAlign = SkToU8(align);
+ SkASSERT((unsigned)align < kAlignCount);
+ fAlign = SkToU8(align);
}
void SkStackViewLayout::setRound(bool r)
{
- fRound = SkToU8(r);
+ fRound = SkToU8(r);
}
////////////////////////////////////////////////////////////////////////////////
@@ -68,170 +68,170 @@ static SkScalar center_align_proc(SkScalar childLimit, SkScalar parentLimit) { r
static SkScalar right_align_proc(SkScalar childLimit, SkScalar parentLimit) { return parentLimit - childLimit; }
static SkScalar fill_align_proc(SkScalar childLimit, SkScalar parentLimit) { return 0; }
-/* Measure the main-dimension for all the children. If a child is marked flex in that direction
- ignore its current value but increment the counter for flexChildren
+/* Measure the main-dimension for all the children. If a child is marked flex in that direction
+ ignore its current value but increment the counter for flexChildren
*/
static SkScalar compute_children_limit(SkView* parent, GetSizeProc sizeProc, int* count,
- uint32_t flexMask, int* flexCount)
+ uint32_t flexMask, int* flexCount)
{
- SkView::B2FIter iter(parent);
- SkView* child;
- SkScalar limit = 0;
- int n = 0, flex = 0;
-
- while ((child = iter.next()) != NULL)
- {
- n += 1;
- if (child->getFlags() & flexMask)
- flex += 1;
- else
- limit += (child->*sizeProc)();
- }
- if (count)
- *count = n;
- if (flexCount)
- *flexCount = flex;
- return limit;
+ SkView::B2FIter iter(parent);
+ SkView* child;
+ SkScalar limit = 0;
+ int n = 0, flex = 0;
+
+ while ((child = iter.next()) != NULL)
+ {
+ n += 1;
+ if (child->getFlags() & flexMask)
+ flex += 1;
+ else
+ limit += (child->*sizeProc)();
+ }
+ if (count)
+ *count = n;
+ if (flexCount)
+ *flexCount = flex;
+ return limit;
}
void SkStackViewLayout::onLayoutChildren(SkView* parent)
{
- static AlignProc gAlignProcs[] = {
- left_align_proc,
- center_align_proc,
- right_align_proc,
- fill_align_proc
- };
-
- SkScalar startM, endM, crossStartM, crossLimit;
- GetSizeProc mainGetSizeP, crossGetSizeP;
- SetLocProc mainLocP, crossLocP;
- SetSizeProc mainSetSizeP, crossSetSizeP;
- SkView::Flag_Mask flexMask;
-
- if (fOrient == kHorizontal_Orient)
- {
- startM = fMargin.fLeft;
- endM = fMargin.fRight;
- crossStartM = fMargin.fTop;
- crossLimit = -fMargin.fTop - fMargin.fBottom;
-
- mainGetSizeP = &SkView::width;
- crossGetSizeP = &SkView::height;
- mainLocP = &SkView::setLocX;
- crossLocP = &SkView::setLocY;
-
- mainSetSizeP = &SkView::setWidth;
- crossSetSizeP = &SkView::setHeight;
-
- flexMask = SkView::kFlexH_Mask;
- }
- else
- {
- startM = fMargin.fTop;
- endM = fMargin.fBottom;
- crossStartM = fMargin.fLeft;
- crossLimit = -fMargin.fLeft - fMargin.fRight;
-
- mainGetSizeP = &SkView::height;
- crossGetSizeP = &SkView::width;
- mainLocP = &SkView::setLocY;
- crossLocP = &SkView::setLocX;
-
- mainSetSizeP = &SkView::setHeight;
- crossSetSizeP = &SkView::setWidth;
-
- flexMask = SkView::kFlexV_Mask;
- }
- crossLimit += (parent->*crossGetSizeP)();
- if (fAlign != kStretch_Align)
- crossSetSizeP = NULL;
-
- int childCount, flexCount;
- SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
-
- if (childCount == 0)
- return;
-
- childLimit += (childCount - 1) * fSpacer;
-
- SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM;
- SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit);
- SkScalar flexAmount = 0;
- SkView::B2FIter iter(parent);
- SkView* child;
-
- if (flexCount > 0 && parentLimit > childLimit)
- flexAmount = (parentLimit - childLimit) / flexCount;
-
- while ((child = iter.next()) != NULL)
- {
- if (fRound)
- pos = SkIntToScalar(SkScalarRound(pos));
- (child->*mainLocP)(pos);
- SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetSizeP)(), crossLimit);
- if (fRound)
- crossLoc = SkIntToScalar(SkScalarRound(crossLoc));
- (child->*crossLocP)(crossLoc);
-
- if (crossSetSizeP)
- (child->*crossSetSizeP)(crossLimit);
- if (child->getFlags() & flexMask)
- (child->*mainSetSizeP)(flexAmount);
- pos += (child->*mainGetSizeP)() + fSpacer;
- }
+ static AlignProc gAlignProcs[] = {
+ left_align_proc,
+ center_align_proc,
+ right_align_proc,
+ fill_align_proc
+ };
+
+ SkScalar startM, endM, crossStartM, crossLimit;
+ GetSizeProc mainGetSizeP, crossGetSizeP;
+ SetLocProc mainLocP, crossLocP;
+ SetSizeProc mainSetSizeP, crossSetSizeP;
+ SkView::Flag_Mask flexMask;
+
+ if (fOrient == kHorizontal_Orient)
+ {
+ startM = fMargin.fLeft;
+ endM = fMargin.fRight;
+ crossStartM = fMargin.fTop;
+ crossLimit = -fMargin.fTop - fMargin.fBottom;
+
+ mainGetSizeP = &SkView::width;
+ crossGetSizeP = &SkView::height;
+ mainLocP = &SkView::setLocX;
+ crossLocP = &SkView::setLocY;
+
+ mainSetSizeP = &SkView::setWidth;
+ crossSetSizeP = &SkView::setHeight;
+
+ flexMask = SkView::kFlexH_Mask;
+ }
+ else
+ {
+ startM = fMargin.fTop;
+ endM = fMargin.fBottom;
+ crossStartM = fMargin.fLeft;
+ crossLimit = -fMargin.fLeft - fMargin.fRight;
+
+ mainGetSizeP = &SkView::height;
+ crossGetSizeP = &SkView::width;
+ mainLocP = &SkView::setLocY;
+ crossLocP = &SkView::setLocX;
+
+ mainSetSizeP = &SkView::setHeight;
+ crossSetSizeP = &SkView::setWidth;
+
+ flexMask = SkView::kFlexV_Mask;
+ }
+ crossLimit += (parent->*crossGetSizeP)();
+ if (fAlign != kStretch_Align)
+ crossSetSizeP = NULL;
+
+ int childCount, flexCount;
+ SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &childCount, flexMask, &flexCount);
+
+ if (childCount == 0)
+ return;
+
+ childLimit += (childCount - 1) * fSpacer;
+
+ SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM;
+ SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit);
+ SkScalar flexAmount = 0;
+ SkView::B2FIter iter(parent);
+ SkView* child;
+
+ if (flexCount > 0 && parentLimit > childLimit)
+ flexAmount = (parentLimit - childLimit) / flexCount;
+
+ while ((child = iter.next()) != NULL)
+ {
+ if (fRound)
+ pos = SkIntToScalar(SkScalarRound(pos));
+ (child->*mainLocP)(pos);
+ SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetSizeP)(), crossLimit);
+ if (fRound)
+ crossLoc = SkIntToScalar(SkScalarRound(crossLoc));
+ (child->*crossLocP)(crossLoc);
+
+ if (crossSetSizeP)
+ (child->*crossSetSizeP)(crossLimit);
+ if (child->getFlags() & flexMask)
+ (child->*mainSetSizeP)(flexAmount);
+ pos += (child->*mainGetSizeP)() + fSpacer;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////
#ifdef SK_DEBUG
- static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
- {
- const char* value = dom.findAttr(node, attr);
- if (value)
- SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
- }
+ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
+ {
+ const char* value = dom.findAttr(node, attr);
+ if (value)
+ SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
+ }
#else
- #define assert_no_attr(dom, node, attr)
+ #define assert_no_attr(dom, node, attr)
#endif
void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- int index;
- SkScalar value[4];
+ int index;
+ SkScalar value[4];
- if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
- this->setOrient((Orient)index);
- else {
- assert_no_attr(dom, node, "orient");
+ if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
+ this->setOrient((Orient)index);
+ else {
+ assert_no_attr(dom, node, "orient");
}
- if (dom.findScalars(node, "margin", value, 4))
- {
- SkRect margin;
- margin.set(value[0], value[1], value[2], value[3]);
- this->setMargin(margin);
- }
- else {
- assert_no_attr(dom, node, "margin");
+ if (dom.findScalars(node, "margin", value, 4))
+ {
+ SkRect margin;
+ margin.set(value[0], value[1], value[2], value[3]);
+ this->setMargin(margin);
+ }
+ else {
+ assert_no_attr(dom, node, "margin");
}
- if (dom.findScalar(node, "spacer", value))
- this->setSpacer(value[0]);
- else {
- assert_no_attr(dom, node, "spacer");
+ if (dom.findScalar(node, "spacer", value))
+ this->setSpacer(value[0]);
+ else {
+ assert_no_attr(dom, node, "spacer");
}
- if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
- this->setPack((Pack)index);
- else {
- assert_no_attr(dom, node, "pack");
+ if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
+ this->setPack((Pack)index);
+ else {
+ assert_no_attr(dom, node, "pack");
}
- if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
- this->setAlign((Align)index);
- else {
- assert_no_attr(dom, node, "align");
+ if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
+ this->setAlign((Align)index);
+ else {
+ assert_no_attr(dom, node, "align");
}
}
@@ -239,36 +239,36 @@ void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
SkFillViewLayout::SkFillViewLayout()
{
- fMargin.setEmpty();
+ fMargin.setEmpty();
}
void SkFillViewLayout::getMargin(SkRect* r) const
{
- if (r)
- *r = fMargin;
+ if (r)
+ *r = fMargin;
}
void SkFillViewLayout::setMargin(const SkRect& margin)
{
- fMargin = margin;
+ fMargin = margin;
}
void SkFillViewLayout::onLayoutChildren(SkView* parent)
{
- SkView::B2FIter iter(parent);
- SkView* child;
-
- while ((child = iter.next()) != NULL)
- {
- child->setLoc(fMargin.fLeft, fMargin.fTop);
- child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
- parent->height() - fMargin.fBottom - fMargin.fTop);
- }
+ SkView::B2FIter iter(parent);
+ SkView* child;
+
+ while ((child = iter.next()) != NULL)
+ {
+ child->setLoc(fMargin.fLeft, fMargin.fTop);
+ child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft,
+ parent->height() - fMargin.fBottom - fMargin.fTop);
+ }
}
void SkFillViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
- (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4);
+ this->INHERITED::onInflate(dom, node);
+ (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4);
}
diff --git a/src/views/SkTextBox.cpp b/src/views/SkTextBox.cpp
index 47237a905e..355944aef1 100644
--- a/src/views/SkTextBox.cpp
+++ b/src/views/SkTextBox.cpp
@@ -156,7 +156,7 @@ void SkTextBox::draw(SkCanvas* canvas, const char text[], size_t len, const SkPa
y += scaledSpacing;
if (y + metrics.fAscent >= height)
break;
- }
+ }
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/views/SkTouchGesture.cpp b/src/views/SkTouchGesture.cpp
index 1828f0390b..afda8c15cd 100644
--- a/src/views/SkTouchGesture.cpp
+++ b/src/views/SkTouchGesture.cpp
@@ -191,7 +191,7 @@ static const float MIN_ZOOM_SCALE = 0.25f;
float SkTouchGesture::limitTotalZoom(float scale) const {
// this query works 'cause we know that we're square-scale w/ no skew/rotation
const float curr = SkScalarToFloat(fGlobalM[0]);
-
+
if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) {
scale = MAX_ZOOM_SCALE / curr;
} else if (scale < 1 && curr * scale < MIN_ZOOM_SCALE) {
@@ -239,7 +239,7 @@ void SkTouchGesture::touchMoved(void* owner, float x, float y) {
SkASSERT(kZoom_State == fState);
const Rec& rec0 = fTouches[0];
const Rec& rec1 = fTouches[1];
-
+
float scale = this->computePinch(rec0, rec1);
scale = this->limitTotalZoom(scale);
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index eb93198240..94eb490a0b 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -95,7 +95,7 @@ void SkView::offset(SkScalar dx, SkScalar dy)
this->setLoc(fLoc.fX + dx, fLoc.fY + dy);
}
-void SkView::setLocalMatrix(const SkMatrix& matrix)
+void SkView::setLocalMatrix(const SkMatrix& matrix)
{
this->inval(NULL);
fMatrix = matrix;
@@ -106,22 +106,22 @@ void SkView::draw(SkCanvas* canvas)
{
if (fWidth && fHeight && this->isVisible())
{
- SkRect r;
+ SkRect r;
r.set(fLoc.fX, fLoc.fY, fLoc.fX + fWidth, fLoc.fY + fHeight);
if (this->isClipToBounds() &&
canvas->quickReject(r)) {
return;
}
- SkAutoCanvasRestore as(canvas, true);
+ SkAutoCanvasRestore as(canvas, true);
if (this->isClipToBounds()) {
canvas->clipRect(r);
}
-
- canvas->translate(fLoc.fX, fLoc.fY);
+
+ canvas->translate(fLoc.fX, fLoc.fY);
canvas->concat(fMatrix);
-
+
if (fParent) {
fParent->beforeChild(this, canvas);
}
@@ -133,21 +133,21 @@ void SkView::draw(SkCanvas* canvas)
if (fParent) {
fParent->afterChild(this, canvas);
}
-
- B2FIter iter(this);
- SkView* child;
+
+ B2FIter iter(this);
+ SkView* child;
SkCanvas* childCanvas = this->beforeChildren(canvas);
while ((child = iter.next()) != NULL)
child->draw(childCanvas);
-
+
this->afterChildren(canvas);
}
}
void SkView::inval(SkRect* rect) {
- SkView* view = this;
+ SkView* view = this;
SkRect storage;
for (;;) {
@@ -184,7 +184,7 @@ void SkView::inval(SkRect* rect) {
bool SkView::setFocusView(SkView* fv)
{
SkView* view = this;
-
+
do {
if (view->onSetFocusView(fv))
return true;
@@ -194,8 +194,8 @@ bool SkView::setFocusView(SkView* fv)
SkView* SkView::getFocusView() const
{
- SkView* focus = NULL;
- const SkView* view = this;
+ SkView* focus = NULL;
+ const SkView* view = this;
do {
if (view->onGetFocusView(&focus))
break;
@@ -223,16 +223,16 @@ SkView* SkView::acceptFocus(FocusDirection dir)
if (this->acceptFocus())
return this;
- B2FIter iter(this);
- SkView* child, *focus;
+ B2FIter iter(this);
+ SkView* child, *focus;
while ((child = iter.next()) != NULL)
if ((focus = child->acceptFocus(dir)) != NULL)
return focus;
}
else // prev
{
- F2BIter iter(this);
- SkView* child, *focus;
+ F2BIter iter(this);
+ SkView* child, *focus;
while ((child = iter.next()) != NULL)
if ((focus = child->acceptFocus(dir)) != NULL)
return focus;
@@ -249,13 +249,13 @@ SkView* SkView::moveFocus(FocusDirection dir)
SkView* focus = this->getFocusView();
if (focus == NULL)
- { // start with the root
+ { // start with the root
focus = this;
while (focus->fParent)
focus = focus->fParent;
}
- SkView* child, *parent;
+ SkView* child, *parent;
if (dir == kNext_FocusDirection)
{
@@ -279,10 +279,10 @@ SkView* SkView::moveFocus(FocusDirection dir)
parent = parent->fParent;
} while (parent != NULL);
}
- else // prevfocus
+ else // prevfocus
{
parent = focus->fParent;
- if (parent == NULL) // we're the root
+ if (parent == NULL) // we're the root
return focus->acceptFocus(dir);
else
{
@@ -364,7 +364,7 @@ void SkView::Click::copyType(const char type[])
this->resetType();
if (type)
{
- size_t len = strlen(type) + 1;
+ size_t len = strlen(type) + 1;
fType = (char*)sk_malloc_throw(len);
memcpy(fType, type, len);
fWeOwnTheType = true;
@@ -379,8 +379,8 @@ SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y)
}
if (this->onSendClickToChildren(x, y)) {
- F2BIter iter(this);
- SkView* child;
+ F2BIter iter(this);
+ SkView* child;
while ((child = iter.next()) != NULL)
{
@@ -526,9 +526,9 @@ void SkView::detachFromParent_NoLayout()
this->inval(NULL);
- SkView* next = NULL;
+ SkView* next = NULL;
- if (fNextSibling != this) // do we have any siblings
+ if (fNextSibling != this) // do we have any siblings
{
fNextSibling->fPrevSibling = fPrevSibling;
fPrevSibling->fNextSibling = fNextSibling;
@@ -657,7 +657,7 @@ bool SkView::globalToLocal(SkScalar x, SkScalar y, SkPoint* local) const
//////////////////////////////////////////////////////////////////
-/* Even if the subclass overrides onInflate, they should always be
+/* Even if the subclass overrides onInflate, they should always be
sure to call the inherited method, so that we get called.
*/
void SkView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
@@ -705,8 +705,8 @@ void SkView::postInflate(const SkTDict<SkView*>& dict)
{
this->onPostInflate(dict);
- B2FIter iter(this);
- SkView* child;
+ B2FIter iter(this);
+ SkView* child;
while ((child = iter.next()) != NULL)
child->postInflate(dict);
}
@@ -716,7 +716,7 @@ void SkView::postInflate(const SkTDict<SkView*>& dict)
SkView* SkView::sendEventToParents(const SkEvent& evt)
{
SkView* parent = fParent;
-
+
while (parent)
{
if (parent->doEvent(evt))
@@ -728,7 +728,7 @@ SkView* SkView::sendEventToParents(const SkEvent& evt)
SkView* SkView::sendQueryToParents(SkEvent* evt) {
SkView* parent = fParent;
-
+
while (parent) {
if (parent->doQuery(evt)) {
return parent;
@@ -747,7 +747,7 @@ SkView::F2BIter::F2BIter(const SkView* parent)
fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
}
-SkView* SkView::F2BIter::next()
+SkView* SkView::F2BIter::next()
{
SkView* curr = fChild;
@@ -767,7 +767,7 @@ SkView::B2FIter::B2FIter(const SkView* parent)
fChild = fFirstChild;
}
-SkView* SkView::B2FIter::next()
+SkView* SkView::B2FIter::next()
{
SkView* curr = fChild;
@@ -810,9 +810,9 @@ static void dumpview(const SkView* view, int level, bool recurse)
if (recurse)
{
- SkView::B2FIter iter(view);
- SkView* child;
- bool noChildren = true;
+ SkView::B2FIter iter(view);
+ SkView* child;
+ bool noChildren = true;
while ((child = iter.next()) != NULL)
{
diff --git a/src/views/SkViewInflate.cpp b/src/views/SkViewInflate.cpp
index 184e54021a..4d7de0483c 100644
--- a/src/views/SkViewInflate.cpp
+++ b/src/views/SkViewInflate.cpp
@@ -19,128 +19,128 @@ SkViewInflate::~SkViewInflate()
void SkViewInflate::rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView* parent)
{
- const char* str = dom.findAttr(node, "id");
- if (str)
- fIDs.set(str, parent);
-
- const SkDOM::Node* child = dom.getFirstChild(node);
- while (child)
- {
- SkView* view = this->createView(dom, child);
- if (view)
- {
- this->rInflate(dom, child, view);
- parent->attachChildToFront(view)->unref();
- }
- else
- {
- const char* name = dom.getName(child);
- const char* target;
-
- if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
- this->addIDStr(&fListenTo, parent, target);
-
- if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
- this->addIDStr(&fBroadcastTo, parent, target);
- }
- child = dom.getNextSibling(child);
- }
-
- parent->setVisibleP(true);
- this->inflateView(parent, dom, node);
+ const char* str = dom.findAttr(node, "id");
+ if (str)
+ fIDs.set(str, parent);
+
+ const SkDOM::Node* child = dom.getFirstChild(node);
+ while (child)
+ {
+ SkView* view = this->createView(dom, child);
+ if (view)
+ {
+ this->rInflate(dom, child, view);
+ parent->attachChildToFront(view)->unref();
+ }
+ else
+ {
+ const char* name = dom.getName(child);
+ const char* target;
+
+ if (!strcmp(name, "listenTo") && (target = dom.findAttr(child, "target")) != NULL)
+ this->addIDStr(&fListenTo, parent, target);
+
+ if (!strcmp(name, "broadcastTo") && (target = dom.findAttr(child, "target")) != NULL)
+ this->addIDStr(&fBroadcastTo, parent, target);
+ }
+ child = dom.getNextSibling(child);
+ }
+
+ parent->setVisibleP(true);
+ this->inflateView(parent, dom, node);
}
void SkViewInflate::inflateView(SkView* view, const SkDOM& dom, const SkDOM::Node* node)
{
- // called after all of view's children have been instantiated.
- // this may be overridden by a subclass, to load in layout or other helpers
- // they should call through to us (INHERITED) before or after their patch
- view->inflate(dom, node);
+ // called after all of view's children have been instantiated.
+ // this may be overridden by a subclass, to load in layout or other helpers
+ // they should call through to us (INHERITED) before or after their patch
+ view->inflate(dom, node);
}
SkView* SkViewInflate::inflate(const SkDOM& dom, const SkDOM::Node* node, SkView* root)
{
- fIDs.reset();
-
- if (root == NULL)
- {
- root = this->createView(dom, node);
- if (root == NULL)
- {
- printf("createView returned NULL on <%s>\n", dom.getName(node));
- return NULL;
- }
- }
- this->rInflate(dom, node, root);
-
- // resolve listeners and broadcasters
- {
- SkView* target;
- const IDStr* iter = fListenTo.begin();
- const IDStr* stop = fListenTo.end();
- for (; iter < stop; iter++)
- {
- if (fIDs.find(iter->fStr, &target))
- target->addListenerID(iter->fView->getSinkID());
- }
-
- iter = fBroadcastTo.begin();
- stop = fBroadcastTo.end();
- for (; iter < stop; iter++)
- {
- if (fIDs.find(iter->fStr, &target))
- iter->fView->addListenerID(target->getSinkID());
- }
- }
-
- // now that the tree is built, give everyone a shot at the ID dict
- root->postInflate(fIDs);
- return root;
+ fIDs.reset();
+
+ if (root == NULL)
+ {
+ root = this->createView(dom, node);
+ if (root == NULL)
+ {
+ printf("createView returned NULL on <%s>\n", dom.getName(node));
+ return NULL;
+ }
+ }
+ this->rInflate(dom, node, root);
+
+ // resolve listeners and broadcasters
+ {
+ SkView* target;
+ const IDStr* iter = fListenTo.begin();
+ const IDStr* stop = fListenTo.end();
+ for (; iter < stop; iter++)
+ {
+ if (fIDs.find(iter->fStr, &target))
+ target->addListenerID(iter->fView->getSinkID());
+ }
+
+ iter = fBroadcastTo.begin();
+ stop = fBroadcastTo.end();
+ for (; iter < stop; iter++)
+ {
+ if (fIDs.find(iter->fStr, &target))
+ iter->fView->addListenerID(target->getSinkID());
+ }
+ }
+
+ // now that the tree is built, give everyone a shot at the ID dict
+ root->postInflate(fIDs);
+ return root;
}
SkView* SkViewInflate::inflate(const char xml[], size_t len, SkView* root)
{
- SkDOM dom;
- const SkDOM::Node* node = dom.build(xml, len);
+ SkDOM dom;
+ const SkDOM::Node* node = dom.build(xml, len);
- return node ? this->inflate(dom, node, root) : NULL;
+ return node ? this->inflate(dom, node, root) : NULL;
}
SkView* SkViewInflate::findViewByID(const char id[]) const
{
- SkASSERT(id);
- SkView* view;
- return fIDs.find(id, &view) ? view : NULL;
+ SkASSERT(id);
+ SkView* view;
+ return fIDs.find(id, &view) ? view : NULL;
}
SkView* SkViewInflate::createView(const SkDOM& dom, const SkDOM::Node* node)
{
- if (!strcmp(dom.getName(node), "view"))
- return new SkView;
- return NULL;
+ if (!strcmp(dom.getName(node), "view"))
+ return new SkView;
+ return NULL;
}
void SkViewInflate::addIDStr(SkTDArray<IDStr>* list, SkView* view, const char* str)
{
- size_t len = strlen(str) + 1;
- IDStr* pair = list->append();
- pair->fView = view;
- pair->fStr = (char*)fStrings.alloc(len, SkChunkAlloc::kThrow_AllocFailType);
- memcpy(pair->fStr, str, len);
+ size_t len = strlen(str) + 1;
+ IDStr* pair = list->append();
+ pair->fView = view;
+ pair->fStr = (char*)fStrings.alloc(len, SkChunkAlloc::kThrow_AllocFailType);
+ memcpy(pair->fStr, str, len);
}
#ifdef SK_DEBUG
void SkViewInflate::dump() const
{
- const IDStr* iter = fListenTo.begin();
- const IDStr* stop = fListenTo.end();
- for (; iter < stop; iter++)
- SkDebugf("inflate: listenTo(\"%s\")\n", iter->fStr);
-
- iter = fBroadcastTo.begin();
- stop = fBroadcastTo.end();
- for (; iter < stop; iter++)
- SkDebugf("inflate: broadcastFrom(\"%s\")\n", iter->fStr);
+ const IDStr* iter = fListenTo.begin();
+ const IDStr* stop = fListenTo.end();
+ for (; iter < stop; iter++)
+ SkDebugf("inflate: listenTo(\"%s\")\n", iter->fStr);
+
+ iter = fBroadcastTo.begin();
+ stop = fBroadcastTo.end();
+ for (; iter < stop; iter++)
+ SkDebugf("inflate: broadcastFrom(\"%s\")\n", iter->fStr);
}
#endif
diff --git a/src/views/SkViewPriv.cpp b/src/views/SkViewPriv.cpp
index ad15f3fdb4..ba40c1e360 100644
--- a/src/views/SkViewPriv.cpp
+++ b/src/views/SkViewPriv.cpp
@@ -11,94 +11,94 @@
void SkView::Artist::draw(SkView* view, SkCanvas* canvas)
{
- SkASSERT(view && canvas);
- this->onDraw(view, canvas);
+ SkASSERT(view && canvas);
+ this->onDraw(view, canvas);
}
void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(&dom && node);
- this->onInflate(dom, node);
+ SkASSERT(&dom && node);
+ this->onInflate(dom, node);
}
void SkView::Artist::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- // subclass should override this as needed
+ // subclass should override this as needed
}
SkView::Artist* SkView::getArtist() const
{
- Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
- SkASSERT(rec == NULL || rec->fArtist != NULL);
+ Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
+ SkASSERT(rec == NULL || rec->fArtist != NULL);
- return rec ? rec->fArtist : NULL;
+ return rec ? rec->fArtist : NULL;
}
SkView::Artist* SkView::setArtist(Artist* obj)
{
- if (obj == NULL)
- {
- this->removeTagList(kViewArtist_SkTagList);
- }
- else // add/replace
- {
- Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
-
- if (rec)
- SkRefCnt_SafeAssign(rec->fArtist, obj);
- else
- this->addTagList(new Artist_SkTagList(obj));
- }
- return obj;
+ if (obj == NULL)
+ {
+ this->removeTagList(kViewArtist_SkTagList);
+ }
+ else // add/replace
+ {
+ Artist_SkTagList* rec = (Artist_SkTagList*)this->findTagList(kViewArtist_SkTagList);
+
+ if (rec)
+ SkRefCnt_SafeAssign(rec->fArtist, obj);
+ else
+ this->addTagList(new Artist_SkTagList(obj));
+ }
+ return obj;
}
////////////////////////////////////////////////////////////////////////////////
void SkView::Layout::layoutChildren(SkView* parent)
{
- SkASSERT(parent);
- if (parent->width() > 0 && parent->height() > 0)
- this->onLayoutChildren(parent);
+ SkASSERT(parent);
+ if (parent->width() > 0 && parent->height() > 0)
+ this->onLayoutChildren(parent);
}
void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
{
- SkASSERT(&dom && node);
- this->onInflate(dom, node);
+ SkASSERT(&dom && node);
+ this->onInflate(dom, node);
}
void SkView::Layout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- // subclass should override this as needed
+ // subclass should override this as needed
}
SkView::Layout* SkView::getLayout() const
{
- Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
- SkASSERT(rec == NULL || rec->fLayout != NULL);
+ Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
+ SkASSERT(rec == NULL || rec->fLayout != NULL);
- return rec ? rec->fLayout : NULL;
+ return rec ? rec->fLayout : NULL;
}
SkView::Layout* SkView::setLayout(Layout* obj, bool invokeLayoutNow)
{
- if (obj == NULL)
- {
- this->removeTagList(kViewLayout_SkTagList);
- }
- else // add/replace
- {
- Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
-
- if (rec)
- SkRefCnt_SafeAssign(rec->fLayout, obj);
- else
- this->addTagList(new Layout_SkTagList(obj));
- }
-
- if (invokeLayoutNow)
- this->invokeLayout();
-
- return obj;
+ if (obj == NULL)
+ {
+ this->removeTagList(kViewLayout_SkTagList);
+ }
+ else // add/replace
+ {
+ Layout_SkTagList* rec = (Layout_SkTagList*)this->findTagList(kViewLayout_SkTagList);
+
+ if (rec)
+ SkRefCnt_SafeAssign(rec->fLayout, obj);
+ else
+ this->addTagList(new Layout_SkTagList(obj));
+ }
+
+ if (invokeLayoutNow)
+ this->invokeLayout();
+
+ return obj;
}
diff --git a/src/views/SkViewPriv.h b/src/views/SkViewPriv.h
index d8cf966ce9..8a9c0b7e9a 100644
--- a/src/views/SkViewPriv.h
+++ b/src/views/SkViewPriv.h
@@ -12,33 +12,33 @@
#include "SkTagList.h"
struct Layout_SkTagList : SkTagList {
- SkView::Layout* fLayout;
-
- Layout_SkTagList(SkView::Layout* layout)
- : SkTagList(kViewLayout_SkTagList), fLayout(layout)
- {
- SkASSERT(layout);
- layout->ref();
- }
- virtual ~Layout_SkTagList()
- {
- fLayout->unref();
- }
+ SkView::Layout* fLayout;
+
+ Layout_SkTagList(SkView::Layout* layout)
+ : SkTagList(kViewLayout_SkTagList), fLayout(layout)
+ {
+ SkASSERT(layout);
+ layout->ref();
+ }
+ virtual ~Layout_SkTagList()
+ {
+ fLayout->unref();
+ }
};
struct Artist_SkTagList : SkTagList {
- SkView::Artist* fArtist;
-
- Artist_SkTagList(SkView::Artist* artist)
- : SkTagList(kViewArtist_SkTagList), fArtist(artist)
- {
- SkASSERT(artist);
- artist->ref();
- }
- virtual ~Artist_SkTagList()
- {
- fArtist->unref();
- }
+ SkView::Artist* fArtist;
+
+ Artist_SkTagList(SkView::Artist* artist)
+ : SkTagList(kViewArtist_SkTagList), fArtist(artist)
+ {
+ SkASSERT(artist);
+ artist->ref();
+ }
+ virtual ~Artist_SkTagList()
+ {
+ fArtist->unref();
+ }
};
#endif
diff --git a/src/views/SkWidget.cpp b/src/views/SkWidget.cpp
index 104429da57..e7de522107 100644
--- a/src/views/SkWidget.cpp
+++ b/src/views/SkWidget.cpp
@@ -22,7 +22,7 @@ SkWidgetView::~SkWidgetView()
const char* SkWidgetView::GetEventType()
{
- return "SkWidgetView";
+ return "SkWidgetView";
}
/////////////////////////////////////////////////////////////////////////////
@@ -30,300 +30,300 @@ const char* SkWidgetView::GetEventType()
class SkTextView::Interp {
public:
- Interp(const SkString& old, SkMSec now, SkMSec dur, AnimaDir dir) : fOldText(old), fInterp(1, 2)
- {
- SkScalar x = 0;
- fInterp.setKeyFrame(0, now, &x, 0);
- x = SK_Scalar1;
- if (dir == kBackward_AnimDir)
- x = -x;
- fInterp.setKeyFrame(1, now + dur, &x);
- }
- bool draw(SkCanvas* canvas, const SkString& newText, SkScalar x, SkScalar y, SkPaint& paint)
- {
- SkScalar scale;
-
- if (fInterp.timeToValues(SkTime::GetMSecs(), &scale) == SkInterpolator::kFreezeEnd_Result)
- {
- canvas->drawText(newText.c_str(), newText.size(), x, y, paint);
- return false;
- }
- else
- {
- U8 alpha = paint.getAlpha();
- SkScalar above, below;
- (void)paint.measureText(NULL, 0, &above, &below);
- SkScalar height = below - above;
- SkScalar dy = SkScalarMul(height, scale);
- if (scale < 0)
- height = -height;
-
- // draw the old
- paint.setAlpha((U8)SkScalarMul(alpha, SK_Scalar1 - SkScalarAbs(scale)));
- canvas->drawText(fOldText.c_str(), fOldText.size(), x, y - dy, paint);
- // draw the new
- paint.setAlpha((U8)SkScalarMul(alpha, SkScalarAbs(scale)));
- canvas->drawText(newText.c_str(), newText.size(), x, y + height - dy, paint);
- // restore the paint
- paint.setAlpha(alpha);
- return true;
- }
- }
+ Interp(const SkString& old, SkMSec now, SkMSec dur, AnimaDir dir) : fOldText(old), fInterp(1, 2)
+ {
+ SkScalar x = 0;
+ fInterp.setKeyFrame(0, now, &x, 0);
+ x = SK_Scalar1;
+ if (dir == kBackward_AnimDir)
+ x = -x;
+ fInterp.setKeyFrame(1, now + dur, &x);
+ }
+ bool draw(SkCanvas* canvas, const SkString& newText, SkScalar x, SkScalar y, SkPaint& paint)
+ {
+ SkScalar scale;
+
+ if (fInterp.timeToValues(SkTime::GetMSecs(), &scale) == SkInterpolator::kFreezeEnd_Result)
+ {
+ canvas->drawText(newText.c_str(), newText.size(), x, y, paint);
+ return false;
+ }
+ else
+ {
+ U8 alpha = paint.getAlpha();
+ SkScalar above, below;
+ (void)paint.measureText(NULL, 0, &above, &below);
+ SkScalar height = below - above;
+ SkScalar dy = SkScalarMul(height, scale);
+ if (scale < 0)
+ height = -height;
+
+ // draw the old
+ paint.setAlpha((U8)SkScalarMul(alpha, SK_Scalar1 - SkScalarAbs(scale)));
+ canvas->drawText(fOldText.c_str(), fOldText.size(), x, y - dy, paint);
+ // draw the new
+ paint.setAlpha((U8)SkScalarMul(alpha, SkScalarAbs(scale)));
+ canvas->drawText(newText.c_str(), newText.size(), x, y + height - dy, paint);
+ // restore the paint
+ paint.setAlpha(alpha);
+ return true;
+ }
+ }
private:
- SkString fOldText;
- SkInterpolator fInterp;
+ SkString fOldText;
+ SkInterpolator fInterp;
};
SkTextView::SkTextView(U32 flags) : SkView(flags), fInterp(NULL), fDoInterp(false)
{
- fMargin.set(0, 0);
+ fMargin.set(0, 0);
}
SkTextView::~SkTextView()
{
- delete fInterp;
+ delete fInterp;
}
void SkTextView::getText(SkString* str) const
{
- if (str)
- str->set(fText);
+ if (str)
+ str->set(fText);
}
void SkTextView::setText(const char text[], AnimaDir dir)
{
- if (!fText.equals(text))
- {
- SkString tmp(text);
- this->privSetText(tmp, dir);
- }
+ if (!fText.equals(text))
+ {
+ SkString tmp(text);
+ this->privSetText(tmp, dir);
+ }
}
void SkTextView::setText(const char text[], size_t len, AnimaDir dir)
{
- if (!fText.equals(text))
- {
- SkString tmp(text, len);
- this->privSetText(tmp, dir);
- }
+ if (!fText.equals(text))
+ {
+ SkString tmp(text, len);
+ this->privSetText(tmp, dir);
+ }
}
void SkTextView::setText(const SkString& src, AnimaDir dir)
{
- if (fText != src)
- this->privSetText(src, dir);
+ if (fText != src)
+ this->privSetText(src, dir);
}
void SkTextView::privSetText(const SkString& src, AnimaDir dir)
{
- SkASSERT(fText != src);
-
- if (fDoInterp)
- {
- if (fInterp)
- delete fInterp;
- fInterp = new Interp(fText, SkTime::GetMSecs(), 500, dir);
- }
- fText = src;
- this->inval(NULL);
+ SkASSERT(fText != src);
+
+ if (fDoInterp)
+ {
+ if (fInterp)
+ delete fInterp;
+ fInterp = new Interp(fText, SkTime::GetMSecs(), 500, dir);
+ }
+ fText = src;
+ this->inval(NULL);
}
/////////////////////////////////////////////////////////////////
void SkTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkTextView::setMargin(const SkPoint& margin)
{
- if (fMargin != margin)
- {
- fMargin = margin;
- this->inval(NULL);
- }
+ if (fMargin != margin)
+ {
+ fMargin = margin;
+ this->inval(NULL);
+ }
}
void SkTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
-
- if (fText.size() == 0)
- return;
-
- SkPaint::Align align = fPaint.getTextAlign();
- SkScalar x, y;
-
- switch (align) {
- case SkPaint::kLeft_Align:
- x = fMargin.fX;
- break;
- case SkPaint::kCenter_Align:
- x = SkScalarHalf(this->width());
- break;
- default:
- SkASSERT(align == SkPaint::kRight_Align);
- x = this->width() - fMargin.fX;
- break;
- }
-
- fPaint.measureText(NULL, 0, &y, NULL);
- y = fMargin.fY - y;
-
- if (fInterp)
- {
- if (fInterp->draw(canvas, fText, x, y, fPaint))
- this->inval(NULL);
- else
- {
- delete fInterp;
- fInterp = NULL;
- }
- }
- else
- canvas->drawText(fText.c_str(), fText.size(), x, y, fPaint);
+ this->INHERITED::onDraw(canvas);
+
+ if (fText.size() == 0)
+ return;
+
+ SkPaint::Align align = fPaint.getTextAlign();
+ SkScalar x, y;
+
+ switch (align) {
+ case SkPaint::kLeft_Align:
+ x = fMargin.fX;
+ break;
+ case SkPaint::kCenter_Align:
+ x = SkScalarHalf(this->width());
+ break;
+ default:
+ SkASSERT(align == SkPaint::kRight_Align);
+ x = this->width() - fMargin.fX;
+ break;
+ }
+
+ fPaint.measureText(NULL, 0, &y, NULL);
+ y = fMargin.fY - y;
+
+ if (fInterp)
+ {
+ if (fInterp->draw(canvas, fText, x, y, fPaint))
+ this->inval(NULL);
+ else
+ {
+ delete fInterp;
+ fInterp = NULL;
+ }
+ }
+ else
+ canvas->drawText(fText.c_str(), fText.size(), x, y, fPaint);
}
//////////////////////////////////////////////////////////////////////////////////////
void SkTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
- SkPoint margin;
- if (dom.findScalars(node, "margin", (SkScalar*)&margin, 2))
- this->setMargin(margin);
- (void)dom.findBool(node, "do-interp", &fDoInterp);
+ SkPoint margin;
+ if (dom.findScalars(node, "margin", (SkScalar*)&margin, 2))
+ this->setMargin(margin);
+ (void)dom.findBool(node, "do-interp", &fDoInterp);
- SkPaint_Inflate(&fPaint, dom, node);
+ SkPaint_Inflate(&fPaint, dom, node);
}
//////////////////////////////////////////////////////////////////////////////////////
SkSliderView::SkSliderView(U32 flags) : SkWidgetView(flags)
{
- fValue = 0;
- fMax = 0;
+ fValue = 0;
+ fMax = 0;
}
static U16 actual_value(U16CPU value, U16CPU max)
{
- return SkToU16(SkMax32(0, SkMin32(value, max)));
+ return SkToU16(SkMax32(0, SkMin32(value, max)));
}
void SkSliderView::setMax(U16CPU max)
{
- if (fMax != max)
- {
- fMax = SkToU16(max);
- if (fValue > 0)
- this->inval(NULL);
- }
+ if (fMax != max)
+ {
+ fMax = SkToU16(max);
+ if (fValue > 0)
+ this->inval(NULL);
+ }
}
void SkSliderView::setValue(U16CPU value)
{
- if (fValue != value)
- {
- U16 prev = actual_value(fValue, fMax);
- U16 next = actual_value(value, fMax);
-
- fValue = SkToU16(value);
- if (prev != next)
- {
- this->inval(NULL);
-
- if (this->hasListeners())
- {
- SkEvent evt;
-
- evt.setType(SkWidgetView::GetEventType());
- evt.setFast32(this->getSinkID());
- evt.setS32("sliderValue", next);
- this->postToListeners(evt);
- }
- }
- }
+ if (fValue != value)
+ {
+ U16 prev = actual_value(fValue, fMax);
+ U16 next = actual_value(value, fMax);
+
+ fValue = SkToU16(value);
+ if (prev != next)
+ {
+ this->inval(NULL);
+
+ if (this->hasListeners())
+ {
+ SkEvent evt;
+
+ evt.setType(SkWidgetView::GetEventType());
+ evt.setFast32(this->getSinkID());
+ evt.setS32("sliderValue", next);
+ this->postToListeners(evt);
+ }
+ }
+ }
}
#include "SkGradientShader.h"
static void setgrad(SkPaint* paint, const SkRect& r)
{
- SkPoint pts[2];
- SkColor colors[2];
+ SkPoint pts[2];
+ SkColor colors[2];
#if 0
- pts[0].set(r.fLeft, r.fTop);
- pts[1].set(r.fLeft + r.height(), r.fBottom);
+ pts[0].set(r.fLeft, r.fTop);
+ pts[1].set(r.fLeft + r.height(), r.fBottom);
#else
- pts[0].set(r.fRight, r.fBottom);
- pts[1].set(r.fRight - r.height(), r.fTop);
+ pts[0].set(r.fRight, r.fBottom);
+ pts[1].set(r.fRight - r.height(), r.fTop);
#endif
- colors[0] = SK_ColorBLUE;
- colors[1] = SK_ColorWHITE;
+ colors[0] = SK_ColorBLUE;
+ colors[1] = SK_ColorWHITE;
- paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kMirror_TileMode))->unref();
+ paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kMirror_TileMode))->unref();
}
void SkSliderView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
+ U16CPU value = SkMax32(0, SkMin32(fValue, fMax));
- SkRect r;
- SkPaint p;
+ SkRect r;
+ SkPaint p;
- r.set(0, 0, this->width(), this->height());
+ r.set(0, 0, this->width(), this->height());
- p.setAntiAliasOn(true);
- p.setStyle(SkPaint::kStroke_Style);
- p.setStrokeWidth(SK_Scalar1);
- r.inset(SK_Scalar1/2, SK_Scalar1/2);
- canvas->drawRect(r, p);
+ p.setAntiAliasOn(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(SK_Scalar1);
+ r.inset(SK_Scalar1/2, SK_Scalar1/2);
+ canvas->drawRect(r, p);
- if (fMax)
- {
- SkFixed percent = SkFixedDiv(value, fMax);
-
- r.inset(SK_Scalar1/2, SK_Scalar1/2);
- r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
- p.setStyle(SkPaint::kFill_Style);
- setgrad(&p, r);
- canvas->drawRect(r, p);
- }
+ if (fMax)
+ {
+ SkFixed percent = SkFixedDiv(value, fMax);
+
+ r.inset(SK_Scalar1/2, SK_Scalar1/2);
+ r.fRight = r.fLeft + SkScalarMul(r.width(), SkFixedToScalar(percent));
+ p.setStyle(SkPaint::kFill_Style);
+ setgrad(&p, r);
+ canvas->drawRect(r, p);
+ }
#if 0
- r.set(0, 0, this->width(), this->height());
- r.inset(SK_Scalar1, SK_Scalar1);
- r.inset(r.width()/2, 0);
- p.setColor(SK_ColorBLACK);
- canvas->drawLine(*(SkPoint*)&r.fLeft, *(SkPoint*)&r.fRight, p);
+ r.set(0, 0, this->width(), this->height());
+ r.inset(SK_Scalar1, SK_Scalar1);
+ r.inset(r.width()/2, 0);
+ p.setColor(SK_ColorBLACK);
+ canvas->drawLine(*(SkPoint*)&r.fLeft, *(SkPoint*)&r.fRight, p);
#endif
}
SkView::Click* SkSliderView::onFindClickHandler(SkScalar x, SkScalar y)
{
- return new Click(this);
+ return new Click(this);
}
bool SkSliderView::onClick(Click* click)
{
- if (fMax)
- {
- SkScalar percent = SkScalarDiv(click->fCurr.fX + SK_Scalar1, this->width() - SK_Scalar1*2);
- percent = SkMaxScalar(0, SkMinScalar(percent, SK_Scalar1));
- this->setValue(SkScalarRound(percent * fMax));
- return true;
- }
- return false;
+ if (fMax)
+ {
+ SkScalar percent = SkScalarDiv(click->fCurr.fX + SK_Scalar1, this->width() - SK_Scalar1*2);
+ percent = SkMaxScalar(0, SkMinScalar(percent, SK_Scalar1));
+ this->setValue(SkScalarRound(percent * fMax));
+ return true;
+ }
+ return false;
}
#endif
diff --git a/src/views/SkWidgets.cpp b/src/views/SkWidgets.cpp
index 69d755bd8b..1693a31239 100644
--- a/src/views/SkWidgets.cpp
+++ b/src/views/SkWidgets.cpp
@@ -15,14 +15,14 @@
#if 0
#ifdef SK_DEBUG
- static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
- {
- const char* value = dom.findAttr(node, attr);
- if (value)
- SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
- }
+ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[])
+ {
+ const char* value = dom.findAttr(node, attr);
+ if (value)
+ SkDebugf("unknown attribute %s=\"%s\"\n", attr, value);
+ }
#else
- #define assert_no_attr(dom, node, attr)
+ #define assert_no_attr(dom, node, attr)
#endif
#include "SkAnimator.h"
@@ -31,56 +31,56 @@
///////////////////////////////////////////////////////////////////////////////
enum SkinType {
- kPushButton_SkinType,
- kStaticText_SkinType,
+ kPushButton_SkinType,
+ kStaticText_SkinType,
- kSkinTypeCount
+ kSkinTypeCount
};
struct SkinSuite {
- SkinSuite();
- ~SkinSuite()
- {
- for (int i = 0; i < kSkinTypeCount; i++)
- delete fAnimators[i];
- }
+ SkinSuite();
+ ~SkinSuite()
+ {
+ for (int i = 0; i < kSkinTypeCount; i++)
+ delete fAnimators[i];
+ }
- SkAnimator* get(SkinType);
+ SkAnimator* get(SkinType);
private:
- SkAnimator* fAnimators[kSkinTypeCount];
+ SkAnimator* fAnimators[kSkinTypeCount];
};
SkinSuite::SkinSuite()
{
- static const char kSkinPath[] = "skins/";
+ static const char kSkinPath[] = "skins/";
- static const char* gSkinNames[] = {
- "pushbutton_skin.xml",
- "statictext_skin.xml"
- };
+ static const char* gSkinNames[] = {
+ "pushbutton_skin.xml",
+ "statictext_skin.xml"
+ };
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gSkinNames); i++)
- {
- size_t len = strlen(gSkinNames[i]);
- SkString path(sizeof(kSkinPath) - 1 + len);
+ for (unsigned i = 0; i < SK_ARRAY_COUNT(gSkinNames); i++)
+ {
+ size_t len = strlen(gSkinNames[i]);
+ SkString path(sizeof(kSkinPath) - 1 + len);
- memcpy(path.writable_str(), kSkinPath, sizeof(kSkinPath) - 1);
- memcpy(path.writable_str() + sizeof(kSkinPath) - 1, gSkinNames[i], len);
+ memcpy(path.writable_str(), kSkinPath, sizeof(kSkinPath) - 1);
+ memcpy(path.writable_str() + sizeof(kSkinPath) - 1, gSkinNames[i], len);
- fAnimators[i] = new SkAnimator;
- if (!fAnimators[i]->decodeURI(path.c_str()))
- {
- delete fAnimators[i];
- fAnimators[i] = NULL;
- }
- }
+ fAnimators[i] = new SkAnimator;
+ if (!fAnimators[i]->decodeURI(path.c_str()))
+ {
+ delete fAnimators[i];
+ fAnimators[i] = NULL;
+ }
+ }
}
SkAnimator* SkinSuite::get(SkinType st)
{
- SkASSERT((unsigned)st < kSkinTypeCount);
- return fAnimators[st];
+ SkASSERT((unsigned)st < kSkinTypeCount);
+ return fAnimators[st];
}
static SkinSuite* gSkinSuite;
@@ -88,11 +88,11 @@ static SkinSuite* gSkinSuite;
static SkAnimator* get_skin_animator(SkinType st)
{
#if 0
- if (gSkinSuite == NULL)
- gSkinSuite = new SkinSuite;
- return gSkinSuite->get(st);
+ if (gSkinSuite == NULL)
+ gSkinSuite = new SkinSuite;
+ return gSkinSuite->get(st);
#else
- return NULL;
+ return NULL;
#endif
}
@@ -104,134 +104,134 @@ void SkWidget::Init()
void SkWidget::Term()
{
- delete gSkinSuite;
+ delete gSkinSuite;
}
void SkWidget::onEnabledChange()
{
- this->inval(NULL);
+ this->inval(NULL);
}
void SkWidget::postWidgetEvent()
{
- if (!fEvent.isType("") && this->hasListeners())
- {
- this->prepareWidgetEvent(&fEvent);
- this->postToListeners(fEvent);
- }
+ if (!fEvent.isType("") && this->hasListeners())
+ {
+ this->prepareWidgetEvent(&fEvent);
+ this->postToListeners(fEvent);
+ }
}
void SkWidget::prepareWidgetEvent(SkEvent*)
{
- // override in subclass to add any additional fields before posting
+ // override in subclass to add any additional fields before posting
}
void SkWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- if ((node = dom.getFirstChild(node, "event")) != NULL)
- fEvent.inflate(dom, node);
+ if ((node = dom.getFirstChild(node, "event")) != NULL)
+ fEvent.inflate(dom, node);
}
///////////////////////////////////////////////////////////////////////////////
size_t SkHasLabelWidget::getLabel(SkString* str) const
{
- if (str)
- *str = fLabel;
- return fLabel.size();
+ if (str)
+ *str = fLabel;
+ return fLabel.size();
}
size_t SkHasLabelWidget::getLabel(char buffer[]) const
{
- if (buffer)
- memcpy(buffer, fLabel.c_str(), fLabel.size());
- return fLabel.size();
+ if (buffer)
+ memcpy(buffer, fLabel.c_str(), fLabel.size());
+ return fLabel.size();
}
void SkHasLabelWidget::setLabel(const SkString& str)
{
- this->setLabel(str.c_str(), str.size());
+ this->setLabel(str.c_str(), str.size());
}
void SkHasLabelWidget::setLabel(const char label[])
{
- this->setLabel(label, strlen(label));
+ this->setLabel(label, strlen(label));
}
void SkHasLabelWidget::setLabel(const char label[], size_t len)
{
- if (!fLabel.equals(label, len))
- {
- fLabel.set(label, len);
- this->onLabelChange();
- }
+ if (!fLabel.equals(label, len))
+ {
+ fLabel.set(label, len);
+ this->onLabelChange();
+ }
}
void SkHasLabelWidget::onLabelChange()
{
- // override in subclass
+ // override in subclass
}
void SkHasLabelWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* text = dom.findAttr(node, "label");
- if (text)
- this->setLabel(text);
+ const char* text = dom.findAttr(node, "label");
+ if (text)
+ this->setLabel(text);
}
/////////////////////////////////////////////////////////////////////////////////////
void SkButtonWidget::setButtonState(State state)
{
- if (fState != state)
- {
- fState = state;
- this->onButtonStateChange();
- }
+ if (fState != state)
+ {
+ fState = state;
+ this->onButtonStateChange();
+ }
}
void SkButtonWidget::onButtonStateChange()
{
- this->inval(NULL);
+ this->inval(NULL);
}
void SkButtonWidget::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- int index;
- if ((index = dom.findList(node, "buttonState", "off,on,unknown")) >= 0)
- this->setButtonState((State)index);
+ int index;
+ if ((index = dom.findList(node, "buttonState", "off,on,unknown")) >= 0)
+ this->setButtonState((State)index);
}
/////////////////////////////////////////////////////////////////////////////////////
bool SkPushButtonWidget::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
- {
- this->postWidgetEvent();
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
+ {
+ this->postWidgetEvent();
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
static const char* computeAnimatorState(int enabled, int focused, SkButtonWidget::State state)
{
- if (!enabled)
- return "disabled";
- if (state == SkButtonWidget::kOn_State)
- {
- SkASSERT(focused);
- return "enabled-pressed";
- }
- if (focused)
- return "enabled-focused";
- return "enabled";
+ if (!enabled)
+ return "disabled";
+ if (state == SkButtonWidget::kOn_State)
+ {
+ SkASSERT(focused);
+ return "enabled-pressed";
+ }
+ if (focused)
+ return "enabled-focused";
+ return "enabled";
}
#include "SkBlurMaskFilter.h"
@@ -239,106 +239,106 @@ static const char* computeAnimatorState(int enabled, int focused, SkButtonWidget
static void create_emboss(SkPaint* paint, SkScalar radius, bool focus, bool pressed)
{
- SkEmbossMaskFilter::Light light;
+ SkEmbossMaskFilter::Light light;
- light.fDirection[0] = SK_Scalar1/2;
- light.fDirection[1] = SK_Scalar1/2;
- light.fDirection[2] = SK_Scalar1/3;
- light.fAmbient = 0x48;
- light.fSpecular = 0x80;
+ light.fDirection[0] = SK_Scalar1/2;
+ light.fDirection[1] = SK_Scalar1/2;
+ light.fDirection[2] = SK_Scalar1/3;
+ light.fAmbient = 0x48;
+ light.fSpecular = 0x80;
- if (pressed)
- {
- light.fDirection[0] = -light.fDirection[0];
- light.fDirection[1] = -light.fDirection[1];
- }
- if (focus)
- light.fDirection[2] += SK_Scalar1/4;
+ if (pressed)
+ {
+ light.fDirection[0] = -light.fDirection[0];
+ light.fDirection[1] = -light.fDirection[1];
+ }
+ if (focus)
+ light.fDirection[2] += SK_Scalar1/4;
- paint->setMaskFilter(new SkEmbossMaskFilter(light, radius))->unref();
+ paint->setMaskFilter(new SkEmbossMaskFilter(light, radius))->unref();
}
void SkPushButtonWidget::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- SkString label;
- this->getLabel(&label);
+ SkString label;
+ this->getLabel(&label);
- SkAnimator* anim = get_skin_animator(kPushButton_SkinType);
+ SkAnimator* anim = get_skin_animator(kPushButton_SkinType);
- if (anim)
- {
- SkEvent evt("user");
+ if (anim)
+ {
+ SkEvent evt("user");
- evt.setString("id", "prime");
- evt.setScalar("prime-width", this->width());
- evt.setScalar("prime-height", this->height());
- evt.setString("prime-text", label);
- evt.setString("prime-state", computeAnimatorState(this->isEnabled(), this->hasFocus(), this->getButtonState()));
+ evt.setString("id", "prime");
+ evt.setScalar("prime-width", this->width());
+ evt.setScalar("prime-height", this->height());
+ evt.setString("prime-text", label);
+ evt.setString("prime-state", computeAnimatorState(this->isEnabled(), this->hasFocus(), this->getButtonState()));
- (void)anim->doUserEvent(evt);
- SkPaint paint;
- anim->draw(canvas, &paint, SkTime::GetMSecs());
- }
- else
- {
- SkRect r;
- SkPaint p;
+ (void)anim->doUserEvent(evt);
+ SkPaint paint;
+ anim->draw(canvas, &paint, SkTime::GetMSecs());
+ }
+ else
+ {
+ SkRect r;
+ SkPaint p;
- r.set(0, 0, this->width(), this->height());
- p.setAntiAliasOn(true);
- p.setColor(SK_ColorBLUE);
- create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
- canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
- p.setMaskFilter(NULL);
+ r.set(0, 0, this->width(), this->height());
+ p.setAntiAliasOn(true);
+ p.setColor(SK_ColorBLUE);
+ create_emboss(&p, SkIntToScalar(12)/5, this->hasFocus(), this->getButtonState() == kOn_State);
+ canvas->drawRoundRect(r, SkScalarHalf(this->height()), SkScalarHalf(this->height()), p);
+ p.setMaskFilter(NULL);
- p.setTextAlign(SkPaint::kCenter_Align);
+ p.setTextAlign(SkPaint::kCenter_Align);
- SkTextBox box;
- box.setMode(SkTextBox::kOneLine_Mode);
- box.setSpacingAlign(SkTextBox::kCenter_SpacingAlign);
- box.setBox(0, 0, this->width(), this->height());
+ SkTextBox box;
+ box.setMode(SkTextBox::kOneLine_Mode);
+ box.setSpacingAlign(SkTextBox::kCenter_SpacingAlign);
+ box.setBox(0, 0, this->width(), this->height());
-// if (this->getButtonState() == kOn_State)
-// p.setColor(SK_ColorRED);
-// else
- p.setColor(SK_ColorWHITE);
+// if (this->getButtonState() == kOn_State)
+// p.setColor(SK_ColorRED);
+// else
+ p.setColor(SK_ColorWHITE);
- box.draw(canvas, label.c_str(), label.size(), p);
- }
+ box.draw(canvas, label.c_str(), label.size(), p);
+ }
}
SkView::Click* SkPushButtonWidget::onFindClickHandler(SkScalar x, SkScalar y)
{
- this->acceptFocus();
- return new Click(this);
+ this->acceptFocus();
+ return new Click(this);
}
bool SkPushButtonWidget::onClick(Click* click)
{
- SkRect r;
- State state = kOff_State;
+ SkRect r;
+ State state = kOff_State;
- this->getLocalBounds(&r);
- if (r.contains(click->fCurr))
- {
- if (click->fState == Click::kUp_State)
- this->postWidgetEvent();
- else
- state = kOn_State;
- }
- this->setButtonState(state);
- return true;
+ this->getLocalBounds(&r);
+ if (r.contains(click->fCurr))
+ {
+ if (click->fState == Click::kUp_State)
+ this->postWidgetEvent();
+ else
+ state = kOn_State;
+ }
+ this->setButtonState(state);
+ return true;
}
//////////////////////////////////////////////////////////////////////////////////////////
SkStaticTextView::SkStaticTextView(U32 flags) : SkView(flags)
{
- fMargin.set(0, 0);
- fMode = kFixedSize_Mode;
- fSpacingAlign = SkTextBox::kStart_SpacingAlign;
+ fMargin.set(0, 0);
+ fMode = kFixedSize_Mode;
+ fSpacingAlign = SkTextBox::kStart_SpacingAlign;
}
SkStaticTextView::~SkStaticTextView()
@@ -347,148 +347,148 @@ SkStaticTextView::~SkStaticTextView()
void SkStaticTextView::computeSize()
{
- if (fMode == kAutoWidth_Mode)
- {
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
- this->setWidth(width + fMargin.fX * 2);
- }
- else if (fMode == kAutoHeight_Mode)
- {
- SkScalar width = this->width() - fMargin.fX * 2;
- int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
+ if (fMode == kAutoWidth_Mode)
+ {
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size(), NULL, NULL);
+ this->setWidth(width + fMargin.fX * 2);
+ }
+ else if (fMode == kAutoHeight_Mode)
+ {
+ SkScalar width = this->width() - fMargin.fX * 2;
+ int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
- SkScalar before, after;
- (void)fPaint.measureText(0, NULL, &before, &after);
+ SkScalar before, after;
+ (void)fPaint.measureText(0, NULL, &before, &after);
- this->setHeight(lines * (after - before) + fMargin.fY * 2);
- }
+ this->setHeight(lines * (after - before) + fMargin.fY * 2);
+ }
}
void SkStaticTextView::setMode(Mode mode)
{
- SkASSERT((unsigned)mode < kModeCount);
+ SkASSERT((unsigned)mode < kModeCount);
- if (fMode != mode)
- {
- fMode = SkToU8(mode);
- this->computeSize();
- }
+ if (fMode != mode)
+ {
+ fMode = SkToU8(mode);
+ this->computeSize();
+ }
}
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
- fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ fSpacingAlign = SkToU8(align);
+ this->inval(NULL);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
- if (fMargin.fX != dx || fMargin.fY != dy)
- {
- fMargin.set(dx, dy);
- this->computeSize();
- this->inval(NULL);
- }
+ if (fMargin.fX != dx || fMargin.fY != dy)
+ {
+ fMargin.set(dx, dy);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
size_t SkStaticTextView::getText(SkString* text) const
{
- if (text)
- *text = fText;
- return fText.size();
+ if (text)
+ *text = fText;
+ return fText.size();
}
size_t SkStaticTextView::getText(char text[]) const
{
- if (text)
- memcpy(text, fText.c_str(), fText.size());
- return fText.size();
+ if (text)
+ memcpy(text, fText.c_str(), fText.size());
+ return fText.size();
}
void SkStaticTextView::setText(const SkString& text)
{
- this->setText(text.c_str(), text.size());
+ this->setText(text.c_str(), text.size());
}
void SkStaticTextView::setText(const char text[])
{
- this->setText(text, strlen(text));
+ this->setText(text, strlen(text));
}
void SkStaticTextView::setText(const char text[], size_t len)
{
- if (!fText.equals(text, len))
- {
- fText.set(text, len);
- this->computeSize();
- this->inval(NULL);
- }
+ if (!fText.equals(text, len))
+ {
+ fText.set(text, len);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::getPaint(SkPaint* paint) const
{
- if (paint)
- *paint = fPaint;
+ if (paint)
+ *paint = fPaint;
}
void SkStaticTextView::setPaint(const SkPaint& paint)
{
- if (fPaint != paint)
- {
- fPaint = paint;
- this->computeSize();
- this->inval(NULL);
- }
+ if (fPaint != paint)
+ {
+ fPaint = paint;
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- if (fText.isEmpty())
- return;
+ if (fText.isEmpty())
+ return;
- SkTextBox box;
+ SkTextBox box;
- box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
- box.setSpacingAlign(this->getSpacingAlign());
- box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
- box.draw(canvas, fText.c_str(), fText.size(), fPaint);
+ box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
+ box.setSpacingAlign(this->getSpacingAlign());
+ box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
+ box.draw(canvas, fText.c_str(), fText.size(), fPaint);
}
void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- int index;
- if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
- this->setMode((Mode)index);
- else
- assert_no_attr(dom, node, "mode");
+ int index;
+ if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
+ this->setMode((Mode)index);
+ else
+ assert_no_attr(dom, node, "mode");
- if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
- this->setSpacingAlign((SkTextBox::SpacingAlign)index);
- else
- assert_no_attr(dom, node, "mode");
+ if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
+ this->setSpacingAlign((SkTextBox::SpacingAlign)index);
+ else
+ assert_no_attr(dom, node, "mode");
- SkScalar s[2];
- if (dom.findScalars(node, "margin", s, 2))
- this->setMargin(s[0], s[1]);
- else
- assert_no_attr(dom, node, "margin");
+ SkScalar s[2];
+ if (dom.findScalars(node, "margin", s, 2))
+ this->setMargin(s[0], s[1]);
+ else
+ assert_no_attr(dom, node, "margin");
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
- if ((node = dom.getFirstChild(node, "paint")) != NULL)
- SkPaint_Inflate(&fPaint, dom, node);
+ if ((node = dom.getFirstChild(node, "paint")) != NULL)
+ SkPaint_Inflate(&fPaint, dom, node);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -505,56 +505,56 @@ SkBitmapView::~SkBitmapView()
bool SkBitmapView::getBitmap(SkBitmap* bitmap) const
{
- if (bitmap)
- *bitmap = fBitmap;
- return fBitmap.getConfig() != SkBitmap::kNo_Config;
+ if (bitmap)
+ *bitmap = fBitmap;
+ return fBitmap.getConfig() != SkBitmap::kNo_Config;
}
void SkBitmapView::setBitmap(const SkBitmap* bitmap, bool viewOwnsPixels)
{
- if (bitmap)
- {
- fBitmap = *bitmap;
- fBitmap.setOwnsPixels(viewOwnsPixels);
- }
+ if (bitmap)
+ {
+ fBitmap = *bitmap;
+ fBitmap.setOwnsPixels(viewOwnsPixels);
+ }
}
bool SkBitmapView::loadBitmapFromFile(const char path[])
{
- SkBitmap bitmap;
+ SkBitmap bitmap;
- if (SkImageDecoder::DecodeFile(path, &bitmap))
- {
- this->setBitmap(&bitmap, true);
- bitmap.setOwnsPixels(false);
- return true;
- }
- return false;
+ if (SkImageDecoder::DecodeFile(path, &bitmap))
+ {
+ this->setBitmap(&bitmap, true);
+ bitmap.setOwnsPixels(false);
+ return true;
+ }
+ return false;
}
void SkBitmapView::onDraw(SkCanvas* canvas)
{
- if (fBitmap.getConfig() != SkBitmap::kNo_Config &&
- fBitmap.width() && fBitmap.height())
- {
- SkAutoCanvasRestore restore(canvas, true);
- SkPaint p;
+ if (fBitmap.getConfig() != SkBitmap::kNo_Config &&
+ fBitmap.width() && fBitmap.height())
+ {
+ SkAutoCanvasRestore restore(canvas, true);
+ SkPaint p;
- p.setFilterType(SkPaint::kBilinear_FilterType);
- canvas->scale( this->width() / fBitmap.width(),
- this->height() / fBitmap.height(),
- 0, 0);
- canvas->drawBitmap(fBitmap, 0, 0, p);
- }
+ p.setFilterType(SkPaint::kBilinear_FilterType);
+ canvas->scale( this->width() / fBitmap.width(),
+ this->height() / fBitmap.height(),
+ 0, 0);
+ canvas->drawBitmap(fBitmap, 0, 0, p);
+ }
}
void SkBitmapView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- const char* src = dom.findAttr(node, "src");
- if (src)
- (void)this->loadBitmapFromFile(src);
+ const char* src = dom.findAttr(node, "src");
+ if (src)
+ (void)this->loadBitmapFromFile(src);
}
#endif
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index c952a61b6d..85b3803c59 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -19,31 +19,31 @@
#include "SkBounder.h"
class test_bounder : public SkBounder {
public:
- test_bounder(const SkBitmap& bm) : fCanvas(bm) {}
+ test_bounder(const SkBitmap& bm) : fCanvas(bm) {}
protected:
- virtual bool onIRect(const SkIRect& r)
- {
- SkRect rr;
+ virtual bool onIRect(const SkIRect& r)
+ {
+ SkRect rr;
- rr.set(SkIntToScalar(r.fLeft), SkIntToScalar(r.fTop),
- SkIntToScalar(r.fRight), SkIntToScalar(r.fBottom));
+ rr.set(SkIntToScalar(r.fLeft), SkIntToScalar(r.fTop),
+ SkIntToScalar(r.fRight), SkIntToScalar(r.fBottom));
- SkPaint p;
+ SkPaint p;
- p.setStyle(SkPaint::kStroke_Style);
- p.setColor(SK_ColorYELLOW);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setColor(SK_ColorYELLOW);
#if 0
- rr.inset(SK_ScalarHalf, SK_ScalarHalf);
+ rr.inset(SK_ScalarHalf, SK_ScalarHalf);
#else
- rr.inset(-SK_ScalarHalf, -SK_ScalarHalf);
+ rr.inset(-SK_ScalarHalf, -SK_ScalarHalf);
#endif
- fCanvas.drawRect(rr, p);
- return true;
- }
+ fCanvas.drawRect(rr, p);
+ return true;
+ }
private:
- SkCanvas fCanvas;
+ SkCanvas fCanvas;
};
SkWindow::SkWindow() : fFocusView(NULL)
@@ -87,39 +87,39 @@ void SkWindow::postConcat(const SkMatrix& matrix) {
void SkWindow::setConfig(SkBitmap::Config config)
{
- this->resize(fBitmap.width(), fBitmap.height(), config);
+ this->resize(fBitmap.width(), fBitmap.height(), config);
}
void SkWindow::resize(int width, int height, SkBitmap::Config config)
{
- if (config == SkBitmap::kNo_Config)
- config = fConfig;
-
- if (width != fBitmap.width() || height != fBitmap.height() || config != fConfig)
- {
- fConfig = config;
- fBitmap.setConfig(config, width, height);
- fBitmap.allocPixels();
+ if (config == SkBitmap::kNo_Config)
+ config = fConfig;
+
+ if (width != fBitmap.width() || height != fBitmap.height() || config != fConfig)
+ {
+ fConfig = config;
+ fBitmap.setConfig(config, width, height);
+ fBitmap.allocPixels();
fBitmap.setIsOpaque(true);
- this->setSize(SkIntToScalar(width), SkIntToScalar(height));
- this->inval(NULL);
- }
+ this->setSize(SkIntToScalar(width), SkIntToScalar(height));
+ this->inval(NULL);
+ }
}
void SkWindow::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
{
- fBitmap.eraseARGB(a, r, g, b);
+ fBitmap.eraseARGB(a, r, g, b);
}
void SkWindow::eraseRGB(U8CPU r, U8CPU g, U8CPU b)
{
- fBitmap.eraseRGB(r, g, b);
+ fBitmap.eraseRGB(r, g, b);
}
bool SkWindow::handleInval(const SkRect* localR)
{
- SkIRect ir;
+ SkIRect ir;
if (localR) {
SkRect devR;
@@ -131,13 +131,13 @@ bool SkWindow::handleInval(const SkRect* localR)
devR.round(&ir);
} else {
ir.set(0, 0,
- SkScalarRound(this->width()),
- SkScalarRound(this->height()));
+ SkScalarRound(this->width()),
+ SkScalarRound(this->height()));
}
- fDirtyRgn.op(ir, SkRegion::kUnion_Op);
+ fDirtyRgn.op(ir, SkRegion::kUnion_Op);
- this->onHandleInval(ir);
- return true;
+ this->onHandleInval(ir);
+ return true;
}
void SkWindow::forceInvalAll() {
@@ -147,9 +147,9 @@ void SkWindow::forceInvalAll() {
}
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- #include <windows.h>
- #include <gx.h>
- extern GXDisplayProperties gDisplayProps;
+ #include <windows.h>
+ #include <gx.h>
+ extern GXDisplayProperties gDisplayProps;
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
@@ -158,128 +158,128 @@ extern bool gEnableControlledThrow;
bool SkWindow::update(SkIRect* updateArea, SkCanvas* canvas)
{
- if (!fDirtyRgn.isEmpty())
- {
- SkBitmap bm = this->getBitmap();
+ if (!fDirtyRgn.isEmpty())
+ {
+ SkBitmap bm = this->getBitmap();
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- char* buffer = (char*)GXBeginDraw();
- SkASSERT(buffer);
+ char* buffer = (char*)GXBeginDraw();
+ SkASSERT(buffer);
- RECT rect;
- GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect);
- buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.cbxPitch;
+ RECT rect;
+ GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect);
+ buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.cbxPitch;
- bm.setPixels(buffer);
+ bm.setPixels(buffer);
#endif
- SkCanvas rasterCanvas;
+ SkCanvas rasterCanvas;
if (NULL == canvas) {
canvas = &rasterCanvas;
}
canvas->setBitmapDevice(bm);
- canvas->clipRegion(fDirtyRgn);
- if (updateArea)
- *updateArea = fDirtyRgn.getBounds();
+ canvas->clipRegion(fDirtyRgn);
+ if (updateArea)
+ *updateArea = fDirtyRgn.getBounds();
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(fMatrix);
- // empty this now, so we can correctly record any inval calls that
- // might be made during the draw call.
- fDirtyRgn.setEmpty();
+ // empty this now, so we can correctly record any inval calls that
+ // might be made during the draw call.
+ fDirtyRgn.setEmpty();
#ifdef TEST_BOUNDER
- test_bounder b(bm);
- canvas->setBounder(&b);
+ test_bounder b(bm);
+ canvas->setBounder(&b);
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
- gEnableControlledThrow = true;
+ gEnableControlledThrow = true;
#endif
#ifdef SK_BUILD_FOR_WIN32
- //try {
- this->draw(canvas);
- //}
- //catch (...) {
- //}
+ //try {
+ this->draw(canvas);
+ //}
+ //catch (...) {
+ //}
#else
- this->draw(canvas);
+ this->draw(canvas);
#endif
#ifdef SK_SIMULATE_FAILED_MALLOC
- gEnableControlledThrow = false;
+ gEnableControlledThrow = false;
#endif
#ifdef TEST_BOUNDER
- canvas->setBounder(NULL);
+ canvas->setBounder(NULL);
#endif
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
- GXEndDraw();
+ GXEndDraw();
#endif
- return true;
- }
- return false;
+ return true;
+ }
+ return false;
}
bool SkWindow::handleChar(SkUnichar uni)
{
- if (this->onHandleChar(uni))
- return true;
+ if (this->onHandleChar(uni))
+ return true;
- SkView* focus = this->getFocusView();
- if (focus == NULL)
- focus = this;
+ SkView* focus = this->getFocusView();
+ if (focus == NULL)
+ focus = this;
- SkEvent evt(SK_EventType_Unichar);
- evt.setFast32(uni);
- return focus->doEvent(evt);
+ SkEvent evt(SK_EventType_Unichar);
+ evt.setFast32(uni);
+ return focus->doEvent(evt);
}
bool SkWindow::handleKey(SkKey key)
{
- if (key == kNONE_SkKey)
- return false;
-
- if (this->onHandleKey(key))
- return true;
-
- // send an event to the focus-view
- {
- SkView* focus = this->getFocusView();
- if (focus == NULL)
- focus = this;
-
- SkEvent evt(SK_EventType_Key);
- evt.setFast32(key);
- if (focus->doEvent(evt))
- return true;
- }
-
- if (key == kUp_SkKey || key == kDown_SkKey)
- {
- if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
- this->onSetFocusView(NULL);
- return true;
- }
- return false;
+ if (key == kNONE_SkKey)
+ return false;
+
+ if (this->onHandleKey(key))
+ return true;
+
+ // send an event to the focus-view
+ {
+ SkView* focus = this->getFocusView();
+ if (focus == NULL)
+ focus = this;
+
+ SkEvent evt(SK_EventType_Key);
+ evt.setFast32(key);
+ if (focus->doEvent(evt))
+ return true;
+ }
+
+ if (key == kUp_SkKey || key == kDown_SkKey)
+ {
+ if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL)
+ this->onSetFocusView(NULL);
+ return true;
+ }
+ return false;
}
bool SkWindow::handleKeyUp(SkKey key)
{
if (key == kNONE_SkKey)
return false;
-
+
if (this->onHandleKeyUp(key))
return true;
-
+
//send an event to the focus-view
{
SkView* focus = this->getFocusView();
if (focus == NULL)
focus = this;
-
+
//should this one be the same?
SkEvent evt(SK_EventType_KeyUp);
evt.setFast32(key);
@@ -290,8 +290,8 @@ bool SkWindow::handleKeyUp(SkKey key)
}
void SkWindow::addMenu(SkOSMenu* menu) {
- *fMenus.append() = menu;
- this->onAddMenu(menu);
+ *fMenus.append() = menu;
+ this->onAddMenu(menu);
}
void SkWindow::setTitle(const char title[]) {
@@ -306,36 +306,36 @@ void SkWindow::setTitle(const char title[]) {
bool SkWindow::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventDelayInval))
- {
- SkRegion::Iterator iter(fDirtyRgn);
-
- for (; !iter.done(); iter.next())
- this->onHandleInval(iter.rect());
- fWaitingOnInval = false;
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventDelayInval))
+ {
+ SkRegion::Iterator iter(fDirtyRgn);
+
+ for (; !iter.done(); iter.next())
+ this->onHandleInval(iter.rect());
+ fWaitingOnInval = false;
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
bool SkWindow::onGetFocusView(SkView** focus) const
{
- if (focus)
- *focus = fFocusView;
- return true;
+ if (focus)
+ *focus = fFocusView;
+ return true;
}
bool SkWindow::onSetFocusView(SkView* focus)
{
- if (fFocusView != focus)
- {
- if (fFocusView)
- fFocusView->onFocusChange(false);
- fFocusView = focus;
- if (focus)
- focus->onFocusChange(true);
- }
- return true;
+ if (fFocusView != focus)
+ {
+ if (fFocusView)
+ fFocusView->onFocusChange(false);
+ fFocusView = focus;
+ if (focus)
+ focus->onFocusChange(true);
+ }
+ return true;
}
//////////////////////////////////////////////////////////////////////
@@ -346,12 +346,12 @@ void SkWindow::onHandleInval(const SkIRect&)
bool SkWindow::onHandleChar(SkUnichar)
{
- return false;
+ return false;
}
bool SkWindow::onHandleKey(SkKey key)
{
- return false;
+ return false;
}
bool SkWindow::onHandleKeyUp(SkKey key)
@@ -365,7 +365,7 @@ bool SkWindow::handleClick(int x, int y, Click::State state, void *owner) {
bool SkWindow::onDispatchClick(int x, int y, Click::State state,
void* owner) {
- bool handled = false;
+ bool handled = false;
// First, attempt to find an existing click with this owner.
int index = -1;
@@ -376,7 +376,7 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
}
}
- switch (state) {
+ switch (state) {
case Click::kDown_State: {
if (index != -1) {
delete fClicks[index];
@@ -410,7 +410,7 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
default:
// Do nothing
break;
- }
- return handled;
+ }
+ return handled;
}
diff --git a/src/views/animated/SkBorderView.cpp b/src/views/animated/SkBorderView.cpp
index cc1c08bc79..3eff6056f9 100644
--- a/src/views/animated/SkBorderView.cpp
+++ b/src/views/animated/SkBorderView.cpp
@@ -17,80 +17,80 @@ SkBorderView::SkBorderView() : fLeft(SkIntToScalar(0)),
fTop(SkIntToScalar(0)),
fBottom(SkIntToScalar(0))
{
- fAnim.setHostEventSink(this);
- init_skin_anim(kBorder_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ init_skin_anim(kBorder_SkinEnum, &fAnim);
}
SkBorderView::~SkBorderView()
{
-
+
}
void SkBorderView::setSkin(const char skin[])
{
- init_skin_anim(skin, &fAnim);
+ init_skin_anim(skin, &fAnim);
}
/* virtual */ void SkBorderView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
}
/*virtual*/ void SkBorderView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
/*virtual*/ void SkBorderView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
/*virtual*/ bool SkBorderView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- evt.findScalar("leftMargin", &fLeft);
- evt.findScalar("rightMargin", &fRight);
- evt.findScalar("topMargin", &fTop);
- evt.findScalar("bottomMargin", &fBottom);
-
- //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout
- //but that gives me an error
- SkStackViewLayout* layout;
- fMargin.set(fLeft, fTop, fRight, fBottom);
- if (this->getLayout())
- {
- layout = (SkStackViewLayout*)this->getLayout();
- layout->setMargin(fMargin);
- }
- else
- {
- layout = new SkStackViewLayout;
- layout->setMargin(fMargin);
- this->setLayout(layout)->unref();
- }
- this->invokeLayout();
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ evt.findScalar("leftMargin", &fLeft);
+ evt.findScalar("rightMargin", &fRight);
+ evt.findScalar("topMargin", &fTop);
+ evt.findScalar("bottomMargin", &fBottom);
+
+ //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout
+ //but that gives me an error
+ SkStackViewLayout* layout;
+ fMargin.set(fLeft, fTop, fRight, fBottom);
+ if (this->getLayout())
+ {
+ layout = (SkStackViewLayout*)this->getLayout();
+ layout->setMargin(fMargin);
+ }
+ else
+ {
+ layout = new SkStackViewLayout;
+ layout->setMargin(fMargin);
+ this->setLayout(layout)->unref();
+ }
+ this->invokeLayout();
+ }
+ return this->INHERITED::onEvent(evt);
}
diff --git a/src/views/animated/SkImageView.cpp b/src/views/animated/SkImageView.cpp
index 8924dd32fb..a75aa73d1b 100644
--- a/src/views/animated/SkImageView.cpp
+++ b/src/views/animated/SkImageView.cpp
@@ -16,288 +16,288 @@
SkImageView::SkImageView()
{
- fMatrix = NULL;
- fScaleType = kMatrix_ScaleType;
+ fMatrix = NULL;
+ fScaleType = kMatrix_ScaleType;
- fData.fAnim = NULL; // handles initializing the other union values
- fDataIsAnim = true;
-
- fUriIsValid = false; // an empty string is not valid
+ fData.fAnim = NULL; // handles initializing the other union values
+ fDataIsAnim = true;
+
+ fUriIsValid = false; // an empty string is not valid
}
SkImageView::~SkImageView()
{
- if (fMatrix)
- sk_free(fMatrix);
-
- this->freeData();
+ if (fMatrix)
+ sk_free(fMatrix);
+
+ this->freeData();
}
void SkImageView::getUri(SkString* uri) const
{
- if (uri)
- *uri = fUri;
+ if (uri)
+ *uri = fUri;
}
void SkImageView::setUri(const char uri[])
{
- if (!fUri.equals(uri))
- {
- fUri.set(uri);
- this->onUriChange();
- }
+ if (!fUri.equals(uri))
+ {
+ fUri.set(uri);
+ this->onUriChange();
+ }
}
void SkImageView::setUri(const SkString& uri)
{
- if (fUri != uri)
- {
- fUri = uri;
- this->onUriChange();
- }
+ if (fUri != uri)
+ {
+ fUri = uri;
+ this->onUriChange();
+ }
}
void SkImageView::setScaleType(ScaleType st)
{
- SkASSERT((unsigned)st <= kFitEnd_ScaleType);
-
- if ((ScaleType)fScaleType != st)
- {
- fScaleType = SkToU8(st);
- if (fUriIsValid)
- this->inval(NULL);
- }
+ SkASSERT((unsigned)st <= kFitEnd_ScaleType);
+
+ if ((ScaleType)fScaleType != st)
+ {
+ fScaleType = SkToU8(st);
+ if (fUriIsValid)
+ this->inval(NULL);
+ }
}
bool SkImageView::getImageMatrix(SkMatrix* matrix) const
{
- if (fMatrix)
- {
- SkASSERT(!fMatrix->isIdentity());
- if (matrix)
- *matrix = *fMatrix;
- return true;
- }
- else
- {
- if (matrix)
- matrix->reset();
- return false;
- }
+ if (fMatrix)
+ {
+ SkASSERT(!fMatrix->isIdentity());
+ if (matrix)
+ *matrix = *fMatrix;
+ return true;
+ }
+ else
+ {
+ if (matrix)
+ matrix->reset();
+ return false;
+ }
}
void SkImageView::setImageMatrix(const SkMatrix* matrix)
{
- bool changed = false;
-
- if (matrix && !matrix->isIdentity())
- {
- if (fMatrix == NULL)
- fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
- *fMatrix = *matrix;
- changed = true;
- }
- else // set us to identity
- {
- if (fMatrix)
- {
- SkASSERT(!fMatrix->isIdentity());
- sk_free(fMatrix);
- fMatrix = NULL;
- changed = true;
- }
- }
-
- // only redraw if we changed our matrix and we're not in scaleToFit mode
- if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
- this->inval(NULL);
+ bool changed = false;
+
+ if (matrix && !matrix->isIdentity())
+ {
+ if (fMatrix == NULL)
+ fMatrix = (SkMatrix*)sk_malloc_throw(sizeof(SkMatrix));
+ *fMatrix = *matrix;
+ changed = true;
+ }
+ else // set us to identity
+ {
+ if (fMatrix)
+ {
+ SkASSERT(!fMatrix->isIdentity());
+ sk_free(fMatrix);
+ fMatrix = NULL;
+ changed = true;
+ }
+ }
+
+ // only redraw if we changed our matrix and we're not in scaleToFit mode
+ if (changed && this->getScaleType() == kMatrix_ScaleType && fUriIsValid)
+ this->inval(NULL);
}
///////////////////////////////////////////////////////////////////////////////////////////////
bool SkImageView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- if (fUriIsValid)
- this->inval(NULL);
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ if (fUriIsValid)
+ this->inval(NULL);
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
static inline SkMatrix::ScaleToFit scaleTypeToScaleToFit(SkImageView::ScaleType st)
{
- SkASSERT(st != SkImageView::kMatrix_ScaleType);
- SkASSERT((unsigned)st <= SkImageView::kFitEnd_ScaleType);
-
- SkASSERT(SkImageView::kFitXY_ScaleType - 1 == SkMatrix::kFill_ScaleToFit);
- SkASSERT(SkImageView::kFitStart_ScaleType - 1 == SkMatrix::kStart_ScaleToFit);
- SkASSERT(SkImageView::kFitCenter_ScaleType - 1 == SkMatrix::kCenter_ScaleToFit);
- SkASSERT(SkImageView::kFitEnd_ScaleType - 1 == SkMatrix::kEnd_ScaleToFit);
-
- return (SkMatrix::ScaleToFit)(st - 1);
+ SkASSERT(st != SkImageView::kMatrix_ScaleType);
+ SkASSERT((unsigned)st <= SkImageView::kFitEnd_ScaleType);
+
+ SkASSERT(SkImageView::kFitXY_ScaleType - 1 == SkMatrix::kFill_ScaleToFit);
+ SkASSERT(SkImageView::kFitStart_ScaleType - 1 == SkMatrix::kStart_ScaleToFit);
+ SkASSERT(SkImageView::kFitCenter_ScaleType - 1 == SkMatrix::kCenter_ScaleToFit);
+ SkASSERT(SkImageView::kFitEnd_ScaleType - 1 == SkMatrix::kEnd_ScaleToFit);
+
+ return (SkMatrix::ScaleToFit)(st - 1);
}
void SkImageView::onDraw(SkCanvas* canvas)
{
- SkRect src;
- if (!this->getDataBounds(&src))
- {
- SkDEBUGCODE(canvas->drawColor(SK_ColorRED);)
- return; // nothing to draw
- }
-
- SkAutoCanvasRestore restore(canvas, true);
- SkMatrix matrix;
-
- if (this->getScaleType() == kMatrix_ScaleType)
- (void)this->getImageMatrix(&matrix);
- else
- {
- SkRect dst;
- dst.set(0, 0, this->width(), this->height());
- matrix.setRectToRect(src, dst, scaleTypeToScaleToFit(this->getScaleType()));
- }
- canvas->concat(matrix);
-
- SkPaint paint;
-
- paint.setAntiAlias(true);
-
- if (fDataIsAnim)
- {
- SkMSec now = SkTime::GetMSecs();
-
- SkAnimator::DifferenceType diff = fData.fAnim->draw(canvas, &paint, now);
-
+ SkRect src;
+ if (!this->getDataBounds(&src))
+ {
+ SkDEBUGCODE(canvas->drawColor(SK_ColorRED);)
+ return; // nothing to draw
+ }
+
+ SkAutoCanvasRestore restore(canvas, true);
+ SkMatrix matrix;
+
+ if (this->getScaleType() == kMatrix_ScaleType)
+ (void)this->getImageMatrix(&matrix);
+ else
+ {
+ SkRect dst;
+ dst.set(0, 0, this->width(), this->height());
+ matrix.setRectToRect(src, dst, scaleTypeToScaleToFit(this->getScaleType()));
+ }
+ canvas->concat(matrix);
+
+ SkPaint paint;
+
+ paint.setAntiAlias(true);
+
+ if (fDataIsAnim)
+ {
+ SkMSec now = SkTime::GetMSecs();
+
+ SkAnimator::DifferenceType diff = fData.fAnim->draw(canvas, &paint, now);
+
SkDEBUGF(("SkImageView : now = %X[%12.3f], diff = %d\n", now, now/1000., diff));
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fData.fAnim->getInvalBounds(&bounds);
- matrix.mapRect(&bounds); // get the bounds into view coordinates
- this->inval(&bounds);
- }
- }
- else
- canvas->drawBitmap(*fData.fBitmap, 0, 0, &paint);
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fData.fAnim->getInvalBounds(&bounds);
+ matrix.mapRect(&bounds); // get the bounds into view coordinates
+ this->inval(&bounds);
+ }
+ }
+ else
+ canvas->drawBitmap(*fData.fBitmap, 0, 0, &paint);
}
void SkImageView::onInflate(const SkDOM& dom, const SkDOMNode* node)
{
- this->INHERITED::onInflate(dom, node);
-
- const char* src = dom.findAttr(node, "src");
- if (src)
- this->setUri(src);
-
- int index = dom.findList(node, "scaleType", "matrix,fitXY,fitStart,fitCenter,fitEnd");
- if (index >= 0)
- this->setScaleType((ScaleType)index);
-
- // need inflate syntax/reader for matrix
+ this->INHERITED::onInflate(dom, node);
+
+ const char* src = dom.findAttr(node, "src");
+ if (src)
+ this->setUri(src);
+
+ int index = dom.findList(node, "scaleType", "matrix,fitXY,fitStart,fitCenter,fitEnd");
+ if (index >= 0)
+ this->setScaleType((ScaleType)index);
+
+ // need inflate syntax/reader for matrix
}
/////////////////////////////////////////////////////////////////////////////////////
void SkImageView::onUriChange()
{
- if (this->freeData())
- this->inval(NULL);
- fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
+ if (this->freeData())
+ this->inval(NULL);
+ fUriIsValid = true; // give ensureUriIsLoaded() a shot at the new uri
}
bool SkImageView::freeData()
{
- if (fData.fAnim) // test is valid for all union values
- {
- if (fDataIsAnim)
- delete fData.fAnim;
- else
- delete fData.fBitmap;
-
- fData.fAnim = NULL; // valid for all union values
- return true;
- }
- return false;
+ if (fData.fAnim) // test is valid for all union values
+ {
+ if (fDataIsAnim)
+ delete fData.fAnim;
+ else
+ delete fData.fBitmap;
+
+ fData.fAnim = NULL; // valid for all union values
+ return true;
+ }
+ return false;
}
bool SkImageView::getDataBounds(SkRect* bounds)
{
- SkASSERT(bounds);
-
- if (this->ensureUriIsLoaded())
- {
- SkScalar width, height;
-
- if (fDataIsAnim)
- {
- if (SkScalarIsNaN(width = fData.fAnim->getScalar("dimensions", "x")) ||
- SkScalarIsNaN(height = fData.fAnim->getScalar("dimensions", "y")))
- {
- // cons up fake bounds
- width = this->width();
- height = this->height();
- }
- }
- else
- {
- width = SkIntToScalar(fData.fBitmap->width());
- height = SkIntToScalar(fData.fBitmap->height());
- }
- bounds->set(0, 0, width, height);
- return true;
- }
- return false;
+ SkASSERT(bounds);
+
+ if (this->ensureUriIsLoaded())
+ {
+ SkScalar width, height;
+
+ if (fDataIsAnim)
+ {
+ if (SkScalarIsNaN(width = fData.fAnim->getScalar("dimensions", "x")) ||
+ SkScalarIsNaN(height = fData.fAnim->getScalar("dimensions", "y")))
+ {
+ // cons up fake bounds
+ width = this->width();
+ height = this->height();
+ }
+ }
+ else
+ {
+ width = SkIntToScalar(fData.fBitmap->width());
+ height = SkIntToScalar(fData.fBitmap->height());
+ }
+ bounds->set(0, 0, width, height);
+ return true;
+ }
+ return false;
}
bool SkImageView::ensureUriIsLoaded()
{
- if (fData.fAnim) // test is valid for all union values
- {
- SkASSERT(fUriIsValid);
- return true;
- }
- if (!fUriIsValid)
- return false;
-
- // try to load the url
- if (fUri.endsWith(".xml")) // assume it is screenplay
- {
- SkAnimator* anim = new SkAnimator;
-
- if (!anim->decodeURI(fUri.c_str()))
- {
- delete anim;
- fUriIsValid = false;
- return false;
- }
- anim->setHostEventSink(this);
-
- fData.fAnim = anim;
- fDataIsAnim = true;
- }
- else // assume it is an image format
- {
+ if (fData.fAnim) // test is valid for all union values
+ {
+ SkASSERT(fUriIsValid);
+ return true;
+ }
+ if (!fUriIsValid)
+ return false;
+
+ // try to load the url
+ if (fUri.endsWith(".xml")) // assume it is screenplay
+ {
+ SkAnimator* anim = new SkAnimator;
+
+ if (!anim->decodeURI(fUri.c_str()))
+ {
+ delete anim;
+ fUriIsValid = false;
+ return false;
+ }
+ anim->setHostEventSink(this);
+
+ fData.fAnim = anim;
+ fDataIsAnim = true;
+ }
+ else // assume it is an image format
+ {
#if 0
- SkBitmap* bitmap = new SkBitmap;
-
- if (!SkImageDecoder::DecodeURL(fUri.c_str(), bitmap))
- {
- delete bitmap;
- fUriIsValid = false;
- return false;
- }
- fData.fBitmap = bitmap;
- fDataIsAnim = false;
+ SkBitmap* bitmap = new SkBitmap;
+
+ if (!SkImageDecoder::DecodeURL(fUri.c_str(), bitmap))
+ {
+ delete bitmap;
+ fUriIsValid = false;
+ return false;
+ }
+ fData.fBitmap = bitmap;
+ fDataIsAnim = false;
#else
return false;
#endif
- }
- return true;
+ }
+ return true;
}
diff --git a/src/views/animated/SkListView.cpp b/src/views/animated/SkListView.cpp
index 20747a285a..ec9d2ee7b0 100644
--- a/src/views/animated/SkListView.cpp
+++ b/src/views/animated/SkListView.cpp
@@ -16,192 +16,192 @@
SkEvent* SkListSource::getEvent(int index)
{
- return NULL;
+ return NULL;
}
#include "SkOSFile.h"
class SkDirListSource : public SkListSource {
public:
- SkDirListSource(const char path[], const char suffix[], const char target[])
- : fPath(path), fSuffix(suffix), fTarget(target)
- {
- fCount = -1;
- }
- virtual int countRows()
- {
- if (fCount < 0)
- {
- fCount = 0;
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- while (fIter.next(NULL))
- fCount += 1;
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- fIndex = 0;
- }
- return fCount;
- }
- virtual void getRow(int index, SkString* left, SkString* right)
- {
- (void)this->countRows();
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (fIndex > index)
- {
- fIter.reset(fPath.c_str(), fSuffix.c_str());
- fIndex = 0;
- }
-
- while (fIndex < index)
- {
- fIter.next(NULL);
- fIndex += 1;
- }
-
- if (fIter.next(left))
- {
- if (left)
- left->remove(left->size() - fSuffix.size(), fSuffix.size());
- }
- else
- {
- if (left)
- left->reset();
- }
- if (right) // only set to ">" if we know we're on a sub-directory
- right->reset();
-
- fIndex += 1;
- }
- virtual SkEvent* getEvent(int index)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- SkEvent* evt = new SkEvent();
- SkString label;
-
- this->getRow(index, &label, NULL);
- evt->setString("name", label.c_str());
-
- int c = fPath.c_str()[fPath.size() - 1];
- if (c != '/' && c != '\\')
- label.prepend("/");
- label.prepend(fPath);
- label.append(fSuffix);
- evt->setString("path", label.c_str());
- evt->setS32("index", index);
- evt->setS32("duration", 22);
- evt->setType(fTarget);
- return evt;
- }
+ SkDirListSource(const char path[], const char suffix[], const char target[])
+ : fPath(path), fSuffix(suffix), fTarget(target)
+ {
+ fCount = -1;
+ }
+ virtual int countRows()
+ {
+ if (fCount < 0)
+ {
+ fCount = 0;
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ while (fIter.next(NULL))
+ fCount += 1;
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ fIndex = 0;
+ }
+ return fCount;
+ }
+ virtual void getRow(int index, SkString* left, SkString* right)
+ {
+ (void)this->countRows();
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (fIndex > index)
+ {
+ fIter.reset(fPath.c_str(), fSuffix.c_str());
+ fIndex = 0;
+ }
+
+ while (fIndex < index)
+ {
+ fIter.next(NULL);
+ fIndex += 1;
+ }
+
+ if (fIter.next(left))
+ {
+ if (left)
+ left->remove(left->size() - fSuffix.size(), fSuffix.size());
+ }
+ else
+ {
+ if (left)
+ left->reset();
+ }
+ if (right) // only set to ">" if we know we're on a sub-directory
+ right->reset();
+
+ fIndex += 1;
+ }
+ virtual SkEvent* getEvent(int index)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ SkEvent* evt = new SkEvent();
+ SkString label;
+
+ this->getRow(index, &label, NULL);
+ evt->setString("name", label.c_str());
+
+ int c = fPath.c_str()[fPath.size() - 1];
+ if (c != '/' && c != '\\')
+ label.prepend("/");
+ label.prepend(fPath);
+ label.append(fSuffix);
+ evt->setString("path", label.c_str());
+ evt->setS32("index", index);
+ evt->setS32("duration", 22);
+ evt->setType(fTarget);
+ return evt;
+ }
private:
- SkString fPath, fSuffix;
- SkString fTarget;
- SkOSFile::Iter fIter;
- int fCount;
- int fIndex;
+ SkString fPath, fSuffix;
+ SkString fTarget;
+ SkOSFile::Iter fIter;
+ int fCount;
+ int fIndex;
};
SkListSource* SkListSource::CreateFromDir(const char path[], const char suffix[], const char target[])
{
- return new SkDirListSource(path, suffix, target);
+ return new SkDirListSource(path, suffix, target);
}
//////////////////////////////////////////////////////////////////
class SkDOMListSource : public SkListSource {
public:
- enum Type {
- kUnknown_Type,
- kDir_Type,
- kToggle_Type
- };
- struct ItemRec {
- SkString fLabel;
- SkString fTail, fAltTail;
- SkString fTarget;
- Type fType;
- };
-
- SkDOMListSource(const SkDOM& dom, const SkDOM::Node* node) : fDirTail(">")
- {
- const SkDOM::Node* child = dom.getFirstChild(node, "item");
- int count = 0;
-
- while (child)
- {
- count += 1;
- child = dom.getNextSibling(child, "item");
- }
-
- fCount = count;
- fList = NULL;
- if (count)
- {
- ItemRec* rec = fList = new ItemRec[count];
-
- child = dom.getFirstChild(node, "item");
- while (child)
- {
- rec->fLabel.set(dom.findAttr(child, "label"));
- rec->fTail.set(dom.findAttr(child, "tail"));
- rec->fAltTail.set(dom.findAttr(child, "alt-tail"));
- rec->fTarget.set(dom.findAttr(child, "target"));
- rec->fType = kUnknown_Type;
-
- int index = dom.findList(child, "type", "dir,toggle");
- if (index >= 0)
- rec->fType = (Type)(index + 1);
-
- child = dom.getNextSibling(child, "item");
- rec += 1;
- }
- }
- }
- virtual ~SkDOMListSource()
- {
- delete[] fList;
- }
- virtual int countRows()
- {
- return fCount;
- }
- virtual void getRow(int index, SkString* left, SkString* right)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (left)
- *left = fList[index].fLabel;
- if (right)
- *right = fList[index].fType == kDir_Type ? fDirTail : fList[index].fTail;
- }
- virtual SkEvent* getEvent(int index)
- {
- SkASSERT((unsigned)index < (unsigned)fCount);
-
- if (fList[index].fType == kDir_Type)
- {
- SkEvent* evt = new SkEvent();
- evt->setType(fList[index].fTarget);
- evt->setFast32(index);
- return evt;
- }
- if (fList[index].fType == kToggle_Type)
- fList[index].fTail.swap(fList[index].fAltTail);
-
- return NULL;
- }
+ enum Type {
+ kUnknown_Type,
+ kDir_Type,
+ kToggle_Type
+ };
+ struct ItemRec {
+ SkString fLabel;
+ SkString fTail, fAltTail;
+ SkString fTarget;
+ Type fType;
+ };
+
+ SkDOMListSource(const SkDOM& dom, const SkDOM::Node* node) : fDirTail(">")
+ {
+ const SkDOM::Node* child = dom.getFirstChild(node, "item");
+ int count = 0;
+
+ while (child)
+ {
+ count += 1;
+ child = dom.getNextSibling(child, "item");
+ }
+
+ fCount = count;
+ fList = NULL;
+ if (count)
+ {
+ ItemRec* rec = fList = new ItemRec[count];
+
+ child = dom.getFirstChild(node, "item");
+ while (child)
+ {
+ rec->fLabel.set(dom.findAttr(child, "label"));
+ rec->fTail.set(dom.findAttr(child, "tail"));
+ rec->fAltTail.set(dom.findAttr(child, "alt-tail"));
+ rec->fTarget.set(dom.findAttr(child, "target"));
+ rec->fType = kUnknown_Type;
+
+ int index = dom.findList(child, "type", "dir,toggle");
+ if (index >= 0)
+ rec->fType = (Type)(index + 1);
+
+ child = dom.getNextSibling(child, "item");
+ rec += 1;
+ }
+ }
+ }
+ virtual ~SkDOMListSource()
+ {
+ delete[] fList;
+ }
+ virtual int countRows()
+ {
+ return fCount;
+ }
+ virtual void getRow(int index, SkString* left, SkString* right)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (left)
+ *left = fList[index].fLabel;
+ if (right)
+ *right = fList[index].fType == kDir_Type ? fDirTail : fList[index].fTail;
+ }
+ virtual SkEvent* getEvent(int index)
+ {
+ SkASSERT((unsigned)index < (unsigned)fCount);
+
+ if (fList[index].fType == kDir_Type)
+ {
+ SkEvent* evt = new SkEvent();
+ evt->setType(fList[index].fTarget);
+ evt->setFast32(index);
+ return evt;
+ }
+ if (fList[index].fType == kToggle_Type)
+ fList[index].fTail.swap(fList[index].fAltTail);
+
+ return NULL;
+ }
private:
- int fCount;
- ItemRec* fList;
- SkString fDirTail;
+ int fCount;
+ ItemRec* fList;
+ SkString fDirTail;
};
SkListSource* SkListSource::CreateFromDOM(const SkDOM& dom, const SkDOM::Node* node)
{
- return new SkDOMListSource(dom, node);
+ return new SkDOMListSource(dom, node);
}
//////////////////////////////////////////////////////////////////
@@ -209,304 +209,304 @@ SkListSource* SkListSource::CreateFromDOM(const SkDOM& dom, const SkDOM::Node* n
SkListView::SkListView(U32 flags) : SkWidgetView(flags)
{
- fSource = NULL;
- fScrollIndex = 0;
- fCurrIndex = -1;
- fRowHeight = SkIntToScalar(16);
- fVisibleRowCount = 0;
- fStrCache = NULL;
+ fSource = NULL;
+ fScrollIndex = 0;
+ fCurrIndex = -1;
+ fRowHeight = SkIntToScalar(16);
+ fVisibleRowCount = 0;
+ fStrCache = NULL;
- fPaint[kBG_Attr].setColor(0);
- fPaint[kNormalText_Attr].setTextSize(SkIntToScalar(14));
- fPaint[kHiliteText_Attr].setTextSize(SkIntToScalar(14));
- fPaint[kHiliteText_Attr].setColor(SK_ColorWHITE);
- fPaint[kHiliteCell_Attr].setColor(SK_ColorBLUE);
+ fPaint[kBG_Attr].setColor(0);
+ fPaint[kNormalText_Attr].setTextSize(SkIntToScalar(14));
+ fPaint[kHiliteText_Attr].setTextSize(SkIntToScalar(14));
+ fPaint[kHiliteText_Attr].setColor(SK_ColorWHITE);
+ fPaint[kHiliteCell_Attr].setColor(SK_ColorBLUE);
}
SkListView::~SkListView()
{
- delete[] fStrCache;
- fSource->safeUnref();
+ delete[] fStrCache;
+ fSource->safeUnref();
}
void SkListView::setRowHeight(SkScalar height)
{
- SkASSERT(height >= 0);
+ SkASSERT(height >= 0);
- if (fRowHeight != height)
- {
- fRowHeight = height;
- this->inval(NULL);
- this->onSizeChange();
- }
+ if (fRowHeight != height)
+ {
+ fRowHeight = height;
+ this->inval(NULL);
+ this->onSizeChange();
+ }
}
void SkListView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
+ if (fCurrIndex != index)
+ {
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
- {
- SkEvent evt;
- evt.setType("listview-selection");
- evt.setFast32(index);
- this->sendEventToParents(evt);
- }
- }
+ {
+ SkEvent evt;
+ evt.setType("listview-selection");
+ evt.setFast32(index);
+ this->sendEventToParents(evt);
+ }
+ }
}
void SkListView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRows() - 1;
- else
- index = SkMax32(index - 1, 0);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRows() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+ this->setSelection(index);
+ }
}
void SkListView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRows() - 1);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRows() - 1);
+ this->setSelection(index);
+ }
}
void SkListView::invalSelection()
{
- SkRect r;
- if (this->getRowRect(fCurrIndex, &r))
- this->inval(&r);
+ SkRect r;
+ if (this->getRowRect(fCurrIndex, &r))
+ this->inval(&r);
}
void SkListView::ensureSelectionIsVisible()
{
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
- if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
+ if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- if (index < 0) // too high
- fScrollIndex = fCurrIndex;
- else
- fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ if (index < 0) // too high
+ fScrollIndex = fCurrIndex;
+ else
+ fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
}
bool SkListView::getRowRect(int index, SkRect* r) const
{
- SkASSERT(r);
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- SkScalar top = index * fRowHeight;
+ SkASSERT(r);
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ SkScalar top = index * fRowHeight;
- if (top < this->height())
- {
- if (r)
- r->set(0, top, this->width(), top + fRowHeight);
- return true;
- }
- }
- return false;
+ if (top < this->height())
+ {
+ if (r)
+ r->set(0, top, this->width(), top + fRowHeight);
+ return true;
+ }
+ }
+ return false;
}
SkPaint& SkListView::paint(Attr attr)
{
- SkASSERT((unsigned)attr < kAttrCount);
- return fPaint[attr];
+ SkASSERT((unsigned)attr < kAttrCount);
+ return fPaint[attr];
}
SkListSource* SkListView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- this->dirtyStrCache();
- this->ensureSelectionIsVisible();
- this->inval(NULL);
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ this->dirtyStrCache();
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+ }
+ return src;
}
void SkListView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- canvas->drawPaint(fPaint[kBG_Attr]);
+ canvas->drawPaint(fPaint[kBG_Attr]);
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
- if (visibleCount == 0)
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
+ if (visibleCount == 0)
+ return;
- this->ensureStrCache(visibleCount);
- int currIndex = this->logicalToVisualIndex(fCurrIndex);
+ this->ensureStrCache(visibleCount);
+ int currIndex = this->logicalToVisualIndex(fCurrIndex);
- if ((unsigned)currIndex < (unsigned)visibleCount)
- {
- SkAutoCanvasRestore restore(canvas, true);
- SkRect r;
+ if ((unsigned)currIndex < (unsigned)visibleCount)
+ {
+ SkAutoCanvasRestore restore(canvas, true);
+ SkRect r;
- canvas->translate(0, currIndex * fRowHeight);
- (void)this->getRowRect(fScrollIndex, &r);
- canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
- }
+ canvas->translate(0, currIndex * fRowHeight);
+ (void)this->getRowRect(fScrollIndex, &r);
+ canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
+ }
- SkPaint* p;
- SkScalar y, x = SkIntToScalar(6);
- SkScalar rite = this->width() - x;
+ SkPaint* p;
+ SkScalar y, x = SkIntToScalar(6);
+ SkScalar rite = this->width() - x;
- {
- SkScalar ascent, descent;
- fPaint[kNormalText_Attr].measureText(0, NULL, &ascent, &descent);
- y = SkScalarHalf(fRowHeight - descent + ascent) - ascent;
- }
+ {
+ SkScalar ascent, descent;
+ fPaint[kNormalText_Attr].measureText(0, NULL, &ascent, &descent);
+ y = SkScalarHalf(fRowHeight - descent + ascent) - ascent;
+ }
- for (int i = 0; i < visibleCount; i++)
- {
- if (i == currIndex)
- p = &fPaint[kHiliteText_Attr];
- else
- p = &fPaint[kNormalText_Attr];
+ for (int i = 0; i < visibleCount; i++)
+ {
+ if (i == currIndex)
+ p = &fPaint[kHiliteText_Attr];
+ else
+ p = &fPaint[kNormalText_Attr];
- p->setTextAlign(SkPaint::kLeft_Align);
- canvas->drawText(fStrCache[i].c_str(), fStrCache[i].size(), x, y, *p);
- p->setTextAlign(SkPaint::kRight_Align);
- canvas->drawText(fStrCache[i + visibleCount].c_str(), fStrCache[i + visibleCount].size(), rite, y, *p);
- canvas->translate(0, fRowHeight);
- }
+ p->setTextAlign(SkPaint::kLeft_Align);
+ canvas->drawText(fStrCache[i].c_str(), fStrCache[i].size(), x, y, *p);
+ p->setTextAlign(SkPaint::kRight_Align);
+ canvas->drawText(fStrCache[i + visibleCount].c_str(), fStrCache[i + visibleCount].size(), rite, y, *p);
+ canvas->translate(0, fRowHeight);
+ }
}
void SkListView::onSizeChange()
{
- SkScalar count = SkScalarDiv(this->height(), fRowHeight);
- int n = SkScalarFloor(count);
+ SkScalar count = SkScalarDiv(this->height(), fRowHeight);
+ int n = SkScalarFloor(count);
- // only want to show rows that are mostly visible
- if (n == 0 || count - SkIntToScalar(n) > SK_Scalar1*75/100)
- n += 1;
+ // only want to show rows that are mostly visible
+ if (n == 0 || count - SkIntToScalar(n) > SK_Scalar1*75/100)
+ n += 1;
- if (fVisibleRowCount != n)
- {
- fVisibleRowCount = n;
- this->ensureSelectionIsVisible();
- this->dirtyStrCache();
- }
+ if (fVisibleRowCount != n)
+ {
+ fVisibleRowCount = n;
+ this->ensureSelectionIsVisible();
+ this->dirtyStrCache();
+ }
}
void SkListView::dirtyStrCache()
{
- if (fStrCache)
- {
- delete[] fStrCache;
- fStrCache = NULL;
- }
+ if (fStrCache)
+ {
+ delete[] fStrCache;
+ fStrCache = NULL;
+ }
}
void SkListView::ensureStrCache(int count)
{
- if (fStrCache == NULL)
- {
- fStrCache = new SkString[count << 1];
+ if (fStrCache == NULL)
+ {
+ fStrCache = new SkString[count << 1];
- if (fSource)
- for (int i = 0; i < count; i++)
- fSource->getRow(i + fScrollIndex, &fStrCache[i], &fStrCache[i + count]);
- }
+ if (fSource)
+ for (int i = 0; i < count; i++)
+ fSource->getRow(i + fScrollIndex, &fStrCache[i], &fStrCache[i + count]);
+ }
}
bool SkListView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- this->moveSelectionUp();
- return true;
- case kDown_SkKey:
- this->moveSelectionDown();
- return true;
- case kRight_SkKey:
- case kOK_SkKey:
- if (fSource && fCurrIndex >= 0)
- {
- SkEvent* evt = fSource->getEvent(fCurrIndex);
- if (evt)
- {
- SkView* view = this->sendEventToParents(*evt);
- delete evt;
- return view != NULL;
- }
- else // hack to make toggle work
- {
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ this->moveSelectionUp();
+ return true;
+ case kDown_SkKey:
+ this->moveSelectionDown();
+ return true;
+ case kRight_SkKey:
+ case kOK_SkKey:
+ if (fSource && fCurrIndex >= 0)
+ {
+ SkEvent* evt = fSource->getEvent(fCurrIndex);
+ if (evt)
+ {
+ SkView* view = this->sendEventToParents(*evt);
+ delete evt;
+ return view != NULL;
+ }
+ else // hack to make toggle work
+ {
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
+ this->INHERITED::onInflate(dom, node);
- SkScalar x;
- const SkDOM::Node* child;
+ SkScalar x;
+ const SkDOM::Node* child;
- if (dom.findScalar(node, "row-height", &x))
- this->setRowHeight(x);
+ if (dom.findScalar(node, "row-height", &x))
+ this->setRowHeight(x);
- if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
- SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
+ if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
+ SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
- // look for a listsource
- {
- SkListSource* src = NULL;
+ // look for a listsource
+ {
+ SkListSource* src = NULL;
- if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
- {
- const char* path = dom.findAttr(child, "path");
- if (path)
- src = SkListSource::CreateFromDir( path,
- dom.findAttr(child, "filter"),
- dom.findAttr(child, "target"));
- }
- else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
- {
- src = SkListSource::CreateFromDOM(dom, child);
- }
+ if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
+ {
+ const char* path = dom.findAttr(child, "path");
+ if (path)
+ src = SkListSource::CreateFromDir( path,
+ dom.findAttr(child, "filter"),
+ dom.findAttr(child, "target"));
+ }
+ else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
+ {
+ src = SkListSource::CreateFromDOM(dom, child);
+ }
- if (src)
- {
- this->setListSource(src)->unref();
- this->setSelection(0);
- }
- }
+ if (src)
+ {
+ this->setListSource(src)->unref();
+ this->setSelection(0);
+ }
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -517,386 +517,386 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
class SkScrollBarView : public SkView {
public:
- SkScrollBarView(const char bg[], const char fg[])
- {
- fBGRef = SkBitmapRef::Decode(bg, true);
- fFGRef = SkBitmapRef::Decode(fg, true);
-
- if (fBGRef)
- this->setWidth(SkIntToScalar(fBGRef->bitmap().width()));
- }
- ~SkScrollBarView()
- {
- delete fBGRef;
- delete fFGRef;
- }
+ SkScrollBarView(const char bg[], const char fg[])
+ {
+ fBGRef = SkBitmapRef::Decode(bg, true);
+ fFGRef = SkBitmapRef::Decode(fg, true);
+
+ if (fBGRef)
+ this->setWidth(SkIntToScalar(fBGRef->bitmap().width()));
+ }
+ ~SkScrollBarView()
+ {
+ delete fBGRef;
+ delete fFGRef;
+ }
protected:
- virtual void onDraw(SkCanvas* canvas)
- {
- if (fBGRef == NULL) return;
+ virtual void onDraw(SkCanvas* canvas)
+ {
+ if (fBGRef == NULL) return;
- SkPaint paint;
+ SkPaint paint;
- SkShader* shader = SkShader::CreateBitmapShader(fBGRef->bitmap(), false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
- paint.setShader(shader)->unref();
+ SkShader* shader = SkShader::CreateBitmapShader(fBGRef->bitmap(), false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
+ paint.setShader(shader)->unref();
- canvas->drawPaint(paint);
- }
+ canvas->drawPaint(paint);
+ }
private:
- SkBitmapRef* fBGRef, *fFGRef;
+ SkBitmapRef* fBGRef, *fFGRef;
};
SkGridView::SkGridView(U32 flags) : SkWidgetView(flags)
{
- fSource = NULL;
- fCurrIndex = -1;
- fVisibleCount.set(0, 0);
+ fSource = NULL;
+ fCurrIndex = -1;
+ fVisibleCount.set(0, 0);
- fPaint[kBG_Attr].setColor(SK_ColorWHITE);
- fPaint[kHiliteCell_Attr].setColor(SK_ColorYELLOW);
- fPaint[kHiliteCell_Attr].setStyle(SkPaint::kStroke_Style);
- fPaint[kHiliteCell_Attr].setAntiAliasOn(true);
- fPaint[kHiliteCell_Attr].setStrokeWidth(SK_Scalar1*3);
+ fPaint[kBG_Attr].setColor(SK_ColorWHITE);
+ fPaint[kHiliteCell_Attr].setColor(SK_ColorYELLOW);
+ fPaint[kHiliteCell_Attr].setStyle(SkPaint::kStroke_Style);
+ fPaint[kHiliteCell_Attr].setAntiAliasOn(true);
+ fPaint[kHiliteCell_Attr].setStrokeWidth(SK_Scalar1*3);
- fScrollBar = new SkScrollBarView("icons/scrollbarGrey.jpg", "icons/scrollbarBlue.jpg");
- this->attachChildToFront(fScrollBar)->unref();
- fScrollBar->setVisibleP(true);
+ fScrollBar = new SkScrollBarView("icons/scrollbarGrey.jpg", "icons/scrollbarBlue.jpg");
+ this->attachChildToFront(fScrollBar)->unref();
+ fScrollBar->setVisibleP(true);
}
SkGridView::~SkGridView()
{
- fSource->safeUnref();
+ fSource->safeUnref();
}
void SkGridView::getCellSize(SkPoint* size) const
{
- if (size)
- *size = fCellSize;
+ if (size)
+ *size = fCellSize;
}
void SkGridView::setCellSize(SkScalar x, SkScalar y)
{
- SkASSERT(x >= 0 && y >= 0);
+ SkASSERT(x >= 0 && y >= 0);
- if (!fCellSize.equals(x, y))
- {
- fCellSize.set(x, y);
- this->inval(NULL);
- }
+ if (!fCellSize.equals(x, y))
+ {
+ fCellSize.set(x, y);
+ this->inval(NULL);
+ }
}
void SkGridView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
+ if (fCurrIndex != index)
+ {
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
- // this generates the click
- {
- SkEvent evt;
- evt.setType("listview-selection");
- evt.setFast32(index);
- this->sendEventToParents(evt);
- }
- }
+ // this generates the click
+ {
+ SkEvent evt;
+ evt.setType("listview-selection");
+ evt.setFast32(index);
+ this->sendEventToParents(evt);
+ }
+ }
}
void SkGridView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRows() - 1;
- else
- index = SkMax32(index - 1, 0);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRows() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+ this->setSelection(index);
+ }
}
void SkGridView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRows() - 1);
- this->setSelection(index);
- }
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRows() - 1);
+ this->setSelection(index);
+ }
}
void SkGridView::invalSelection()
{
- SkRect r;
- if (this->getCellRect(fCurrIndex, &r))
- {
- SkScalar inset = 0;
- if (fPaint[kHiliteCell_Attr].getStyle() != SkPaint::kFill_Style)
- inset += fPaint[kHiliteCell_Attr].getStrokeWidth() / 2;
- if (fPaint[kHiliteCell_Attr].isAntiAliasOn())
- inset += SK_Scalar1;
- r.inset(-inset, -inset);
- this->inval(&r);
- }
+ SkRect r;
+ if (this->getCellRect(fCurrIndex, &r))
+ {
+ SkScalar inset = 0;
+ if (fPaint[kHiliteCell_Attr].getStyle() != SkPaint::kFill_Style)
+ inset += fPaint[kHiliteCell_Attr].getStrokeWidth() / 2;
+ if (fPaint[kHiliteCell_Attr].isAntiAliasOn())
+ inset += SK_Scalar1;
+ r.inset(-inset, -inset);
+ this->inval(&r);
+ }
}
void SkGridView::ensureSelectionIsVisible()
{
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
#if 0
- if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
-
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- if (index < 0) // too high
- fScrollIndex = fCurrIndex;
- else
- fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
-
- this->dirtyStrCache();
- this->inval(NULL);
- }
- }
+ if ((unsigned)fCurrIndex < (unsigned)fSource->countRows())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
+
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ if (index < 0) // too high
+ fScrollIndex = fCurrIndex;
+ else
+ fScrollIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)fScrollIndex < (unsigned)fSource->countRows());
+
+ this->dirtyStrCache();
+ this->inval(NULL);
+ }
+ }
#endif
}
bool SkGridView::getCellRect(int index, SkRect* r) const
{
- if (fVisibleCount.fY == 0)
- return false;
+ if (fVisibleCount.fY == 0)
+ return false;
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- SkRect bounds;
- int row = index / fVisibleCount.fY;
- int col = index % fVisibleCount.fY;
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ SkRect bounds;
+ int row = index / fVisibleCount.fY;
+ int col = index % fVisibleCount.fY;
- bounds.set(0, 0, fCellSize.fX, fCellSize.fY);
- bounds.offset(col * (fCellSize.fX + SkIntToScalar(col > 0)),
- row * (fCellSize.fY + SkIntToScalar(row > 0)));
+ bounds.set(0, 0, fCellSize.fX, fCellSize.fY);
+ bounds.offset(col * (fCellSize.fX + SkIntToScalar(col > 0)),
+ row * (fCellSize.fY + SkIntToScalar(row > 0)));
- if (bounds.fTop < this->height())
- {
- if (r)
- *r = bounds;
- return true;
- }
- }
- return false;
+ if (bounds.fTop < this->height())
+ {
+ if (r)
+ *r = bounds;
+ return true;
+ }
+ }
+ return false;
}
SkPaint& SkGridView::paint(Attr attr)
{
- SkASSERT((unsigned)attr < kAttrCount);
- return fPaint[attr];
+ SkASSERT((unsigned)attr < kAttrCount);
+ return fPaint[attr];
}
SkListSource* SkGridView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- // this->dirtyStrCache();
- this->ensureSelectionIsVisible();
- this->inval(NULL);
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ // this->dirtyStrCache();
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+ }
+ return src;
}
#include "SkShader.h"
static void copybits(SkCanvas* canvas, const SkBitmap& bm, const SkRect& dst, const SkPaint& paint)
{
- SkRect src;
- SkMatrix matrix;
+ SkRect src;
+ SkMatrix matrix;
- src.set(0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()));
- if (matrix.setRectToRect(src, dst))
- {
- SkPaint p(paint);
- SkShader* shader = SkShader::CreateBitmapShader(bm, false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
- p.setShader(shader)->unref();
+ src.set(0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()));
+ if (matrix.setRectToRect(src, dst))
+ {
+ SkPaint p(paint);
+ SkShader* shader = SkShader::CreateBitmapShader(bm, false, SkPaint::kNo_FilterType, SkShader::kClamp_TileMode);
+ p.setShader(shader)->unref();
- shader->setLocalMatrix(matrix);
- canvas->drawRect(dst, p);
- }
+ shader->setLocalMatrix(matrix);
+ canvas->drawRect(dst, p);
+ }
}
#include "SkImageDecoder.h"
void SkGridView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- canvas->drawPaint(fPaint[kBG_Attr]);
+ canvas->drawPaint(fPaint[kBG_Attr]);
- if (fSource == NULL)
- return;
+ if (fSource == NULL)
+ return;
#if 0
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
- if (visibleCount == 0)
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRows() - fScrollIndex);
+ if (visibleCount == 0)
+ return;
- this->ensureStrCache(visibleCount);
- int currIndex = this->logicalToVisualIndex(fCurrIndex);
+ this->ensureStrCache(visibleCount);
+ int currIndex = this->logicalToVisualIndex(fCurrIndex);
#endif
- SkPaint p;
- for (int i = 0; i < fSource->countRows(); i++)
- {
- bool forced = false;
- SkEvent* evt = fSource->getEvent(i);
- SkASSERT(evt);
- SkString path(evt->findString("path"));
- delete evt;
-
- SkBitmapRef* bmr = SkBitmapRef::Decode(path.c_str(), false);
- if (bmr == NULL)
- {
- bmr = SkBitmapRef::Decode(path.c_str(), true);
- if (bmr)
- forced = true;
- }
-
- if (bmr)
- {
- SkAutoTDelete<SkBitmapRef> autoRef(bmr);
- SkRect r;
- if (!this->getCellRect(i, &r))
- break;
- copybits(canvas, bmr->bitmap(), r, p);
- }
- // only draw one forced bitmap at a time
- if (forced)
- {
- this->inval(NULL); // could inval only the remaining visible cells...
- break;
- }
- }
-
- // draw the hilite
- {
- SkRect r;
- if (fCurrIndex >= 0 && this->getCellRect(fCurrIndex, &r))
- canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
- }
+ SkPaint p;
+ for (int i = 0; i < fSource->countRows(); i++)
+ {
+ bool forced = false;
+ SkEvent* evt = fSource->getEvent(i);
+ SkASSERT(evt);
+ SkString path(evt->findString("path"));
+ delete evt;
+
+ SkBitmapRef* bmr = SkBitmapRef::Decode(path.c_str(), false);
+ if (bmr == NULL)
+ {
+ bmr = SkBitmapRef::Decode(path.c_str(), true);
+ if (bmr)
+ forced = true;
+ }
+
+ if (bmr)
+ {
+ SkAutoTDelete<SkBitmapRef> autoRef(bmr);
+ SkRect r;
+ if (!this->getCellRect(i, &r))
+ break;
+ copybits(canvas, bmr->bitmap(), r, p);
+ }
+ // only draw one forced bitmap at a time
+ if (forced)
+ {
+ this->inval(NULL); // could inval only the remaining visible cells...
+ break;
+ }
+ }
+
+ // draw the hilite
+ {
+ SkRect r;
+ if (fCurrIndex >= 0 && this->getCellRect(fCurrIndex, &r))
+ canvas->drawRect(r, fPaint[kHiliteCell_Attr]);
+ }
}
static int check_count(int n, SkScalar s)
{
- // only want to show cells that are mostly visible
- if (n == 0 || s - SkIntToScalar(n) > SK_Scalar1*75/100)
- n += 1;
- return n;
+ // only want to show cells that are mostly visible
+ if (n == 0 || s - SkIntToScalar(n) > SK_Scalar1*75/100)
+ n += 1;
+ return n;
}
void SkGridView::onSizeChange()
{
- fScrollBar->setHeight(this->height());
- fScrollBar->setLoc(this->locX() + this->width() - fScrollBar->width(), 0);
+ fScrollBar->setHeight(this->height());
+ fScrollBar->setLoc(this->locX() + this->width() - fScrollBar->width(), 0);
- if (fCellSize.equals(0, 0))
- {
- fVisibleCount.set(0, 0);
- return;
- }
+ if (fCellSize.equals(0, 0))
+ {
+ fVisibleCount.set(0, 0);
+ return;
+ }
- SkScalar rows = SkScalarDiv(this->height(), fCellSize.fY);
- SkScalar cols = SkScalarDiv(this->width(), fCellSize.fX);
- int y = SkScalarFloor(rows);
- int x = SkScalarFloor(cols);
+ SkScalar rows = SkScalarDiv(this->height(), fCellSize.fY);
+ SkScalar cols = SkScalarDiv(this->width(), fCellSize.fX);
+ int y = SkScalarFloor(rows);
+ int x = SkScalarFloor(cols);
- y = check_count(y, rows);
- x = check_count(x, cols);
+ y = check_count(y, rows);
+ x = check_count(x, cols);
- if (!fVisibleCount.equals(x, y))
- {
- fVisibleCount.set(x, y);
- this->ensureSelectionIsVisible();
- // this->dirtyStrCache();
- }
+ if (!fVisibleCount.equals(x, y))
+ {
+ fVisibleCount.set(x, y);
+ this->ensureSelectionIsVisible();
+ // this->dirtyStrCache();
+ }
}
bool SkGridView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- this->moveSelectionUp();
- return true;
- case kDown_SkKey:
- this->moveSelectionDown();
- return true;
- case kRight_SkKey:
- case kOK_SkKey:
- if (fSource && fCurrIndex >= 0)
- {
- SkEvent* evt = fSource->getEvent(fCurrIndex);
- if (evt)
- {
- // augment the event with our local rect
- (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL));
-
- SkView* view = this->sendEventToParents(*evt);
- delete evt;
- return view != NULL;
- }
- }
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ this->moveSelectionUp();
+ return true;
+ case kDown_SkKey:
+ this->moveSelectionDown();
+ return true;
+ case kRight_SkKey:
+ case kOK_SkKey:
+ if (fSource && fCurrIndex >= 0)
+ {
+ SkEvent* evt = fSource->getEvent(fCurrIndex);
+ if (evt)
+ {
+ // augment the event with our local rect
+ (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL));
+
+ SkView* view = this->sendEventToParents(*evt);
+ delete evt;
+ return view != NULL;
+ }
+ }
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
void SkGridView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- SkScalar x[2];
- const SkDOM::Node* child;
-
- if (dom.findScalars(node, "cell-size", x, 2))
- this->setCellSize(x[0], x[1]);
-
- if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
- SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
-
- // look for a listsource
- {
- SkListSource* src = NULL;
-
- if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
- {
- const char* path = dom.findAttr(child, "path");
- if (path)
- src = SkListSource::CreateFromDir( path,
- dom.findAttr(child, "filter"),
- dom.findAttr(child, "target"));
- }
- else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
- {
- src = SkListSource::CreateFromDOM(dom, child);
- }
-
- if (src)
- {
- this->setListSource(src)->unref();
- this->setSelection(0);
- }
- }
- this->onSizeChange();
+ this->INHERITED::onInflate(dom, node);
+
+ SkScalar x[2];
+ const SkDOM::Node* child;
+
+ if (dom.findScalars(node, "cell-size", x, 2))
+ this->setCellSize(x[0], x[1]);
+
+ if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
+ SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);
+
+ // look for a listsource
+ {
+ SkListSource* src = NULL;
+
+ if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
+ {
+ const char* path = dom.findAttr(child, "path");
+ if (path)
+ src = SkListSource::CreateFromDir( path,
+ dom.findAttr(child, "filter"),
+ dom.findAttr(child, "target"));
+ }
+ else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
+ {
+ src = SkListSource::CreateFromDOM(dom, child);
+ }
+
+ if (src)
+ {
+ this->setListSource(src)->unref();
+ this->setSelection(0);
+ }
+ }
+ this->onSizeChange();
}
#endif
diff --git a/src/views/animated/SkListWidget.cpp b/src/views/animated/SkListWidget.cpp
index 4d95e0fc46..f91c6843b7 100644
--- a/src/views/animated/SkListWidget.cpp
+++ b/src/views/animated/SkListWidget.cpp
@@ -13,320 +13,320 @@
extern void init_skin_anim(const char name[], SkAnimator*);
struct SkListView::BindingRec {
- SkString fSlotName;
- int fFieldIndex;
+ SkString fSlotName;
+ int fFieldIndex;
};
SkListView::SkListView()
{
- fSource = NULL; // our list-source
- fScrollBar = NULL;
- fAnims = NULL; // array of animators[fVisibleRowCount]
- fBindings = NULL; // our fields->slot array
- fBindingCount = 0; // number of entries in fSlots array
- fScrollIndex = 0; // number of cells to skip before first visible cell
- fCurrIndex = -1; // index of "selected" cell
- fVisibleRowCount = 0; // number of cells that can fit in our bounds
- fAnimContentDirty = true; // true if fAnims[] have their correct content
- fAnimFocusDirty = true;
-
- fHeights[kNormal_Height] = SkIntToScalar(16);
- fHeights[kSelected_Height] = SkIntToScalar(16);
-
- this->setFlags(this->getFlags() | kFocusable_Mask);
+ fSource = NULL; // our list-source
+ fScrollBar = NULL;
+ fAnims = NULL; // array of animators[fVisibleRowCount]
+ fBindings = NULL; // our fields->slot array
+ fBindingCount = 0; // number of entries in fSlots array
+ fScrollIndex = 0; // number of cells to skip before first visible cell
+ fCurrIndex = -1; // index of "selected" cell
+ fVisibleRowCount = 0; // number of cells that can fit in our bounds
+ fAnimContentDirty = true; // true if fAnims[] have their correct content
+ fAnimFocusDirty = true;
+
+ fHeights[kNormal_Height] = SkIntToScalar(16);
+ fHeights[kSelected_Height] = SkIntToScalar(16);
+
+ this->setFlags(this->getFlags() | kFocusable_Mask);
}
SkListView::~SkListView()
{
- SkSafeUnref(fScrollBar);
- SkSafeUnref(fSource);
- delete[] fAnims;
- delete[] fBindings;
+ SkSafeUnref(fScrollBar);
+ SkSafeUnref(fSource);
+ delete[] fAnims;
+ delete[] fBindings;
}
void SkListView::setHasScrollBar(bool hasSB)
{
- if (hasSB != this->hasScrollBar())
- {
- if (hasSB)
- {
- SkASSERT(fScrollBar == NULL);
- fScrollBar = (SkScrollBarView*)SkWidgetFactory(kScroll_WidgetEnum);
- fScrollBar->setVisibleP(true);
- this->attachChildToFront(fScrollBar);
- fScrollBar->setHeight(this->height()); // assume it auto-sets its width
- // fScrollBar->setLoc(this->getContentWidth(), 0);
- fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
- }
- else
- {
- SkASSERT(fScrollBar);
- fScrollBar->detachFromParent();
- fScrollBar->unref();
- fScrollBar = NULL;
- }
- this->dirtyCache(kAnimContent_DirtyFlag);
- }
+ if (hasSB != this->hasScrollBar())
+ {
+ if (hasSB)
+ {
+ SkASSERT(fScrollBar == NULL);
+ fScrollBar = (SkScrollBarView*)SkWidgetFactory(kScroll_WidgetEnum);
+ fScrollBar->setVisibleP(true);
+ this->attachChildToFront(fScrollBar);
+ fScrollBar->setHeight(this->height()); // assume it auto-sets its width
+ // fScrollBar->setLoc(this->getContentWidth(), 0);
+ fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
+ }
+ else
+ {
+ SkASSERT(fScrollBar);
+ fScrollBar->detachFromParent();
+ fScrollBar->unref();
+ fScrollBar = NULL;
+ }
+ this->dirtyCache(kAnimContent_DirtyFlag);
+ }
}
void SkListView::setSelection(int index)
{
- if (fCurrIndex != index)
- {
- fAnimFocusDirty = true;
- this->inval(NULL);
-
- this->invalSelection();
- fCurrIndex = index;
- this->invalSelection();
- this->ensureSelectionIsVisible();
- }
+ if (fCurrIndex != index)
+ {
+ fAnimFocusDirty = true;
+ this->inval(NULL);
+
+ this->invalSelection();
+ fCurrIndex = index;
+ this->invalSelection();
+ this->ensureSelectionIsVisible();
+ }
}
bool SkListView::moveSelectionUp()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = fSource->countRecords() - 1;
- else
- index = SkMax32(index - 1, 0);
-
- if (fCurrIndex != index)
- {
- this->setSelection(index);
- return true;
- }
- }
- return false;
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = fSource->countRecords() - 1;
+ else
+ index = SkMax32(index - 1, 0);
+
+ if (fCurrIndex != index)
+ {
+ this->setSelection(index);
+ return true;
+ }
+ }
+ return false;
}
bool SkListView::moveSelectionDown()
{
- if (fSource)
- {
- int index = fCurrIndex;
- if (index < 0) // no selection
- index = 0;
- else
- index = SkMin32(index + 1, fSource->countRecords() - 1);
-
- if (fCurrIndex != index)
- {
- this->setSelection(index);
- return true;
- }
- }
- return false;
+ if (fSource)
+ {
+ int index = fCurrIndex;
+ if (index < 0) // no selection
+ index = 0;
+ else
+ index = SkMin32(index + 1, fSource->countRecords() - 1);
+
+ if (fCurrIndex != index)
+ {
+ this->setSelection(index);
+ return true;
+ }
+ }
+ return false;
}
void SkListView::invalSelection()
{
- SkRect r;
- if (this->getRowRect(fCurrIndex, &r))
- this->inval(&r);
+ SkRect r;
+ if (this->getRowRect(fCurrIndex, &r))
+ this->inval(&r);
}
void SkListView::ensureSelectionIsVisible()
{
- if (fSource && (unsigned)fCurrIndex < (unsigned)fSource->countRecords())
- {
- int index = this->logicalToVisualIndex(fCurrIndex);
-
- if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
- {
- int newIndex;
-
- if (index < 0) // too high
- newIndex = fCurrIndex;
- else
- newIndex = fCurrIndex - fVisibleRowCount + 1;
- SkASSERT((unsigned)newIndex < (unsigned)fSource->countRecords());
- this->inval(NULL);
-
- if (fScrollIndex != newIndex)
- {
- fScrollIndex = newIndex;
- if (fScrollBar)
- fScrollBar->setStart(newIndex);
- this->dirtyCache(kAnimContent_DirtyFlag);
- }
- }
- }
+ if (fSource && (unsigned)fCurrIndex < (unsigned)fSource->countRecords())
+ {
+ int index = this->logicalToVisualIndex(fCurrIndex);
+
+ if ((unsigned)index >= (unsigned)fVisibleRowCount) // need to scroll
+ {
+ int newIndex;
+
+ if (index < 0) // too high
+ newIndex = fCurrIndex;
+ else
+ newIndex = fCurrIndex - fVisibleRowCount + 1;
+ SkASSERT((unsigned)newIndex < (unsigned)fSource->countRecords());
+ this->inval(NULL);
+
+ if (fScrollIndex != newIndex)
+ {
+ fScrollIndex = newIndex;
+ if (fScrollBar)
+ fScrollBar->setStart(newIndex);
+ this->dirtyCache(kAnimContent_DirtyFlag);
+ }
+ }
+ }
}
SkScalar SkListView::getContentWidth() const
{
- SkScalar width = this->width();
-
- if (fScrollBar)
- {
- width -= fScrollBar->width();
- if (width < 0)
- width = 0;
- }
- return width;
+ SkScalar width = this->width();
+
+ if (fScrollBar)
+ {
+ width -= fScrollBar->width();
+ if (width < 0)
+ width = 0;
+ }
+ return width;
}
bool SkListView::getRowRect(int index, SkRect* r) const
{
- SkASSERT(r);
-
- index = this->logicalToVisualIndex(index);
- if (index >= 0)
- {
- int selection = this->logicalToVisualIndex(fCurrIndex);
-
- SkScalar height = fHeights[index == selection ? kSelected_Height : kNormal_Height];
- SkScalar top = index * fHeights[kNormal_Height];
-
- if (index > selection && selection >= 0)
- top += fHeights[kSelected_Height] - fHeights[kNormal_Height];
-
- if (top < this->height())
- {
- if (r)
- r->set(0, top, this->getContentWidth(), top + height);
- return true;
- }
- }
- return false;
+ SkASSERT(r);
+
+ index = this->logicalToVisualIndex(index);
+ if (index >= 0)
+ {
+ int selection = this->logicalToVisualIndex(fCurrIndex);
+
+ SkScalar height = fHeights[index == selection ? kSelected_Height : kNormal_Height];
+ SkScalar top = index * fHeights[kNormal_Height];
+
+ if (index > selection && selection >= 0)
+ top += fHeights[kSelected_Height] - fHeights[kNormal_Height];
+
+ if (top < this->height())
+ {
+ if (r)
+ r->set(0, top, this->getContentWidth(), top + height);
+ return true;
+ }
+ }
+ return false;
}
SkListSource* SkListView::setListSource(SkListSource* src)
{
- if (fSource != src)
- {
- SkRefCnt_SafeAssign(fSource, src);
- this->ensureSelectionIsVisible();
- this->inval(NULL);
-
- if (fScrollBar)
- fScrollBar->setTotal(fSource->countRecords());
- }
- return src;
+ if (fSource != src)
+ {
+ SkRefCnt_SafeAssign(fSource, src);
+ this->ensureSelectionIsVisible();
+ this->inval(NULL);
+
+ if (fScrollBar)
+ fScrollBar->setTotal(fSource->countRecords());
+ }
+ return src;
}
void SkListView::dirtyCache(unsigned dirtyFlags)
{
- if (dirtyFlags & kAnimCount_DirtyFlag)
- {
- delete fAnims;
- fAnims = NULL;
- fAnimContentDirty = true;
- fAnimFocusDirty = true;
- }
- if (dirtyFlags & kAnimContent_DirtyFlag)
- {
- if (!fAnimContentDirty)
- {
- this->inval(NULL);
- fAnimContentDirty = true;
- }
- fAnimFocusDirty = true;
- }
+ if (dirtyFlags & kAnimCount_DirtyFlag)
+ {
+ delete fAnims;
+ fAnims = NULL;
+ fAnimContentDirty = true;
+ fAnimFocusDirty = true;
+ }
+ if (dirtyFlags & kAnimContent_DirtyFlag)
+ {
+ if (!fAnimContentDirty)
+ {
+ this->inval(NULL);
+ fAnimContentDirty = true;
+ }
+ fAnimFocusDirty = true;
+ }
}
bool SkListView::ensureCache()
{
- if (fSkinName.size() == 0)
- return false;
-
- if (fAnims == NULL)
- {
- int n = SkMax32(1, fVisibleRowCount);
-
- SkASSERT(fAnimContentDirty);
- fAnims = new SkAnimator[n];
- for (int i = 0; i < n; i++)
- {
- fAnims[i].setHostEventSink(this);
- init_skin_anim(fSkinName.c_str(), &fAnims[i]);
- }
-
- fHeights[kNormal_Height] = fAnims[0].getScalar("idleHeight", "value");
- fHeights[kSelected_Height] = fAnims[0].getScalar("focusedHeight", "value");
-
- fAnimFocusDirty = true;
- }
-
- if (fAnimContentDirty && fSource)
- {
- fAnimContentDirty = false;
-
- SkString str;
- SkEvent evt("user");
- evt.setString("id", "setFields");
- evt.setS32("rowCount", fVisibleRowCount);
-
- SkEvent dimEvt("user");
- dimEvt.setString("id", "setDim");
- dimEvt.setScalar("dimX", this->getContentWidth());
- dimEvt.setScalar("dimY", this->height());
-
- for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
- {
- evt.setS32("relativeIndex", i - fScrollIndex);
- for (int j = 0; j < fBindingCount; j++)
- {
- fSource->getRecord(i, fBindings[j].fFieldIndex, &str);
+ if (fSkinName.size() == 0)
+ return false;
+
+ if (fAnims == NULL)
+ {
+ int n = SkMax32(1, fVisibleRowCount);
+
+ SkASSERT(fAnimContentDirty);
+ fAnims = new SkAnimator[n];
+ for (int i = 0; i < n; i++)
+ {
+ fAnims[i].setHostEventSink(this);
+ init_skin_anim(fSkinName.c_str(), &fAnims[i]);
+ }
+
+ fHeights[kNormal_Height] = fAnims[0].getScalar("idleHeight", "value");
+ fHeights[kSelected_Height] = fAnims[0].getScalar("focusedHeight", "value");
+
+ fAnimFocusDirty = true;
+ }
+
+ if (fAnimContentDirty && fSource)
+ {
+ fAnimContentDirty = false;
+
+ SkString str;
+ SkEvent evt("user");
+ evt.setString("id", "setFields");
+ evt.setS32("rowCount", fVisibleRowCount);
+
+ SkEvent dimEvt("user");
+ dimEvt.setString("id", "setDim");
+ dimEvt.setScalar("dimX", this->getContentWidth());
+ dimEvt.setScalar("dimY", this->height());
+
+ for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
+ {
+ evt.setS32("relativeIndex", i - fScrollIndex);
+ for (int j = 0; j < fBindingCount; j++)
+ {
+ fSource->getRecord(i, fBindings[j].fFieldIndex, &str);
//SkDEBUGF(("getRecord(%d,%d,%s) slot(%s)\n", i, fBindings[j].fFieldIndex, str.c_str(), fBindings[j].fSlotName.c_str()));
- evt.setString(fBindings[j].fSlotName.c_str(), str.c_str());
- }
- (void)fAnims[i % fVisibleRowCount].doUserEvent(evt);
- (void)fAnims[i % fVisibleRowCount].doUserEvent(dimEvt);
- }
- fAnimFocusDirty = true;
- }
-
- if (fAnimFocusDirty)
- {
+ evt.setString(fBindings[j].fSlotName.c_str(), str.c_str());
+ }
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(evt);
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(dimEvt);
+ }
+ fAnimFocusDirty = true;
+ }
+
+ if (fAnimFocusDirty)
+ {
//SkDEBUGF(("service fAnimFocusDirty\n"));
- fAnimFocusDirty = false;
+ fAnimFocusDirty = false;
- SkEvent focusEvt("user");
- focusEvt.setString("id", "setFocus");
+ SkEvent focusEvt("user");
+ focusEvt.setString("id", "setFocus");
- for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
- {
- focusEvt.setS32("FOCUS", i == fCurrIndex);
- (void)fAnims[i % fVisibleRowCount].doUserEvent(focusEvt);
- }
- }
+ for (int i = fScrollIndex; i < fScrollIndex + fVisibleRowCount; i++)
+ {
+ focusEvt.setS32("FOCUS", i == fCurrIndex);
+ (void)fAnims[i % fVisibleRowCount].doUserEvent(focusEvt);
+ }
+ }
- return true;
+ return true;
}
void SkListView::ensureVisibleRowCount()
{
- SkScalar height = this->height();
- int n = 0;
-
- if (height > 0)
- {
- n = 1;
- height -= fHeights[kSelected_Height];
- if (height > 0)
- {
- SkScalar count = SkScalarDiv(height, fHeights[kNormal_Height]);
- n += SkScalarFloor(count);
- if (count - SkIntToScalar(n) > SK_Scalar1*3/4)
- n += 1;
-
- // SkDebugf("count %g, n %d\n", count/65536., n);
- }
- }
-
- if (fVisibleRowCount != n)
- {
- if (fScrollBar)
- fScrollBar->setShown(n);
-
- fVisibleRowCount = n;
- this->ensureSelectionIsVisible();
- this->dirtyCache(kAnimCount_DirtyFlag | kAnimContent_DirtyFlag);
- }
+ SkScalar height = this->height();
+ int n = 0;
+
+ if (height > 0)
+ {
+ n = 1;
+ height -= fHeights[kSelected_Height];
+ if (height > 0)
+ {
+ SkScalar count = SkScalarDiv(height, fHeights[kNormal_Height]);
+ n += SkScalarFloor(count);
+ if (count - SkIntToScalar(n) > SK_Scalar1*3/4)
+ n += 1;
+
+ // SkDebugf("count %g, n %d\n", count/65536., n);
+ }
+ }
+
+ if (fVisibleRowCount != n)
+ {
+ if (fScrollBar)
+ fScrollBar->setShown(n);
+
+ fVisibleRowCount = n;
+ this->ensureSelectionIsVisible();
+ this->dirtyCache(kAnimCount_DirtyFlag | kAnimContent_DirtyFlag);
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -336,76 +336,76 @@ void SkListView::ensureVisibleRowCount()
void SkListView::onSizeChange()
{
- this->INHERITED::onSizeChange();
+ this->INHERITED::onSizeChange();
- if (fScrollBar)
- fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
+ if (fScrollBar)
+ fScrollBar->setLoc(this->width()-SkIntToScalar(10), 0);
- this->ensureVisibleRowCount();
+ this->ensureVisibleRowCount();
}
void SkListView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- this->ensureVisibleRowCount();
+ this->ensureVisibleRowCount();
- int visibleCount = SkMin32(fVisibleRowCount, fSource->countRecords() - fScrollIndex);
- if (visibleCount == 0 || !this->ensureCache())
- return;
+ int visibleCount = SkMin32(fVisibleRowCount, fSource->countRecords() - fScrollIndex);
+ if (visibleCount == 0 || !this->ensureCache())
+ return;
//SkDebugf("visibleCount %d scrollIndex %d currIndex %d\n", visibleCount, fScrollIndex, fCurrIndex);
- SkAutoCanvasRestore ar(canvas, true);
- SkMSec now = SkTime::GetMSecs();
- SkRect bounds;
-
- bounds.fLeft = 0;
- bounds.fRight = this->getContentWidth();
- bounds.fBottom = 0;
- // assign bounds.fTop inside the loop
-
- // hack to reveal our bounds for debugging
- if (this->hasFocus())
- canvas->drawARGB(0x11, 0, 0, 0xFF);
- else
- canvas->drawARGB(0x11, 0x88, 0x88, 0x88);
-
- for (int i = fScrollIndex; i < fScrollIndex + visibleCount; i++)
- {
- SkPaint paint;
- SkScalar height = fHeights[i == fCurrIndex ? kSelected_Height : kNormal_Height];
-
- bounds.fTop = bounds.fBottom;
- bounds.fBottom += height;
-
- canvas->save();
- if (fAnims[i % fVisibleRowCount].draw(canvas, &paint, now) != SkAnimator::kNotDifferent)
- this->inval(&bounds);
- canvas->restore();
-
- canvas->translate(0, height);
- }
+ SkAutoCanvasRestore ar(canvas, true);
+ SkMSec now = SkTime::GetMSecs();
+ SkRect bounds;
+
+ bounds.fLeft = 0;
+ bounds.fRight = this->getContentWidth();
+ bounds.fBottom = 0;
+ // assign bounds.fTop inside the loop
+
+ // hack to reveal our bounds for debugging
+ if (this->hasFocus())
+ canvas->drawARGB(0x11, 0, 0, 0xFF);
+ else
+ canvas->drawARGB(0x11, 0x88, 0x88, 0x88);
+
+ for (int i = fScrollIndex; i < fScrollIndex + visibleCount; i++)
+ {
+ SkPaint paint;
+ SkScalar height = fHeights[i == fCurrIndex ? kSelected_Height : kNormal_Height];
+
+ bounds.fTop = bounds.fBottom;
+ bounds.fBottom += height;
+
+ canvas->save();
+ if (fAnims[i % fVisibleRowCount].draw(canvas, &paint, now) != SkAnimator::kNotDifferent)
+ this->inval(&bounds);
+ canvas->restore();
+
+ canvas->translate(0, height);
+ }
}
bool SkListView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Key))
- {
- switch (evt.getFast32()) {
- case kUp_SkKey:
- return this->moveSelectionUp();
- case kDown_SkKey:
- return this->moveSelectionDown();
- case kRight_SkKey:
- case kOK_SkKey:
- this->postWidgetEvent();
- return true;
- default:
- break;
- }
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Key))
+ {
+ switch (evt.getFast32()) {
+ case kUp_SkKey:
+ return this->moveSelectionUp();
+ case kDown_SkKey:
+ return this->moveSelectionDown();
+ case kRight_SkKey:
+ case kOK_SkKey:
+ this->postWidgetEvent();
+ return true;
+ default:
+ break;
+ }
+ }
+ return this->INHERITED::onEvent(evt);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -414,78 +414,78 @@ static const char gListViewEventSlot[] = "sk-listview-slot-name";
/*virtual*/ bool SkListView::onPrepareWidgetEvent(SkEvent* evt)
{
- if (fSource && fCurrIndex >= 0 && this->INHERITED::onPrepareWidgetEvent(evt) &&
- fSource->prepareWidgetEvent(evt, fCurrIndex))
- {
- evt->setS32(gListViewEventSlot, fCurrIndex);
- return true;
- }
- return false;
+ if (fSource && fCurrIndex >= 0 && this->INHERITED::onPrepareWidgetEvent(evt) &&
+ fSource->prepareWidgetEvent(evt, fCurrIndex))
+ {
+ evt->setS32(gListViewEventSlot, fCurrIndex);
+ return true;
+ }
+ return false;
}
int SkListView::GetWidgetEventListIndex(const SkEvent& evt)
{
- int32_t index;
+ int32_t index;
- return evt.findS32(gListViewEventSlot, &index) ? index : -1;
+ return evt.findS32(gListViewEventSlot, &index) ? index : -1;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- {
- bool hasScrollBar;
- if (dom.findBool(node, "scrollBar", &hasScrollBar))
- this->setHasScrollBar(hasScrollBar);
- }
-
- const SkDOM::Node* child;
-
- if ((child = dom.getFirstChild(node, "bindings")) != NULL)
- {
- delete[] fBindings;
- fBindings = NULL;
- fBindingCount = 0;
-
- SkListSource* listSrc = SkListSource::Factory(dom.findAttr(child, "data-fields"));
- SkASSERT(listSrc);
- fSkinName.set(dom.findAttr(child, "skin-slots"));
- SkASSERT(fSkinName.size());
-
- this->setListSource(listSrc)->unref();
-
- int count = dom.countChildren(child, "bind");
- if (count > 0)
- {
- fBindings = new BindingRec[count];
- count = 0; // reuse this to count up to the number of valid bindings
-
- child = dom.getFirstChild(child, "bind");
- SkASSERT(child);
- do {
- const char* fieldName = dom.findAttr(child, "field");
- const char* slotName = dom.findAttr(child, "slot");
- if (fieldName && slotName)
- {
- fBindings[count].fFieldIndex = listSrc->findFieldIndex(fieldName);
- if (fBindings[count].fFieldIndex >= 0)
- fBindings[count++].fSlotName.set(slotName);
- }
- } while ((child = dom.getNextSibling(child, "bind")) != NULL);
-
- fBindingCount = SkToU16(count);
- if (count == 0)
- {
- SkDEBUGF(("SkListView::onInflate: no valid <bind> elements in <listsource>\n"));
- delete[] fBindings;
- }
- }
- this->dirtyCache(kAnimCount_DirtyFlag);
- this->setSelection(0);
- }
+ this->INHERITED::onInflate(dom, node);
+
+ {
+ bool hasScrollBar;
+ if (dom.findBool(node, "scrollBar", &hasScrollBar))
+ this->setHasScrollBar(hasScrollBar);
+ }
+
+ const SkDOM::Node* child;
+
+ if ((child = dom.getFirstChild(node, "bindings")) != NULL)
+ {
+ delete[] fBindings;
+ fBindings = NULL;
+ fBindingCount = 0;
+
+ SkListSource* listSrc = SkListSource::Factory(dom.findAttr(child, "data-fields"));
+ SkASSERT(listSrc);
+ fSkinName.set(dom.findAttr(child, "skin-slots"));
+ SkASSERT(fSkinName.size());
+
+ this->setListSource(listSrc)->unref();
+
+ int count = dom.countChildren(child, "bind");
+ if (count > 0)
+ {
+ fBindings = new BindingRec[count];
+ count = 0; // reuse this to count up to the number of valid bindings
+
+ child = dom.getFirstChild(child, "bind");
+ SkASSERT(child);
+ do {
+ const char* fieldName = dom.findAttr(child, "field");
+ const char* slotName = dom.findAttr(child, "slot");
+ if (fieldName && slotName)
+ {
+ fBindings[count].fFieldIndex = listSrc->findFieldIndex(fieldName);
+ if (fBindings[count].fFieldIndex >= 0)
+ fBindings[count++].fSlotName.set(slotName);
+ }
+ } while ((child = dom.getNextSibling(child, "bind")) != NULL);
+
+ fBindingCount = SkToU16(count);
+ if (count == 0)
+ {
+ SkDEBUGF(("SkListView::onInflate: no valid <bind> elements in <listsource>\n"));
+ delete[] fBindings;
+ }
+ }
+ this->dirtyCache(kAnimCount_DirtyFlag);
+ this->setSelection(0);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -493,137 +493,137 @@ void SkListView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
class SkXMLListSource : public SkListSource {
public:
- SkXMLListSource(const char doc[], size_t len);
- virtual ~SkXMLListSource()
- {
- delete[] fFields;
- delete[] fRecords;
- }
-
- virtual int countFields() { return fFieldCount; }
- virtual void getFieldName(int index, SkString* field)
- {
- SkASSERT((unsigned)index < (unsigned)fFieldCount);
- if (field)
- *field = fFields[index];
- }
- virtual int findFieldIndex(const char field[])
- {
- for (int i = 0; i < fFieldCount; i++)
- if (fFields[i].equals(field))
- return i;
- return -1;
- }
-
- virtual int countRecords() { return fRecordCount; }
- virtual void getRecord(int rowIndex, int fieldIndex, SkString* data)
- {
- SkASSERT((unsigned)rowIndex < (unsigned)fRecordCount);
- SkASSERT((unsigned)fieldIndex < (unsigned)fFieldCount);
- if (data)
- *data = fRecords[rowIndex * fFieldCount + fieldIndex];
- }
-
- virtual bool prepareWidgetEvent(SkEvent* evt, int rowIndex)
- {
- // hack, for testing right now. Need the xml to tell us what to jam in and where
- SkString data;
-
- this->getRecord(rowIndex, 0, &data);
- evt->setString("xml-listsource", data.c_str());
- return true;
- }
-
+ SkXMLListSource(const char doc[], size_t len);
+ virtual ~SkXMLListSource()
+ {
+ delete[] fFields;
+ delete[] fRecords;
+ }
+
+ virtual int countFields() { return fFieldCount; }
+ virtual void getFieldName(int index, SkString* field)
+ {
+ SkASSERT((unsigned)index < (unsigned)fFieldCount);
+ if (field)
+ *field = fFields[index];
+ }
+ virtual int findFieldIndex(const char field[])
+ {
+ for (int i = 0; i < fFieldCount; i++)
+ if (fFields[i].equals(field))
+ return i;
+ return -1;
+ }
+
+ virtual int countRecords() { return fRecordCount; }
+ virtual void getRecord(int rowIndex, int fieldIndex, SkString* data)
+ {
+ SkASSERT((unsigned)rowIndex < (unsigned)fRecordCount);
+ SkASSERT((unsigned)fieldIndex < (unsigned)fFieldCount);
+ if (data)
+ *data = fRecords[rowIndex * fFieldCount + fieldIndex];
+ }
+
+ virtual bool prepareWidgetEvent(SkEvent* evt, int rowIndex)
+ {
+ // hack, for testing right now. Need the xml to tell us what to jam in and where
+ SkString data;
+
+ this->getRecord(rowIndex, 0, &data);
+ evt->setString("xml-listsource", data.c_str());
+ return true;
+ }
+
private:
- SkString* fFields; // [fFieldCount]
- SkString* fRecords; // [fRecordCount][fFieldCount]
- int fFieldCount, fRecordCount;
+ SkString* fFields; // [fFieldCount]
+ SkString* fRecords; // [fRecordCount][fFieldCount]
+ int fFieldCount, fRecordCount;
};
#include "SkDOM.h"
SkXMLListSource::SkXMLListSource(const char doc[], size_t len)
{
- fFieldCount = fRecordCount = 0;
- fFields = fRecords = NULL;
-
- SkDOM dom;
-
- const SkDOM::Node* node = dom.build(doc, len);
- SkASSERT(node);
- const SkDOM::Node* child;
-
- child = dom.getFirstChild(node, "fields");
- if (child)
- {
- fFieldCount = dom.countChildren(child, "field");
- fFields = new SkString[fFieldCount];
-
- int n = 0;
- child = dom.getFirstChild(child, "field");
- while (child)
- {
- fFields[n].set(dom.findAttr(child, "name"));
- child = dom.getNextSibling(child, "field");
- n += 1;
- }
- SkASSERT(n == fFieldCount);
- }
-
- child = dom.getFirstChild(node, "records");
- if (child)
- {
- fRecordCount = dom.countChildren(child, "record");
- fRecords = new SkString[fRecordCount * fFieldCount];
-
- int n = 0;
- child = dom.getFirstChild(child, "record");
- while (child)
- {
- for (int i = 0; i < fFieldCount; i++)
- fRecords[n * fFieldCount + i].set(dom.findAttr(child, fFields[i].c_str()));
- child = dom.getNextSibling(child, "record");
- n += 1;
- }
- SkASSERT(n == fRecordCount);
- }
+ fFieldCount = fRecordCount = 0;
+ fFields = fRecords = NULL;
+
+ SkDOM dom;
+
+ const SkDOM::Node* node = dom.build(doc, len);
+ SkASSERT(node);
+ const SkDOM::Node* child;
+
+ child = dom.getFirstChild(node, "fields");
+ if (child)
+ {
+ fFieldCount = dom.countChildren(child, "field");
+ fFields = new SkString[fFieldCount];
+
+ int n = 0;
+ child = dom.getFirstChild(child, "field");
+ while (child)
+ {
+ fFields[n].set(dom.findAttr(child, "name"));
+ child = dom.getNextSibling(child, "field");
+ n += 1;
+ }
+ SkASSERT(n == fFieldCount);
+ }
+
+ child = dom.getFirstChild(node, "records");
+ if (child)
+ {
+ fRecordCount = dom.countChildren(child, "record");
+ fRecords = new SkString[fRecordCount * fFieldCount];
+
+ int n = 0;
+ child = dom.getFirstChild(child, "record");
+ while (child)
+ {
+ for (int i = 0; i < fFieldCount; i++)
+ fRecords[n * fFieldCount + i].set(dom.findAttr(child, fFields[i].c_str()));
+ child = dom.getNextSibling(child, "record");
+ n += 1;
+ }
+ SkASSERT(n == fRecordCount);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////
SkListSource* SkListSource::Factory(const char name[])
{
- static const char gDoc[] =
- "<db name='contacts.db'>"
- "<fields>"
- "<field name='name'/>"
- "<field name='work-num'/>"
- "<field name='home-num'/>"
- "<field name='type'/>"
- "</fields>"
- "<records>"
- "<record name='Andy McFadden' work-num='919 357-1234' home-num='919 123-4567' type='0'/>"
- "<record name='Brian Swetland' work-num='919 123-1234' home-num='929 123-4567' type='1' />"
- "<record name='Chris Desalvo' work-num='919 345-1234' home-num='949 123-4567' type='1' />"
- "<record name='Chris White' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Dan Bornstein' work-num='919 357-1234' home-num='919 123-4567' type='0' />"
- "<record name='Don Cung' work-num='919 123-1234' home-num='929 123-4567' type='2' />"
- "<record name='Eric Fischer' work-num='919 345-1234' home-num='949 123-4567' type='2' />"
- "<record name='Ficus Kirkpatric' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Jack Veenstra' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Jeff Yaksick' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Joe Onorato' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Mathias Agopian' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Mike Fleming' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
- "<record name='Nick Sears' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Rich Miner' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
- "<record name='Tracey Cole' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "<record name='Wei Huang' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
- "</records>"
- "</db>";
-
+ static const char gDoc[] =
+ "<db name='contacts.db'>"
+ "<fields>"
+ "<field name='name'/>"
+ "<field name='work-num'/>"
+ "<field name='home-num'/>"
+ "<field name='type'/>"
+ "</fields>"
+ "<records>"
+ "<record name='Andy McFadden' work-num='919 357-1234' home-num='919 123-4567' type='0'/>"
+ "<record name='Brian Swetland' work-num='919 123-1234' home-num='929 123-4567' type='1' />"
+ "<record name='Chris Desalvo' work-num='919 345-1234' home-num='949 123-4567' type='1' />"
+ "<record name='Chris White' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Dan Bornstein' work-num='919 357-1234' home-num='919 123-4567' type='0' />"
+ "<record name='Don Cung' work-num='919 123-1234' home-num='929 123-4567' type='2' />"
+ "<record name='Eric Fischer' work-num='919 345-1234' home-num='949 123-4567' type='2' />"
+ "<record name='Ficus Kirkpatric' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Jack Veenstra' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Jeff Yaksick' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Joe Onorato' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Mathias Agopian' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Mike Fleming' work-num='919 234-1234' home-num='939 123-4567' type='2' />"
+ "<record name='Nick Sears' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Rich Miner' work-num='919 234-1234' home-num='939 123-4567' type='1' />"
+ "<record name='Tracey Cole' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "<record name='Wei Huang' work-num='919 234-1234' home-num='939 123-4567' type='0' />"
+ "</records>"
+ "</db>";
+
//SkDebugf("doc size %d\n", sizeof(gDoc)-1);
- return new SkXMLListSource(gDoc, sizeof(gDoc) - 1);
+ return new SkXMLListSource(gDoc, sizeof(gDoc) - 1);
}
diff --git a/src/views/animated/SkProgressBarView.cpp b/src/views/animated/SkProgressBarView.cpp
index ce26ac4ed8..e7754eb612 100644
--- a/src/views/animated/SkProgressBarView.cpp
+++ b/src/views/animated/SkProgressBarView.cpp
@@ -13,97 +13,97 @@
SkProgressBarView::SkProgressBarView()
{
- init_skin_anim(kProgress_SkinEnum, &fAnim);
- fAnim.setHostEventSink(this);
- fProgress = 0;
- fMax = 100;
-
+ init_skin_anim(kProgress_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ fProgress = 0;
+ fMax = 100;
+
}
void SkProgressBarView::changeProgress(int diff)
{
- int newProg = fProgress + diff;
- if (newProg > 0 && newProg < fMax)
- this->setProgress(newProg);
- //otherwise i'll just leave it as it is
- //this implies that if a new max and progress are set, max must be set first
+ int newProg = fProgress + diff;
+ if (newProg > 0 && newProg < fMax)
+ this->setProgress(newProg);
+ //otherwise i'll just leave it as it is
+ //this implies that if a new max and progress are set, max must be set first
}
/*virtual*/ void SkProgressBarView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
-
+
/*virtual*/ bool SkProgressBarView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- SkScalar height;
-
- if (evt.findScalar("y", &height))
- this->setHeight(height);
- return true;
- }
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ SkScalar height;
+
+ if (evt.findScalar("y", &height))
+ this->setHeight(height);
+ return true;
+ }
+ return this->INHERITED::onEvent(evt);
}
/*virtual*/ void SkProgressBarView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
- int32_t temp;
- if (dom.findS32(node, "max", &temp))
- this->setMax(temp);
- if (dom.findS32(node, "progress", &temp))
- this->setProgress(temp);
+ this->INHERITED::onInflate(dom, node);
+ int32_t temp;
+ if (dom.findS32(node, "max", &temp))
+ this->setMax(temp);
+ if (dom.findS32(node, "progress", &temp))
+ this->setProgress(temp);
}
/*virtual*/ void SkProgressBarView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
void SkProgressBarView::reset()
{
- fProgress = 0;
- SkEvent e("user");
- e.setString("id", "reset");
- fAnim.doUserEvent(e);
+ fProgress = 0;
+ SkEvent e("user");
+ e.setString("id", "reset");
+ fAnim.doUserEvent(e);
}
void SkProgressBarView::setMax(int max)
{
- fMax = max;
- SkEvent e("user");
- e.setString("id", "setMax");
- e.setS32("newMax", max);
- fAnim.doUserEvent(e);
+ fMax = max;
+ SkEvent e("user");
+ e.setString("id", "setMax");
+ e.setS32("newMax", max);
+ fAnim.doUserEvent(e);
}
void SkProgressBarView::setProgress(int progress)
{
- fProgress = progress;
- SkEvent e("user");
- e.setString("id", "setProgress");
- e.setS32("newProgress", progress);
- fAnim.doUserEvent(e);
+ fProgress = progress;
+ SkEvent e("user");
+ e.setString("id", "setProgress");
+ e.setS32("newProgress", progress);
+ fAnim.doUserEvent(e);
}
diff --git a/src/views/animated/SkScrollBarView.cpp b/src/views/animated/SkScrollBarView.cpp
index 98288f5b74..0d937750be 100644
--- a/src/views/animated/SkScrollBarView.cpp
+++ b/src/views/animated/SkScrollBarView.cpp
@@ -16,131 +16,131 @@
SkScrollBarView::SkScrollBarView()
{
- fAnim.setHostEventSink(this);
- init_skin_anim(kScroll_SkinEnum, &fAnim);
+ fAnim.setHostEventSink(this);
+ init_skin_anim(kScroll_SkinEnum, &fAnim);
- fTotalLength = 0;
- fStartPoint = 0;
- fShownLength = 0;
+ fTotalLength = 0;
+ fStartPoint = 0;
+ fShownLength = 0;
- this->adjust();
+ this->adjust();
}
void SkScrollBarView::setStart(unsigned start)
{
- if ((int)start < 0)
- start = 0;
-
- if (fStartPoint != start)
- {
- fStartPoint = start;
- this->adjust();
- }
+ if ((int)start < 0)
+ start = 0;
+
+ if (fStartPoint != start)
+ {
+ fStartPoint = start;
+ this->adjust();
+ }
}
void SkScrollBarView::setShown(unsigned shown)
{
- if ((int)shown < 0)
- shown = 0;
-
- if (fShownLength != shown)
- {
- fShownLength = shown;
- this->adjust();
- }
+ if ((int)shown < 0)
+ shown = 0;
+
+ if (fShownLength != shown)
+ {
+ fShownLength = shown;
+ this->adjust();
+ }
}
void SkScrollBarView::setTotal(unsigned total)
{
- if ((int)total < 0)
- total = 0;
-
- if (fTotalLength != total)
- {
- fTotalLength = total;
- this->adjust();
- }
+ if ((int)total < 0)
+ total = 0;
+
+ if (fTotalLength != total)
+ {
+ fTotalLength = total;
+ this->adjust();
+ }
}
/* virtual */ void SkScrollBarView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
- this->INHERITED::onInflate(dom, node);
-
- int32_t value;
- if (dom.findS32(node, "total", &value))
- this->setTotal(value);
- if (dom.findS32(node, "shown", &value))
- this->setShown(value);
+ this->INHERITED::onInflate(dom, node);
+
+ int32_t value;
+ if (dom.findS32(node, "total", &value))
+ this->setTotal(value);
+ if (dom.findS32(node, "shown", &value))
+ this->setShown(value);
}
/*virtual*/ void SkScrollBarView::onSizeChange()
{
- this->INHERITED::onSizeChange();
- SkEvent evt("user");
- evt.setString("id", "setDim");
- evt.setScalar("dimX", this->width());
- evt.setScalar("dimY", this->height());
- fAnim.doUserEvent(evt);
+ this->INHERITED::onSizeChange();
+ SkEvent evt("user");
+ evt.setString("id", "setDim");
+ evt.setScalar("dimX", this->width());
+ evt.setScalar("dimY", this->height());
+ fAnim.doUserEvent(evt);
}
/*virtual*/ void SkScrollBarView::onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
- if (diff == SkAnimator::kDifferent)
- this->inval(NULL);
- else if (diff == SkAnimator::kPartiallyDifferent)
- {
- SkRect bounds;
- fAnim.getInvalBounds(&bounds);
- this->inval(&bounds);
- }
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
+ if (diff == SkAnimator::kDifferent)
+ this->inval(NULL);
+ else if (diff == SkAnimator::kPartiallyDifferent)
+ {
+ SkRect bounds;
+ fAnim.getInvalBounds(&bounds);
+ this->inval(&bounds);
+ }
}
/*virtual*/ bool SkScrollBarView::onEvent(const SkEvent& evt)
{
- if (evt.isType(SK_EventType_Inval))
- {
- this->inval(NULL);
- return true;
- }
- if (evt.isType("recommendDim"))
- {
- SkScalar width;
-
- if (evt.findScalar("x", &width))
- this->setWidth(width);
- return true;
- }
-
- return this->INHERITED::onEvent(evt);
+ if (evt.isType(SK_EventType_Inval))
+ {
+ this->inval(NULL);
+ return true;
+ }
+ if (evt.isType("recommendDim"))
+ {
+ SkScalar width;
+
+ if (evt.findScalar("x", &width))
+ this->setWidth(width);
+ return true;
+ }
+
+ return this->INHERITED::onEvent(evt);
}
void SkScrollBarView::adjust()
{
- int total = fTotalLength;
- int start = fStartPoint;
- int shown = fShownLength;
- int hideBar = 0;
-
- if (total <= 0 || shown <= 0 || shown >= total) // no bar to show
- {
- total = 1; // avoid divide-by-zero. should be done by skin/script
- hideBar = 1; // signal we don't want a thumb
- }
- else
- {
- if (start + shown > total)
- start = total - shown;
- }
-
- SkEvent e("user");
- e.setString("id", "adjustScrollBar");
- e.setScalar("_totalLength", SkIntToScalar(total));
- e.setScalar("_startPoint", SkIntToScalar(start));
- e.setScalar("_shownLength", SkIntToScalar(shown));
-// e.setS32("hideBar", hideBar);
- fAnim.doUserEvent(e);
+ int total = fTotalLength;
+ int start = fStartPoint;
+ int shown = fShownLength;
+ int hideBar = 0;
+
+ if (total <= 0 || shown <= 0 || shown >= total) // no bar to show
+ {
+ total = 1; // avoid divide-by-zero. should be done by skin/script
+ hideBar = 1; // signal we don't want a thumb
+ }
+ else
+ {
+ if (start + shown > total)
+ start = total - shown;
+ }
+
+ SkEvent e("user");
+ e.setString("id", "adjustScrollBar");
+ e.setScalar("_totalLength", SkIntToScalar(total));
+ e.setScalar("_startPoint", SkIntToScalar(start));
+ e.setScalar("_shownLength", SkIntToScalar(shown));
+// e.setS32("hideBar", hideBar);
+ fAnim.doUserEvent(e);
}
diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp
index 79eecd6cbd..8ab11835d7 100644
--- a/src/views/animated/SkStaticTextView.cpp
+++ b/src/views/animated/SkStaticTextView.cpp
@@ -21,11 +21,11 @@ static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char
SkStaticTextView::SkStaticTextView()
{
- fMargin.set(0, 0);
- fMode = kFixedSize_Mode;
- fSpacingAlign = SkTextBox::kStart_SpacingAlign;
-
-// init_skin_paint(kStaticText_SkinEnum, &fPaint);
+ fMargin.set(0, 0);
+ fMode = kFixedSize_Mode;
+ fSpacingAlign = SkTextBox::kStart_SpacingAlign;
+
+// init_skin_paint(kStaticText_SkinEnum, &fPaint);
}
SkStaticTextView::~SkStaticTextView()
@@ -34,155 +34,155 @@ SkStaticTextView::~SkStaticTextView()
void SkStaticTextView::computeSize()
{
- if (fMode == kAutoWidth_Mode)
- {
- SkScalar width = fPaint.measureText(fText.c_str(), fText.size());
- this->setWidth(width + fMargin.fX * 2);
- }
- else if (fMode == kAutoHeight_Mode)
- {
- SkScalar width = this->width() - fMargin.fX * 2;
- int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
+ if (fMode == kAutoWidth_Mode)
+ {
+ SkScalar width = fPaint.measureText(fText.c_str(), fText.size());
+ this->setWidth(width + fMargin.fX * 2);
+ }
+ else if (fMode == kAutoHeight_Mode)
+ {
+ SkScalar width = this->width() - fMargin.fX * 2;
+ int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0;
- this->setHeight(lines * fPaint.getFontSpacing() + fMargin.fY * 2);
- }
+ this->setHeight(lines * fPaint.getFontSpacing() + fMargin.fY * 2);
+ }
}
void SkStaticTextView::setMode(Mode mode)
{
- SkASSERT((unsigned)mode < kModeCount);
+ SkASSERT((unsigned)mode < kModeCount);
- if (fMode != mode)
- {
- fMode = SkToU8(mode);
- this->computeSize();
- }
+ if (fMode != mode)
+ {
+ fMode = SkToU8(mode);
+ this->computeSize();
+ }
}
void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align)
{
- fSpacingAlign = SkToU8(align);
- this->inval(NULL);
+ fSpacingAlign = SkToU8(align);
+ this->inval(NULL);
}
void SkStaticTextView::getMargin(SkPoint* margin) const
{
- if (margin)
- *margin = fMargin;
+ if (margin)
+ *margin = fMargin;
}
void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy)
{
- if (fMargin.fX != dx || fMargin.fY != dy)
- {
- fMargin.set(dx, dy);
- this->computeSize();
- this->inval(NULL);
- }
+ if (fMargin.fX != dx || fMargin.fY != dy)
+ {
+ fMargin.set(dx, dy);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
size_t SkStaticTextView::getText(SkString* text) const
{
- if (text)
- *text = fText;
- return fText.size();
+ if (text)
+ *text = fText;
+ return fText.size();
}
size_t SkStaticTextView::getText(char text[]) const
{
- if (text)
- memcpy(text, fText.c_str(), fText.size());
- return fText.size();
+ if (text)
+ memcpy(text, fText.c_str(), fText.size());
+ return fText.size();
}
void SkStaticTextView::setText(const SkString& text)
{
- this->setText(text.c_str(), text.size());
+ this->setText(text.c_str(), text.size());
}
void SkStaticTextView::setText(const char text[])
{
- if (text == NULL)
- text = "";
- this->setText(text, strlen(text));
+ if (text == NULL)
+ text = "";
+ this->setText(text, strlen(text));
}
void SkStaticTextView::setText(const char text[], size_t len)
{
- if (!fText.equals(text, len))
- {
- fText.set(text, len);
- this->computeSize();
- this->inval(NULL);
- }
+ if (!fText.equals(text, len))
+ {
+ fText.set(text, len);
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::getPaint(SkPaint* paint) const
{
- if (paint)
- *paint = fPaint;
+ if (paint)
+ *paint = fPaint;
}
void SkStaticTextView::setPaint(const SkPaint& paint)
{
- if (fPaint != paint)
- {
- fPaint = paint;
- this->computeSize();
- this->inval(NULL);
- }
+ if (fPaint != paint)
+ {
+ fPaint = paint;
+ this->computeSize();
+ this->inval(NULL);
+ }
}
void SkStaticTextView::onDraw(SkCanvas* canvas)
{
- this->INHERITED::onDraw(canvas);
+ this->INHERITED::onDraw(canvas);
- if (fText.isEmpty())
- return;
+ if (fText.isEmpty())
+ return;
- SkTextBox box;
+ SkTextBox box;
- box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
- box.setSpacingAlign(this->getSpacingAlign());
- box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
- box.draw(canvas, fText.c_str(), fText.size(), fPaint);
+ box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode);
+ box.setSpacingAlign(this->getSpacingAlign());
+ box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY);
+ box.draw(canvas, fText.c_str(), fText.size(), fPaint);
}
void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
if (false) { // avoid bit rot, suppress warning
- this->INHERITED::onInflate(dom, node);
-
- int index;
- if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
- this->setMode((Mode)index);
- else
- assert_no_attr(dom, node, "mode");
-
- if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
- this->setSpacingAlign((SkTextBox::SpacingAlign)index);
- else
- assert_no_attr(dom, node, "spacing-align");
-
- SkScalar s[2];
- if (dom.findScalars(node, "margin", s, 2))
- this->setMargin(s[0], s[1]);
- else
- assert_no_attr(dom, node, "margin");
-
- const char* text = dom.findAttr(node, "text");
- if (text)
- this->setText(text);
-
- if ((node = dom.getFirstChild(node, "paint")) != NULL &&
- (node = dom.getFirstChild(node, "screenplay")) != NULL)
- {
+ this->INHERITED::onInflate(dom, node);
+
+ int index;
+ if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
+ this->setMode((Mode)index);
+ else
+ assert_no_attr(dom, node, "mode");
+
+ if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
+ this->setSpacingAlign((SkTextBox::SpacingAlign)index);
+ else
+ assert_no_attr(dom, node, "spacing-align");
+
+ SkScalar s[2];
+ if (dom.findScalars(node, "margin", s, 2))
+ this->setMargin(s[0], s[1]);
+ else
+ assert_no_attr(dom, node, "margin");
+
+ const char* text = dom.findAttr(node, "text");
+ if (text)
+ this->setText(text);
+
+ if ((node = dom.getFirstChild(node, "paint")) != NULL &&
+ (node = dom.getFirstChild(node, "screenplay")) != NULL)
+ {
// FIXME: Including inflate_paint causes Windows build to fail -- it complains
// that SKListView::SkListView is undefined.
#if 0
- inflate_paint(dom, node, &fPaint);
+ inflate_paint(dom, node, &fPaint);
#endif
- }
+ }
}
}
diff --git a/src/views/animated/SkWidgetViews.cpp b/src/views/animated/SkWidgetViews.cpp
index ee03b7b1a7..9c1cae7fb2 100644
--- a/src/views/animated/SkWidgetViews.cpp
+++ b/src/views/animated/SkWidgetViews.cpp
@@ -19,7 +19,7 @@ enum SkinEnum {
kProgress_SkinEnum,
kScroll_SkinEnum,
kStaticText_SkinEnum,
-
+
kSkinEnumCount
};
*/
@@ -45,7 +45,7 @@ void init_skin_anim(const char path[], SkAnimator* anim)
{
SkASSERT(path && anim);
- SkFILEStream stream(path);
+ SkFILEStream stream(path);
if (!stream.isValid())
{
@@ -69,9 +69,9 @@ void init_skin_paint(SkinEnum se, SkPaint* paint)
{
SkASSERT(paint);
- SkAnimator anim;
- SkCanvas canvas;
-
+ SkAnimator anim;
+ SkCanvas canvas;
+
init_skin_anim(se, &anim);
anim.draw(&canvas, paint, 0);
}
@@ -80,15 +80,15 @@ void inflate_paint(const SkDOM& dom, const SkDOM::Node* node, SkPaint* paint)
{
SkASSERT(paint);
- SkAnimator anim;
- SkCanvas canvas;
-
+ SkAnimator anim;
+ SkCanvas canvas;
+
if (!anim.decodeDOM(dom, node))
{
SkDEBUGF(("inflate_paint: decoding dom failed\n"));
SkDEBUGCODE(dom.dump(node);)
sk_throw();
- }
+ }
anim.draw(&canvas, paint, 0);
}
@@ -102,7 +102,7 @@ const char* SkWidgetView::getLabel() const
{
return fLabel.c_str();
}
-
+
void SkWidgetView::getLabel(SkString* label) const
{
if (label)
@@ -118,7 +118,7 @@ void SkWidgetView::setLabel(const char label[], size_t len)
{
if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
{
- SkString tmp(label, len);
+ SkString tmp(label, len);
this->onLabelChange(fLabel.c_str(), tmp.c_str());
fLabel.swap(tmp);
@@ -138,13 +138,13 @@ bool SkWidgetView::postWidgetEvent()
{
if (!fEvent.isType(""))
{
- SkEvent evt(fEvent); // make a copy since onPrepareWidgetEvent may edit the event
+ SkEvent evt(fEvent); // make a copy since onPrepareWidgetEvent may edit the event
if (this->onPrepareWidgetEvent(&evt))
{
SkDEBUGCODE(evt.dump("SkWidgetView::postWidgetEvent");)
- this->postToListeners(evt); // wonder if this should return true if there are > 0 listeners...
+ this->postToListeners(evt); // wonder if this should return true if there are > 0 listeners...
return true;
}
}
@@ -158,7 +158,7 @@ bool SkWidgetView::postWidgetEvent()
const char* label = dom.findAttr(node, "label");
if (label)
this->setLabel(label);
-
+
if ((node = dom.getFirstChild(node, "event")) != NULL)
fEvent.inflate(dom, node);
}
@@ -178,8 +178,8 @@ static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot";
SkEventSinkID SkWidgetView::GetWidgetEventSinkID(const SkEvent& evt)
{
- int32_t sinkID;
-
+ int32_t sinkID;
+
return evt.findS32(gWidgetEventSinkIDSlotName, &sinkID) ? (SkEventSinkID)sinkID : 0;
}
@@ -204,14 +204,14 @@ SkCheckButtonView::SkCheckButtonView() : fCheckState(kOff_CheckState)
void SkCheckButtonView::setCheckState(CheckState state)
{
SkASSERT((unsigned)state <= kUnknown_CheckState);
-
+
if (fCheckState != state)
{
this->onCheckStateChange(this->getCheckState(), state);
fCheckState = SkToU8(state);
}
}
-
+
/*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState)
{
this->inval(NULL);
@@ -220,7 +220,7 @@ void SkCheckButtonView::setCheckState(CheckState state)
/*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
this->INHERITED::onInflate(dom, node);
-
+
int index = dom.findList(node, "check-state", "off,on,unknown");
if (index >= 0)
this->setCheckState((CheckState)index);
@@ -238,8 +238,8 @@ static const char gCheckStateSlotName[] = "sk-checkbutton-check-slot";
bool SkCheckButtonView::GetWidgetEventCheckState(const SkEvent& evt, CheckState* state)
{
- int32_t state32;
-
+ int32_t state32;
+
if (evt.findS32(gCheckStateSlotName, &state32))
{
if (state)
@@ -274,7 +274,7 @@ protected:
evt.setString("LABEL", newLabel);
fAnim.doUserEvent(evt);
}
-
+
virtual void onFocusChange(bool gainFocus)
{
this->INHERITED::onFocusChange(gainFocus);
@@ -298,19 +298,19 @@ protected:
virtual void onDraw(SkCanvas* canvas)
{
- SkPaint paint;
- SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-
+ SkPaint paint;
+ SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+
if (diff == SkAnimator::kDifferent)
this->inval(NULL);
else if (diff == SkAnimator::kPartiallyDifferent)
{
- SkRect bounds;
+ SkRect bounds;
fAnim.getInvalBounds(&bounds);
this->inval(&bounds);
}
}
-
+
virtual bool onEvent(const SkEvent& evt)
{
if (evt.isType(SK_EventType_Inval))
@@ -320,20 +320,20 @@ protected:
}
if (evt.isType("recommendDim"))
{
- SkScalar height;
-
+ SkScalar height;
+
if (evt.findScalar("y", &height))
this->setHeight(height);
return true;
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual bool onPrepareWidgetEvent(SkEvent* evt)
{
if (this->INHERITED::onPrepareWidgetEvent(evt))
{
- SkEvent e("user");
+ SkEvent e("user");
e.setString("id", "handlePress");
(void)fAnim.doUserEvent(e);
return true;
@@ -342,8 +342,8 @@ protected:
}
private:
- SkAnimator fAnim;
-
+ SkAnimator fAnim;
+
typedef SkButtonView INHERITED;
};
@@ -354,7 +354,7 @@ SkView* SkWidgetFactory(const char name[])
{
if (name == NULL)
return NULL;
-
+
// must be in the same order as the SkSkinWidgetEnum is declared
static const char* gNames[] = {
"sk-border",
@@ -364,7 +364,7 @@ SkView* SkWidgetFactory(const char name[])
"sk-progress",
"sk-scroll",
"sk-text"
-
+
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++)
diff --git a/src/views/mac/SkNSView.h b/src/views/mac/SkNSView.h
index 8b83b34f49..109a9982cc 100644
--- a/src/views/mac/SkNSView.h
+++ b/src/views/mac/SkNSView.h
@@ -21,7 +21,7 @@ class SkEvent;
@interface SkNSView : NSView {
BOOL fRedrawRequestPending;
-
+
NSString* fTitle;
SkOSWindow* fWind;
#if SK_SUPPORT_GPU
diff --git a/src/views/mac/SkOSWindow_Mac.cpp b/src/views/mac/SkOSWindow_Mac.cpp
index 63106f088d..ec107901f8 100644
--- a/src/views/mac/SkOSWindow_Mac.cpp
+++ b/src/views/mac/SkOSWindow_Mac.cpp
@@ -26,15 +26,15 @@
static void (*gPrevNewHandler)();
extern "C" {
- static void sk_new_handler()
- {
- if (SkGraphics::SetFontCacheUsed(0))
- return;
- if (gPrevNewHandler)
- gPrevNewHandler();
- else
- sk_throw();
- }
+ static void sk_new_handler()
+ {
+ if (SkGraphics::SetFontCacheUsed(0))
+ return;
+ if (gPrevNewHandler)
+ gPrevNewHandler();
+ else
+ sk_throw();
+ }
}
static SkOSWindow* gCurrOSWin;
@@ -43,36 +43,36 @@ static EventQueueRef gCurrEventQ;
static OSStatus MyDrawEventHandler(EventHandlerCallRef myHandler,
EventRef event, void *userData) {
- // NOTE: GState is save/restored by the HIView system doing the callback,
+ // NOTE: GState is save/restored by the HIView system doing the callback,
// so the draw handler doesn't need to do it
- OSStatus status = noErr;
- CGContextRef context;
- HIRect bounds;
+ OSStatus status = noErr;
+ CGContextRef context;
+ HIRect bounds;
- // Get the CGContextRef
- status = GetEventParameter (event, kEventParamCGContextRef,
+ // Get the CGContextRef
+ status = GetEventParameter (event, kEventParamCGContextRef,
typeCGContextRef, NULL,
sizeof (CGContextRef),
NULL,
&context);
- if (status != noErr) {
- SkDebugf("Got error %d getting the context!\n", status);
- return status;
- }
+ if (status != noErr) {
+ SkDebugf("Got error %d getting the context!\n", status);
+ return status;
+ }
- // Get the bounding rectangle
- HIViewGetBounds ((HIViewRef) userData, &bounds);
+ // Get the bounding rectangle
+ HIViewGetBounds ((HIViewRef) userData, &bounds);
gCurrOSWin->doPaint(context);
- return status;
+ return status;
}
-#define SK_MacEventClass FOUR_CHAR_CODE('SKec')
-#define SK_MacEventKind FOUR_CHAR_CODE('SKek')
-#define SK_MacEventParamName FOUR_CHAR_CODE('SKev')
-#define SK_MacEventSinkIDParamName FOUR_CHAR_CODE('SKes')
+#define SK_MacEventClass FOUR_CHAR_CODE('SKec')
+#define SK_MacEventKind FOUR_CHAR_CODE('SKek')
+#define SK_MacEventParamName FOUR_CHAR_CODE('SKev')
+#define SK_MacEventSinkIDParamName FOUR_CHAR_CODE('SKes')
static void set_bindingside(HISideBinding* side, HIViewRef parent, HIBindingKind kind) {
side->toView = parent;
@@ -94,17 +94,17 @@ static void set_axisposition(HIAxisPosition* pos, HIViewRef parent, HIPositionKi
SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd), fAGLCtx(NULL)
{
- OSStatus result;
+ OSStatus result;
WindowRef wr = (WindowRef)hWnd;
HIViewRef imageView, parent;
HIViewRef rootView = HIViewGetRoot(wr);
HIViewFindByID(rootView, kHIViewWindowContentID, &parent);
result = HIImageViewCreate(NULL, &imageView);
- SkASSERT(result == noErr);
+ SkASSERT(result == noErr);
result = HIViewAddSubview(parent, imageView);
- SkASSERT(result == noErr);
+ SkASSERT(result == noErr);
fHVIEW = imageView;
@@ -128,41 +128,41 @@ SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd), fAGLCtx(NULL)
HIImageViewSetOpaque(imageView, true);
HIImageViewSetScaleToFit(imageView, false);
- static const EventTypeSpec gTypes[] = {
- { kEventClassKeyboard, kEventRawKeyDown },
+ static const EventTypeSpec gTypes[] = {
+ { kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyUp },
- { kEventClassMouse, kEventMouseDown },
- { kEventClassMouse, kEventMouseDragged },
- { kEventClassMouse, kEventMouseMoved },
- { kEventClassMouse, kEventMouseUp },
- { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
- { kEventClassWindow, kEventWindowBoundsChanged },
-// { kEventClassWindow, kEventWindowDrawContent },
- { SK_MacEventClass, SK_MacEventKind }
- };
-
- EventHandlerUPP handlerUPP = NewEventHandlerUPP(SkOSWindow::EventHandler);
- int count = SK_ARRAY_COUNT(gTypes);
-
- result = InstallEventHandler(GetWindowEventTarget(wr), handlerUPP,
- count, gTypes, this, nil);
- SkASSERT(result == noErr);
-
- gCurrOSWin = this;
- gCurrEventQ = GetCurrentEventQueue();
- gEventTarget = GetWindowEventTarget(wr);
-
- static bool gOnce = true;
- if (gOnce) {
- gOnce = false;
- gPrevNewHandler = set_new_handler(sk_new_handler);
- }
+ { kEventClassMouse, kEventMouseDown },
+ { kEventClassMouse, kEventMouseDragged },
+ { kEventClassMouse, kEventMouseMoved },
+ { kEventClassMouse, kEventMouseUp },
+ { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
+ { kEventClassWindow, kEventWindowBoundsChanged },
+// { kEventClassWindow, kEventWindowDrawContent },
+ { SK_MacEventClass, SK_MacEventKind }
+ };
+
+ EventHandlerUPP handlerUPP = NewEventHandlerUPP(SkOSWindow::EventHandler);
+ int count = SK_ARRAY_COUNT(gTypes);
+
+ result = InstallEventHandler(GetWindowEventTarget(wr), handlerUPP,
+ count, gTypes, this, nil);
+ SkASSERT(result == noErr);
+
+ gCurrOSWin = this;
+ gCurrEventQ = GetCurrentEventQueue();
+ gEventTarget = GetWindowEventTarget(wr);
+
+ static bool gOnce = true;
+ if (gOnce) {
+ gOnce = false;
+ gPrevNewHandler = set_new_handler(sk_new_handler);
+ }
}
void SkOSWindow::doPaint(void* ctx)
{
#if 0
- this->update(NULL);
+ this->update(NULL);
const SkBitmap& bm = this->getBitmap();
CGImageRef img = SkCreateCGImageRef(bm);
@@ -187,10 +187,10 @@ void SkOSWindow::doPaint(void* ctx)
void SkOSWindow::updateSize()
{
- Rect r;
+ Rect r;
- GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r);
- this->resize(r.right - r.left, r.bottom - r.top);
+ GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r);
+ this->resize(r.right - r.left, r.bottom - r.top);
#if 0
HIRect frame;
@@ -238,24 +238,24 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu)
static void getparam(EventRef inEvent, OSType name, OSType type, UInt32 size, void* data)
{
- EventParamType actualType;
- UInt32 actualSize;
- OSStatus status;
-
- status = GetEventParameter(inEvent, name, type, &actualType, size, &actualSize, data);
- SkASSERT(status == noErr);
- SkASSERT(actualType == type);
- SkASSERT(actualSize == size);
+ EventParamType actualType;
+ UInt32 actualSize;
+ OSStatus status;
+
+ status = GetEventParameter(inEvent, name, type, &actualType, size, &actualSize, data);
+ SkASSERT(status == noErr);
+ SkASSERT(actualType == type);
+ SkASSERT(actualSize == size);
}
enum {
- SK_MacReturnKey = 36,
- SK_MacDeleteKey = 51,
- SK_MacEndKey = 119,
- SK_MacLeftKey = 123,
- SK_MacRightKey = 124,
- SK_MacDownKey = 125,
- SK_MacUpKey = 126,
+ SK_MacReturnKey = 36,
+ SK_MacDeleteKey = 51,
+ SK_MacEndKey = 119,
+ SK_MacLeftKey = 123,
+ SK_MacRightKey = 124,
+ SK_MacDownKey = 125,
+ SK_MacUpKey = 126,
SK_Mac0Key = 0x52,
SK_Mac1Key = 0x53,
@@ -271,17 +271,17 @@ enum {
static SkKey raw2key(UInt32 raw)
{
- static const struct {
- UInt32 fRaw;
- SkKey fKey;
- } gKeys[] = {
- { SK_MacUpKey, kUp_SkKey },
- { SK_MacDownKey, kDown_SkKey },
- { SK_MacLeftKey, kLeft_SkKey },
- { SK_MacRightKey, kRight_SkKey },
- { SK_MacReturnKey, kOK_SkKey },
- { SK_MacDeleteKey, kBack_SkKey },
- { SK_MacEndKey, kEnd_SkKey },
+ static const struct {
+ UInt32 fRaw;
+ SkKey fKey;
+ } gKeys[] = {
+ { SK_MacUpKey, kUp_SkKey },
+ { SK_MacDownKey, kDown_SkKey },
+ { SK_MacLeftKey, kLeft_SkKey },
+ { SK_MacRightKey, kRight_SkKey },
+ { SK_MacReturnKey, kOK_SkKey },
+ { SK_MacDeleteKey, kBack_SkKey },
+ { SK_MacEndKey, kEnd_SkKey },
{ SK_Mac0Key, k0_SkKey },
{ SK_Mac1Key, k1_SkKey },
{ SK_Mac2Key, k2_SkKey },
@@ -292,54 +292,54 @@ static SkKey raw2key(UInt32 raw)
{ SK_Mac7Key, k7_SkKey },
{ SK_Mac8Key, k8_SkKey },
{ SK_Mac9Key, k9_SkKey }
- };
+ };
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
- if (gKeys[i].fRaw == raw)
- return gKeys[i].fKey;
- return kNONE_SkKey;
+ for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
+ if (gKeys[i].fRaw == raw)
+ return gKeys[i].fKey;
+ return kNONE_SkKey;
}
static void post_skmacevent()
{
- EventRef ref;
- OSStatus status = CreateEvent(nil, SK_MacEventClass, SK_MacEventKind, 0, 0, &ref);
- SkASSERT(status == noErr);
+ EventRef ref;
+ OSStatus status = CreateEvent(nil, SK_MacEventClass, SK_MacEventKind, 0, 0, &ref);
+ SkASSERT(status == noErr);
#if 0
- status = SetEventParameter(ref, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
- SkASSERT(status == noErr);
- status = SetEventParameter(ref, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
- SkASSERT(status == noErr);
+ status = SetEventParameter(ref, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
+ SkASSERT(status == noErr);
+ status = SetEventParameter(ref, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
+ SkASSERT(status == noErr);
#endif
- EventTargetRef target = gEventTarget;
- SetEventParameter(ref, kEventParamPostTarget, typeEventTargetRef, sizeof(target), &target);
- SkASSERT(status == noErr);
+ EventTargetRef target = gEventTarget;
+ SetEventParameter(ref, kEventParamPostTarget, typeEventTargetRef, sizeof(target), &target);
+ SkASSERT(status == noErr);
- status = PostEventToQueue(gCurrEventQ, ref, kEventPriorityStandard);
- SkASSERT(status == noErr);
+ status = PostEventToQueue(gCurrEventQ, ref, kEventPriorityStandard);
+ SkASSERT(status == noErr);
- ReleaseEvent(ref);
+ ReleaseEvent(ref);
}
pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* userData )
{
- SkOSWindow* win = (SkOSWindow*)userData;
- OSStatus result = eventNotHandledErr;
- UInt32 wClass = GetEventClass(inEvent);
- UInt32 wKind = GetEventKind(inEvent);
+ SkOSWindow* win = (SkOSWindow*)userData;
+ OSStatus result = eventNotHandledErr;
+ UInt32 wClass = GetEventClass(inEvent);
+ UInt32 wKind = GetEventKind(inEvent);
- gCurrOSWin = win; // will need to be in TLS. Set this so PostEvent will work
+ gCurrOSWin = win; // will need to be in TLS. Set this so PostEvent will work
- switch (wClass) {
+ switch (wClass) {
case kEventClassMouse: {
- Point pt;
- getparam(inEvent, kEventParamMouseLocation, typeQDPoint, sizeof(pt), &pt);
- SetPortWindowPort((WindowRef)win->getHWND());
- GlobalToLocal(&pt);
+ Point pt;
+ getparam(inEvent, kEventParamMouseLocation, typeQDPoint, sizeof(pt), &pt);
+ SetPortWindowPort((WindowRef)win->getHWND());
+ GlobalToLocal(&pt);
- switch (wKind) {
+ switch (wKind) {
case kEventMouseDown:
if (win->handleClick(pt.h, pt.v, Click::kDown_State)) {
result = noErr;
@@ -357,9 +357,9 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
break;
default:
break;
- }
+ }
break;
- }
+ }
case kEventClassKeyboard:
if (wKind == kEventRawKeyDown) {
UInt32 raw;
@@ -412,8 +412,8 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
post_skmacevent();
}
#if 0
- SkEvent* evt;
- SkEventSinkID sinkID;
+ SkEvent* evt;
+ SkEventSinkID sinkID;
getparam(inEvent, SK_MacEventParamName, SK_MacEventParamName, sizeof(evt), &evt);
getparam(inEvent, SK_MacEventSinkIDParamName, SK_MacEventSinkIDParamName, sizeof(sinkID), &sinkID);
#endif
@@ -422,47 +422,47 @@ pascal OSStatus SkOSWindow::EventHandler( EventHandlerCallRef inHandler, EventRe
}
default:
break;
- }
- if (result == eventNotHandledErr) {
- result = CallNextEventHandler(inHandler, inEvent);
}
- return result;
+ if (result == eventNotHandledErr) {
+ result = CallNextEventHandler(inHandler, inEvent);
+ }
+ return result;
}
///////////////////////////////////////////////////////////////////////////////////////
void SkEvent::SignalNonEmptyQueue()
{
- post_skmacevent();
-// SkDebugf("signal nonempty\n");
+ post_skmacevent();
+// SkDebugf("signal nonempty\n");
}
-static TMTask gTMTaskRec;
-static TMTask* gTMTaskPtr;
+static TMTask gTMTaskRec;
+static TMTask* gTMTaskPtr;
static void sk_timer_proc(TMTask* rec)
{
- SkEvent::ServiceQueueTimer();
-// SkDebugf("timer task fired\n");
+ SkEvent::ServiceQueueTimer();
+// SkDebugf("timer task fired\n");
}
void SkEvent::SignalQueueTimer(SkMSec delay)
{
- if (gTMTaskPtr)
- {
- RemoveTimeTask((QElem*)gTMTaskPtr);
- DisposeTimerUPP(gTMTaskPtr->tmAddr);
- gTMTaskPtr = nil;
- }
- if (delay)
- {
- gTMTaskPtr = &gTMTaskRec;
- memset(gTMTaskPtr, 0, sizeof(gTMTaskRec));
- gTMTaskPtr->tmAddr = NewTimerUPP(sk_timer_proc);
- OSErr err = InstallTimeTask((QElem*)gTMTaskPtr);
-// SkDebugf("installtimetask of %d returned %d\n", delay, err);
- PrimeTimeTask((QElem*)gTMTaskPtr, delay);
- }
+ if (gTMTaskPtr)
+ {
+ RemoveTimeTask((QElem*)gTMTaskPtr);
+ DisposeTimerUPP(gTMTaskPtr->tmAddr);
+ gTMTaskPtr = nil;
+ }
+ if (delay)
+ {
+ gTMTaskPtr = &gTMTaskRec;
+ memset(gTMTaskPtr, 0, sizeof(gTMTaskRec));
+ gTMTaskPtr->tmAddr = NewTimerUPP(sk_timer_proc);
+ OSErr err = InstallTimeTask((QElem*)gTMTaskPtr);
+// SkDebugf("installtimetask of %d returned %d\n", delay, err);
+ PrimeTimeTask((QElem*)gTMTaskPtr, delay);
+ }
}
#define USE_MSAA 0
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index c2ba8b4349..4edc5acfd3 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -24,7 +24,7 @@ static void post_SkEvent_event() {
static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
SkBitmap::Config config;
-
+
switch (src->format->BytesPerPixel) {
case 2:
config = SkBitmap::kRGB_565_Config;
@@ -35,7 +35,7 @@ static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
default:
return false;
}
-
+
dst->setConfig(config, src->w, src->h, src->pitch);
dst->setPixels(src->pixels);
return true;
@@ -44,7 +44,7 @@ static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
SkOSWindow::SkOSWindow(void* screen) {
fScreen = reinterpret_cast<SDL_Surface*>(screen);
this->resize(fScreen->w, fScreen->h);
-
+
uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT;
uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT;
uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT;
@@ -141,7 +141,7 @@ static SkKey find_skkey(SDLKey src) {
SDLK_UNKNOWN, // power
SDLK_UNKNOWN, // camera
};
-
+
const SDLKey* array = gKeys;
for (size_t i = 0; i < SK_ARRAY_COUNT(gKeys); i++) {
if (array[i] == src) {
@@ -213,7 +213,7 @@ void SkEvent::SignalNonEmptyQueue() {
static Uint32 timer_callback(Uint32 interval) {
// SkDebugf("-------- timercallback %d\n", interval);
- SkEvent::ServiceQueueTimer();
+ SkEvent::ServiceQueueTimer();
return 0;
}
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index e761bdef74..46a2b3dd09 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -231,7 +231,7 @@ bool SkOSWindow::attach(SkBackEndTypes /* attachType */, int msaaSampleCount) {
this->initWindow(msaaSampleCount);
if (NULL == fUnixWindow.fDisplay) {
return false;
- }
+ }
if (NULL == fUnixWindow.fGLContext) {
SkASSERT(NULL != fVi);
diff --git a/src/views/unix/keysym2ucs.c b/src/views/unix/keysym2ucs.c
index 520c6a7614..a0c4ced9e0 100644
--- a/src/views/unix/keysym2ucs.c
+++ b/src/views/unix/keysym2ucs.c
@@ -828,19 +828,19 @@ long keysym2ucs(KeySym keysym)
/* also check for directly encoded 24-bit UCS characters */
if ((keysym & 0xff000000) == 0x01000000)
- return keysym & 0x00ffffff;
+ return keysym & 0x00ffffff;
/* binary search in table */
while (max >= min) {
- mid = (min + max) / 2;
- if (keysymtab[mid].keysym < keysym)
- min = mid + 1;
- else if (keysymtab[mid].keysym > keysym)
- max = mid - 1;
- else {
- /* found it */
- return keysymtab[mid].ucs;
- }
+ mid = (min + max) / 2;
+ if (keysymtab[mid].keysym < keysym)
+ min = mid + 1;
+ else if (keysymtab[mid].keysym > keysym)
+ max = mid - 1;
+ else {
+ /* found it */
+ return keysymtab[mid].ucs;
+ }
}
/* no matching Unicode value found */
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index 88a0a36a0f..038a2e85a1 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -115,7 +115,7 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} break;
case WM_UNICHAR:
this->handleChar(wParam);
- return true;
+ return true;
case WM_CHAR: {
this->handleChar(SkUTF8_ToUnichar((char*)&wParam));
return true;
@@ -138,11 +138,11 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
delete rect;
return true;
} break;
-
- case WM_LBUTTONDOWN:
+
+ case WM_LBUTTONDOWN:
this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), Click::kDown_State);
return true;
-
+
case WM_MOUSEMOVE:
this->handleClick(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), Click::kMoved_State);
return true;
@@ -172,15 +172,15 @@ void SkOSWindow::doPaint(void* ctx) {
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = bitmap.width();
- bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
+ bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
- //
- // Do the SetDIBitsToDevice.
- //
+ //
+ // Do the SetDIBitsToDevice.
+ //
// TODO(wjmaclean):
// Fix this call to handle SkBitmaps that have rowBytes != width,
// i.e. may have padding at the end of lines. The SkASSERT below
@@ -235,7 +235,7 @@ enum {
SK_MacRightKey = 124,
SK_MacDownKey = 125,
SK_MacUpKey = 126,
-
+
SK_Mac0Key = 0x52,
SK_Mac1Key = 0x53,
SK_Mac2Key = 0x54,
@@ -247,7 +247,7 @@ enum {
SK_Mac8Key = 0x5b,
SK_Mac9Key = 0x5c
};
-
+
static SkKey raw2key(uint32_t raw)
{
static const struct {
@@ -272,7 +272,7 @@ static SkKey raw2key(uint32_t raw)
{ SK_Mac8Key, k8_SkKey },
{ SK_Mac9Key, k9_SkKey }
};
-
+
for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
if (gKeys[i].fRaw == raw)
return gKeys[i].fKey;
@@ -303,7 +303,7 @@ void SkEvent::SignalQueueTimer(SkMSec delay)
gTimer = NULL;
}
if (delay)
- {
+ {
gTimer = SetTimer(NULL, 0, delay, sk_timer_proc);
//SkDebugf("SetTimer of %d returned %d\n", delay, gTimer);
}
@@ -382,7 +382,7 @@ HGLRC create_gl(HWND hwnd, int msaaSampleCount) {
BOOL set = SetPixelFormat(dc, format, &pfd);
SkASSERT(TRUE == set);
}
-
+
HGLRC glrc = wglCreateContext(dc);
SkASSERT(glrc);
@@ -428,7 +428,7 @@ bool create_ANGLE(EGLNativeWindowType hWnd,
EGLSurface* eglSurface) {
static const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE, EGL_NONE
+ EGL_NONE, EGL_NONE
};
static const EGLint configAttribList[] = {
EGL_RED_SIZE, 8,
@@ -482,33 +482,33 @@ bool create_ANGLE(EGLNativeWindowType hWnd,
}
}
if (!foundConfig) {
- if (!eglChooseConfig(display, configAttribList,
+ if (!eglChooseConfig(display, configAttribList,
&config, 1, &numConfigs)) {
return false;
}
}
// Create a surface
- EGLSurface surface = eglCreateWindowSurface(display, config,
- (EGLNativeWindowType)hWnd,
+ EGLSurface surface = eglCreateWindowSurface(display, config,
+ (EGLNativeWindowType)hWnd,
surfaceAttribList);
if (surface == EGL_NO_SURFACE) {
return false;
}
// Create a GL context
- EGLContext context = eglCreateContext(display, config,
+ EGLContext context = eglCreateContext(display, config,
EGL_NO_CONTEXT,
contextAttribs );
if (context == EGL_NO_CONTEXT ) {
return false;
- }
-
+ }
+
// Make the context current
if (!eglMakeCurrent(display, surface, surface, context)) {
return false;
}
-
+
*eglDisplay = display;
*eglContext = context;
*eglSurface = surface;
@@ -583,7 +583,7 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, int msaaSampleCount) {
switch (attachType) {
case kNone_BackEndType:
// nothing to do
- break;
+ break;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
result = attachGL(msaaSampleCount);
@@ -611,7 +611,7 @@ void SkOSWindow::detach() {
switch (fAttached) {
case kNone_BackEndType:
// nothing to do
- break;
+ break;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
detachGL();
@@ -633,7 +633,7 @@ void SkOSWindow::present() {
switch (fAttached) {
case kNone_BackEndType:
// nothing to do
- return;
+ return;
#if SK_SUPPORT_GPU
case kNativeGL_BackEndType:
presentGL();
diff --git a/src/xml/SkDOM.cpp b/src/xml/SkDOM.cpp
index 474c2915bb..bdfdd86bdc 100644
--- a/src/xml/SkDOM.cpp
+++ b/src/xml/SkDOM.cpp
@@ -19,10 +19,10 @@ bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
if (this->startElement(elemName))
return false;
-
+
SkDOM::AttrIter iter(dom, node);
const char* name, *value;
-
+
while ((name = iter.next(&value)) != NULL)
if (this->addAttribute(name, value))
return false;
@@ -32,7 +32,7 @@ bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
if (!this->parse(dom, node))
return false;
} while ((node = dom.getNextSibling(node)) != NULL);
-
+
return !this->endElement(elemName);
}
@@ -312,7 +312,7 @@ static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par
const char* elem = dom.getName(node);
parser->startElement(elem);
-
+
SkDOM::AttrIter iter(dom, node);
const char* name;
const char* value;
@@ -467,7 +467,7 @@ void SkDOM::dump(const Node* node, int level) const
void SkDOM::UnitTest()
{
#ifdef SK_SUPPORT_UNITTEST
- static const char gDoc[] =
+ static const char gDoc[] =
"<root a='1' b='2'>"
"<elem1 c='3' />"
"<elem2 d='4' />"
diff --git a/src/xml/SkJSDisplayable.cpp b/src/xml/SkJSDisplayable.cpp
index 0e14fde52e..502779743f 100644
--- a/src/xml/SkJSDisplayable.cpp
+++ b/src/xml/SkJSDisplayable.cpp
@@ -83,7 +83,7 @@ JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc,
}
-JSFunctionSpec SkJSDisplayable_methods[] =
+JSFunctionSpec SkJSDisplayable_methods[] =
{
{ "draw", SkJSDisplayable::Draw, 1, 0, 0 },
{ 0 }
@@ -219,7 +219,7 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
jsval *vp)
{
if (JSVAL_IS_INT(id) == 0)
- return JS_TRUE;
+ return JS_TRUE;
SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
SkDisplayable* displayable = p->fDisplayable;
SkDisplayTypes displayableType = displayable->getType();
@@ -295,7 +295,7 @@ JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) {
if (JSVAL_IS_INT(id) == 0)
- return JS_TRUE;
+ return JS_TRUE;
SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
SkDisplayable* displayable = p->fDisplayable;
SkDisplayTypes displayableType = displayable->getType();
diff --git a/src/xml/SkXMLParser.cpp b/src/xml/SkXMLParser.cpp
index 17329be1cc..63929a94e2 100644
--- a/src/xml/SkXMLParser.cpp
+++ b/src/xml/SkXMLParser.cpp
@@ -74,7 +74,7 @@ bool SkXMLParser::endElement(const char elem[])
return this->onEndElement(elem);
}
-bool SkXMLParser::text(const char text[], int len)
+bool SkXMLParser::text(const char text[], int len)
{
return this->onText(text, len);
}
diff --git a/src/xml/SkXMLPullParser.cpp b/src/xml/SkXMLPullParser.cpp
index 03fed42343..4080aeb1ec 100644
--- a/src/xml/SkXMLPullParser.cpp
+++ b/src/xml/SkXMLPullParser.cpp
@@ -26,7 +26,7 @@ SkXMLPullParser::SkXMLPullParser(SkStream* stream) : fStream(NULL)
{
fCurr.fEventType = ERROR;
fDepth = 0;
-
+
this->setStream(stream);
}
@@ -65,12 +65,12 @@ SkXMLPullParser::EventType SkXMLPullParser::nextToken()
case END_TAG:
fDepth -= 1;
// fall through
- default:
+ default:
reset(&fCurr);
fCurr.fEventType = this->onNextToken();
break;
}
-
+
switch (fCurr.fEventType) {
case START_TAG:
fDepth += 1;
@@ -125,11 +125,11 @@ int SkXMLPullParser::getAttributeCount()
void SkXMLPullParser::getAttributeInfo(int index, AttrInfo* info)
{
SkASSERT((unsigned)index < (unsigned)fCurr.fAttrInfoCount);
-
+
if (info)
*info = fCurr.fAttrInfos[index];
}
-
+
bool SkXMLPullParser::onEntityReplacement(const char name[],
SkString* replacement)
{
diff --git a/src/xml/SkXMLWriter.cpp b/src/xml/SkXMLWriter.cpp
index 935745dc95..451d1d5241 100644
--- a/src/xml/SkXMLWriter.cpp
+++ b/src/xml/SkXMLWriter.cpp
@@ -69,7 +69,7 @@ bool SkXMLWriter::doStart(const char name[], size_t length)
return firstChild;
}
-SkXMLWriter::Elem* SkXMLWriter::getEnd()
+SkXMLWriter::Elem* SkXMLWriter::getEnd()
{
Elem* elem;
fElems.pop(&elem);