Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index bef8d97..c52a460 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -73,7 +73,7 @@
}
fImpl->fZStream.zalloc = &skia_alloc_func;
fImpl->fZStream.zfree = &skia_free_func;
- fImpl->fZStream.opaque = NULL;
+ fImpl->fZStream.opaque = nullptr;
SkDEBUGCODE(int r =) deflateInit(&fImpl->fZStream, Z_DEFAULT_COMPRESSION);
SkASSERT(Z_OK == r);
}
@@ -87,7 +87,7 @@
do_deflate(Z_FINISH, &fImpl->fZStream, fImpl->fOut, fImpl->fInBuffer,
fImpl->fInBufferIndex);
(void)deflateEnd(&fImpl->fZStream);
- fImpl->fOut = NULL;
+ fImpl->fOut = nullptr;
}
bool SkDeflateWStream::write(const void* void_buffer, size_t len) {
diff --git a/src/pdf/SkJpegInfo.cpp b/src/pdf/SkJpegInfo.cpp
index 85cd325..455b4aa 100644
--- a/src/pdf/SkJpegInfo.cpp
+++ b/src/pdf/SkJpegInfo.cpp
@@ -22,7 +22,7 @@
}
if (JpegSegment::StandAloneMarker(fMarker)) {
fLength = 0;
- fBuffer = NULL;
+ fBuffer = nullptr;
return true;
}
if (!this->readBigendianUint16(&fLength) || fLength < 2) {
diff --git a/src/pdf/SkJpegInfo.h b/src/pdf/SkJpegInfo.h
index 1be4c0f..178d648 100644
--- a/src/pdf/SkJpegInfo.h
+++ b/src/pdf/SkJpegInfo.h
@@ -19,7 +19,7 @@
};
/** Returns true iff the data seems to be a valid JFIF JPEG image.
- If so and if info is not NULL, populate info.
+ If so and if info is not nullptr, populate info.
JPEG/JFIF References:
http://www.w3.org/Graphics/JPEG/itu-t81.pdf
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index 3505233..de43221 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -439,12 +439,12 @@
SkASSERT(canon);
if (!SkColorTypeIsValid(bitmap.colorType()) ||
kUnknown_SkColorType == bitmap.colorType()) {
- return NULL;
+ return nullptr;
}
SkBitmap copy;
const SkBitmap& bm = immutable_bitmap(bitmap, ©);
if (bm.drawsNothing()) {
- return NULL;
+ return nullptr;
}
if (SkPDFBitmap* canonBitmap = canon->findBitmap(bm)) {
return SkRef(canonBitmap);
@@ -463,7 +463,7 @@
}
}
- SkPDFObject* smask = NULL;
+ SkPDFObject* smask = nullptr;
if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) {
smask = new PDFAlphaBitmap(bm);
}
diff --git a/src/pdf/SkPDFBitmap.h b/src/pdf/SkPDFBitmap.h
index 2c8653f..58d91be 100644
--- a/src/pdf/SkPDFBitmap.h
+++ b/src/pdf/SkPDFBitmap.h
@@ -24,7 +24,7 @@
*/
class SkPDFBitmap : public SkPDFObject {
public:
- // Returns NULL on unsupported bitmap;
+ // Returns nullptr on unsupported bitmap;
static SkPDFBitmap* Create(SkPDFCanon*, const SkBitmap&);
bool equals(const SkBitmap& other) const {
return fBitmap.getGenerationID() == other.getGenerationID() &&
diff --git a/src/pdf/SkPDFCanon.cpp b/src/pdf/SkPDFCanon.cpp
index b6187cb..6cc3995 100644
--- a/src/pdf/SkPDFCanon.cpp
+++ b/src/pdf/SkPDFCanon.cpp
@@ -41,7 +41,7 @@
return ptrArray[i];
}
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -51,7 +51,7 @@
SkPDFFont** relatedFontPtr) const {
SkASSERT(relatedFontPtr);
- SkPDFFont* relatedFont = NULL;
+ SkPDFFont* relatedFont = nullptr;
for (int i = 0; i < fFontRecords.count(); ++i) {
SkPDFFont::Match match = SkPDFFont::IsMatch(
fFontRecords[i].fFont, fFontRecords[i].fFontID,
@@ -62,8 +62,8 @@
relatedFont = fFontRecords[i].fFont;
}
}
- *relatedFontPtr = relatedFont; // May still be NULL.
- return NULL;
+ *relatedFontPtr = relatedFont; // May still be nullptr.
+ return nullptr;
}
void SkPDFCanon::addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID) {
@@ -109,7 +109,7 @@
const SkPDFGraphicState* SkPDFCanon::findGraphicState(
const SkPDFGraphicState& key) const {
const WrapGS* ptr = fGraphicStateRecords.find(WrapGS(&key));
- return ptr ? ptr->fPtr : NULL;
+ return ptr ? ptr->fPtr : nullptr;
}
void SkPDFCanon::addGraphicState(const SkPDFGraphicState* state) {
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 5198e7b..2ad5a22 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -40,9 +40,9 @@
// reset to original setting, unrefs all objects.
void reset();
- // Returns exact match if there is one. If not, it returns NULL.
+ // Returns exact match if there is one. If not, it returns nullptr.
// If there is no exact match, but there is a related font, we
- // still return NULL, but also set *relatedFont.
+ // still return nullptr, but also set *relatedFont.
SkPDFFont* findFont(uint32_t fontID,
uint16_t glyphID,
SkPDFFont** relatedFont) const;
@@ -78,7 +78,7 @@
SkTDArray<SkPDFImageShader*> fImageShaderRecords;
struct WrapGS {
- explicit WrapGS(const SkPDFGraphicState* ptr = NULL) : fPtr(ptr) {}
+ explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {}
const SkPDFGraphicState* fPtr;
bool operator==(const WrapGS& rhs) const {
SkASSERT(fPtr);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 678e6c0..a5c9557 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -43,7 +43,7 @@
static void replace_srcmode_on_opaque_paint(SkPaint* paint) {
if (kSrcOver_SkXfermodeInterpretation
== SkInterpretXfermode(*paint, false)) {
- paint->setXfermode(NULL);
+ paint->setXfermode(nullptr);
}
}
@@ -86,7 +86,7 @@
SkMatrix ident;
ident.reset();
- SkAutoGlyphCache autoCache(paint, NULL, &ident);
+ SkAutoGlyphCache autoCache(paint, nullptr, &ident);
SkGlyphCache* cache = autoCache.getCache();
const char* start = reinterpret_cast<const char*>(glyphs);
@@ -126,7 +126,7 @@
const uint16_t** glyphIDs) {
// Make sure we have a glyph id encoding.
if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) {
- int numGlyphs = paint.textToGlyphs(text, len, NULL);
+ int numGlyphs = paint.textToGlyphs(text, len, nullptr);
storage->reset(numGlyphs);
paint.textToGlyphs(text, len, storage->get());
*glyphIDs = storage->get();
@@ -204,10 +204,10 @@
int fGraphicStateIndex;
// We may change the font (i.e. for Type1 support) within a
- // ContentEntry. This is the one currently in effect, or NULL if none.
+ // ContentEntry. This is the one currently in effect, or nullptr if none.
SkPDFFont* fFont;
// In PDF, text size has no default value. It is only valid if fFont is
- // not NULL.
+ // not nullptr.
SkScalar fTextSize;
};
@@ -216,7 +216,7 @@
fTextFill(SkPaint::kFill_Style),
fShaderIndex(-1),
fGraphicStateIndex(-1),
- fFont(NULL),
+ fFont(nullptr),
fTextSize(SK_ScalarNaN) {
fMatrix.reset();
}
@@ -309,7 +309,7 @@
}
}
- SkASSERT(prefixEntry == NULL);
+ SkASSERT(prefixEntry == nullptr);
}
static void emit_clip(SkPath* clipPath, SkRect* clipRect,
@@ -444,7 +444,7 @@
#ifdef SK_PDF_USE_PATHOPS_CLIPPING
SkPath clipPath;
if (get_clip_stack_path(transform, clipStack, clipRegion, &clipPath)) {
- emit_clip(&clipPath, NULL, fContentStream);
+ emit_clip(&clipPath, nullptr, fContentStream);
return;
}
#endif
@@ -474,7 +474,7 @@
if (needRegion) {
SkPath clipPath;
SkAssertResult(clipRegion.getBoundaryPath(&clipPath));
- emit_clip(&clipPath, NULL, fContentStream);
+ emit_clip(&clipPath, nullptr, fContentStream);
} else {
skip_clip_stack_prefix(fEntries[0].fClipStack, clipStack, &iter);
const SkClipStack::Element* clipEntry;
@@ -484,14 +484,14 @@
case SkClipStack::Element::kRect_Type: {
SkRect translatedClip;
transform.mapRect(&translatedClip, clipEntry->getRect());
- emit_clip(NULL, &translatedClip, fContentStream);
+ emit_clip(nullptr, &translatedClip, fContentStream);
break;
}
default: {
SkPath translatedPath;
clipEntry->asPath(&translatedPath);
translatedPath.transform(transform, &translatedPath);
- emit_clip(&translatedPath, NULL, fContentStream);
+ emit_clip(&translatedPath, nullptr, fContentStream);
break;
}
}
@@ -572,13 +572,13 @@
// to improve quality and file size (http://skbug.com/3043)
// TODO: should we return true if there is a colorfilter?
- return layerPaint.getImageFilter() != NULL;
+ return layerPaint.getImageFilter() != nullptr;
}
SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint* layerPaint) {
if (cinfo.fForImageFilter ||
(layerPaint && not_supported_for_layers(*layerPaint))) {
- return NULL;
+ return nullptr;
}
SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
return SkPDFDevice::Create(size, fRasterDpi, fCanon);
@@ -594,9 +594,9 @@
// So we manually destruct the object.
~ContentEntry() {
ContentEntry* val = fNext.detach();
- while (val != NULL) {
+ while (val != nullptr) {
ContentEntry* valNext = val->fNext.detach();
- // When the destructor is called, fNext is NULL and exits.
+ // When the destructor is called, fNext is nullptr and exits.
delete val;
val = valNext;
}
@@ -610,18 +610,18 @@
ScopedContentEntry(SkPDFDevice* device, const SkDraw& draw,
const SkPaint& paint, bool hasText = false)
: fDevice(device),
- fContentEntry(NULL),
+ fContentEntry(nullptr),
fXfermode(SkXfermode::kSrcOver_Mode),
- fDstFormXObject(NULL) {
+ fDstFormXObject(nullptr) {
init(draw.fClipStack, *draw.fClip, *draw.fMatrix, paint, hasText);
}
ScopedContentEntry(SkPDFDevice* device, const SkClipStack* clipStack,
const SkRegion& clipRegion, const SkMatrix& matrix,
const SkPaint& paint, bool hasText = false)
: fDevice(device),
- fContentEntry(NULL),
+ fContentEntry(nullptr),
fXfermode(SkXfermode::kSrcOver_Mode),
- fDstFormXObject(NULL) {
+ fDstFormXObject(nullptr) {
init(clipStack, clipRegion, matrix, paint, hasText);
}
@@ -629,7 +629,7 @@
if (fContentEntry) {
SkPath* shape = &fShape;
if (shape->isEmpty()) {
- shape = NULL;
+ shape = nullptr;
}
fDevice->finishContentEntry(fXfermode, fDstFormXObject, shape);
}
@@ -702,11 +702,11 @@
, fPageSize(pageSize)
, fContentSize(pageSize)
, fExistingClipRegion(SkIRect::MakeSize(pageSize))
- , fAnnotations(NULL)
- , fLastContentEntry(NULL)
- , fLastMarginContentEntry(NULL)
+ , fAnnotations(nullptr)
+ , fLastContentEntry(nullptr)
+ , fLastMarginContentEntry(nullptr)
, fDrawingArea(kContent_DrawingArea)
- , fClipStack(NULL)
+ , fClipStack(nullptr)
, fFontGlyphUsage(new SkPDFGlyphSetMap)
, fRasterDpi(rasterDpi)
, fCanon(canon) {
@@ -731,13 +731,13 @@
}
void SkPDFDevice::init() {
- fAnnotations = NULL;
+ fAnnotations = nullptr;
fContentEntries.free();
- fLastContentEntry = NULL;
+ fLastContentEntry = nullptr;
fMarginContentEntries.free();
- fLastMarginContentEntry = NULL;
+ fLastMarginContentEntry = nullptr;
fDrawingArea = kContent_DrawingArea;
- if (fFontGlyphUsage.get() == NULL) {
+ if (fFontGlyphUsage.get() == nullptr) {
fFontGlyphUsage.reset(new SkPDFGlyphSetMap);
}
}
@@ -946,7 +946,7 @@
if (linkToName) {
return create_link_named_dest(linkToName, r);
}
- return NULL;
+ return nullptr;
}
void SkPDFDevice::drawRect(const SkDraw& d,
@@ -963,7 +963,7 @@
}
SkPath path;
path.addRect(r);
- drawPath(d, path, paint, NULL, true);
+ drawPath(d, path, paint, nullptr, true);
return;
}
@@ -996,7 +996,7 @@
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addRRect(rrect);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkPDFDevice::drawOval(const SkDraw& draw,
@@ -1006,7 +1006,7 @@
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addOval(oval);
- this->drawPath(draw, path, paint, NULL, true);
+ this->drawPath(draw, path, paint, nullptr, true);
}
void SkPDFDevice::drawPath(const SkDraw& d,
@@ -1043,14 +1043,14 @@
bool fill = paint.getFillPath(origPath, pathPtr);
SkPaint noEffectPaint(paint);
- noEffectPaint.setPathEffect(NULL);
+ noEffectPaint.setPathEffect(nullptr);
if (fill) {
noEffectPaint.setStyle(SkPaint::kFill_Style);
} else {
noEffectPaint.setStyle(SkPaint::kStroke_Style);
noEffectPaint.setStrokeWidth(0);
}
- drawPath(d, *pathPtr, noEffectPaint, NULL, true);
+ drawPath(d, *pathPtr, noEffectPaint, nullptr, true);
return;
}
@@ -1154,7 +1154,7 @@
SkMatrix transform = matrix;
transform.postConcat(*d.fMatrix);
- this->internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, NULL,
+ this->internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, nullptr,
paint);
}
@@ -1171,7 +1171,7 @@
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y));
- this->internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL,
+ this->internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, nullptr,
paint);
}
@@ -1215,8 +1215,8 @@
SkPaint paint = srcPaint;
replace_srcmode_on_opaque_paint(&paint);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- if (paint.getMaskFilter() != NULL) {
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ if (paint.getMaskFilter() != nullptr) {
// Don't pretend we support drawing MaskFilters, it makes for artifacts
// making text unreadable (e.g. same text twice when using CSS shadows).
return;
@@ -1228,7 +1228,7 @@
}
SkGlyphStorage storage(0);
- const uint16_t* glyphIDs = NULL;
+ const uint16_t* glyphIDs = nullptr;
int numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -1267,8 +1267,8 @@
SkPaint paint = srcPaint;
replace_srcmode_on_opaque_paint(&paint);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- if (paint.getMaskFilter() != NULL) {
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ if (paint.getMaskFilter() != nullptr) {
// Don't pretend we support drawing MaskFilters, it makes for artifacts
// making text unreadable (e.g. same text twice when using CSS shadows).
return;
@@ -1281,7 +1281,7 @@
}
SkGlyphStorage storage(0);
- const uint16_t* glyphIDs = NULL;
+ const uint16_t* glyphIDs = nullptr;
size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -1374,7 +1374,7 @@
void SkPDFDevice::onDetachFromCanvas() {
INHERITED::onDetachFromCanvas();
- fClipStack = NULL;
+ fClipStack = nullptr;
}
SkSurface* SkPDFDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
@@ -1451,7 +1451,7 @@
// TODO(ctguil): For margins, I'm not sure fExistingClipStack/Region is the
// right thing to pass here.
GraphicStackState gsState(fExistingClipStack, fExistingClipRegion, data);
- while (entry != NULL) {
+ while (entry != nullptr) {
SkPoint translation;
translation.iset(this->getOrigin());
translation.negate();
@@ -1485,7 +1485,7 @@
if (fPageSize != fContentSize) {
SkRect r = SkRect::MakeWH(SkIntToScalar(this->width()),
SkIntToScalar(this->height()));
- emit_clip(NULL, &r, out);
+ emit_clip(nullptr, &r, out);
}
SkPDFDevice::copyContentEntriesToData(fContentEntries.get(), out);
@@ -1525,7 +1525,7 @@
// To be consistent with the raster output, hairline strokes
// are rendered as non-inverted.
modifiedPath.toggleInverseFillType();
- drawPath(d, modifiedPath, paint, NULL, true);
+ drawPath(d, modifiedPath, paint, nullptr, true);
return true;
}
}
@@ -1584,7 +1584,7 @@
}
void SkPDFDevice::addAnnotation(SkPDFDict* annotation) {
- if (NULL == fAnnotations) {
+ if (nullptr == fAnnotations) {
fAnnotations = new SkPDFArray;
}
fAnnotations->appendObject(annotation);
@@ -1653,14 +1653,14 @@
const SkPaint& paint,
bool hasText,
SkPDFFormXObject** dst) {
- *dst = NULL;
+ *dst = nullptr;
if (clipRegion.isEmpty()) {
- return NULL;
+ return nullptr;
}
// The clip stack can come from an SkDraw where it is technically optional.
SkClipStack synthesizedClipStack;
- if (clipStack == NULL) {
+ if (clipStack == nullptr) {
if (clipRegion == fExistingClipRegion) {
clipStack = &fExistingClipStack;
} else {
@@ -1699,7 +1699,7 @@
xfermode != SkXfermode::kSrcOut_Mode) {
// Except for Src and SrcOut, if there isn't anything already there,
// then we're done.
- return NULL;
+ return nullptr;
}
}
// TODO(vandebo): Figure out how/if we can handle the following modes:
@@ -1707,7 +1707,7 @@
// Dst xfer mode doesn't draw source at all.
if (xfermode == SkXfermode::kDst_Mode) {
- return NULL;
+ return nullptr;
}
ContentEntry* entry;
@@ -1798,7 +1798,7 @@
// If there is shape, then an empty source with Src, SrcIn, SrcOut,
// DstIn, DstAtop or Modulate reduces to Clear and DstOut or SrcAtop
// reduces to Dst.
- if (shape == NULL || xfermode == SkXfermode::kDstOut_Mode ||
+ if (shape == nullptr || xfermode == SkXfermode::kDstOut_Mode ||
xfermode == SkXfermode::kSrcATop_Mode) {
ScopedContentEntry content(this, &fExistingClipStack,
fExistingClipRegion, identity,
@@ -1827,7 +1827,7 @@
} else {
SkAutoTUnref<SkPDFFormXObject> dstMaskStorage;
SkPDFFormXObject* dstMask = srcFormXObject.get();
- if (shape != NULL) {
+ if (shape != nullptr) {
// Draw shape into a form-xobject.
SkDraw d;
d.fMatrix = &identity;
@@ -1836,7 +1836,7 @@
SkPaint filledPaint;
filledPaint.setColor(SK_ColorBLACK);
filledPaint.setStyle(SkPaint::kFill_Style);
- this->drawPath(d, *shape, filledPaint, NULL, true);
+ this->drawPath(d, *shape, filledPaint, nullptr, true);
dstMaskStorage.reset(createFormXObjectFromDevice());
dstMask = dstMaskStorage.get();
@@ -1915,9 +1915,9 @@
const SkPaint& paint,
bool hasText,
GraphicStateEntry* entry) {
- NOT_IMPLEMENTED(paint.getPathEffect() != NULL, false);
- NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
- NOT_IMPLEMENTED(paint.getColorFilter() != NULL, false);
+ NOT_IMPLEMENTED(paint.getPathEffect() != nullptr, false);
+ NOT_IMPLEMENTED(paint.getMaskFilter() != nullptr, false);
+ NOT_IMPLEMENTED(paint.getColorFilter() != nullptr, false);
entry->fMatrix = matrix;
entry->fClipStack = clipStack;
@@ -1967,7 +1967,7 @@
SkShader::GradientInfo gradientInfo;
SkColor gradientColor;
gradientInfo.fColors = &gradientColor;
- gradientInfo.fColorOffsets = NULL;
+ gradientInfo.fColorOffsets = nullptr;
gradientInfo.fColorCount = 1;
if (shader->asAGradient(&gradientInfo) ==
SkShader::kColor_GradientType) {
@@ -2025,7 +2025,7 @@
void SkPDFDevice::updateFont(const SkPaint& paint, uint16_t glyphID,
ContentEntry* contentEntry) {
SkTypeface* typeface = paint.getTypeface();
- if (contentEntry->fState.fFont == NULL ||
+ if (contentEntry->fState.fFont == nullptr ||
contentEntry->fState.fTextSize != paint.getTextSize() ||
!contentEntry->fState.fFont->hasGlyph(glyphID)) {
int fontIndex = getFontResourceIndex(typeface, glyphID);
@@ -2080,7 +2080,7 @@
subsetBitmap = &tmpSubsetBitmap;
*subsetBitmap = origBitmap;
}
- srcRect = NULL;
+ srcRect = nullptr;
// Transform the bitmap in the new space, without taking into
// account the initial transform.
@@ -2156,7 +2156,7 @@
SkScalarCeilToInt(bounds.width()),
SkScalarCeilToInt(bounds.height())));
clipRegion = &perspectiveBounds;
- srcRect = NULL;
+ srcRect = nullptr;
bitmap = &perspectiveBitmap;
}
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 06d3e10..fbd5fb3 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -152,7 +152,7 @@
*/
SkPDFArray* copyMediaBox() const;
- /** Get the annotations from this page, or NULL if there are none.
+ /** Get the annotations from this page, or nullptr if there are none.
*/
SkPDFArray* getAnnotations() const { return fAnnotations; }
@@ -247,7 +247,7 @@
bool invertClip);
// If the paint or clip is such that we shouldn't draw anything, this
- // returns NULL and does not create a content entry.
+ // returns nullptr and does not create a content entry.
// setUpContentEntry and finishContentEntry can be used directly, but
// the preferred method is to use the ScopedContentEntry helper class.
ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
@@ -288,7 +288,7 @@
bool handleInversePath(const SkDraw& d, const SkPath& origPath,
const SkPaint& paint, bool pathIsMutable,
- const SkMatrix* prePathMatrix = NULL);
+ const SkMatrix* prePathMatrix = nullptr);
bool handlePointAnnotation(const SkPoint* points, size_t count,
const SkMatrix& matrix, SkAnnotation* annot);
void addAnnotation(SkPDFDict*);
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 25ffc0b..8df59b7 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -77,7 +77,7 @@
return parsePFBSection(&srcPtr, &remaining, 1, headerLen) &&
parsePFBSection(&srcPtr, &remaining, 2, dataLen) &&
parsePFBSection(&srcPtr, &remaining, 1, trailerLen) &&
- parsePFBSection(&srcPtr, &remaining, 3, NULL);
+ parsePFBSection(&srcPtr, &remaining, 3, nullptr);
}
/* The sections of a PFA file are implicitly defined. The body starts
@@ -162,13 +162,13 @@
// Make as few copies as possible given these constraints.
SkDynamicMemoryWStream dynamicStream;
SkAutoTDelete<SkMemoryStream> staticStream;
- SkData* data = NULL;
+ SkData* data = nullptr;
const uint8_t* src;
size_t srcLen;
if ((srcLen = srcStream->getLength()) > 0) {
staticStream.reset(new SkMemoryStream(srcLen + 1));
src = (const uint8_t*)staticStream->getMemoryBase();
- if (srcStream->getMemoryBase() != NULL) {
+ if (srcStream->getMemoryBase() != nullptr) {
memcpy((void *)src, srcStream->getMemoryBase(), srcLen);
} else {
size_t read = 0;
@@ -176,7 +176,7 @@
size_t got = srcStream->read((void *)staticStream->getAtPos(),
srcLen - read);
if (got == 0) {
- return NULL;
+ return nullptr;
}
read += got;
staticStream->seek(read);
@@ -191,7 +191,7 @@
dynamicStream.write(buf, amount);
}
amount = 0;
- dynamicStream.write(&amount, 1); // NULL terminator.
+ dynamicStream.write(&amount, 1); // nullptr terminator.
data = dynamicStream.copyToData();
src = data->bytes();
srcLen = data->size() - 1;
@@ -268,7 +268,7 @@
return SkData::NewFromMalloc(buffer.detach(), length);
}
- return NULL;
+ return nullptr;
}
// scale from em-units to base-1000, returning as a SkScalar
@@ -329,7 +329,7 @@
SkPDFArray* array),
Data* defaultAdvance) {
SkPDFArray* result = new SkPDFArray();
- for (; advanceInfo != NULL; advanceInfo = advanceInfo->fNext.get()) {
+ for (; advanceInfo != nullptr; advanceInfo = advanceInfo->fNext.get()) {
switch (advanceInfo->fType) {
case SkAdvancedTypefaceMetrics::WidthRange::kDefault: {
SkASSERT(advanceInfo->fAdvance.count() == 1);
@@ -520,7 +520,7 @@
for (int i = firstGlyphID - glyphOffset; i < limit + 1; ++i) {
bool inSubset = i < limit &&
- (subset == NULL || subset->has(i + glyphOffset));
+ (subset == nullptr || subset->has(i + glyphOffset));
if (!rangeEmpty) {
// PDF spec requires bfrange not changing the higher byte,
// e.g. <1035> <10FF> <2222> is ok, but
@@ -596,11 +596,11 @@
size_t fontSize = fontData->getLength();
// Read font into buffer.
- SkPDFStream* subsetFontStream = NULL;
+ SkPDFStream* subsetFontStream = nullptr;
SkTDArray<unsigned char> originalFont;
originalFont.setCount(SkToInt(fontSize));
if (fontData->read(originalFont.begin(), fontSize) == fontSize) {
- unsigned char* subsetFont = NULL;
+ unsigned char* subsetFont = nullptr;
// sfntly requires unsigned int* to be passed in, as far as we know,
// unsigned int is equivalent to uint32_t on all platforms.
static_assert(sizeof(unsigned int) == sizeof(uint32_t), "unsigned_int_not_32_bits");
@@ -610,11 +610,11 @@
subset.begin(),
subset.count(),
&subsetFont);
- if (subsetFontSize > 0 && subsetFont != NULL) {
+ if (subsetFontSize > 0 && subsetFont != nullptr) {
SkAutoDataUnref data(SkData::NewWithProc(subsetFont,
subsetFontSize,
sk_delete_array,
- NULL));
+ nullptr));
subsetFontStream = new SkPDFStream(data.get());
fontSize = subsetFontSize;
}
@@ -671,7 +671,7 @@
const SkPDFGlyphSetMap::FontGlyphSetPair* SkPDFGlyphSetMap::F2BIter::next() const {
if (fIndex >= fMap->count()) {
- return NULL;
+ return nullptr;
}
return &((*fMap)[fIndex++]);
}
@@ -697,7 +697,7 @@
void SkPDFGlyphSetMap::reset() {
for (int i = 0; i < fMap.count(); ++i) {
- delete fMap[i].fGlyphSet; // Should not be NULL.
+ delete fMap[i].fGlyphSet; // Should not be nullptr.
}
fMap.reset();
}
@@ -806,7 +806,7 @@
}
SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics;
- SkPDFDict* relatedFontDescriptor = NULL;
+ SkPDFDict* relatedFontDescriptor = nullptr;
if (relatedFont) {
fontMetrics.reset(SkSafeRef(relatedFont->fontInfo()));
relatedFontDescriptor = relatedFont->getFontDescriptor();
@@ -832,7 +832,7 @@
info, SkTypeface::kHAdvance_PerGlyphInfo);
#endif
fontMetrics.reset(
- typeface->getAdvancedTypefaceMetrics(info, NULL, 0));
+ typeface->getAdvancedTypefaceMetrics(info, nullptr, 0));
#if defined (SK_SFNTLY_SUBSETTER)
if (fontMetrics.get() &&
fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) {
@@ -840,7 +840,7 @@
info = SkTBitOr<SkTypeface::PerGlyphInfo>(
info, SkTypeface::kHAdvance_PerGlyphInfo);
fontMetrics.reset(
- typeface->getAdvancedTypefaceMetrics(info, NULL, 0));
+ typeface->getAdvancedTypefaceMetrics(info, nullptr, 0));
}
#endif
}
@@ -852,7 +852,7 @@
}
SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
- return NULL; // Default: no support.
+ return nullptr; // Default: no support.
}
SkPDFFont::SkPDFFont(const SkAdvancedTypefaceMetrics* info,
@@ -864,7 +864,7 @@
, fLastGlyphID(info ? info->fLastGlyphID : 0)
, fFontInfo(SkSafeRef(info))
, fDescriptor(SkSafeRef(relatedFontDescriptor)) {
- if (info == NULL ||
+ if (info == nullptr ||
info->fFlags & SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag) {
fFontType = SkAdvancedTypefaceMetrics::kOther_Font;
} else {
@@ -886,7 +886,7 @@
}
if (type == SkAdvancedTypefaceMetrics::kType1CID_Font ||
type == SkAdvancedTypefaceMetrics::kTrueType_Font) {
- SkASSERT(relatedFontDescriptor == NULL);
+ SkASSERT(relatedFontDescriptor == nullptr);
return new SkPDFType0Font(info, typeface);
}
if (type == SkAdvancedTypefaceMetrics::kType1_Font) {
@@ -904,7 +904,7 @@
}
void SkPDFFont::setFontInfo(const SkAdvancedTypefaceMetrics* info) {
- if (info == NULL || info == fFontInfo.get()) {
+ if (info == nullptr || info == fFontInfo.get()) {
return;
}
fFontInfo.reset(info);
@@ -933,7 +933,7 @@
}
bool SkPDFFont::addCommonFontDescriptorEntries(int16_t defaultWidth) {
- if (fDescriptor.get() == NULL) {
+ if (fDescriptor.get() == nullptr) {
return false;
}
@@ -970,7 +970,7 @@
}
void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
- if (fFontInfo == NULL || fFontInfo->fGlyphToUnicode.begin() == NULL) {
+ if (fFontInfo == nullptr || fFontInfo->fGlyphToUnicode.begin() == nullptr) {
return;
}
this->insertObjRef("ToUnicode",
@@ -986,10 +986,10 @@
///////////////////////////////////////////////////////////////////////////////
SkPDFType0Font::SkPDFType0Font(const SkAdvancedTypefaceMetrics* info, SkTypeface* typeface)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
SkDEBUGCODE(fPopulated = false);
if (!canSubset()) {
- this->populate(NULL);
+ this->populate(nullptr);
}
}
@@ -997,7 +997,7 @@
SkPDFFont* SkPDFType0Font::getFontSubset(const SkPDFGlyphSet* subset) {
if (!canSubset()) {
- return NULL;
+ return nullptr;
}
SkPDFType0Font* newSubset = new SkPDFType0Font(fontInfo(), typeface());
newSubset->populate(subset);
@@ -1037,7 +1037,7 @@
SkPDFCIDFont::SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
const SkPDFGlyphSet* subset)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
this->populate(subset);
}
@@ -1062,7 +1062,7 @@
#if defined(SK_SFNTLY_SUBSETTER)
if (this->canSubset()) {
SkAutoTUnref<SkPDFStream> fontStream;
- SkPDFStream* rawStream = NULL;
+ SkPDFStream* rawStream = nullptr;
fontSize = get_subset_font_stream(fontInfo()->fFontName.c_str(),
typeface(),
*subset,
@@ -1077,7 +1077,7 @@
#endif
SkAutoTUnref<SkPDFSharedStream> fontStream;
SkAutoTDelete<SkStreamAsset> fontData(
- this->typeface()->openStream(NULL));
+ this->typeface()->openStream(nullptr));
SkASSERT(fontData);
fontSize = fontData->getLength();
SkASSERT(fontSize > 0);
@@ -1089,7 +1089,7 @@
case SkAdvancedTypefaceMetrics::kCFF_Font:
case SkAdvancedTypefaceMetrics::kType1CID_Font: {
SkAutoTUnref<SkPDFSharedStream> fontStream(
- new SkPDFSharedStream(this->typeface()->openStream(NULL)));
+ new SkPDFSharedStream(this->typeface()->openStream(nullptr)));
if (getType() == SkAdvancedTypefaceMetrics::kCFF_Font) {
fontStream->dict()->insertName("Subtype", "Type1C");
@@ -1123,7 +1123,7 @@
info = SkTypeface::kGlyphNames_PerGlyphInfo;
info = SkTBitOr<SkTypeface::PerGlyphInfo>(
info, SkTypeface::kHAdvance_PerGlyphInfo);
- uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin();
+ uint32_t* glyphs = (glyphIDs.count() == 0) ? nullptr : glyphIDs.begin();
uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0;
SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics(
typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount));
@@ -1131,7 +1131,7 @@
addFontDescriptor(0, &glyphIDs);
} else {
// Other CID fonts
- addFontDescriptor(0, NULL);
+ addFontDescriptor(0, nullptr);
}
insertName("BaseFont", fontInfo()->fFontName);
@@ -1219,7 +1219,7 @@
SkAutoTDelete<SkStream> rawFontData(typeface()->openStream(&ttcIndex));
SkAutoTUnref<SkData> fontData(handle_type1_stream(rawFontData.get(), &header,
&data, &trailer));
- if (fontData.get() == NULL) {
+ if (fontData.get() == nullptr) {
return false;
}
if (canEmbed()) {
@@ -1242,10 +1242,10 @@
adjustGlyphRangeForSingleByteEncoding(glyphID);
int16_t defaultWidth = 0;
- const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry = NULL;
+ const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry = nullptr;
const SkAdvancedTypefaceMetrics::WidthRange* widthEntry;
for (widthEntry = fontInfo()->fGlyphWidths.get();
- widthEntry != NULL;
+ widthEntry != nullptr;
widthEntry = widthEntry->fNext.get()) {
switch (widthEntry->fType) {
case SkAdvancedTypefaceMetrics::WidthRange::kDefault:
@@ -1255,7 +1255,7 @@
SkASSERT(false);
break;
case SkAdvancedTypefaceMetrics::WidthRange::kRange:
- SkASSERT(widthRangeEntry == NULL);
+ SkASSERT(widthRangeEntry == nullptr);
widthRangeEntry = widthEntry;
break;
}
@@ -1320,7 +1320,7 @@
SkPDFType3Font::SkPDFType3Font(const SkAdvancedTypefaceMetrics* info,
SkTypeface* typeface,
uint16_t glyphID)
- : SkPDFFont(info, typeface, NULL) {
+ : SkPDFFont(info, typeface, nullptr) {
this->populate(glyphID);
}
@@ -1331,7 +1331,7 @@
paint.setTypeface(typeface());
paint.setTextSize(1000);
const SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- SkAutoGlyphCache autoCache(paint, &props, NULL);
+ SkAutoGlyphCache autoCache(paint, &props, nullptr);
SkGlyphCache* cache = autoCache.getCache();
// If fLastGlyphID isn't set (because there is not fFontInfo), look it up.
if (lastGlyphID() == 0) {
@@ -1394,7 +1394,7 @@
this->insertObject("Widths", widthArray.detach());
this->insertName("CIDToGIDMap", "Identity");
- this->populateToUnicodeTable(NULL);
+ this->populateToUnicodeTable(nullptr);
return true;
}
@@ -1409,7 +1409,7 @@
if (existingGlyphID == 0 || searchGlyphID == 0) {
return SkPDFFont::kExact_Match;
}
- if (existingFont != NULL) {
+ if (existingFont != nullptr) {
return (existingFont->fFirstGlyphID <= searchGlyphID &&
searchGlyphID <= existingFont->fLastGlyphID)
? SkPDFFont::kExact_Match
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index d85c582..404e8b7 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -82,7 +82,7 @@
public:
virtual ~SkPDFFont();
- /** Returns the typeface represented by this class. Returns NULL for the
+ /** Returns the typeface represented by this class. Returns nullptr for the
* default typeface.
*/
SkTypeface* typeface();
@@ -133,7 +133,7 @@
/** Subset the font based on usage set. Returns a SkPDFFont instance with
* subset.
* @param usage Glyph subset requested.
- * @return NULL if font does not support subsetting, a new instance
+ * @return nullptr if font does not support subsetting, a new instance
* of SkPDFFont otherwise.
*/
virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
@@ -175,7 +175,7 @@
void adjustGlyphRangeForSingleByteEncoding(uint16_t glyphID);
// Generate ToUnicode table according to glyph usage subset.
- // If subset is NULL, all available glyph ids will be used.
+ // If subset is nullptr, all available glyph ids will be used.
void populateToUnicodeTable(const SkPDFGlyphSet* subset);
// Create instances of derived types based on fontInfo.
diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp
index 07f42fa..09db140 100644
--- a/src/pdf/SkPDFFormXObject.cpp
+++ b/src/pdf/SkPDFFormXObject.cpp
@@ -25,7 +25,7 @@
this->setData(content.get());
SkAutoTUnref<SkPDFArray> bboxArray(device->copyMediaBox());
- this->init(NULL, resourceDict.get(), bboxArray);
+ this->init(nullptr, resourceDict.get(), bboxArray);
// We invert the initial transform and apply that to the xobject so that
// it doesn't get applied twice. We can't just undo it because it's
@@ -68,7 +68,7 @@
SkAutoTUnref<SkPDFDict> group(new SkPDFDict("Group"));
group->insertName("S", "Transparency");
- if (colorSpace != NULL) {
+ if (colorSpace != nullptr) {
group->insertName("CS", colorSpace);
}
group->insertBool("I", true); // Isolated.
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index bff32ae..162ddc8 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -65,9 +65,9 @@
// TODO(vandebo): Figure out if we can support more of these modes.
case SkXfermode::kXor_Mode:
case SkXfermode::kPlus_Mode:
- return NULL;
+ return nullptr;
}
- return NULL;
+ return nullptr;
}
// If a SkXfermode is unsupported in PDF, this function returns
diff --git a/src/pdf/SkPDFResourceDict.h b/src/pdf/SkPDFResourceDict.h
index 2913779..698823b 100644
--- a/src/pdf/SkPDFResourceDict.h
+++ b/src/pdf/SkPDFResourceDict.h
@@ -34,7 +34,7 @@
* The full set of ProcSet entries is automatically created for backwards
* compatibility, as recommended by the PDF spec.
*
- * Any arguments can be NULL.
+ * Any arguments can be nullptr.
*/
static SkPDFDict* Create(
const SkTDArray<SkPDFObject*>* gStateResources,
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 6b4e758..645091d 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -495,7 +495,7 @@
// handle compose shader by pulling things up to a layer, drawing with
// the first shader, applying the xfer mode and drawing again with the
// second shader, then applying the layer to the original drawing.
- return NULL;
+ return nullptr;
} else if (state.fType == SkShader::kNone_GradientType) {
SkPDFObject* shader = canon->findImageShader(state);
return shader ? SkRef(shader)
@@ -533,7 +533,7 @@
if (gState) {
graphicStates.push(gState);
}
- return SkPDFResourceDict::Create(&graphicStates, &patterns, NULL, NULL);
+ return SkPDFResourceDict::Create(&graphicStates, &patterns, nullptr, nullptr);
}
static void populate_tiling_pattern_dict(SkPDFDict* pattern,
@@ -592,7 +592,7 @@
SkAutoTDelete<SkStream> alphaStream(create_pattern_fill_content(-1, bbox));
SkAutoTUnref<SkPDFDict>
- resources(get_gradient_resource_dict(luminosityShader, NULL));
+ resources(get_gradient_resource_dict(luminosityShader, nullptr));
SkAutoTUnref<SkPDFFormXObject> alphaMask(
new SkPDFFormXObject(alphaStream.get(), bbox, resources.get()));
@@ -615,7 +615,7 @@
SkAutoTUnref<SkPDFObject> colorShader(
get_pdf_shader_by_state(canon, dpi, &opaqueState));
if (!colorShader) {
- return NULL;
+ return nullptr;
}
// Create resource dict with alpha graphics state as G0 and
@@ -712,7 +712,7 @@
const SkPDFShader::State& state = **autoState;
SkString (*codeFunction)(const SkShader::GradientInfo& info,
- const SkMatrix& perspectiveRemover) = NULL;
+ const SkMatrix& perspectiveRemover) = nullptr;
SkPoint transformPoints[2];
// Depending on the type of the gradient, we want to transform the
@@ -743,7 +743,7 @@
case SkShader::kColor_GradientType:
case SkShader::kNone_GradientType:
default:
- return NULL;
+ return nullptr;
}
// Move any scaling (assuming a unit gradient) or translation
@@ -766,14 +766,14 @@
if (finalMatrix.hasPerspective()) {
if (!split_perspective(finalMatrix,
&finalMatrix, &perspectiveInverseOnly)) {
- return NULL;
+ return nullptr;
}
}
SkRect bbox;
bbox.set(state.fBBox);
if (!inverse_transform_bbox(finalMatrix, &bbox)) {
- return NULL;
+ return nullptr;
}
SkAutoTUnref<SkPDFArray> domain(new SkPDFArray);
@@ -792,7 +792,7 @@
SkShader::GradientInfo twoPointRadialInfo = *info;
SkMatrix inverseMapperMatrix;
if (!mapperMatrix.invert(&inverseMapperMatrix)) {
- return NULL;
+ return nullptr;
}
inverseMapperMatrix.mapPoints(twoPointRadialInfo.fPoint, 2);
twoPointRadialInfo.fRadius[0] =
@@ -843,7 +843,7 @@
SkRect deviceBounds;
deviceBounds.set(state.fBBox);
if (!inverse_transform_bbox(finalMatrix, &deviceBounds)) {
- return NULL;
+ return nullptr;
}
const SkBitmap* image = &state.fImage;
@@ -1099,8 +1099,8 @@
fBBox(bbox),
fPixelGeneration(0) {
fInfo.fColorCount = 0;
- fInfo.fColors = NULL;
- fInfo.fColorOffsets = NULL;
+ fInfo.fColors = nullptr;
+ fInfo.fColorOffsets = nullptr;
fShaderTransform = shader.getLocalMatrix();
fImageTileModes[0] = fImageTileModes[1] = SkShader::kClamp_TileMode;
diff --git a/src/pdf/SkPDFShader.h b/src/pdf/SkPDFShader.h
index 1cc36ce..9380b57 100644
--- a/src/pdf/SkPDFShader.h
+++ b/src/pdf/SkPDFShader.h
@@ -29,7 +29,7 @@
class State;
/** Get the PDF shader for the passed SkShader. If the SkShader is
- * invalid in some way, returns NULL. The reference count of
+ * invalid in some way, returns nullptr. The reference count of
* the object is incremented and it is the caller's responsibility to
* unreference it when done. This is needed to accommodate the weak
* reference pattern used when the returned object is new and has no