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

Unified Diff: Source/platform/graphics/GraphicsLayer.cpp

Issue 594193002: [blink] Pass SkBitmap by reference in WebNinePatchLayer::setBitmap and refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | public/platform/WebNinePatchLayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/platform/graphics/GraphicsLayer.cpp b/Source/platform/graphics/GraphicsLayer.cpp
index d4cfec068531bfc6af789a6234b2ea02cd898210..98cc5139f15d2baa6a5d5e2f4cb2dd693b80baaa 100644
--- a/Source/platform/graphics/GraphicsLayer.cpp
+++ b/Source/platform/graphics/GraphicsLayer.cpp
@@ -952,7 +952,15 @@ void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : nullptr;
if (nativeImage) {
m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->createNinePatchLayer());
- m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
+ const SkBitmap& bitmap = nativeImage->bitmap();
+ int borderWidth = bitmap.width() - aperture.width();
+ int borderHeight = bitmap.height() - aperture.height();
+ WebRect border(aperture.x(), aperture.y(), borderWidth, borderHeight);
+
+ m_ninePatchLayer->setBitmap(bitmap);
+ m_ninePatchLayer->setAperture(aperture);
+ m_ninePatchLayer->setBorder(border);
+
m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
registerContentsLayer(m_ninePatchLayer->layer());
}
« no previous file with comments | « no previous file | public/platform/WebNinePatchLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698