diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-02 22:00:04 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-02 22:00:04 +0000 |
commit | 8b30d9a3cc0cc0d72f094989ddf3e21971d1a0e5 (patch) | |
tree | e7422a8ec501e5bc9bcbcd2f160492e3d490f9d5 | |
parent | d3c3f0e21d86d73389430b3248fcbfd9f199e3c5 (diff) |
Remove dead code in gpu/.
These files are not referenced by any .gyp file in Skia or Chromium.
ninja -C out/Debug everything still builds.
BUG=skia:
R=bsalomon@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/218553003
git-svn-id: http://skia.googlecode.com/svn/trunk@14034 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/gpu/FlingState.cpp | 125 | ||||
-rw-r--r-- | src/gpu/GrAddPathRenderers_none.cpp | 15 | ||||
-rw-r--r-- | src/gpu/GrMemory.cpp | 26 | ||||
-rw-r--r-- | src/gpu/GrRectanizer_fifo.cpp | 121 |
4 files changed, 0 insertions, 287 deletions
diff --git a/src/gpu/FlingState.cpp b/src/gpu/FlingState.cpp deleted file mode 100644 index f0db5016bd..0000000000 --- a/src/gpu/FlingState.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#include "FlingState.h" -#include "SkMatrix.h" -#include "SkTime.h" - -#define DISCRETIZE_TRANSLATE_TO_AVOID_FLICKER true - -static const float MAX_FLING_SPEED = 1500; - -static float pin_max_fling(float speed) { - if (speed > MAX_FLING_SPEED) { - speed = MAX_FLING_SPEED; - } - return speed; -} - -static double getseconds() { - return SkTime::GetMSecs() * 0.001; -} - -// returns +1 or -1, depending on the sign of x -// returns +1 if x is zero -static SkScalar SkScalarSign(SkScalar x) { - SkScalar sign = SK_Scalar1; - if (x < 0) { - sign = -sign; - } - return sign; -} - -static void unit_axis_align(SkVector* unit) { - const SkScalar TOLERANCE = SkDoubleToScalar(0.15); - if (SkScalarAbs(unit->fX) < TOLERANCE) { - unit->fX = 0; - unit->fY = SkScalarSign(unit->fY); - } else if (SkScalarAbs(unit->fY) < TOLERANCE) { - unit->fX = SkScalarSign(unit->fX); - unit->fY = 0; - } -} - -void FlingState::reset(float sx, float sy) { - fActive = true; - fDirection.set(sx, sy); - fSpeed0 = SkPoint::Normalize(&fDirection); - fSpeed0 = pin_max_fling(fSpeed0); - fTime0 = getseconds(); - - unit_axis_align(&fDirection); -// printf("---- speed %g dir %g %g\n", fSpeed0, fDirection.fX, fDirection.fY); -} - -bool FlingState::evaluateMatrix(SkMatrix* matrix) { - if (!fActive) { - return false; - } - - const float t = getseconds() - fTime0; - const float MIN_SPEED = 2; - const float K0 = 5.0; - const float K1 = 0.02; - const float speed = fSpeed0 * (sk_float_exp(- K0 * t) - K1); - if (speed <= MIN_SPEED) { - fActive = false; - return false; - } - float dist = (fSpeed0 - speed) / K0; - -// printf("---- time %g speed %g dist %g\n", t, speed, dist); - float tx = fDirection.fX * dist; - float ty = fDirection.fY * dist; - if (DISCRETIZE_TRANSLATE_TO_AVOID_FLICKER) { - tx = sk_float_round2int(tx); - ty = sk_float_round2int(ty); - } - matrix->setTranslate(tx, ty); -// printf("---- evaluate (%g %g)\n", tx, ty); - - return true; -} - -//////////////////////////////////////// - -GrAnimateFloat::GrAnimateFloat() : fTime0(0) {} - -void GrAnimateFloat::start(float v0, float v1, float duration) { - fValue0 = v0; - fValue1 = v1; - fDuration = duration; - if (duration > 0) { - fTime0 = SkTime::GetMSecs(); - if (!fTime0) { - fTime0 = 1; // time0 is our sentinel - } - } else { - fTime0 = 0; - } -} - -float GrAnimateFloat::evaluate() { - if (!fTime0) { - return fValue1; - } - - double elapsed = (SkTime::GetMSecs() - fTime0) * 0.001; - if (elapsed >= fDuration) { - fTime0 = 0; - return fValue1; - } - - double t = elapsed / fDuration; - if (true) { - t = (3 - 2 * t) * t * t; - } - return fValue0 + t * (fValue1 - fValue0); -} diff --git a/src/gpu/GrAddPathRenderers_none.cpp b/src/gpu/GrAddPathRenderers_none.cpp deleted file mode 100644 index 02da710724..0000000000 --- a/src/gpu/GrAddPathRenderers_none.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#include "GrPathRenderer.h" - - -void GrPathRenderer::AddPathRenderers(GrContext*, - GrPathRendererChain::UsageFlags, - GrPathRendererChain*) {} diff --git a/src/gpu/GrMemory.cpp b/src/gpu/GrMemory.cpp deleted file mode 100644 index bf96b0bc31..0000000000 --- a/src/gpu/GrMemory.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#include <stdlib.h> -#include "GrTypes.h" - -void* GrMalloc(size_t bytes) { - void* ptr = ::malloc(bytes); - if (NULL == ptr) { - ::exit(-1); - } - return ptr; -} - -void GrFree(void* ptr) { - if (ptr) { - ::free(ptr); - } -} diff --git a/src/gpu/GrRectanizer_fifo.cpp b/src/gpu/GrRectanizer_fifo.cpp deleted file mode 100644 index 9dd808618b..0000000000 --- a/src/gpu/GrRectanizer_fifo.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#include "GrRectanizer.h" -#include "GrTBSearch.h" - -#define MIN_HEIGHT_POW2 2 - -class GrRectanizerFIFO : public GrRectanizer { -public: - GrRectanizerFIFO(int w, int h) : GrRectanizer(w, h) { - fNextStripY = 0; - fAreaSoFar = 0; - sk_bzero(fRows, sizeof(fRows)); - } - - virtual ~GrRectanizerFIFO() { - } - - virtual bool addRect(int w, int h, GrIPoint16* loc); - - virtual float percentFull() const { - return fAreaSoFar / ((float)this->width() * this->height()); - } - - virtual int stripToPurge(int height) const { return -1; } - virtual void purgeStripAtY(int yCoord) { } - - /////////////////////////////////////////////////////////////////////////// - - struct Row { - GrIPoint16 fLoc; - int fRowHeight; - - bool canAddWidth(int width, int containerWidth) const { - return fLoc.fX + width <= containerWidth; - } - }; - - Row fRows[16]; - - static int HeightToRowIndex(int height) { - SkASSERT(height >= MIN_HEIGHT_POW2); - return 32 - Gr_clz(height - 1); - } - - int fNextStripY; - int32_t fAreaSoFar; - - bool canAddStrip(int height) const { - return fNextStripY + height <= this->height(); - } - - void initRow(Row* row, int rowHeight) { - row->fLoc.set(0, fNextStripY); - row->fRowHeight = rowHeight; - fNextStripY += rowHeight; - } -}; - -bool GrRectanizerFIFO::addRect(int width, int height, GrIPoint16* loc) { - if ((unsigned)width > (unsigned)this->width() || - (unsigned)height > (unsigned)this->height()) { - return false; - } - - int32_t area = width * height; - - /* - We use bsearch, but there may be more than one row with the same height, - so we actually search for height-1, which can only be a pow2 itself if - height == 2. Thus we set a minimum height. - */ - height = GrNextPow2(height); - if (height < MIN_HEIGHT_POW2) { - height = MIN_HEIGHT_POW2; - } - - Row* row = &fRows[HeightToRowIndex(height)]; - SkASSERT(row->fRowHeight == 0 || row->fRowHeight == height); - - if (0 == row->fRowHeight) { - if (!this->canAddStrip(height)) { - return false; - } - this->initRow(row, height); - } else { - if (!row->canAddWidth(width, this->width())) { - if (!this->canAddStrip(height)) { - return false; - } - // that row is now "full", so retarget our Row record for - // another one - this->initRow(row, height); - } - } - - SkASSERT(row->fRowHeight == height); - SkASSERT(row->canAddWidth(width, this->width())); - *loc = row->fLoc; - row->fLoc.fX += width; - - SkASSERT(row->fLoc.fX <= this->width()); - SkASSERT(row->fLoc.fY <= this->height()); - SkASSERT(fNextStripY <= this->height()); - fAreaSoFar += area; - return true; -} - -/////////////////////////////////////////////////////////////////////////////// - -GrRectanizer* GrRectanizer::Factory(int width, int height) { - return SkNEW_ARGS(GrRectanizerFIFO, (width, height)); -} |