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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #ifndef UNICODE 10 #ifndef UNICODE
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 } 1064 }
1065 1065
1066 if (SkShader::kSweep_GradientType == gradientType) { 1066 if (SkShader::kSweep_GradientType == gradientType) {
1067 //have to fake 1067 //have to fake
1068 } 1068 }
1069 } 1069 }
1070 1070
1071 SkBitmap outTexture; 1071 SkBitmap outTexture;
1072 SkMatrix outMatrix; 1072 SkMatrix outMatrix;
1073 SkShader::TileMode xy[2]; 1073 SkShader::TileMode xy[2];
1074 SkShader::BitmapType bitmapType = shader->asABitmap(&outTexture, 1074 if (shader->isABitmap(&outTexture, &outMatrix, xy)) {
1075 &outMatrix, 1075 //TODO: outMatrix??
1076 xy); 1076 SkMatrix localMatrix = shader->getLocalMatrix();
1077 switch (bitmapType) { 1077 if (parentTransform) {
1078 case SkShader::kDefault_BitmapType: { 1078 localMatrix.preConcat(*parentTransform);
1079 //TODO: outMatrix?? 1079 }
1080 SkMatrix localMatrix = shader->getLocalMatrix();
1081 if (parentTransform) {
1082 localMatrix.preConcat(*parentTransform);
1083 }
1084 1080
1085 SkTScopedComPtr<IXpsOMTileBrush> tileBrush; 1081 SkTScopedComPtr<IXpsOMTileBrush> tileBrush;
1086 HR(this->createXpsImageBrush(outTexture, 1082 HR(this->createXpsImageBrush(outTexture,
1087 localMatrix, 1083 localMatrix,
1088 xy, 1084 xy,
1089 skPaint.getAlpha(), 1085 skPaint.getAlpha(),
1090 &tileBrush)); 1086 &tileBrush));
1091 1087
1092 HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed."); 1088 HRM(tileBrush->QueryInterface<IXpsOMBrush>(brush), "QI failed.");
1093 1089 } else {
1094 return S_OK; 1090 HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush));
1095 }
1096 default:
1097 break;
1098 } 1091 }
1099
1100 HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush));
1101 return S_OK; 1092 return S_OK;
1102 } 1093 }
1103 1094
1104 static bool rect_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { 1095 static bool rect_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) {
1105 const bool zeroWidth = (0 == paint.getStrokeWidth()); 1096 const bool zeroWidth = (0 == paint.getStrokeWidth());
1106 const bool stroke = (SkPaint::kFill_Style != paint.getStyle()); 1097 const bool stroke = (SkPaint::kFill_Style != paint.getStyle());
1107 1098
1108 return paint.getPathEffect() || 1099 return paint.getPathEffect() ||
1109 paint.getMaskFilter() || 1100 paint.getMaskFilter() ||
1110 paint.getRasterizer() || 1101 paint.getRasterizer() ||
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 //To what stream do we write? 2258 //To what stream do we write?
2268 //SkXPSDevice* dev = new SkXPSDevice(this); 2259 //SkXPSDevice* dev = new SkXPSDevice(this);
2269 //SkSize s = SkSize::Make(width, height); 2260 //SkSize s = SkSize::Make(width, height);
2270 //dev->BeginCanvas(s, s, SkMatrix::I()); 2261 //dev->BeginCanvas(s, s, SkMatrix::I());
2271 //return dev; 2262 //return dev;
2272 } 2263 }
2273 #endif 2264 #endif
2274 return new SkXPSDevice(this->fXpsFactory.get()); 2265 return new SkXPSDevice(this->fXpsFactory.get());
2275 } 2266 }
2276 2267
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698