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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 287593005: Inline noop willFoo/didFoo into SkCanvas.h. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | « include/core/SkCanvas.h ('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 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 823
824 fMCRec = newTop; 824 fMCRec = newTop;
825 825
826 if (SkCanvas::kClip_SaveFlag & flags) { 826 if (SkCanvas::kClip_SaveFlag & flags) {
827 fClipStack.save(); 827 fClipStack.save();
828 } 828 }
829 829
830 return saveCount; 830 return saveCount;
831 } 831 }
832 832
833 void SkCanvas::willSave(SaveFlags) {
834 // Do nothing. Subclasses may do something.
835 }
836
837 int SkCanvas::save() { 833 int SkCanvas::save() {
838 this->willSave(kMatrixClip_SaveFlag); 834 this->willSave(kMatrixClip_SaveFlag);
839 return this->internalSave(kMatrixClip_SaveFlag); 835 return this->internalSave(kMatrixClip_SaveFlag);
840 } 836 }
841 837
842 int SkCanvas::save(SaveFlags flags) { 838 int SkCanvas::save(SaveFlags flags) {
843 this->willSave(flags); 839 this->willSave(flags);
844 // call shared impl 840 // call shared impl
845 return this->internalSave(flags); 841 return this->internalSave(flags);
846 } 842 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 return false; 886 return false;
891 } 887 }
892 } 888 }
893 889
894 if (intersection) { 890 if (intersection) {
895 *intersection = ir; 891 *intersection = ir;
896 } 892 }
897 return true; 893 return true;
898 } 894 }
899 895
900 SkCanvas::SaveLayerStrategy SkCanvas::willSaveLayer(const SkRect*, const SkPaint *, SaveFlags) {
901
902 // Do nothing. Subclasses may do something.
903 return kFullLayer_SaveLayerStrategy;
904 }
905
906 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) { 896 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
907 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLa yer_SaveFlag); 897 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLa yer_SaveFlag);
908 return this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, fals e, strategy); 898 return this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, fals e, strategy);
909 } 899 }
910 900
911 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 901 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
912 SaveFlags flags) { 902 SaveFlags flags) {
913 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags); 903 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
914 return this->internalSaveLayer(bounds, paint, flags, false, strategy); 904 return this->internalSaveLayer(bounds, paint, flags, false, strategy);
915 } 905 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 SaveFlags flags) { 982 SaveFlags flags) {
993 if (0xFF == alpha) { 983 if (0xFF == alpha) {
994 return this->saveLayer(bounds, NULL, flags); 984 return this->saveLayer(bounds, NULL, flags);
995 } else { 985 } else {
996 SkPaint tmpPaint; 986 SkPaint tmpPaint;
997 tmpPaint.setAlpha(alpha); 987 tmpPaint.setAlpha(alpha);
998 return this->saveLayer(bounds, &tmpPaint, flags); 988 return this->saveLayer(bounds, &tmpPaint, flags);
999 } 989 }
1000 } 990 }
1001 991
1002 void SkCanvas::willRestore() {
1003 // Do nothing. Subclasses may do something.
1004 }
1005
1006 void SkCanvas::restore() { 992 void SkCanvas::restore() {
1007 // check for underflow 993 // check for underflow
1008 if (fMCStack.count() > 1) { 994 if (fMCStack.count() > 1) {
1009 this->willRestore(); 995 this->willRestore();
1010 this->internalRestore(); 996 this->internalRestore();
1011 } 997 }
1012 } 998 }
1013 999
1014 void SkCanvas::internalRestore() { 1000 void SkCanvas::internalRestore() {
1015 SkASSERT(fMCStack.count() != 0); 1001 SkASSERT(fMCStack.count() != 0);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 m.setRotate(degrees); 1323 m.setRotate(degrees);
1338 this->concat(m); 1324 this->concat(m);
1339 } 1325 }
1340 1326
1341 void SkCanvas::skew(SkScalar sx, SkScalar sy) { 1327 void SkCanvas::skew(SkScalar sx, SkScalar sy) {
1342 SkMatrix m; 1328 SkMatrix m;
1343 m.setSkew(sx, sy); 1329 m.setSkew(sx, sy);
1344 this->concat(m); 1330 this->concat(m);
1345 } 1331 }
1346 1332
1347 void SkCanvas::didConcat(const SkMatrix&) {
1348 // Do nothing. Subclasses may do something.
1349 }
1350
1351 void SkCanvas::concat(const SkMatrix& matrix) { 1333 void SkCanvas::concat(const SkMatrix& matrix) {
1352 if (matrix.isIdentity()) { 1334 if (matrix.isIdentity()) {
1353 return; 1335 return;
1354 } 1336 }
1355 1337
1356 fDeviceCMDirty = true; 1338 fDeviceCMDirty = true;
1357 fCachedLocalClipBoundsDirty = true; 1339 fCachedLocalClipBoundsDirty = true;
1358 fMCRec->fMatrix->preConcat(matrix); 1340 fMCRec->fMatrix->preConcat(matrix);
1359 1341
1360 this->didConcat(matrix); 1342 this->didConcat(matrix);
1361 } 1343 }
1362 1344
1363 void SkCanvas::didSetMatrix(const SkMatrix&) {
1364 // Do nothing. Subclasses may do something.
1365 }
1366
1367 void SkCanvas::setMatrix(const SkMatrix& matrix) { 1345 void SkCanvas::setMatrix(const SkMatrix& matrix) {
1368 fDeviceCMDirty = true; 1346 fDeviceCMDirty = true;
1369 fCachedLocalClipBoundsDirty = true; 1347 fCachedLocalClipBoundsDirty = true;
1370 *fMCRec->fMatrix = matrix; 1348 *fMCRec->fMatrix = matrix;
1371 this->didSetMatrix(matrix); 1349 this->didSetMatrix(matrix);
1372 } 1350 }
1373 1351
1374 void SkCanvas::resetMatrix() { 1352 void SkCanvas::resetMatrix() {
1375 SkMatrix matrix; 1353 SkMatrix matrix;
1376 1354
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 if (!supported_for_raster_canvas(info)) { 2628 if (!supported_for_raster_canvas(info)) {
2651 return NULL; 2629 return NULL;
2652 } 2630 }
2653 2631
2654 SkBitmap bitmap; 2632 SkBitmap bitmap;
2655 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2633 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2656 return NULL; 2634 return NULL;
2657 } 2635 }
2658 return SkNEW_ARGS(SkCanvas, (bitmap)); 2636 return SkNEW_ARGS(SkCanvas, (bitmap));
2659 } 2637 }
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698