diff options
author | 2009-04-03 14:26:10 +0000 | |
---|---|---|
committer | 2009-04-03 14:26:10 +0000 | |
commit | 9c970453fd1cb6e9618e37c61507465772deca80 (patch) | |
tree | 5dfbc59e5cfd9283bf5e6b10b640fa28ea95326b /src/core | |
parent | 41bccf55b56d75ab0c0b3726dd64baba80ba7e90 (diff) |
import portability fixes from Chrome around floats
move porting functions for SkDebugf into /ports directory
git-svn-id: http://skia.googlecode.com/svn/trunk@147 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkDebug_stdio.cpp | 61 | ||||
-rw-r--r-- | src/core/SkDrawing.cpp | 36 | ||||
-rw-r--r-- | src/core/SkFP.h | 2 | ||||
-rw-r--r-- | src/core/core_files.mk | 1 |
4 files changed, 19 insertions, 81 deletions
diff --git a/src/core/SkDebug_stdio.cpp b/src/core/SkDebug_stdio.cpp deleted file mode 100644 index c8a0d8123e..0000000000 --- a/src/core/SkDebug_stdio.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* libs/corecg/SkDebug_stdio.cpp -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -#include "SkTypes.h" - -static const size_t kBufferSize = 256; - -#ifdef ANDROID - -#define LOG_TAG "skia" -#include <utils/Log.h> - -void Android_SkDebugf(const char* file, int line, const char* function, - const char* format, ...) -{ - if (format[0] == '\n' && format[1] == '\0') - return; - va_list args; - va_start(args, format); -#ifdef HAVE_ANDROID_OS - char buffer[kBufferSize + 1]; - vsnprintf(buffer, kBufferSize, format, args); - if (buffer[0] != 0) - __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s", buffer); -#else - android_vprintLog(ANDROID_LOG_DEBUG, NULL, LOG_TAG, format, args); -#endif - va_end(args); -} - -#else - -#include <stdarg.h> -#include <stdio.h> - -void SkDebugf(const char format[], ...) -{ - char buffer[kBufferSize + 1]; - va_list args; - va_start(args, format); - vsnprintf(buffer, kBufferSize, format, args); - va_end(args); - fprintf(stderr, buffer); -} - -#endif - diff --git a/src/core/SkDrawing.cpp b/src/core/SkDrawing.cpp index 85f3175bdb..f54afcc1f4 100644 --- a/src/core/SkDrawing.cpp +++ b/src/core/SkDrawing.cpp @@ -1,28 +1,28 @@ -#include "SkDrawable.h" +#include "SkDrawing.h" #include "SkCanvas.h" -SkDrawable::SkDrawable() { +SkDrawing::SkDrawing() { fMatrix.reset(); fParent = fFirstChild = fNextSibling = fPrevSibling = NULL; } -SkDrawable::~SkDrawable() { +SkDrawing::~SkDrawing() { this->detachAllChildren(); } /////////////////////////////////////////////////////////////////////////////// -void SkDrawable::resetMatrix() { +void SkDrawing::resetMatrix() { fMatrix.reset(); } -void SkDrawable::getMatrix(SkMatrix* matrix) const { +void SkDrawing::getMatrix(SkMatrix* matrix) const { if (matrix) { *matrix = fMatrix; } } -void SkDrawable::setMatrix(const SkMatrix& matrix) { +void SkDrawing::setMatrix(const SkMatrix& matrix) { if (fMatrix != matrix) { this->inval(); fMatrix = matrix; @@ -30,7 +30,7 @@ void SkDrawable::setMatrix(const SkMatrix& matrix) { } } -void SkDrawable::draw(SkCanvas* canvas) { +void SkDrawing::draw(SkCanvas* canvas) { SkAutoCanvasRestore ar(canvas, false); canvas->save(SkCanvas::kMatrix_SaveFlag); canvas->concat(fMatrix); @@ -38,7 +38,7 @@ void SkDrawable::draw(SkCanvas* canvas) { this->onDraw(canvas); B2FIter iter(this); - SkDrawable* child; + SkDrawing* child; while ((child = iter.next()) != NULL) { child->draw(canvas); } @@ -46,8 +46,8 @@ void SkDrawable::draw(SkCanvas* canvas) { /////////////////////////////////////////////////////////////////////////////// -void SkDrawable::detachFromParent() { - SkDrawable* parent = fParent; +void SkDrawing::detachFromParent() { + SkDrawing* parent = fParent; if (NULL == parent) { return; @@ -55,7 +55,7 @@ void SkDrawable::detachFromParent() { this->inval(); - SkDrawable* next = NULL; + SkDrawing* next = NULL; if (fNextSibling != this) { // do we have any siblings fNextSibling->fPrevSibling = fPrevSibling; @@ -71,7 +71,7 @@ void SkDrawable::detachFromParent() { this->unref(); } -SkDrawable* SkDrawable::attachChildToBack(SkDrawable* child) { +SkDrawing* SkDrawing::attachChildToBack(SkDrawing* child) { SkASSERT(child != this); if (child == NULL || fFirstChild == child) { @@ -97,7 +97,7 @@ SkDrawable* SkDrawable::attachChildToBack(SkDrawable* child) { return child; } -SkDrawable* SkDrawable::attachChildToFront(SkDrawable* child) { +SkDrawing* SkDrawing::attachChildToFront(SkDrawing* child) { SkASSERT(child != this); if (child == NULL || fFirstChild && fFirstChild->fPrevSibling == child) { @@ -123,7 +123,7 @@ SkDrawable* SkDrawable::attachChildToFront(SkDrawable* child) { return child; } -void SkDrawable::detachAllChildren() { +void SkDrawing::detachAllChildren() { while (fFirstChild) { fFirstChild->detachFromParent(); } @@ -131,16 +131,16 @@ void SkDrawable::detachAllChildren() { /////////////////////////////////////////////////////////////////////////////// -SkDrawable::B2FIter::B2FIter(const SkDrawable* parent) { +SkDrawing::B2FIter::B2FIter(const SkDrawing* parent) { fFirstChild = parent ? parent->fFirstChild : NULL; fChild = fFirstChild; } -SkDrawable* SkDrawable::B2FIter::next() { - SkDrawable* curr = fChild; +SkDrawing* SkDrawing::B2FIter::next() { + SkDrawing* curr = fChild; if (fChild) { - SkDrawable* next = fChild->fNextSibling; + SkDrawing* next = fChild->fNextSibling; if (next == fFirstChild) { next = NULL; } diff --git a/src/core/SkFP.h b/src/core/SkFP.h index 5e25d22372..3aab411ace 100644 --- a/src/core/SkFP.h +++ b/src/core/SkFP.h @@ -41,7 +41,7 @@ #define SkFPDivInt(a, n) ((a) / (n)) #define SkFPInvert(x) SkScalarInvert(x) #define SkFPSqrt(x) SkScalarSqrt(x) - #define SkFPCubeRoot(x) static_cast<float>(pow(x, 0.33333333333)) + #define SkFPCubeRoot(x) sk_float_pow(x, 0.3333333f) #define SkFPLT(a, b) ((a) < (b)) #define SkFPLE(a, b) ((a) <= (b)) diff --git a/src/core/core_files.mk b/src/core/core_files.mk index 37c55e1800..27849e7021 100644 --- a/src/core/core_files.mk +++ b/src/core/core_files.mk @@ -27,7 +27,6 @@ SOURCE := \ SkCordic.cpp \ SkCubicClipper.cpp \ SkDebug.cpp \ - SkDebug_stdio.cpp \ SkDeque.cpp \ SkDevice.cpp \ SkDither.cpp \ |