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

Side by Side Diff: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp

Issue 2683343002: Notify listeners on bitmaprenderer context changes (Closed)
Patch Set: Change didDraw() call. Created 3 years, 9 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 | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/imagebitmap/ImageBitmapRenderingContext.h" 5 #include "modules/imagebitmap/ImageBitmapRenderingContext.h"
6 6
7 #include "bindings/modules/v8/RenderingContext.h" 7 #include "bindings/modules/v8/RenderingContext.h"
8 #include "core/frame/ImageBitmap.h" 8 #include "core/frame/ImageBitmap.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/StaticBitmapImage.h" 10 #include "platform/graphics/StaticBitmapImage.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 sk_sp<SkSurface> surface = 55 sk_sp<SkSurface> surface =
56 SkSurface::MakeRasterN32Premul(skImage->width(), skImage->height()); 56 SkSurface::MakeRasterN32Premul(skImage->width(), skImage->height());
57 if (!surface) { 57 if (!surface) {
58 // silent failure 58 // silent failure
59 m_image.clear(); 59 m_image.clear();
60 return; 60 return;
61 } 61 }
62 surface->getCanvas()->drawImage(skImage, 0, 0); 62 surface->getCanvas()->drawImage(skImage, 0, 0);
63 m_image = StaticBitmapImage::create(surface->makeImageSnapshot()); 63 m_image = StaticBitmapImage::create(surface->makeImageSnapshot());
64 } 64 }
65 canvas()->didDraw( 65 didDraw(skImage->bounds());
66 FloatRect(FloatPoint(), FloatSize(m_image->width(), m_image->height())));
67 imageBitmap->close(); 66 imageBitmap->close();
68 } 67 }
69 68
70 bool ImageBitmapRenderingContext::paint(GraphicsContext& gc, const IntRect& r) { 69 bool ImageBitmapRenderingContext::paint(GraphicsContext& gc, const IntRect& r) {
71 if (!m_image) 70 if (!m_image)
72 return true; 71 return true;
73 72
74 // With impl-side painting, it is unsafe to use a gpu-backed SkImage 73 // With impl-side painting, it is unsafe to use a gpu-backed SkImage
75 DCHECK( 74 DCHECK(
76 !m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) 75 !m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget())
(...skipping 12 matching lines...) Expand all
89 if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) 88 if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled())
90 return nullptr; 89 return nullptr;
91 return new ImageBitmapRenderingContext(canvas, attrs, document); 90 return new ImageBitmapRenderingContext(canvas, attrs, document);
92 } 91 }
93 92
94 void ImageBitmapRenderingContext::stop() { 93 void ImageBitmapRenderingContext::stop() {
95 m_image.clear(); 94 m_image.clear();
96 } 95 }
97 96
98 } // blink 97 } // blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698