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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.cpp

Issue 2957513002: Removed calls to RefPtr::Release in return statements with auto move. (Closed)
Patch Set: rebased Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return null_image; 65 return null_image;
66 } 66 }
67 67
68 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { 68 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) {
69 const WebData& resource = Platform::Current()->GetDataResource(name); 69 const WebData& resource = Platform::Current()->GetDataResource(name);
70 if (resource.IsEmpty()) 70 if (resource.IsEmpty())
71 return Image::NullImage(); 71 return Image::NullImage();
72 72
73 RefPtr<Image> image = BitmapImage::Create(); 73 RefPtr<Image> image = BitmapImage::Create();
74 image->SetData(resource, true); 74 image->SetData(resource, true);
75 return image.Release(); 75 return image;
76 } 76 }
77 77
78 bool Image::SupportsType(const String& type) { 78 bool Image::SupportsType(const String& type) {
79 return MIMETypeRegistry::IsSupportedImageResourceMIMEType(type); 79 return MIMETypeRegistry::IsSupportedImageResourceMIMEType(type);
80 } 80 }
81 81
82 Image::SizeAvailability Image::SetData(RefPtr<SharedBuffer> data, 82 Image::SizeAvailability Image::SetData(RefPtr<SharedBuffer> data,
83 bool all_data_received) { 83 bool all_data_received) {
84 encoded_image_data_ = std::move(data); 84 encoded_image_data_ = std::move(data);
85 if (!encoded_image_data_.Get()) 85 if (!encoded_image_data_.Get())
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 context.DrawRect(dest_rect, flags); 335 context.DrawRect(dest_rect, flags);
336 336
337 if (CurrentFrameIsLazyDecoded()) 337 if (CurrentFrameIsLazyDecoded())
338 PlatformInstrumentation::DidDrawLazyPixelRef(image_id); 338 PlatformInstrumentation::DidDrawLazyPixelRef(image_id);
339 } 339 }
340 340
341 PassRefPtr<Image> Image::ImageForDefaultFrame() { 341 PassRefPtr<Image> Image::ImageForDefaultFrame() {
342 RefPtr<Image> image(this); 342 RefPtr<Image> image(this);
343 343
344 return image.Release(); 344 return image;
345 } 345 }
346 346
347 PaintImage Image::PaintImageForCurrentFrame() { 347 PaintImage Image::PaintImageForCurrentFrame() {
348 auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED 348 auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED
349 : PaintImage::AnimationType::STATIC; 349 : PaintImage::AnimationType::STATIC;
350 auto completion_state = CurrentFrameIsComplete() 350 auto completion_state = CurrentFrameIsComplete()
351 ? PaintImage::CompletionState::DONE 351 ? PaintImage::CompletionState::DONE
352 : PaintImage::CompletionState::PARTIALLY_DONE; 352 : PaintImage::CompletionState::PARTIALLY_DONE;
353 return PaintImage(stable_image_id_, ImageForCurrentFrame(), animation_type, 353 return PaintImage(stable_image_id_, ImageForCurrentFrame(), animation_type,
354 completion_state, FrameCount(), is_multipart_); 354 completion_state, FrameCount(), is_multipart_);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 FloatRect subset = dest; 401 FloatRect subset = dest;
402 subset.SetX((dest.X() - tile.X()) / scale.Width()); 402 subset.SetX((dest.X() - tile.X()) / scale.Width());
403 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); 403 subset.SetY((dest.Y() - tile.Y()) / scale.Height());
404 subset.SetWidth(dest.Width() / scale.Width()); 404 subset.SetWidth(dest.Width() / scale.Width());
405 subset.SetHeight(dest.Height() / scale.Height()); 405 subset.SetHeight(dest.Height() / scale.Height());
406 406
407 return subset; 407 return subset;
408 } 408 }
409 409
410 } // namespace blink 410 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698