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

Side by Side Diff: include/core/SkCanvas.h

Issue 189883010: hide getTotalClip, so we can eventually remove it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 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 | « gyp/skia_for_chromium_defines.gypi ('k') | src/core/SkCanvas.cpp » ('j') | 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkClipStack.h" 14 #include "SkClipStack.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkRegion.h" 18 #include "SkRegion.h"
19 #include "SkXfermode.h" 19 #include "SkXfermode.h"
20 20
21 //#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG 21 //#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
22 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE
23 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP
22 24
23 class SkBounder; 25 class SkBounder;
24 class SkBaseDevice; 26 class SkBaseDevice;
25 class SkDraw; 27 class SkDraw;
26 class SkDrawFilter; 28 class SkDrawFilter;
27 class SkMetaData; 29 class SkMetaData;
28 class SkPicture; 30 class SkPicture;
29 class SkRRect; 31 class SkRRect;
30 class SkSurface; 32 class SkSurface;
31 class SkSurface_Base; 33 class SkSurface_Base;
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1052
1051 /** 1053 /**
1052 * Return true if the current clip is empty (i.e. nothing will draw). 1054 * Return true if the current clip is empty (i.e. nothing will draw).
1053 * Note: this is not always a free call, so it should not be used 1055 * Note: this is not always a free call, so it should not be used
1054 * more often than necessary. However, once the canvas has computed this 1056 * more often than necessary. However, once the canvas has computed this
1055 * result, subsequent calls will be cheap (until the clip state changes, 1057 * result, subsequent calls will be cheap (until the clip state changes,
1056 * which can happen on any clip..() or restore() call. 1058 * which can happen on any clip..() or restore() call.
1057 */ 1059 */
1058 virtual bool isClipEmpty() const; 1060 virtual bool isClipEmpty() const;
1059 1061
1062 /**
1063 * Returns true if the current clip is just a (non-empty) rectangle.
1064 * Returns false if the clip is empty, or if it is complex.
1065 */
1066 virtual bool isClipRect() const;
1067
1060 /** Return the current matrix on the canvas. 1068 /** Return the current matrix on the canvas.
1061 This does not account for the translate in any of the devices. 1069 This does not account for the translate in any of the devices.
1062 @return The current matrix on the canvas. 1070 @return The current matrix on the canvas.
1063 */ 1071 */
1064 const SkMatrix& getTotalMatrix() const; 1072 const SkMatrix& getTotalMatrix() const;
1065 1073
1074 #ifdef SK_SUPPORT_LEGACY_GETCLIPTYPE
1066 enum ClipType { 1075 enum ClipType {
1067 kEmpty_ClipType = 0, 1076 kEmpty_ClipType = 0,
1068 kRect_ClipType, 1077 kRect_ClipType,
1069 kComplex_ClipType 1078 kComplex_ClipType
1070 }; 1079 };
1071
1072 /** Returns a description of the total clip; may be cheaper than 1080 /** Returns a description of the total clip; may be cheaper than
1073 getting the clip and querying it directly. 1081 getting the clip and querying it directly.
1074 */ 1082 */
1075 virtual ClipType getClipType() const; 1083 virtual ClipType getClipType() const;
1084 #endif
1076 1085
1086 #ifdef SK_SUPPORT_LEGACY_GETTOTALCLIP
1077 /** DEPRECATED -- need to move this guy to private/friend 1087 /** DEPRECATED -- need to move this guy to private/friend
1078 * Return the current device clip (concatenation of all clip calls). 1088 * Return the current device clip (concatenation of all clip calls).
1079 * This does not account for the translate in any of the devices. 1089 * This does not account for the translate in any of the devices.
1080 * @return the current device clip (concatenation of all clip calls). 1090 * @return the current device clip (concatenation of all clip calls).
1081 */ 1091 */
1082 const SkRegion& getTotalClip() const; 1092 const SkRegion& getTotalClip() const;
1093 #endif
1083 1094
1084 /** Return the clip stack. The clip stack stores all the individual 1095 /** Return the clip stack. The clip stack stores all the individual
1085 * clips organized by the save/restore frame in which they were 1096 * clips organized by the save/restore frame in which they were
1086 * added. 1097 * added.
1087 * @return the current clip stack ("list" of individual clip elements) 1098 * @return the current clip stack ("list" of individual clip elements)
1088 */ 1099 */
1089 const SkClipStack* getClipStack() const { 1100 const SkClipStack* getClipStack() const {
1090 return &fClipStack; 1101 return &fClipStack;
1091 } 1102 }
1092 1103
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // having to expose that class def to the public. There is an assert 1149 // having to expose that class def to the public. There is an assert
1139 // in our constructor to ensure that fStorage is large enough 1150 // in our constructor to ensure that fStorage is large enough
1140 // (though needs to be a compile-time-assert!). We use intptr_t to work 1151 // (though needs to be a compile-time-assert!). We use intptr_t to work
1141 // safely with 32 and 64 bit machines (to ensure the storage is enough) 1152 // safely with 32 and 64 bit machines (to ensure the storage is enough)
1142 intptr_t fStorage[32]; 1153 intptr_t fStorage[32];
1143 class SkDrawIter* fImpl; // this points at fStorage 1154 class SkDrawIter* fImpl; // this points at fStorage
1144 SkPaint fDefaultPaint; 1155 SkPaint fDefaultPaint;
1145 bool fDone; 1156 bool fDone;
1146 }; 1157 };
1147 1158
1159 // don't call
1160 const SkRegion& internal_private_getTotalClip() const;
1161 // don't call
1162 void internal_private_getTotalClipAsPath(SkPath*) const;
1163
1148 protected: 1164 protected:
1149 // default impl defers to getDevice()->newSurface(info) 1165 // default impl defers to getDevice()->newSurface(info)
1150 virtual SkSurface* onNewSurface(const SkImageInfo&); 1166 virtual SkSurface* onNewSurface(const SkImageInfo&);
1151 1167
1152 // default impl defers to its device 1168 // default impl defers to its device
1153 virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes); 1169 virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes);
1154 1170
1155 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); 1171 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);
1156 1172
1157 enum ClipEdgeStyle { 1173 enum ClipEdgeStyle {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 bool asROBitmap(SkBitmap*) const; 1413 bool asROBitmap(SkBitmap*) const;
1398 1414
1399 private: 1415 private:
1400 SkBitmap fBitmap; // used if peekPixels() fails 1416 SkBitmap fBitmap; // used if peekPixels() fails
1401 const void* fAddr; // NULL on failure 1417 const void* fAddr; // NULL on failure
1402 SkImageInfo fInfo; 1418 SkImageInfo fInfo;
1403 size_t fRowBytes; 1419 size_t fRowBytes;
1404 }; 1420 };
1405 1421
1406 #endif 1422 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698