Remove uses of SK_DEBUG and SkAssert
Change-Id: I72885e4413726750d3729d8df5a75507e3cdb9b4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103390
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nigi <nigi@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 532c157..a6e308d 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -2163,7 +2163,9 @@
// TODO(caryclark) Once Skia supports 8 bit src to 8 bit dst remove this
if (m_pBitmap && m_pBitmap->GetBPP() == 8 && pSource->GetBPP() == 8) {
SkMatrix inv;
- SkAssertResult(skMatrix.invert(&inv));
+ if (!skMatrix.invert(&inv)) {
+ return false;
+ }
for (int y = 0; y < m_pBitmap->GetHeight(); ++y) {
for (int x = 0; x < m_pBitmap->GetWidth(); ++x) {
SkPoint src = {x + 0.5f, y + 0.5f};
@@ -2264,10 +2266,10 @@
}
void CFX_DefaultRenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
-#ifdef SK_DEBUG
+#if !defined(NDEBUG)
static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver())
->DebugVerifyBitmapIsPreMultiplied();
-#endif // SK_DEBUG
+#endif
}
bool CFX_DefaultRenderDevice::SetBitsWithMask(
@@ -2284,7 +2286,7 @@
}
void CFX_DIBBase::DebugVerifyBitmapIsPreMultiplied() const {
-#ifdef SK_DEBUG
+#if !defined(NDEBUG)
DCHECK_EQ(GetBPP(), 32);
const uint32_t* buffer = reinterpret_cast<uint32_t*>(GetBuffer().data());
int width = GetWidth();
@@ -2297,11 +2299,11 @@
uint8_t r = SkGetPackedR32(srcRow[x]);
uint8_t g = SkGetPackedG32(srcRow[x]);
uint8_t b = SkGetPackedB32(srcRow[x]);
- SkA32Assert(a);
+ DCHECK(static_cast<unsigned>(a) <= SK_A32_MASK);
DCHECK(r <= a);
DCHECK(g <= a);
DCHECK(b <= a);
}
}
-#endif // SK_DEBUG
+#endif
}
diff --git a/third_party/skia_shared/SkFloatToDecimal.cpp b/third_party/skia_shared/SkFloatToDecimal.cpp
index 774974e..90d4be3 100644
--- a/third_party/skia_shared/SkFloatToDecimal.cpp
+++ b/third_party/skia_shared/SkFloatToDecimal.cpp
@@ -7,14 +7,11 @@
#include "SkFloatToDecimal.h"
+#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
-//#include "SkTypes.h"
-#include <cassert>
-#define SkASSERT assert
-
namespace pdfium {
namespace skia {
namespace {
@@ -44,9 +41,11 @@
while (e-- > 15) { value *= 10.0; }
return value;
} else {
- SkASSERT(e < 0);
+ assert(e < 0);
double value = 1.0;
- while (e++ < 0) { value /= 10.0; }
+ while (e++ < 0) {
+ value /= 10.0;
+ }
return value;
}
}
@@ -108,7 +107,7 @@
*output_ptr++ = '-';
value = -value;
}
- SkASSERT(value >= 0.0f);
+ assert(value >= 0.0f);
int binaryExponent;
(void)std::frexp(value, &binaryExponent);
@@ -116,31 +115,31 @@
int decimalExponent = static_cast<int>(std::floor(kLog2 * binaryExponent));
int decimalShift = decimalExponent - 8;
double power = pow10(-decimalShift);
- SkASSERT(value * power <= (double)INT_MAX);
+ assert(value * power <= (double)INT_MAX);
int d = static_cast<int>(value * power + 0.5);
- // SkASSERT(value == (float)(d * pow(10.0, decimalShift)));
- SkASSERT(d <= 999999999);
+ // assert(value == (float)(d * pow(10.0, decimalShift)));
+ assert(d <= 999999999);
if (d > 167772159) { // floor(pow(10,1+log10(1<<24)))
// need one fewer decimal digits for 24-bit precision.
decimalShift = decimalExponent - 7;
- // SkASSERT(power * 0.1 = pow10(-decimalShift));
+ // assert(power * 0.1 = pow10(-decimalShift));
// recalculate to get rounding right.
d = static_cast<int>(value * (power * 0.1) + 0.5);
- SkASSERT(d <= 99999999);
+ assert(d <= 99999999);
}
while (d % 10 == 0) {
d /= 10;
++decimalShift;
}
- SkASSERT(d > 0);
- // SkASSERT(value == (float)(d * pow(10.0, decimalShift)));
+ assert(d > 0);
+ // assert(value == (float)(d * pow(10.0, decimalShift)));
unsigned char buffer[9]; // decimal value buffer.
int bufferIndex = 0;
do {
buffer[bufferIndex++] = d % 10;
d /= 10;
} while (d != 0);
- SkASSERT(bufferIndex <= (int)sizeof(buffer) && bufferIndex > 0);
+ assert(bufferIndex <= (int)sizeof(buffer) && bufferIndex > 0);
if (decimalShift >= 0) {
do {
--bufferIndex;
@@ -174,7 +173,7 @@
}
}
}
- SkASSERT(output_ptr <= end);
+ assert(output_ptr <= end);
*output_ptr = '\0';
return static_cast<unsigned>(output_ptr - output);
}