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

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

Issue 660383003: Added a non-null check in the constructor of StaticBitmapImage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 "platform/graphics/skia/NativeImageSkia.h" 10 #include "platform/graphics/skia/NativeImageSkia.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<Image> StaticBitmapImage::create(PassRefPtr<SkImage> image)
18 { 18 {
19 return adoptRef(new StaticBitmapImage(image)); 19 return adoptRef(new StaticBitmapImage(image));
20 } 20 }
21 21
22 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image) 22 StaticBitmapImage::StaticBitmapImage(PassRefPtr<SkImage> image) : m_image(image)
23 { 23 {
24 ASSERT(m_image);
24 } 25 }
25 26
26 StaticBitmapImage::~StaticBitmapImage() { } 27 StaticBitmapImage::~StaticBitmapImage() { }
27 28
28 IntSize StaticBitmapImage::size() const 29 IntSize StaticBitmapImage::size() const
29 { 30 {
30 return IntSize(m_image->width(), m_image->height()); 31 return IntSize(m_image->width(), m_image->height());
31 } 32 }
32 33
33 bool StaticBitmapImage::currentFrameKnownToBeOpaque() 34 bool StaticBitmapImage::currentFrameKnownToBeOpaque()
(...skipping 21 matching lines...) Expand all
55 56
56 SkCanvas* canvas = ctx->canvas(); 57 SkCanvas* canvas = ctx->canvas();
57 58
58 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint); 59 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint);
59 60
60 if (ImageObserver* observer = imageObserver()) 61 if (ImageObserver* observer = imageObserver())
61 observer->didDraw(this); 62 observer->didDraw(this);
62 } 63 }
63 64
64 } 65 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698