aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-08-27 07:41:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-27 07:41:16 -0700
commit96fcdcc219d2a0d3579719b84b28bede76efba64 (patch)
tree0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /src/pdf
parent435af2f736c85c3274a0c6760a3523810750d237 (diff)
Style Change: NULL->nullptr
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkDeflate.cpp4
-rw-r--r--src/pdf/SkJpegInfo.cpp2
-rw-r--r--src/pdf/SkJpegInfo.h2
-rw-r--r--src/pdf/SkPDFBitmap.cpp6
-rw-r--r--src/pdf/SkPDFBitmap.h2
-rw-r--r--src/pdf/SkPDFCanon.cpp10
-rw-r--r--src/pdf/SkPDFCanon.h6
-rw-r--r--src/pdf/SkPDFDevice.cpp124
-rw-r--r--src/pdf/SkPDFDevice.h6
-rw-r--r--src/pdf/SkPDFFont.cpp80
-rw-r--r--src/pdf/SkPDFFont.h6
-rw-r--r--src/pdf/SkPDFFormXObject.cpp4
-rw-r--r--src/pdf/SkPDFGraphicState.cpp4
-rw-r--r--src/pdf/SkPDFResourceDict.h2
-rw-r--r--src/pdf/SkPDFShader.cpp24
-rw-r--r--src/pdf/SkPDFShader.h2
16 files changed, 142 insertions, 142 deletions
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index bef8d9757e..c52a4600c4 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -73,7 +73,7 @@ SkDeflateWStream::SkDeflateWStream(SkWStream* out) : fImpl(new SkDeflateWStream:
}
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 @@ void SkDeflateWStream::finalize() {
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 85cd3251cd..455b4aa2c0 100644
--- a/src/pdf/SkJpegInfo.cpp
+++ b/src/pdf/SkJpegInfo.cpp
@@ -22,7 +22,7 @@ public:
}
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 1be4c0fa66..178d648a1a 100644
--- a/src/pdf/SkJpegInfo.h
+++ b/src/pdf/SkJpegInfo.h
@@ -19,7 +19,7 @@ struct SkJFIFInfo {
};
/** 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 35052334db..de43221630 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -439,12 +439,12 @@ SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) {
SkASSERT(canon);
if (!SkColorTypeIsValid(bitmap.colorType()) ||
kUnknown_SkColorType == bitmap.colorType()) {
- return NULL;
+ return nullptr;
}
SkBitmap copy;
const SkBitmap& bm = immutable_bitmap(bitmap, &copy);
if (bm.drawsNothing()) {
- return NULL;
+ return nullptr;
}
if (SkPDFBitmap* canonBitmap = canon->findBitmap(bm)) {
return SkRef(canonBitmap);
@@ -463,7 +463,7 @@ SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) {
}
}
- 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 2c8653f315..58d91bec88 100644
--- a/src/pdf/SkPDFBitmap.h
+++ b/src/pdf/SkPDFBitmap.h
@@ -24,7 +24,7 @@ class SkPDFCanon;
*/
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 b6187cbb33..6cc3995412 100644
--- a/src/pdf/SkPDFCanon.cpp
+++ b/src/pdf/SkPDFCanon.cpp
@@ -41,7 +41,7 @@ T* find_item(const SkTDArray<T*>& ptrArray, const U& object) {
return ptrArray[i];
}
}
- return NULL;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -51,7 +51,7 @@ SkPDFFont* SkPDFCanon::findFont(uint32_t fontID,
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 @@ SkPDFFont* SkPDFCanon::findFont(uint32_t fontID,
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 @@ void SkPDFCanon::addImageShader(SkPDFImageShader* pdfShader) {
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 5198e7b0ac..2ad5a229aa 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -40,9 +40,9 @@ public:
// 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 @@ private:
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 678e6c058f..a5c9557412 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 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
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 @@ static int force_glyph_encoding(const SkPaint& paint, const void* text,
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 @@ struct GraphicStateEntry {
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 @@ GraphicStateEntry::GraphicStateEntry() : fColor(SK_ColorBLACK),
fTextFill(SkPaint::kFill_Style),
fShaderIndex(-1),
fGraphicStateIndex(-1),
- fFont(NULL),
+ fFont(nullptr),
fTextSize(SK_ScalarNaN) {
fMatrix.reset();
}
@@ -309,7 +309,7 @@ static void skip_clip_stack_prefix(const SkClipStack& prefix,
}
}
- SkASSERT(prefixEntry == NULL);
+ SkASSERT(prefixEntry == nullptr);
}
static void emit_clip(SkPath* clipPath, SkRect* clipRect,
@@ -444,7 +444,7 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
#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 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
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 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
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 @@ static bool not_supported_for_layers(const SkPaint& layerPaint) {
// 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 @@ struct ContentEntry {
// 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 @@ public:
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 @@ public:
if (fContentEntry) {
SkPath* shape = &fShape;
if (shape->isEmpty()) {
- shape = NULL;
+ shape = nullptr;
}
fDevice->finishContentEntry(fXfermode, fDstFormXObject, shape);
}
@@ -702,11 +702,11 @@ SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFCanon* canon
, 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 @@ SkPDFDevice::~SkPDFDevice() {
}
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 @@ static SkPDFDict* create_rect_annotation(const SkRect& r,
if (linkToName) {
return create_link_named_dest(linkToName, r);
}
- return NULL;
+ return nullptr;
}
void SkPDFDevice::drawRect(const SkDraw& d,
@@ -963,7 +963,7 @@ void SkPDFDevice::drawRect(const SkDraw& d,
}
SkPath path;
path.addRect(r);
- drawPath(d, path, paint, NULL, true);
+ drawPath(d, path, paint, nullptr, true);
return;
}
@@ -996,7 +996,7 @@ void SkPDFDevice::drawRRect(const SkDraw& draw,
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 @@ void SkPDFDevice::drawOval(const SkDraw& draw,
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 @@ void SkPDFDevice::drawPath(const SkDraw& d,
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 @@ void SkPDFDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap,
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 @@ void SkPDFDevice::drawSprite(const SkDraw& d, const SkBitmap& bitmap,
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 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
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 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
}
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 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
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 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
}
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::onAttachToCanvas(SkCanvas* canvas) {
void SkPDFDevice::onDetachFromCanvas() {
INHERITED::onDetachFromCanvas();
- fClipStack = NULL;
+ fClipStack = nullptr;
}
SkSurface* SkPDFDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
@@ -1451,7 +1451,7 @@ void SkPDFDevice::copyContentEntriesToData(ContentEntry* entry,
// 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 @@ void SkPDFDevice::writeContent(SkWStream* out) const {
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 @@ bool SkPDFDevice::handleInversePath(const SkDraw& d, const SkPath& origPath,
// 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 @@ bool SkPDFDevice::handlePointAnnotation(const SkPoint* points, size_t count,
}
void SkPDFDevice::addAnnotation(SkPDFDict* annotation) {
- if (NULL == fAnnotations) {
+ if (nullptr == fAnnotations) {
fAnnotations = new SkPDFArray;
}
fAnnotations->appendObject(annotation);
@@ -1653,14 +1653,14 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
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 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
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 @@ ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
// Dst xfer mode doesn't draw source at all.
if (xfermode == SkXfermode::kDst_Mode) {
- return NULL;
+ return nullptr;
}
ContentEntry* entry;
@@ -1798,7 +1798,7 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
// 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 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
} 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 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
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 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
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 @@ void SkPDFDevice::populateGraphicStateEntryFromPaint(
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 @@ int SkPDFDevice::addXObjectResource(SkPDFObject* xObject) {
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 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
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 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
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 06d3e108ee..fbd5fb3c9c 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -152,7 +152,7 @@ public:
*/
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 @@ private:
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 @@ private:
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 25ffc0b851..8df59b77f1 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -77,7 +77,7 @@ bool parsePFB(const uint8_t* src, size_t size, size_t* headerLen,
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 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
// 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 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
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 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
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 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen,
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* composeAdvanceData(
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 @@ void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
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 @@ static size_t get_subset_font_stream(const char* fontName,
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 @@ static size_t get_subset_font_stream(const char* fontName,
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 @@ SkPDFGlyphSetMap::F2BIter::F2BIter(const SkPDFGlyphSetMap& map) {
const SkPDFGlyphSetMap::FontGlyphSetPair* SkPDFGlyphSetMap::F2BIter::next() const {
if (fIndex >= fMap->count()) {
- return NULL;
+ return nullptr;
}
return &((*fMap)[fIndex++]);
}
@@ -697,7 +697,7 @@ void SkPDFGlyphSetMap::merge(const SkPDFGlyphSetMap& usage) {
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 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
}
SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics;
- SkPDFDict* relatedFontDescriptor = NULL;
+ SkPDFDict* relatedFontDescriptor = nullptr;
if (relatedFont) {
fontMetrics.reset(SkSafeRef(relatedFont->fontInfo()));
relatedFontDescriptor = relatedFont->getFontDescriptor();
@@ -832,7 +832,7 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
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 @@ SkPDFFont* SkPDFFont::GetFontResource(SkPDFCanon* canon,
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::GetFontResource(SkPDFCanon* canon,
}
SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
- return NULL; // Default: no support.
+ return nullptr; // Default: no support.
}
SkPDFFont::SkPDFFont(const SkAdvancedTypefaceMetrics* info,
@@ -864,7 +864,7 @@ SkPDFFont::SkPDFFont(const SkAdvancedTypefaceMetrics* info,
, 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 @@ SkPDFFont* SkPDFFont::Create(SkPDFCanon* canon,
}
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 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::fontInfo() {
}
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 @@ void SkPDFFont::setFontDescriptor(SkPDFDict* descriptor) {
}
bool SkPDFFont::addCommonFontDescriptorEntries(int16_t defaultWidth) {
- if (fDescriptor.get() == NULL) {
+ if (fDescriptor.get() == nullptr) {
return false;
}
@@ -970,7 +970,7 @@ void SkPDFFont::adjustGlyphRangeForSingleByteEncoding(uint16_t glyphID) {
}
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 @@ void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
///////////////////////////////////////////////////////////////////////////////
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 @@ SkPDFType0Font::~SkPDFType0Font() {}
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 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
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 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
#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 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
#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 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
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 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
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 @@ bool SkPDFCIDFont::populate(const SkPDFGlyphSet* subset) {
addFontDescriptor(0, &glyphIDs);
} else {
// Other CID fonts
- addFontDescriptor(0, NULL);
+ addFontDescriptor(0, nullptr);
}
insertName("BaseFont", fontInfo()->fFontName);
@@ -1219,7 +1219,7 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
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 @@ bool SkPDFType1Font::populate(int16_t glyphID) {
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 @@ bool SkPDFType1Font::populate(int16_t glyphID) {
SkASSERT(false);
break;
case SkAdvancedTypefaceMetrics::WidthRange::kRange:
- SkASSERT(widthRangeEntry == NULL);
+ SkASSERT(widthRangeEntry == nullptr);
widthRangeEntry = widthEntry;
break;
}
@@ -1320,7 +1320,7 @@ void SkPDFType1Font::addWidthInfoFromRange(
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 @@ bool SkPDFType3Font::populate(uint16_t glyphID) {
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 @@ bool SkPDFType3Font::populate(uint16_t glyphID) {
this->insertObject("Widths", widthArray.detach());
this->insertName("CIDToGIDMap", "Identity");
- this->populateToUnicodeTable(NULL);
+ this->populateToUnicodeTable(nullptr);
return true;
}
@@ -1409,7 +1409,7 @@ SkPDFFont::Match SkPDFFont::IsMatch(SkPDFFont* existingFont,
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 d85c5826d3..404e8b7621 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -82,7 +82,7 @@ class SkPDFFont : public SkPDFDict {
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 @@ public:
/** 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 @@ protected:
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 07f42facb3..09db1404c9 100644
--- a/src/pdf/SkPDFFormXObject.cpp
+++ b/src/pdf/SkPDFFormXObject.cpp
@@ -25,7 +25,7 @@ SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) {
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 @@ void SkPDFFormXObject::init(const char* colorSpace,
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 bff32aec36..162ddc8447 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -65,9 +65,9 @@ static const char* as_blend_mode(SkXfermode::Mode mode) {
// 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 291377903f..698823b36c 100644
--- a/src/pdf/SkPDFResourceDict.h
+++ b/src/pdf/SkPDFResourceDict.h
@@ -34,7 +34,7 @@ public:
* 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 6b4e758950..645091dad2 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -495,7 +495,7 @@ static SkPDFObject* get_pdf_shader_by_state(
// 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 @@ static SkPDFDict* get_gradient_resource_dict(
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 @@ static SkPDFObject* create_smask_graphic_state(
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 @@ SkPDFAlphaFunctionShader* SkPDFAlphaFunctionShader::Create(
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 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
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 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
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 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
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 @@ SkPDFFunctionShader* SkPDFFunctionShader::Create(
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 @@ SkPDFImageShader* SkPDFImageShader::Create(
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 @@ SkPDFShader::State::State(const SkShader& shader, const SkMatrix& canvasTransfor
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 1cc36cee19..9380b57a72 100644
--- a/src/pdf/SkPDFShader.h
+++ b/src/pdf/SkPDFShader.h
@@ -29,7 +29,7 @@ public:
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