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
This commit is contained in:
djsollen@google.com 2011-11-08 19:00:26 +00:00
parent 6245ab718d
commit 56c69773ae
35 changed files with 46 additions and 70 deletions

View File

@ -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

View File

@ -723,7 +723,7 @@ public:
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

View File

@ -220,7 +220,7 @@ protected:
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);

View File

@ -55,7 +55,7 @@ public:
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;

View File

@ -278,7 +278,7 @@ public:
static void SetSubpixelOrder(LCDOrder order);
static LCDOrder GetSubpixelOrder();
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
///////////////////////////////////////////////////////////////////////////
/**

View File

@ -818,7 +818,7 @@ public:
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 @@ private:
unsigned fStyle : 2;
unsigned fTextEncoding : 2; // 3 values
unsigned fHinting : 2;
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
uint32_t fGenerationID;
#endif

View File

@ -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 @@ public:
void flatten(SkWriter32&) const;
void unflatten(SkReader32&);
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
uint32_t getGenerationID() const;
#endif
@ -660,7 +660,7 @@ private:
uint8_t fSegmentMask;
mutable uint8_t fBoundsIsDirty;
mutable uint8_t fConvexity;
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
uint32_t fGenerationID;
#endif

View File

@ -124,7 +124,7 @@ public:
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

View File

@ -283,7 +283,7 @@ public:
*/
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();

View File

@ -21,7 +21,7 @@ public:
typedef T (*Factory)(P);
SkTRegistry(Factory fact) {
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
// work-around for double-initialization bug
{
SkTRegistry* reg = gHead;

View File

@ -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>

View File

@ -32,7 +32,7 @@ void sk_memset32_portable(uint32_t dst[], uint32_t value, int count);
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)

View File

@ -45,7 +45,7 @@ public:
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

View File

@ -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"

View File

@ -150,7 +150,7 @@ public:
void rotateY(SkScalar deg);
void rotateZ(SkScalar deg);
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
void setCameraLocation(SkScalar x, SkScalar y, SkScalar z);
#endif

View File

@ -108,7 +108,7 @@ private:
#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"

View File

@ -1041,7 +1041,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
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 @@ void SampleWindow::onSizeChange() {
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();

View File

@ -255,7 +255,7 @@ bool SkDisplayEvent::setProperty(int index, SkScriptValue& value) {
return true;
}
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
#include "SkMetaData.h"
#include "SkParse.h"

View File

@ -7,12 +7,6 @@
*/
#ifdef __arm__
#ifdef ANDROID
#include <machine/cpu-features.h>
#endif
#endif
#include "SkColorPriv.h"
/*

View File

@ -1617,7 +1617,7 @@ void SkCanvas::drawTextOnPath(const void* text, size_t byteLength,
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) {

View File

@ -410,7 +410,7 @@ void SkDevice::drawTextOnPath(const SkDraw& draw, const void* text,
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) {

View File

@ -1973,7 +1973,7 @@ void SkDraw::drawTextOnPath(const char text[], size_t byteLength,
}
}
#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 {

View File

@ -159,18 +159,12 @@ void ValidateHeap() {}
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();
}

View File

@ -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 @@ SkPaint::SkPaint() {
fStyle = kFill_Style;
fTextEncoding = kUTF8_TextEncoding;
fHinting = kNormal_Hinting;
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = 0;
#endif
}
@ -125,11 +125,11 @@ SkPaint& SkPaint::operator=(const SkPaint& src) {
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 @@ bool operator==(const SkPaint& a, const SkPaint& b) {
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 @@ static void DetachDescProc(const SkDescriptor* desc, void* context) {
*((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);

View File

@ -93,7 +93,7 @@ SkPath::SkPath()
, fBoundsIsDirty(true) {
fConvexity = kUnknown_Convexity;
fSegmentMask = 0;
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = 0;
#endif
}
@ -101,7 +101,7 @@ SkPath::SkPath()
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 @@ void SkPath::swap(SkPath& other) {
}
}
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
uint32_t SkPath::getGenerationID() const {
return fGenerationID;
}

View File

@ -498,7 +498,7 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
SkipClipRec skipRect, skipRegion, skipPath;
#endif
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
SkAutoMutexAcquire autoMutex(fDrawMutex);
#endif

View File

@ -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 @@ private:
SkRefCntPlayback fRCPlayback;
SkTypefacePlayback fTFPlayback;
SkFactoryPlayback* fFactoryPlayback;
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
SkMutex fDrawMutex;
#endif
};

View File

@ -159,7 +159,7 @@ const char* SkPixelRef::FactoryToName(Factory fact) {
///////////////////////////////////////////////////////////////////////////////
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
void SkPixelRef::globalRef(void* data) {
this->ref();
}

View File

@ -11,10 +11,6 @@
#include "SkTemplates.h"
#include "SkThread.h"
#ifdef ANDROID
#include <stdio.h>
#endif
SkDEBUGCODE(int32_t gRgnAllocCounter;)
/////////////////////////////////////////////////////////////////////////////////////////////////
@ -171,7 +167,7 @@ bool SkRegion::op(const SkRegion& rgn, const SkIRect& rect, Op op) {
///////////////////////////////////////////////////////////////////////////////
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
char* SkRegion::toString()
{
Iterator iter(*this);

View File

@ -108,7 +108,7 @@ void sk_memset32_portable(uint32_t dst[], uint32_t value, int count) {
}
}
#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;

View File

@ -82,7 +82,7 @@ bool SkBlurDrawLooper::next(SkCanvas* canvas, SkPaint* paint) {
fState = kDone;
return false;
}
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
SkColor blurColor;
blurColor = fBlurColor;
if (SkColorGetA(blurColor) == 255) {

View File

@ -39,7 +39,7 @@ static const struct Pair {
MAKE_PAIR(Multiply),
MAKE_PAIR(Screen),
{ SkPorterDuff::kAdd_Mode, SkXfermode::kPlus_Mode },
#ifdef ANDROID
#ifdef SK_BUILD_FOR_ANDROID
MAKE_PAIR(Overlay),
#endif
};

View File

@ -7,10 +7,6 @@
*/
#ifdef ANDROID
#include <machine/cpu-features.h>
#endif
#include "SkBitmapProcState.h"
#include "SkColorPriv.h"
#include "SkUtils.h"

View File

@ -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 @@ static void S32A_D565_Opaque_Dither_neon (uint16_t * SK_RESTRICT dst,
/* 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

View File

@ -362,7 +362,7 @@ void Sk3DView::restore() {
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);