Update files to use SK_BUILD_FOR_ANDROID.
This CL also removes any unecessary references to
the ANDROID definition.
Review URL: http://codereview.appspot.com/5354049
git-svn-id: http://skia.googlecode.com/svn/trunk@2629 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 229b80e..c2928a5 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -24,7 +24,7 @@
#include "SkPicture.h"
#include "SkString.h"
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
static void log_error(const char msg[]) { SkDebugf("%s", msg); }
static void log_progress(const char msg[]) { SkDebugf("%s", msg); }
#else
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index f7f918e..d22fbd6 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -723,7 +723,7 @@
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
/** Draw the text on path, with each character/glyph origin specified by the pos[]
array. The origin is interpreted by the Align setting in the paint.
@param text The text to be drawn
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 488a004..6fe1c19 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -220,7 +220,7 @@
virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
virtual void drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
const SkPoint pos[], const SkPaint& paint,
const SkPath& path, const SkMatrix* matrix);
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index 2ea0740..f1e126a 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -55,7 +55,7 @@
int scalarsPerPosition, const SkPaint& paint) const;
void drawTextOnPath(const char text[], size_t byteLength,
const SkPath&, const SkMatrix*, const SkPaint&) const;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void drawPosTextOnPath(const char text[], size_t byteLength,
const SkPoint pos[], const SkPaint& paint,
const SkPath& path, const SkMatrix* matrix) const;
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index c32c3d5..1b18aba 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -278,7 +278,7 @@
static void SetSubpixelOrder(LCDOrder order);
static LCDOrder GetSubpixelOrder();
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
///////////////////////////////////////////////////////////////////////////
/**
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index ee9b65c..eb5611b 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -818,7 +818,7 @@
void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
SkPath* path) const;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
const SkGlyph& getUnicharMetrics(SkUnichar);
const void* findImage(const SkGlyph&);
@@ -854,7 +854,7 @@
unsigned fStyle : 2;
unsigned fTextEncoding : 2; // 3 values
unsigned fHinting : 2;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t fGenerationID;
#endif
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 5982ea0..8eedb46 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -13,7 +13,7 @@
#include "SkMatrix.h"
#include "SkTDArray.h"
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
#define GEN_ID_INC fGenerationID++
#define GEN_ID_PTR_INC(ptr) ptr->fGenerationID++
#else
@@ -646,7 +646,7 @@
void flatten(SkWriter32&) const;
void unflatten(SkReader32&);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t getGenerationID() const;
#endif
@@ -660,7 +660,7 @@
uint8_t fSegmentMask;
mutable uint8_t fBoundsIsDirty;
mutable uint8_t fConvexity;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t fGenerationID;
#endif
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index e5073af..7e21a43 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -124,7 +124,7 @@
virtual Factory getFactory() const { return NULL; }
virtual void flatten(SkFlattenableWriteBuffer&) const;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
/**
* Acquire a "global" ref on this object.
* The default implementation just calls ref(), but subclasses can override
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index 7942985..bbce882 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -283,7 +283,7 @@
*/
bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
/** Returns a new char* containing the list of rectangles in this region
*/
char* toString();
diff --git a/include/core/SkTRegistry.h b/include/core/SkTRegistry.h
index f655a43..34fcffd 100644
--- a/include/core/SkTRegistry.h
+++ b/include/core/SkTRegistry.h
@@ -21,7 +21,7 @@
typedef T (*Factory)(P);
SkTRegistry(Factory fact) {
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
// work-around for double-initialization bug
{
SkTRegistry* reg = gHead;
diff --git a/include/core/SkThread_platform.h b/include/core/SkThread_platform.h
index 68c9c1f..2d94571 100644
--- a/include/core/SkThread_platform.h
+++ b/include/core/SkThread_platform.h
@@ -10,7 +10,7 @@
#ifndef SkThread_platform_DEFINED
#define SkThread_platform_DEFINED
-#if defined(ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK)
+#if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK)
#include <utils/threads.h>
#include <utils/Atomic.h>
diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h
index fb18d20..2e20107 100644
--- a/include/core/SkUtils.h
+++ b/include/core/SkUtils.h
@@ -32,7 +32,7 @@
typedef void (*SkMemset32Proc)(uint32_t dst[], uint32_t value, int count);
SkMemset32Proc SkMemset32GetPlatformProc();
-#if defined(ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK)
+#if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK)
#include "cutils/memory.h"
#define sk_memset16(dst, value, count) android_memset16(dst, value, (count) << 1)
diff --git a/include/effects/SkPorterDuff.h b/include/effects/SkPorterDuff.h
index 2d5bdb1..44d94f8 100644
--- a/include/effects/SkPorterDuff.h
+++ b/include/effects/SkPorterDuff.h
@@ -45,7 +45,7 @@
kMultiply_Mode, //!< [Sa * Da, Sc * Dc]
kScreen_Mode, //!< [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
kAdd_Mode, //!< Saturate(S + D)
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
kOverlay_Mode,
#endif
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index 1d07af1..461dee7 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -61,7 +61,7 @@
#undef GR_IOS_BUILD
#define GR_IOS_BUILD 1
// #error "IOS"
- #elif (defined(ANDROID_NDK) && ANDROID_NDK) || defined(ANDROID)
+ #elif defined(SK_BUILD_FOR_ANDROID)
#undef GR_ANDROID_BUILD
#define GR_ANDROID_BUILD 1
// #error "ANDROID"
diff --git a/include/utils/SkCamera.h b/include/utils/SkCamera.h
index e82aaa1..57521b8 100644
--- a/include/utils/SkCamera.h
+++ b/include/utils/SkCamera.h
@@ -150,7 +150,7 @@
void rotateY(SkScalar deg);
void rotateZ(SkScalar deg);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void setCameraLocation(SkScalar x, SkScalar y, SkScalar z);
#endif
diff --git a/include/views/SkWindow.h b/include/views/SkWindow.h
index eda928c..c72163c 100644
--- a/include/views/SkWindow.h
+++ b/include/views/SkWindow.h
@@ -108,7 +108,7 @@
#include "SkOSWindow_Mac.h"
#elif defined(SK_BUILD_FOR_WIN)
#include "SkOSWindow_Win.h"
-#elif defined(ANDROID)
+#elif defined(SK_BUILD_FOR_ANDROID)
#include "SkOSWindow_Android.h"
#elif defined(SK_BUILD_FOR_UNIX)
#include "SkOSWindow_Unix.h"
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index aeb71ad..17778fb 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1041,7 +1041,7 @@
SkPDFDocument doc;
SkPDFDevice* device = static_cast<SkPDFDevice*>(fPdfCanvas->getDevice());
doc.appendPage(device);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
name.prepend("/sdcard/");
#endif
@@ -1787,7 +1787,7 @@
fZoomCenterX = SkScalarHalf(this->width());
fZoomCenterY = SkScalarHalf(this->height());
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
// FIXME: The first draw after a size change does not work on Android, so
// we post an invalidate.
this->postInvalDelay();
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index d295018..e3116d7 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -255,7 +255,7 @@
return true;
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
#include "SkMetaData.h"
#include "SkParse.h"
diff --git a/src/core/SkBitmapProcState_filter.h b/src/core/SkBitmapProcState_filter.h
index dcb93cf..f69e17a 100644
--- a/src/core/SkBitmapProcState_filter.h
+++ b/src/core/SkBitmapProcState_filter.h
@@ -7,12 +7,6 @@
*/
-#ifdef __arm__
-#ifdef ANDROID
- #include <machine/cpu-features.h>
-#endif
-#endif
-
#include "SkColorPriv.h"
/*
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 1640a94..ea1c467 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1617,7 +1617,7 @@
LOOPER_END
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void SkCanvas::drawPosTextOnPath(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint,
const SkPath& path, const SkMatrix* matrix) {
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index bf25ff1..a66f2a9 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -410,7 +410,7 @@
draw.drawTextOnPath((const char*)text, len, path, matrix, paint);
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void SkDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
const SkPoint pos[], const SkPaint& paint,
const SkPath& path, const SkMatrix* matrix) {
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index e7bcee5..579e29a 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1973,7 +1973,7 @@
}
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void SkDraw::drawPosTextOnPath(const char text[], size_t byteLength,
const SkPoint pos[], const SkPaint& paint,
const SkPath& path, const SkMatrix* matrix) const {
diff --git a/src/core/SkMemory_stdlib.cpp b/src/core/SkMemory_stdlib.cpp
index 88194e5..0f195e7 100644
--- a/src/core/SkMemory_stdlib.cpp
+++ b/src/core/SkMemory_stdlib.cpp
@@ -159,18 +159,12 @@
void sk_throw()
{
-#ifdef ANDROID
- fprintf(stderr, "throwing...\n");
-#endif
SkASSERT(!"sk_throw");
abort();
}
void sk_out_of_memory(void)
{
-#ifdef ANDROID
- fprintf(stderr,"- out of memory in SGL -\n");
-#endif
SkASSERT(!"sk_out_of_memory");
abort();
}
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index aa1d7b1..ac9c68f 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -32,7 +32,7 @@
#define SK_DefaultFlags 0 //(kNativeHintsText_Flag)
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
#define GEN_ID_INC fGenerationID++
#define GEN_ID_INC_EVAL(expression) if (expression) { fGenerationID++; }
#else
@@ -71,7 +71,7 @@
fStyle = kFill_Style;
fTextEncoding = kUTF8_TextEncoding;
fHinting = kNormal_Hinting;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = 0;
#endif
}
@@ -125,11 +125,11 @@
SkSafeUnref(fLooper);
SkSafeUnref(fImageFilter);
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t oldGenerationID = fGenerationID;
#endif
memcpy(this, &src, sizeof(src));
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = oldGenerationID + 1;
#endif
@@ -143,16 +143,16 @@
void SkPaint::reset() {
SkPaint init;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t oldGenerationID = fGenerationID;
#endif
*this = init;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = oldGenerationID + 1;
#endif
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t SkPaint::getGenerationID() const {
return fGenerationID;
}
@@ -377,7 +377,7 @@
*((SkGlyphCache**)context) = SkGlyphCache::DetachCache(desc);
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
const SkGlyph& SkPaint::getUnicharMetrics(SkUnichar text) {
SkGlyphCache* cache;
descriptorProc(NULL, DetachDescProc, &cache, true);
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index cda2d4a..bdf4d27 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -93,7 +93,7 @@
, fBoundsIsDirty(true) {
fConvexity = kUnknown_Convexity;
fSegmentMask = 0;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = 0;
#endif
}
@@ -101,7 +101,7 @@
SkPath::SkPath(const SkPath& src) {
SkDEBUGCODE(src.validate();)
*this = src;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
// the assignment operator above increments the ID so correct for that here
fGenerationID--;
#endif
@@ -156,7 +156,7 @@
}
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
uint32_t SkPath::getGenerationID() const {
return fGenerationID;
}
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 60e1698..b75ae40 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -498,7 +498,7 @@
SkipClipRec skipRect, skipRegion, skipPath;
#endif
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
SkAutoMutexAcquire autoMutex(fDrawMutex);
#endif
diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h
index d227bc2..88f86e2 100644
--- a/src/core/SkPicturePlayback.h
+++ b/src/core/SkPicturePlayback.h
@@ -19,7 +19,7 @@
#include "SkRegion.h"
#include "SkPictureFlat.h"
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
#include "SkThread.h"
#endif
@@ -174,7 +174,7 @@
SkRefCntPlayback fRCPlayback;
SkTypefacePlayback fTFPlayback;
SkFactoryPlayback* fFactoryPlayback;
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
SkMutex fDrawMutex;
#endif
};
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 2fd65cf..31eccc5 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -159,7 +159,7 @@
///////////////////////////////////////////////////////////////////////////////
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void SkPixelRef::globalRef(void* data) {
this->ref();
}
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index 10b58bf..334caa8 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -11,10 +11,6 @@
#include "SkTemplates.h"
#include "SkThread.h"
-#ifdef ANDROID
-#include <stdio.h>
-#endif
-
SkDEBUGCODE(int32_t gRgnAllocCounter;)
/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -171,7 +167,7 @@
///////////////////////////////////////////////////////////////////////////////
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
char* SkRegion::toString()
{
Iterator iter(*this);
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index 18323cc..8b7ebf3 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -108,7 +108,7 @@
}
}
-#if !defined(ANDROID) || defined(SK_BUILD_FOR_ANDROID_NDK)
+#if !defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_ANDROID_NDK)
static void sk_memset16_stub(uint16_t dst[], uint16_t value, int count) {
SkMemset16Proc proc = SkMemset16GetPlatformProc();
sk_memset16 = proc ? proc : sk_memset16_portable;
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index 8746f9a..5021428 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -82,7 +82,7 @@
fState = kDone;
return false;
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
SkColor blurColor;
blurColor = fBlurColor;
if (SkColorGetA(blurColor) == 255) {
diff --git a/src/effects/SkPorterDuff.cpp b/src/effects/SkPorterDuff.cpp
index 515a3d4..8acb345 100644
--- a/src/effects/SkPorterDuff.cpp
+++ b/src/effects/SkPorterDuff.cpp
@@ -39,7 +39,7 @@
MAKE_PAIR(Multiply),
MAKE_PAIR(Screen),
{ SkPorterDuff::kAdd_Mode, SkXfermode::kPlus_Mode },
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
MAKE_PAIR(Overlay),
#endif
};
diff --git a/src/opts/SkBitmapProcState_opts_arm.cpp b/src/opts/SkBitmapProcState_opts_arm.cpp
index 224f754..20d62e1 100644
--- a/src/opts/SkBitmapProcState_opts_arm.cpp
+++ b/src/opts/SkBitmapProcState_opts_arm.cpp
@@ -7,10 +7,6 @@
*/
-#ifdef ANDROID
- #include <machine/cpu-features.h>
-#endif
-
#include "SkBitmapProcState.h"
#include "SkColorPriv.h"
#include "SkUtils.h"
diff --git a/src/opts/SkBlitRow_opts_arm.cpp b/src/opts/SkBlitRow_opts_arm.cpp
index d653963..f882701 100644
--- a/src/opts/SkBlitRow_opts_arm.cpp
+++ b/src/opts/SkBlitRow_opts_arm.cpp
@@ -6,10 +6,6 @@
*/
-#ifdef ANDROID
- #include <machine/cpu-features.h>
-#endif
-
#include "SkBlitRow.h"
#include "SkBlitMask.h"
#include "SkColorPriv.h"
@@ -992,7 +988,7 @@
/* calculate 'd', which will be 0..7 */
/* dbase[] is 0..7; alpha is 0..256; 16 bits suffice */
-#if ANDROID
+#if SK_BUILD_FOR_ANDROID
/* SkAlpha255To256() semantic a+1 vs a+a>>7 */
alpha8 = vaddw_u8(vmovl_u8(sa), vdup_n_u8(1));
#else
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index 328f588..a387257 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -362,7 +362,7 @@
fRec = next;
}
-#ifdef ANDROID
+#ifdef SK_BUILD_FOR_ANDROID
void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
// the camera location is passed in inches, set in pt
SkScalar lz = z * SkFloatToScalar(72.0f);