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

Unified Diff: src/utils/SkBitSet.cpp

Issue 2265623002: src/utils/SkBitSet: simplify (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-19 (Friday) 16:05:19 EDT Created 4 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
« no previous file with comments | « src/utils/SkBitSet.h ('k') | src/xps/SkXPSDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitSet.cpp
diff --git a/src/utils/SkBitSet.cpp b/src/utils/SkBitSet.cpp
deleted file mode 100755
index 4323ffb6d35e5f1b5cc58d89c6f2b13db63fe979..0000000000000000000000000000000000000000
--- a/src/utils/SkBitSet.cpp
+++ /dev/null
@@ -1,70 +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 "SkBitSet.h"
-
-SkBitSet::SkBitSet(int numberOfBits)
- : fBitData(nullptr), fDwordCount(0), fBitCount(numberOfBits) {
- SkASSERT(numberOfBits > 0);
- // Round up size to 32-bit boundary.
- fDwordCount = (numberOfBits + 31) / 32;
- fBitData.set(sk_calloc_throw(fDwordCount * sizeof(uint32_t)));
-}
-
-SkBitSet::SkBitSet(SkBitSet&& source)
- : fBitData(source.fBitData.release())
- , fDwordCount(source.fDwordCount)
- , fBitCount(source.fBitCount) {
- source.fDwordCount = 0;
- source.fBitCount = 0;
-}
-
-SkBitSet& SkBitSet::operator=(SkBitSet&& rhs) {
- if (this != &rhs) {
- fBitCount = rhs.fBitCount;
- fDwordCount = rhs.fDwordCount;
- fBitData.reset(); // Free old pointer.
- fBitData.set(rhs.fBitData.release());
- rhs.fBitCount = 0;
- rhs.fDwordCount = 0;
- }
- return *this;
-}
-
-bool SkBitSet::operator==(const SkBitSet& rhs) {
- if (fBitCount == rhs.fBitCount) {
- if (fBitData.get() != nullptr) {
- return (memcmp(fBitData.get(), rhs.fBitData.get(),
- fDwordCount * sizeof(uint32_t)) == 0);
- }
- return true;
- }
- return false;
-}
-
-bool SkBitSet::operator!=(const SkBitSet& rhs) {
- return !(*this == rhs);
-}
-
-void SkBitSet::clearAll() {
- if (fBitData.get() != nullptr) {
- sk_bzero(fBitData.get(), fDwordCount * sizeof(uint32_t));
- }
-}
-
-bool SkBitSet::orBits(const SkBitSet& source) {
- if (fBitCount != source.fBitCount) {
- return false;
- }
- uint32_t* targetBitmap = this->internalGet(0);
- uint32_t* sourceBitmap = source.internalGet(0);
- for (size_t i = 0; i < fDwordCount; ++i) {
- targetBitmap[i] |= sourceBitmap[i];
- }
- return true;
-}
« no previous file with comments | « src/utils/SkBitSet.h ('k') | src/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698