aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar benjaminwagner <benjaminwagner@google.com>2016-02-24 08:29:11 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-24 08:29:11 -0800
commitc2d35d851365bb89f392fe2dd7af57e169de26b7 (patch)
treeafa19bb232e8406edd7b29e2d4240da55ed04782 /src
parentf15b07b75ce6b1ad2bde91b3baf17ef9210241b3 (diff)
Revert of Simple cleanups related to SkFixed. (patchset #4 id:120001 of https://codereview.chromium.org/1683743005/ )
Reason for revert: New test is failing on Windows. Original issue's description: > Cleanups related to SkFixed. > > Remove SK_FixedNaN. It does not seem to be supported or used anywhere in Skia, Chromium, Android, or Google3, (except accidentally by TwoPtRadial::kDontDrawT). I think supporting it would erase any benefit of SkFixed over float. > > Remove SkBitmapFilter::lookup. It does not appear to be used anywhere in Skia, Chromium, Android, or Google3. > > Fix a bug in SkPaint::breakText that limited it to ~5kB of text. Now it can handle more than 1GB. > > BUG=skia:4632 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1683743005 > > Committed: https://skia.googlesource.com/skia/+/7ea5cb18389db11a94175de95c9db2b44972630c TBR=mtklein@google.com,reed@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4632 Review URL: https://codereview.chromium.org/1724283003
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapFilter.h12
-rw-r--r--src/core/SkPaint.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/src/core/SkBitmapFilter.h b/src/core/SkBitmapFilter.h
index ca3e0930f2..6fa8edde34 100644
--- a/src/core/SkBitmapFilter.h
+++ b/src/core/SkBitmapFilter.h
@@ -28,6 +28,15 @@ public:
}
virtual ~SkBitmapFilter() {}
+ SkFixed lookup(float x) const {
+ if (!fPrecomputed) {
+ precomputeTable();
+ }
+ int filter_idx = int(sk_float_abs(x * fLookupMultiplier));
+ SkASSERT(filter_idx < SKBITMAP_FILTER_TABLE_SIZE);
+ return fFilterTable[filter_idx];
+ }
+
SkScalar lookupScalar(float x) const {
if (!fPrecomputed) {
precomputeTable();
@@ -58,16 +67,19 @@ protected:
float fLookupMultiplier;
mutable bool fPrecomputed;
+ mutable SkFixed fFilterTable[SKBITMAP_FILTER_TABLE_SIZE];
mutable SkScalar fFilterTableScalar[SKBITMAP_FILTER_TABLE_SIZE];
private:
void precomputeTable() const {
fPrecomputed = true;
+ SkFixed *ftp = fFilterTable;
SkScalar *ftpScalar = fFilterTableScalar;
for (int x = 0; x < SKBITMAP_FILTER_TABLE_SIZE; ++x) {
float fx = ((float)x + .5f) * this->width() / SKBITMAP_FILTER_TABLE_SIZE;
float filter_value = evaluate(fx);
*ftpScalar++ = filter_value;
+ *ftp++ = SkFloatToFixed(filter_value);
}
}
};
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 638e251b36..d3384a628d 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -925,7 +925,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(false);
const int xyIndex = paint.isVerticalText() ? 1 : 0;
// use 64bits for our accumulator, to avoid overflowing 16.16
- Sk48Dot16 max = SkScalarTo48Dot16(maxWidth);
+ Sk48Dot16 max = SkScalarToFixed(maxWidth);
Sk48Dot16 width = 0;
SkAutoKern autokern;
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.h b/src/effects/gradients/SkTwoPointConicalGradient.h
index 954b09698e..f468de8007 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.h
+++ b/src/effects/gradients/SkTwoPointConicalGradient.h
@@ -15,7 +15,6 @@
// Should only be initialized once via init(). Immutable afterwards.
struct TwoPtRadial {
enum {
- // This value is outside the range SK_FixedMin to SK_FixedMax.
kDontDrawT = 0x80000000
};