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

Unified Diff: cc/resources/picture.cc

Issue 638353002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formating. Created 6 years, 2 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: cc/resources/picture.cc
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 6fa5abcabf203e4bfddcb99d3e72856155e98f3f..6f02e91e196348df17c11139f167c26e75a0d7b3 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -45,7 +45,7 @@ SkData* EncodeBitmap(size_t* offset, const SkBitmap& bm) {
if (bm.isOpaque()) {
SkAutoLockPixels lock_bitmap(bm);
if (bm.empty())
- return NULL;
+ return nullptr;
encoding_succeeded = gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(bm.getAddr32(0, 0)),
@@ -63,7 +63,7 @@ SkData* EncodeBitmap(size_t* offset, const SkBitmap& bm) {
*offset = 0;
return SkData::NewWithCopy(&data.front(), data.size());
}
- return NULL;
+ return nullptr;
}
bool DecodeBitmap(const void* buffer, size_t size, SkBitmap* bm) {
@@ -110,7 +110,7 @@ scoped_refptr<Picture> Picture::CreateFromSkpValue(const base::Value* value) {
// Decode the picture from base64.
std::string encoded;
if (!value->GetAsString(&encoded))
- return NULL;
+ return nullptr;
std::string decoded;
base::Base64Decode(encoded, &decoded);
@@ -118,39 +118,39 @@ scoped_refptr<Picture> Picture::CreateFromSkpValue(const base::Value* value) {
// Read the picture. This creates an empty picture on failure.
SkPicture* skpicture = SkPicture::CreateFromStream(&stream, &DecodeBitmap);
- if (skpicture == NULL)
- return NULL;
+ if (skpicture == nullptr)
+ return nullptr;
gfx::Rect layer_rect(skpicture->width(), skpicture->height());
return make_scoped_refptr(new Picture(skpicture, layer_rect));
}
scoped_refptr<Picture> Picture::CreateFromValue(const base::Value* raw_value) {
- const base::DictionaryValue* value = NULL;
+ const base::DictionaryValue* value = nullptr;
if (!raw_value->GetAsDictionary(&value))
- return NULL;
+ return nullptr;
// Decode the picture from base64.
std::string encoded;
if (!value->GetString("skp64", &encoded))
- return NULL;
+ return nullptr;
std::string decoded;
base::Base64Decode(encoded, &decoded);
SkMemoryStream stream(decoded.data(), decoded.size());
- const base::Value* layer_rect_value = NULL;
+ const base::Value* layer_rect_value = nullptr;
if (!value->Get("params.layer_rect", &layer_rect_value))
- return NULL;
+ return nullptr;
gfx::Rect layer_rect;
if (!MathUtil::FromValue(layer_rect_value, &layer_rect))
- return NULL;
+ return nullptr;
// Read the picture. This creates an empty picture on failure.
SkPicture* skpicture = SkPicture::CreateFromStream(&stream, &DecodeBitmap);
- if (skpicture == NULL)
- return NULL;
+ if (skpicture == nullptr)
+ return nullptr;
return make_scoped_refptr(new Picture(skpicture, layer_rect));
}
@@ -183,9 +183,9 @@ bool Picture::IsSuitableForGpuRasterization() const {
// picture. But we are on the main thread while the rasterization context
// may be on the compositor or raster thread.
// SkPicture::suitableForGpuRasterization is not implemented yet.
- // Pass a NULL context for now and discuss with skia folks if the context
+ // Pass a nullptr context for now and discuss with skia folks if the context
// is really needed.
- return picture_->suitableForGpuRasterization(NULL);
+ return picture_->suitableForGpuRasterization(nullptr);
}
int Picture::ApproximateOpCount() const {
@@ -227,7 +227,7 @@ void Picture::Record(ContentLayerClient* painter,
case RECORD_NORMALLY:
// Already setup for normal recording.
break;
- case RECORD_WITH_SK_NULL_CANVAS:
+ case RECORD_WITH_SK_nullptr_CANVAS:
canvas = skia::AdoptRef(SkCreateNullCanvas());
break;
case RECORD_WITH_PAINTING_DISABLED:
@@ -392,7 +392,7 @@ scoped_ptr<base::Value> Picture::AsValue() const {
skia::RefPtr<SkCanvas> canvas(skia::SharePtr(recorder.beginRecording(
layer_rect_.width(),
layer_rect_.height(),
- NULL))); // Default (no) bounding-box hierarchy is fastest.
+ nullptr))); // Default (no) bounding-box hierarchy is fastest.
playback_->draw(canvas.get());
skia::RefPtr<SkPicture> picture(skia::AdoptRef(recorder.endRecording()));
picture->serialize(&stream, &EncodeBitmap);
@@ -437,7 +437,7 @@ base::LazyInstance<Picture::PixelRefs>
Picture::PixelRefIterator::empty_pixel_refs_;
Picture::PixelRefIterator::PixelRefIterator()
- : picture_(NULL),
+ : picture_(nullptr),
current_pixel_refs_(empty_pixel_refs_.Pointer()),
current_index_(0),
min_point_(-1, -1),

Powered by Google App Engine
This is Rietveld 408576698