OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 } | 1217 } |
1218 } | 1218 } |
1219 LOOPER_END | 1219 LOOPER_END |
1220 } | 1220 } |
1221 | 1221 |
1222 ///////////////////////////////////////////////////////////////////////////// | 1222 ///////////////////////////////////////////////////////////////////////////// |
1223 void SkCanvas::didTranslate(SkScalar, SkScalar) { | 1223 void SkCanvas::didTranslate(SkScalar, SkScalar) { |
1224 // Do nothing. Subclasses may do something. | 1224 // Do nothing. Subclasses may do something. |
1225 } | 1225 } |
1226 | 1226 |
1227 bool SkCanvas::translate(SkScalar dx, SkScalar dy) { | 1227 void SkCanvas::translate(SkScalar dx, SkScalar dy) { |
1228 fDeviceCMDirty = true; | 1228 fDeviceCMDirty = true; |
1229 fCachedLocalClipBoundsDirty = true; | 1229 fCachedLocalClipBoundsDirty = true; |
1230 bool res = fMCRec->fMatrix->preTranslate(dx, dy); | 1230 fMCRec->fMatrix->preTranslate(dx, dy); |
1231 | 1231 |
1232 this->didTranslate(dx, dy); | 1232 this->didTranslate(dx, dy); |
1233 return res; | |
1234 } | 1233 } |
1235 | 1234 |
1236 void SkCanvas::didScale(SkScalar, SkScalar) { | 1235 void SkCanvas::didScale(SkScalar, SkScalar) { |
1237 // Do nothing. Subclasses may do something. | 1236 // Do nothing. Subclasses may do something. |
1238 } | 1237 } |
1239 | 1238 |
1240 bool SkCanvas::scale(SkScalar sx, SkScalar sy) { | 1239 void SkCanvas::scale(SkScalar sx, SkScalar sy) { |
1241 fDeviceCMDirty = true; | 1240 fDeviceCMDirty = true; |
1242 fCachedLocalClipBoundsDirty = true; | 1241 fCachedLocalClipBoundsDirty = true; |
1243 bool res = fMCRec->fMatrix->preScale(sx, sy); | 1242 fMCRec->fMatrix->preScale(sx, sy); |
1244 | 1243 |
1245 this->didScale(sx, sy); | 1244 this->didScale(sx, sy); |
1246 return res; | |
1247 } | 1245 } |
1248 | 1246 |
1249 void SkCanvas::didRotate(SkScalar) { | 1247 void SkCanvas::didRotate(SkScalar) { |
1250 // Do nothing. Subclasses may do something. | 1248 // Do nothing. Subclasses may do something. |
1251 } | 1249 } |
1252 | 1250 |
1253 bool SkCanvas::rotate(SkScalar degrees) { | 1251 void SkCanvas::rotate(SkScalar degrees) { |
1254 fDeviceCMDirty = true; | 1252 fDeviceCMDirty = true; |
1255 fCachedLocalClipBoundsDirty = true; | 1253 fCachedLocalClipBoundsDirty = true; |
1256 bool res = fMCRec->fMatrix->preRotate(degrees); | 1254 fMCRec->fMatrix->preRotate(degrees); |
1257 | 1255 |
1258 this->didRotate(degrees); | 1256 this->didRotate(degrees); |
1259 return res; | |
1260 } | 1257 } |
1261 | 1258 |
1262 void SkCanvas::didSkew(SkScalar, SkScalar) { | 1259 void SkCanvas::didSkew(SkScalar, SkScalar) { |
1263 // Do nothing. Subclasses may do something. | 1260 // Do nothing. Subclasses may do something. |
1264 } | 1261 } |
1265 | 1262 |
1266 bool SkCanvas::skew(SkScalar sx, SkScalar sy) { | 1263 void SkCanvas::skew(SkScalar sx, SkScalar sy) { |
1267 fDeviceCMDirty = true; | 1264 fDeviceCMDirty = true; |
1268 fCachedLocalClipBoundsDirty = true; | 1265 fCachedLocalClipBoundsDirty = true; |
1269 bool res = fMCRec->fMatrix->preSkew(sx, sy); | 1266 fMCRec->fMatrix->preSkew(sx, sy); |
1270 | 1267 |
1271 this->didSkew(sx, sy); | 1268 this->didSkew(sx, sy); |
1272 return res; | |
1273 } | 1269 } |
1274 | 1270 |
1275 void SkCanvas::didConcat(const SkMatrix&) { | 1271 void SkCanvas::didConcat(const SkMatrix&) { |
1276 // Do nothing. Subclasses may do something. | 1272 // Do nothing. Subclasses may do something. |
1277 } | 1273 } |
1278 | 1274 |
1279 bool SkCanvas::concat(const SkMatrix& matrix) { | 1275 void SkCanvas::concat(const SkMatrix& matrix) { |
1280 fDeviceCMDirty = true; | 1276 fDeviceCMDirty = true; |
1281 fCachedLocalClipBoundsDirty = true; | 1277 fCachedLocalClipBoundsDirty = true; |
1282 bool res = fMCRec->fMatrix->preConcat(matrix); | 1278 fMCRec->fMatrix->preConcat(matrix); |
1283 | 1279 |
1284 this->didConcat(matrix); | 1280 this->didConcat(matrix); |
1285 return res; | |
1286 } | 1281 } |
1287 | 1282 |
1288 void SkCanvas::didSetMatrix(const SkMatrix&) { | 1283 void SkCanvas::didSetMatrix(const SkMatrix&) { |
1289 // Do nothing. Subclasses may do something. | 1284 // Do nothing. Subclasses may do something. |
1290 } | 1285 } |
1291 | 1286 |
1292 void SkCanvas::setMatrix(const SkMatrix& matrix) { | 1287 void SkCanvas::setMatrix(const SkMatrix& matrix) { |
1293 fDeviceCMDirty = true; | 1288 fDeviceCMDirty = true; |
1294 fCachedLocalClipBoundsDirty = true; | 1289 fCachedLocalClipBoundsDirty = true; |
1295 *fMCRec->fMatrix = matrix; | 1290 *fMCRec->fMatrix = matrix; |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2569 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2575 return NULL; | 2570 return NULL; |
2576 } | 2571 } |
2577 | 2572 |
2578 // should this functionality be moved into allocPixels()? | 2573 // should this functionality be moved into allocPixels()? |
2579 if (!bitmap.info().isOpaque()) { | 2574 if (!bitmap.info().isOpaque()) { |
2580 bitmap.eraseColor(0); | 2575 bitmap.eraseColor(0); |
2581 } | 2576 } |
2582 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2577 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2583 } | 2578 } |
OLD | NEW |