aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-30 14:24:37 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-30 14:24:37 +0000
commit4ad4ae907fa83773f671137b0e4e8c9525ab81cd (patch)
treea3b424ce1bfe5f345ca68ff2f22c285866b6e36f /include
parenta306d93cd73c3fc1d81479cbba98638f1e055385 (diff)
Reason for revert: need to update callsites in linux codecs R=robertphillips@google.com TBR=robertphillips@google.com NOTREECHECKS=true NOTRY=true BUG= Author: reed@google.com Review URL: https://codereview.chromium.org/122283002 git-svn-id: http://skia.googlecode.com/svn/trunk@12841 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/Sk64.h7
-rw-r--r--include/core/SkBitmap.h51
-rw-r--r--include/core/SkMath.h26
-rw-r--r--include/core/SkTypes.h4
-rw-r--r--include/utils/SkRandom.h30
5 files changed, 25 insertions, 93 deletions
diff --git a/include/core/Sk64.h b/include/core/Sk64.h
index c12a97c8a1..009744938f 100644
--- a/include/core/Sk64.h
+++ b/include/core/Sk64.h
@@ -1,3 +1,4 @@
+
/*
* Copyright 2006 The Android Open Source Project
*
@@ -5,6 +6,7 @@
* found in the LICENSE file.
*/
+
#ifndef Sk64_DEFINED
#define Sk64_DEFINED
@@ -26,11 +28,6 @@ public:
int64_t as64() const { return ((int64_t)fHi << 32) | fLo; }
int64_t getLongLong() const { return this->as64(); }
- void set64(int64_t value) {
- fHi = (int32_t)(value >> 32);
- fLo = (uint32_t)value;
- }
-
/** Returns non-zero if the Sk64 can be represented as a signed 32 bit integer
*/
SkBool is32() const { return fHi == ((int32_t)fLo >> 31); }
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 2b900bef34..c0e299ab94 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -1,3 +1,4 @@
+
/*
* Copyright 2006 The Android Open Source Project
*
@@ -5,19 +6,17 @@
* found in the LICENSE file.
*/
+
#ifndef SkBitmap_DEFINED
#define SkBitmap_DEFINED
+#include "Sk64.h"
#include "SkColor.h"
#include "SkColorTable.h"
#include "SkImageInfo.h"
#include "SkPoint.h"
#include "SkRefCnt.h"
-#ifdef SK_SUPPORT_LEGACY_SK64
- #include "Sk64.h"
-#endif
-
struct SkIRect;
struct SkRect;
class SkPaint;
@@ -150,37 +149,19 @@ public:
*/
size_t getSafeSize() const ;
- /**
- * Return the full size of the bitmap, in bytes.
- */
- int64_t computeSize64() const {
- return sk_64_mul(fHeight, fRowBytes);
- }
-
- /**
- * Return the number of bytes from the pointer returned by getPixels()
- * to the end of the allocated space in the buffer. This may be smaller
- * than computeSize64() if there is any rowbytes padding beyond the width.
- */
- int64_t computeSafeSize64() const {
- return ComputeSafeSize64((Config)fConfig, fWidth, fHeight, fRowBytes);
- }
-
-#ifdef SK_SUPPORT_LEGACY_SK64
- SK_ATTR_DEPRECATED("use getSize64()")
+ /** Return the byte size of the pixels, based on the height and rowBytes.
+ This routine is slightly slower than getSize(), but does not truncate
+ the answer to 32bits.
+ */
Sk64 getSize64() const {
Sk64 size;
- size.set64(this->computeSize64());
+ size.setMul(fHeight, fRowBytes);
return size;
}
- SK_ATTR_DEPRECATED("use getSafeSize64()")
- Sk64 getSafeSize64() const {
- Sk64 size;
- size.set64(this->computeSafeSize64());
- return size;
- }
-#endif
+ /** Same as getSafeSize(), but does not truncate the answer to 32bits.
+ */
+ Sk64 getSafeSize64() const ;
/** Returns true if this bitmap is marked as immutable, meaning that the
contents of its pixels will not change for the lifetime of the bitmap.
@@ -236,7 +217,7 @@ public:
return ComputeBytesPerPixel(c) >> 1;
}
- static int64_t ComputeSize64(Config, int width, int height);
+ static Sk64 ComputeSize64(Config, int width, int height);
static size_t ComputeSize(Config, int width, int height);
/**
@@ -697,10 +678,10 @@ private:
/* Internal computations for safe size.
*/
- static int64_t ComputeSafeSize64(Config config,
- uint32_t width,
- uint32_t height,
- size_t rowBytes);
+ static Sk64 ComputeSafeSize64(Config config,
+ uint32_t width,
+ uint32_t height,
+ size_t rowBytes);
static size_t ComputeSafeSize(Config config,
uint32_t width,
uint32_t height,
diff --git a/include/core/SkMath.h b/include/core/SkMath.h
index ba6223ed06..affcadaf2c 100644
--- a/include/core/SkMath.h
+++ b/include/core/SkMath.h
@@ -35,32 +35,6 @@ int32_t SkSqrtBits(int32_t value, int bitBias);
*/
#define SkSqrt32(n) SkSqrtBits(n, 15)
-// 64bit -> 32bit utilities
-
-/**
- * Return true iff the 64bit value can exactly be represented in signed 32bits
- */
-static inline bool sk_64_isS32(int64_t value) {
- return (int32_t)value == value;
-}
-
-/**
- * Return the 64bit argument as signed 32bits, asserting in debug that the arg
- * exactly fits in signed 32bits. In the release build, no checks are preformed
- * and the return value if the arg does not fit is undefined.
- */
-static inline int32_t sk_64_asS32(int64_t value) {
- SkASSERT(sk_64_isS32(value));
- return (int32_t)value;
-}
-
-// Handy util that can be passed two ints, and will automatically promote to
-// 64bits before the multiply, so the caller doesn't have to remember to cast
-// e.g. (int64_t)a * b;
-static inline int64_t sk_64_mul(int64_t a, int64_t b) {
- return a * b;
-}
-
///////////////////////////////////////////////////////////////////////////////
//! Returns the number of leading zero bits (0...32)
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 06c8583a61..c30a8a2d66 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -1,3 +1,4 @@
+
/*
* Copyright 2006 The Android Open Source Project
*
@@ -5,6 +6,7 @@
* found in the LICENSE file.
*/
+
#ifndef SkTypes_DEFINED
#define SkTypes_DEFINED
@@ -13,8 +15,6 @@
#include "SkPostConfig.h"
#include <stdint.h>
-//#define SK_SUPPORT_LEGACY_SK64
-
/** \file SkTypes.h
*/
diff --git a/include/utils/SkRandom.h b/include/utils/SkRandom.h
index 9191ec35c1..eeaa701c6e 100644
--- a/include/utils/SkRandom.h
+++ b/include/utils/SkRandom.h
@@ -10,12 +10,9 @@
#ifndef SkRandom_DEFINED
#define SkRandom_DEFINED
+#include "Sk64.h"
#include "SkScalar.h"
-#ifdef SK_SUPPORT_LEGACY_SK64
- #include "Sk64.h"
-#endif
-
/** \class SkLCGRandom
Utility class that implements pseudo random 32bit numbers using a fast
@@ -126,21 +123,13 @@ public:
return this->nextUScalar1() <= fractionTrue;
}
- /**
- * Return the next pseudo random number as a signed 64bit value.
- */
- int64_t next64() {
- int64_t hi = this->nextS();
- return (hi << 32) | this->nextU();
- }
-
-#ifdef SK_SUPPORT_LEGACY_SK64
- SK_ATTR_DEPRECATED("use next64()")
+ /** Return the next pseudo random number as a signed 64bit value.
+ */
void next64(Sk64* a) {
SkASSERT(a);
a->set(this->nextS(), this->nextU());
}
-#endif
+
/**
* Return the current seed. This allows the caller to later reset to the
* same seed (using setSeed) so it can generate the same sequence.
@@ -287,21 +276,12 @@ public:
return this->nextUScalar1() <= fractionTrue;
}
- /**
- * Return the next pseudo random number as a signed 64bit value.
+ /** Return the next pseudo random number as a signed 64bit value.
*/
- int64_t next64() {
- int64_t hi = this->nextS();
- return (hi << 32) | this->nextU();
- }
-
-#ifdef SK_SUPPORT_LEGACY_SK64
- SK_ATTR_DEPRECATED("use next64()")
void next64(Sk64* a) {
SkASSERT(a);
a->set(this->nextS(), this->nextU());
}
-#endif
/** Reset the random object.
*/