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

Unified Diff: src/device/xps/SkXPSDevice.cpp

Issue 1287263005: change asABitmap to isABitmap on shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
Index: src/device/xps/SkXPSDevice.cpp
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 56800d154018c296e7d417b0692e695965bc5279..2b15cd9f4ac5e0072cdd305df643edae0cf21188 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -1071,33 +1071,24 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
SkBitmap outTexture;
SkMatrix outMatrix;
SkShader::TileMode xy[2];
- SkShader::BitmapType bitmapType = shader->asABitmap(&outTexture,
- &outMatrix,
- xy);
- switch (bitmapType) {
- case SkShader::kDefault_BitmapType: {
- //TODO: outMatrix??
- SkMatrix localMatrix = shader->getLocalMatrix();
- if (parentTransform) {
- localMatrix.preConcat(*parentTransform);
- }
-
- SkTScopedComPtr<IXpsOMTileBrush> tileBrush;
- HR(this->createXpsImageBrush(outTexture,
- localMatrix,
- xy,
- skPaint.getAlpha(),
- &tileBrush));
+ if (shader->isABitmap(&outTexture, &outMatrix, xy)) {
+ //TODO: outMatrix??
+ SkMatrix localMatrix = shader->getLocalMatrix();
+ if (parentTransform) {
+ localMatrix.preConcat(*parentTransform);
+ }
- HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed.");
+ SkTScopedComPtr<IXpsOMTileBrush> tileBrush;
+ HR(this->createXpsImageBrush(outTexture,
+ localMatrix,
+ xy,
+ skPaint.getAlpha(),
+ &tileBrush));
- return S_OK;
- }
- default:
- break;
+ HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed.");
+ } else {
+ HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush));
}
-
- HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush));
return S_OK;
}

Powered by Google App Engine
This is Rietveld 408576698