diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 01:51:39 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 01:51:39 +0000 |
commit | de6b07ebe55062c249328533e610a8620691d4fc (patch) | |
tree | 87d85ea0b8287ec72d07362f67411ce6d87a5c9d /cc | |
parent | a2cdfe8a194500e76171a0ef2e8ab6257dccfb51 (diff) | |
download | chromium_src-de6b07ebe55062c249328533e610a8620691d4fc.zip chromium_src-de6b07ebe55062c249328533e610a8620691d4fc.tar.gz chromium_src-de6b07ebe55062c249328533e610a8620691d4fc.tar.bz2 |
cc: Get rid of FloatToSkScalar() function.
Accordding to Dana:
"We can probably just call SkFloatToScalar directly in those sites.
Those values should never be NaN or infinity."
BUG=147395
TEST=cc_unittests
R=enne@chromium.org,danakj@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11293084
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc.gyp | 2 | ||||
-rw-r--r-- | cc/content_layer_updater.cc | 6 | ||||
-rw-r--r-- | cc/stubs/SkiaUtils.h | 6 | ||||
-rw-r--r-- | cc/stubs/skia_utils.h | 29 |
4 files changed, 3 insertions, 40 deletions
@@ -262,7 +262,6 @@ 'stubs/IntPoint.h', 'stubs/IntSize.h', 'stubs/Region.h', - 'stubs/SkiaUtils.h', 'stubs/UnitBezier.h', 'stubs/config.h', @@ -270,7 +269,6 @@ 'stubs/float_size.h', 'stubs/int_point.h', 'stubs/int_size.h', - 'stubs/skia_utils.h', 'stubs/unit_bezier.h', ], }, diff --git a/cc/content_layer_updater.cc b/cc/content_layer_updater.cc index 8888e0d..5ad5f85 100644 --- a/cc/content_layer_updater.cc +++ b/cc/content_layer_updater.cc @@ -6,7 +6,6 @@ #include "cc/content_layer_updater.h" -#include "SkiaUtils.h" #include "base/debug/trace_event.h" #include "base/time.h" #include "cc/layer_painter.h" @@ -14,6 +13,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkRect.h" +#include "third_party/skia/include/core/SkScalar.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/rect_f.h" @@ -32,12 +32,12 @@ void ContentLayerUpdater::paintContents(SkCanvas* canvas, const gfx::Rect& conte { TRACE_EVENT0("cc", "ContentLayerUpdater::paintContents"); canvas->save(); - canvas->translate(FloatToSkScalar(-contentRect.x()), FloatToSkScalar(-contentRect.y())); + canvas->translate(SkFloatToScalar(-contentRect.x()), SkFloatToScalar(-contentRect.y())); gfx::Rect layerRect = contentRect; if (contentsWidthScale != 1 || contentsHeightScale != 1) { - canvas->scale(FloatToSkScalar(contentsWidthScale), FloatToSkScalar(contentsHeightScale)); + canvas->scale(SkFloatToScalar(contentsWidthScale), SkFloatToScalar(contentsHeightScale)); gfx::RectF rect = gfx::ScaleRect(contentRect, 1 / contentsWidthScale, 1 / contentsHeightScale); layerRect = gfx::ToEnclosingRect(rect); diff --git a/cc/stubs/SkiaUtils.h b/cc/stubs/SkiaUtils.h deleted file mode 100644 index c3bbf89..0000000 --- a/cc/stubs/SkiaUtils.h +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Temporary forwarding header -#include "cc/stubs/skia_utils.h" diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h deleted file mode 100644 index 8404fa3..0000000 --- a/cc/stubs/skia_utils.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_SKIAUTILS_H_ -#define CC_STUBS_SKIAUTILS_H_ - -#include <limits> - -#include "third_party/skia/include/core/SkScalar.h" - -namespace cc { - -// Skia has problems when passed infinite, etc floats, filter them to 0. -inline SkScalar FloatToSkScalar(float f) -{ - // This checks if |f| is NaN. - if (f != f) - return 0; - if (f == std::numeric_limits<double>::infinity()) - return 0; - if (f == -std::numeric_limits<double>::infinity()) - return 0; - return SkFloatToScalar(f); -} - -} - -#endif // CC_STUBS_SKIAUTILS_H_ |