Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: src/opts/SkPMFloat_none.h

Issue 1319413003: Move float<->byte conversions into Sk4f. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ranges Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/opts/SkPMFloat_none.h
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
deleted file mode 100644
index 17c76d90f4a505983d1ec21ff3b342e80c3ffcb8..0000000000000000000000000000000000000000
--- a/src/opts/SkPMFloat_none.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-namespace { // See SkPMFloat.h
-
-inline SkPMFloat::SkPMFloat(SkPMColor c) {
- float inv255 = 1.0f/255;
- *this = SkPMFloat::FromARGB(SkGetPackedA32(c) * inv255,
- SkGetPackedR32(c) * inv255,
- SkGetPackedG32(c) * inv255,
- SkGetPackedB32(c) * inv255);
- SkASSERT(this->isValid());
-}
-
-inline SkPMColor SkPMFloat::round() const {
- float a = this->a(),
- r = this->r(),
- g = this->g(),
- b = this->b();
- a = a < 0 ? 0 : (a > 1 ? 1 : a);
- r = r < 0 ? 0 : (r > 1 ? 1 : r);
- g = g < 0 ? 0 : (g > 1 ? 1 : g);
- b = b < 0 ? 0 : (b > 1 ? 1 : b);
- SkPMColor c = SkPackARGB32(255*a+0.5f, 255*r+0.5f, 255*g+0.5f, 255*b+0.5f);
- SkPMColorAssert(c);
- return c;
-}
-
-inline Sk4f SkPMFloat::alphas() const {
- return Sk4f(this->a());
-}
-
-inline SkPMFloat SkPMFloat::FromOpaqueColor(SkColor c) {
- SkASSERT(SkColorGetA(c) == 0xFF);
- float inv255 = 1.0f / 255;
- SkPMFloat pmf = SkPMFloat::FromARGB(1.0f,
- SkColorGetR(c) * inv255,
- SkColorGetG(c) * inv255,
- SkColorGetB(c) * inv255);
- SkASSERT(pmf.isValid());
- return pmf;
-}
-
-} // namespace

Powered by Google App Engine
This is Rietveld 408576698