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

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

Issue 1460653003: StaticImageBitmap::create should return PassRefPtr<StaticImageBitmap> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "platform/graphics/StaticBitmapImage.h" 6 #include "platform/graphics/StaticBitmapImage.h"
7 7
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/ImageObserver.h" 9 #include "platform/graphics/ImageObserver.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkImage.h" 11 #include "third_party/skia/include/core/SkImage.h"
12 #include "third_party/skia/include/core/SkPaint.h" 12 #include "third_party/skia/include/core/SkPaint.h"
13 #include "third_party/skia/include/core/SkShader.h" 13 #include "third_party/skia/include/core/SkShader.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 PassRefPtr<Image> StaticBitmapImage::create(PassRefPtr<SkImage> image) 17 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(PassRefPtr<SkImage> imag e)
18 { 18 {
19 if (!image) 19 if (!image)
20 return nullptr; 20 return nullptr;
21 return adoptRef(new StaticBitmapImage(image)); 21 return adoptRef(new StaticBitmapImage(image));
22 } 22 }
23 23
24 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) 24 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image)
25 { 25 {
26 ASSERT(m_image); 26 ASSERT(m_image);
27 } 27 }
(...skipping 25 matching lines...) Expand all
53 ASSERT(adjustedSrcRect.width() <= m_image->width() && adjustedSrcRect.height () <= m_image->height()); 53 ASSERT(adjustedSrcRect.width() <= m_image->width() && adjustedSrcRect.height () <= m_image->height());
54 54
55 SkRect srcSkRect = adjustedSrcRect; 55 SkRect srcSkRect = adjustedSrcRect;
56 canvas->drawImageRect(m_image.get(), srcSkRect, dstRect, &paint, 56 canvas->drawImageRect(m_image.get(), srcSkRect, dstRect, &paint,
57 WebCoreClampingModeToSkiaRectConstraint(clampMode)); 57 WebCoreClampingModeToSkiaRectConstraint(clampMode));
58 58
59 if (ImageObserver* observer = imageObserver()) 59 if (ImageObserver* observer = imageObserver())
60 observer->didDraw(this); 60 observer->didDraw(this);
61 } 61 }
62 62
63 PassRefPtr<SkImage> StaticBitmapImage::imageForCurrentFrame()
64 {
65 return m_image;
66 }
67
63 } // namespace blink 68 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698