SK_SUPPORTED_DEPRECATED_FIXEDROUND around deprecated fixed[round,ceil,floor]
git-svn-id: http://skia.googlecode.com/svn/trunk@12903 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
4e4b09a44e
commit
9fb00413ec
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2006 The Android Open Source Project
|
* Copyright 2006 The Android Open Source Project
|
||||||
*
|
*
|
||||||
@ -6,12 +5,13 @@
|
|||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef SkFixed_DEFINED
|
#ifndef SkFixed_DEFINED
|
||||||
#define SkFixed_DEFINED
|
#define SkFixed_DEFINED
|
||||||
|
|
||||||
#include "SkTypes.h"
|
#include "SkTypes.h"
|
||||||
|
|
||||||
|
//#define SK_SUPPORTED_DEPRECATED_FIXEDROUND
|
||||||
|
|
||||||
/** \file SkFixed.h
|
/** \file SkFixed.h
|
||||||
|
|
||||||
Types and macros for 16.16 fixed point
|
Types and macros for 16.16 fixed point
|
||||||
@ -77,10 +77,11 @@ typedef int32_t SkFixed;
|
|||||||
#define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000)
|
#define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000)
|
||||||
#define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000)
|
#define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000)
|
||||||
|
|
||||||
// DEPRECATED
|
#ifdef SK_SUPPORTED_DEPRECATED_FIXEDROUND
|
||||||
#define SkFixedFloor(x) SkFixedFloorToInt(x)
|
# define SkFixedFloor(x) SkFixedFloorToInt(x)
|
||||||
#define SkFixedCeil(x) SkFixedCeilToInt(x)
|
# define SkFixedCeil(x) SkFixedCeilToInt(x)
|
||||||
#define SkFixedRound(x) SkFixedRoundToInt(x)
|
# define SkFixedRound(x) SkFixedRoundToInt(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SkFixedAbs(x) SkAbs32(x)
|
#define SkFixedAbs(x) SkAbs32(x)
|
||||||
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
|
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
|
||||||
|
@ -1496,8 +1496,8 @@ void SkDraw::drawText_asPaths(const char text[], size_t byteLength,
|
|||||||
static void D1G_NoBounder_RectClip(const SkDraw1Glyph& state,
|
static void D1G_NoBounder_RectClip(const SkDraw1Glyph& state,
|
||||||
SkFixed fx, SkFixed fy,
|
SkFixed fx, SkFixed fy,
|
||||||
const SkGlyph& glyph) {
|
const SkGlyph& glyph) {
|
||||||
int left = SkFixedFloor(fx);
|
int left = SkFixedFloorToInt(fx);
|
||||||
int top = SkFixedFloor(fy);
|
int top = SkFixedFloorToInt(fy);
|
||||||
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
||||||
SkASSERT(NULL == state.fBounder);
|
SkASSERT(NULL == state.fBounder);
|
||||||
SkASSERT((NULL == state.fClip && state.fAAClip) ||
|
SkASSERT((NULL == state.fClip && state.fAAClip) ||
|
||||||
@ -1540,8 +1540,8 @@ static void D1G_NoBounder_RectClip(const SkDraw1Glyph& state,
|
|||||||
static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state,
|
static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state,
|
||||||
SkFixed fx, SkFixed fy,
|
SkFixed fx, SkFixed fy,
|
||||||
const SkGlyph& glyph) {
|
const SkGlyph& glyph) {
|
||||||
int left = SkFixedFloor(fx);
|
int left = SkFixedFloorToInt(fx);
|
||||||
int top = SkFixedFloor(fy);
|
int top = SkFixedFloorToInt(fy);
|
||||||
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
||||||
SkASSERT(!state.fClip->isRect());
|
SkASSERT(!state.fClip->isRect());
|
||||||
SkASSERT(NULL == state.fBounder);
|
SkASSERT(NULL == state.fBounder);
|
||||||
@ -1577,8 +1577,8 @@ static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state,
|
|||||||
static void D1G_Bounder(const SkDraw1Glyph& state,
|
static void D1G_Bounder(const SkDraw1Glyph& state,
|
||||||
SkFixed fx, SkFixed fy,
|
SkFixed fx, SkFixed fy,
|
||||||
const SkGlyph& glyph) {
|
const SkGlyph& glyph) {
|
||||||
int left = SkFixedFloor(fx);
|
int left = SkFixedFloorToInt(fx);
|
||||||
int top = SkFixedFloor(fy);
|
int top = SkFixedFloorToInt(fy);
|
||||||
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
|
||||||
|
|
||||||
SkMask mask;
|
SkMask mask;
|
||||||
@ -1618,8 +1618,8 @@ static void D1G_Bounder(const SkDraw1Glyph& state,
|
|||||||
static void D1G_Bounder_AAClip(const SkDraw1Glyph& state,
|
static void D1G_Bounder_AAClip(const SkDraw1Glyph& state,
|
||||||
SkFixed fx, SkFixed fy,
|
SkFixed fx, SkFixed fy,
|
||||||
const SkGlyph& glyph) {
|
const SkGlyph& glyph) {
|
||||||
int left = SkFixedFloor(fx);
|
int left = SkFixedFloorToInt(fx);
|
||||||
int top = SkFixedFloor(fy);
|
int top = SkFixedFloorToInt(fy);
|
||||||
SkIRect bounds;
|
SkIRect bounds;
|
||||||
bounds.set(left, top, left + glyph.fWidth, top + glyph.fHeight);
|
bounds.set(left, top, left + glyph.fWidth, top + glyph.fHeight);
|
||||||
|
|
||||||
|
@ -97,20 +97,20 @@ static inline void XRect_set(SkXRect* xr, const SkRect& src) {
|
|||||||
/** Round the SkXRect coordinates, and store the result in the SkIRect.
|
/** Round the SkXRect coordinates, and store the result in the SkIRect.
|
||||||
*/
|
*/
|
||||||
static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
|
static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
|
||||||
dst->fLeft = SkFixedRound(xr.fLeft);
|
dst->fLeft = SkFixedRoundToInt(xr.fLeft);
|
||||||
dst->fTop = SkFixedRound(xr.fTop);
|
dst->fTop = SkFixedRoundToInt(xr.fTop);
|
||||||
dst->fRight = SkFixedRound(xr.fRight);
|
dst->fRight = SkFixedRoundToInt(xr.fRight);
|
||||||
dst->fBottom = SkFixedRound(xr.fBottom);
|
dst->fBottom = SkFixedRoundToInt(xr.fBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Round the SkXRect coordinates out (i.e. use floor for left/top, and ceiling
|
/** Round the SkXRect coordinates out (i.e. use floor for left/top, and ceiling
|
||||||
for right/bottom), and store the result in the SkIRect.
|
for right/bottom), and store the result in the SkIRect.
|
||||||
*/
|
*/
|
||||||
static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
|
static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
|
||||||
dst->fLeft = SkFixedFloor(xr.fLeft);
|
dst->fLeft = SkFixedFloorToInt(xr.fLeft);
|
||||||
dst->fTop = SkFixedFloor(xr.fTop);
|
dst->fTop = SkFixedFloorToInt(xr.fTop);
|
||||||
dst->fRight = SkFixedCeil(xr.fRight);
|
dst->fRight = SkFixedCeilToInt(xr.fRight);
|
||||||
dst->fBottom = SkFixedCeil(xr.fBottom);
|
dst->fBottom = SkFixedCeilToInt(xr.fBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -466,11 +466,11 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
|
|||||||
// now test if our Y values are completely inside the clip
|
// now test if our Y values are completely inside the clip
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
if (slope >= 0) { // T2B
|
if (slope >= 0) { // T2B
|
||||||
top = SkFixedFloor(fstart - SK_FixedHalf);
|
top = SkFixedFloorToInt(fstart - SK_FixedHalf);
|
||||||
bottom = SkFixedCeil(fstart + (istop - istart - 1) * slope + SK_FixedHalf);
|
bottom = SkFixedCeilToInt(fstart + (istop - istart - 1) * slope + SK_FixedHalf);
|
||||||
} else { // B2T
|
} else { // B2T
|
||||||
bottom = SkFixedCeil(fstart + SK_FixedHalf);
|
bottom = SkFixedCeilToInt(fstart + SK_FixedHalf);
|
||||||
top = SkFixedFloor(fstart + (istop - istart - 1) * slope - SK_FixedHalf);
|
top = SkFixedFloorToInt(fstart + (istop - istart - 1) * slope - SK_FixedHalf);
|
||||||
}
|
}
|
||||||
#ifdef OUTSET_BEFORE_CLIP_TEST
|
#ifdef OUTSET_BEFORE_CLIP_TEST
|
||||||
top -= 1;
|
top -= 1;
|
||||||
@ -542,11 +542,11 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
|
|||||||
// now test if our X values are completely inside the clip
|
// now test if our X values are completely inside the clip
|
||||||
int left, right;
|
int left, right;
|
||||||
if (slope >= 0) { // L2R
|
if (slope >= 0) { // L2R
|
||||||
left = SkFixedFloor(fstart - SK_FixedHalf);
|
left = SkFixedFloorToInt(fstart - SK_FixedHalf);
|
||||||
right = SkFixedCeil(fstart + (istop - istart - 1) * slope + SK_FixedHalf);
|
right = SkFixedCeilToInt(fstart + (istop - istart - 1) * slope + SK_FixedHalf);
|
||||||
} else { // R2L
|
} else { // R2L
|
||||||
right = SkFixedCeil(fstart + SK_FixedHalf);
|
right = SkFixedCeilToInt(fstart + SK_FixedHalf);
|
||||||
left = SkFixedFloor(fstart + (istop - istart - 1) * slope - SK_FixedHalf);
|
left = SkFixedFloorToInt(fstart + (istop - istart - 1) * slope - SK_FixedHalf);
|
||||||
}
|
}
|
||||||
#ifdef OUTSET_BEFORE_CLIP_TEST
|
#ifdef OUTSET_BEFORE_CLIP_TEST
|
||||||
left -= 1;
|
left -= 1;
|
||||||
|
@ -162,7 +162,7 @@ char* SkStrAppendFixed(char string[], SkFixed x) {
|
|||||||
static const uint16_t gTens[] = { 1000, 100, 10, 1 };
|
static const uint16_t gTens[] = { 1000, 100, 10, 1 };
|
||||||
const uint16_t* tens = gTens;
|
const uint16_t* tens = gTens;
|
||||||
|
|
||||||
x = SkFixedRound(frac * 10000);
|
x = SkFixedRoundToInt(frac * 10000);
|
||||||
SkASSERT(x <= 10000);
|
SkASSERT(x <= 10000);
|
||||||
if (x == 10000) {
|
if (x == 10000) {
|
||||||
x -= 1;
|
x -= 1;
|
||||||
|
@ -107,7 +107,7 @@ void SkTableMaskFilter::MakeClipTable(uint8_t table[256], uint8_t min,
|
|||||||
SkFixed scale = (1 << 16) * 255 / (max - min);
|
SkFixed scale = (1 << 16) * 255 / (max - min);
|
||||||
memset(table, 0, min + 1);
|
memset(table, 0, min + 1);
|
||||||
for (int i = min + 1; i < max; i++) {
|
for (int i = min + 1; i < max; i++) {
|
||||||
int value = SkFixedRound(scale * (i - min));
|
int value = SkFixedRoundToInt(scale * (i - min));
|
||||||
SkASSERT(value <= 255);
|
SkASSERT(value <= 255);
|
||||||
table[i] = value;
|
table[i] = value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user