@shopify/react-native-skia 0.1.213 → 0.1.214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  3. package/cpp/api/JsiSkSurface.h +4 -1
  4. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  5. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  6. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  7. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkCodec.h +4 -3
  9. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  10. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  11. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  18. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  19. package/cpp/skia/include/core/SkBitmap.h +8 -8
  20. package/cpp/skia/include/core/SkCanvas.h +37 -50
  21. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  22. package/cpp/skia/include/core/SkColor.h +1 -1
  23. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  24. package/cpp/skia/include/core/SkColorTable.h +3 -0
  25. package/cpp/skia/include/core/SkColorType.h +2 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  27. package/cpp/skia/include/core/SkDocument.h +1 -0
  28. package/cpp/skia/include/core/SkFont.h +11 -2
  29. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  30. package/cpp/skia/include/core/SkGraphics.h +3 -13
  31. package/cpp/skia/include/core/SkImage.h +57 -111
  32. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  33. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  34. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  35. package/cpp/skia/include/core/SkM44.h +7 -3
  36. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  37. package/cpp/skia/include/core/SkMatrix.h +17 -17
  38. package/cpp/skia/include/core/SkMesh.h +71 -61
  39. package/cpp/skia/include/core/SkMilestone.h +1 -1
  40. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  41. package/cpp/skia/include/core/SkPaint.h +1 -1
  42. package/cpp/skia/include/core/SkPath.h +12 -4
  43. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  44. package/cpp/skia/include/core/SkPicture.h +19 -6
  45. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  46. package/cpp/skia/include/core/SkPixmap.h +2 -3
  47. package/cpp/skia/include/core/SkRRect.h +1 -1
  48. package/cpp/skia/include/core/SkRect.h +107 -110
  49. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  50. package/cpp/skia/include/core/SkRegion.h +7 -1
  51. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  52. package/cpp/skia/include/core/SkShader.h +9 -0
  53. package/cpp/skia/include/core/SkStream.h +9 -9
  54. package/cpp/skia/include/core/SkString.h +1 -1
  55. package/cpp/skia/include/core/SkSurface.h +14 -25
  56. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  57. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  58. package/cpp/skia/include/core/SkTypeface.h +7 -2
  59. package/cpp/skia/include/core/SkTypes.h +4 -12
  60. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  61. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  62. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  63. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  64. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  65. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  66. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  67. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  68. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  69. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  70. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  71. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  72. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  73. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  74. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  75. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  77. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  78. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  79. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  80. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  81. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  82. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  83. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  84. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  85. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  86. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  87. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  88. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  89. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  90. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  91. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  92. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  93. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  94. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  95. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  96. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  97. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  98. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  99. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  100. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  101. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  102. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  103. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  104. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  105. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  106. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  107. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  108. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  109. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  110. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  111. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  112. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  113. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  114. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  115. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  116. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  117. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  118. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  119. package/cpp/skia/include/utils/SkBase64.h +2 -2
  120. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  121. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  122. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  123. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  124. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  125. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  126. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  127. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  128. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  129. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  130. package/cpp/skia/src/core/SkChecksum.h +2 -1
  131. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  132. package/cpp/skia/src/core/SkTHash.h +19 -9
  133. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  134. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  135. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  137. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  138. package/lib/commonjs/external/reanimated/index.js +13 -0
  139. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  140. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  142. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  144. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  147. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  149. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  150. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  151. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  152. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  153. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  154. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  155. package/lib/commonjs/views/types.js +3 -0
  156. package/lib/commonjs/views/types.js.map +1 -1
  157. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  158. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  159. package/lib/module/external/reanimated/index.d.ts +1 -0
  160. package/lib/module/external/reanimated/index.js +1 -0
  161. package/lib/module/external/reanimated/index.js.map +1 -1
  162. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  163. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  164. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  165. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  166. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  167. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  168. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  169. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  170. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  171. package/lib/module/skia/types/MaskFilter.js +3 -0
  172. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  173. package/lib/module/views/types.js +3 -0
  174. package/lib/module/views/types.js.map +1 -1
  175. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  176. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  177. package/libs/android/arm64-v8a/libskia.a +0 -0
  178. package/libs/android/arm64-v8a/libskottie.a +0 -0
  179. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  180. package/libs/android/arm64-v8a/libsksg.a +0 -0
  181. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  182. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  183. package/libs/android/arm64-v8a/libsvg.a +0 -0
  184. package/libs/android/armeabi-v7a/libskia.a +0 -0
  185. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  186. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  187. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  188. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  189. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  190. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  191. package/libs/android/x86/libskia.a +0 -0
  192. package/libs/android/x86/libskottie.a +0 -0
  193. package/libs/android/x86/libskparagraph.a +0 -0
  194. package/libs/android/x86/libsksg.a +0 -0
  195. package/libs/android/x86/libskshaper.a +0 -0
  196. package/libs/android/x86/libskunicode.a +0 -0
  197. package/libs/android/x86/libsvg.a +0 -0
  198. package/libs/android/x86_64/libskia.a +0 -0
  199. package/libs/android/x86_64/libskottie.a +0 -0
  200. package/libs/android/x86_64/libskparagraph.a +0 -0
  201. package/libs/android/x86_64/libsksg.a +0 -0
  202. package/libs/android/x86_64/libskshaper.a +0 -0
  203. package/libs/android/x86_64/libskunicode.a +0 -0
  204. package/libs/android/x86_64/libsvg.a +0 -0
  205. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  206. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  207. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  208. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  209. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  210. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  211. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  212. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  213. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  214. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  215. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  216. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  217. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  218. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  220. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  221. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  223. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  224. package/package.json +1 -1
  225. package/react-native-skia.podspec +1 -1
  226. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  227. package/src/external/reanimated/index.ts +1 -0
  228. package/src/external/reanimated/moduleWrapper.ts +6 -10
  229. package/src/external/reanimated/renderHelpers.ts +41 -1
  230. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  231. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  232. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  233. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  234. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  235. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  236. package/cpp/skia/include/core/SkTime.h +0 -63
  237. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  238. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  239. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  240. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  241. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  242. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  243. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  244. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  245. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -9,15 +9,16 @@
9
9
  #define SkRect_DEFINED
10
10
 
11
11
  #include "include/core/SkPoint.h"
12
- #include "include/core/SkScalar.h"
13
12
  #include "include/core/SkSize.h"
14
13
  #include "include/core/SkTypes.h"
14
+ #include "include/private/base/SkFloatingPoint.h"
15
15
  #include "include/private/base/SkSafe32.h"
16
16
  #include "include/private/base/SkTFitsIn.h"
17
17
 
18
- #include <string>
19
18
  #include <algorithm>
19
+ #include <cmath>
20
20
  #include <cstdint>
21
+ #include <cstring>
21
22
 
22
23
  struct SkRect;
23
24
 
@@ -41,7 +42,7 @@ struct SK_API SkIRect {
41
42
 
42
43
  @return bounds (0, 0, 0, 0)
43
44
  */
44
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeEmpty() {
45
+ [[nodiscard]] static constexpr SkIRect MakeEmpty() {
45
46
  return SkIRect{0, 0, 0, 0};
46
47
  }
47
48
 
@@ -52,7 +53,7 @@ struct SK_API SkIRect {
52
53
  @param h height of constructed SkIRect
53
54
  @return bounds (0, 0, w, h)
54
55
  */
55
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h) {
56
+ [[nodiscard]] static constexpr SkIRect MakeWH(int32_t w, int32_t h) {
56
57
  return SkIRect{0, 0, w, h};
57
58
  }
58
59
 
@@ -62,7 +63,7 @@ struct SK_API SkIRect {
62
63
  @param size values for SkIRect width and height
63
64
  @return bounds (0, 0, size.width(), size.height())
64
65
  */
65
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size) {
66
+ [[nodiscard]] static constexpr SkIRect MakeSize(const SkISize& size) {
66
67
  return SkIRect{0, 0, size.fWidth, size.fHeight};
67
68
  }
68
69
 
@@ -74,7 +75,7 @@ struct SK_API SkIRect {
74
75
  @param size values for SkIRect width and height
75
76
  @return bounds at pt with width and height of size
76
77
  */
77
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakePtSize(SkIPoint pt, SkISize size) {
78
+ [[nodiscard]] static constexpr SkIRect MakePtSize(SkIPoint pt, SkISize size) {
78
79
  return MakeXYWH(pt.x(), pt.y(), size.width(), size.height());
79
80
  }
80
81
 
@@ -87,8 +88,7 @@ struct SK_API SkIRect {
87
88
  @param b integer stored in fBottom
88
89
  @return bounds (l, t, r, b)
89
90
  */
90
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t,
91
- int32_t r, int32_t b) {
91
+ [[nodiscard]] static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b) {
92
92
  return SkIRect{l, t, r, b};
93
93
  }
94
94
 
@@ -101,8 +101,7 @@ struct SK_API SkIRect {
101
101
  @param h added to y and stored in fBottom
102
102
  @return bounds at (x, y) with width w and height h
103
103
  */
104
- static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y,
105
- int32_t w, int32_t h) {
104
+ [[nodiscard]] static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h) {
106
105
  return { x, y, Sk32_sat_add(x, w), Sk32_sat_add(y, h) };
107
106
  }
108
107
 
@@ -524,7 +523,7 @@ struct SK_API SkIRect {
524
523
  @param b SkIRect to intersect
525
524
  @return true if a and b have area in common
526
525
  */
527
- bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b);
526
+ [[nodiscard]] bool intersect(const SkIRect& a, const SkIRect& b);
528
527
 
529
528
  /** Returns true if a intersects b.
530
529
  Returns false if either a or b is empty, or do not intersect.
@@ -574,17 +573,17 @@ struct SK_API SkIRect {
574
573
  };
575
574
 
576
575
  /** \struct SkRect
577
- SkRect holds four SkScalar coordinates describing the upper and
576
+ SkRect holds four float coordinates describing the upper and
578
577
  lower bounds of a rectangle. SkRect may be created from outer bounds or
579
578
  from position, width, and height. SkRect describes an area; if its right
580
579
  is less than or equal to its left, or if its bottom is less than or equal to
581
580
  its top, it is considered empty.
582
581
  */
583
582
  struct SK_API SkRect {
584
- SkScalar fLeft = 0; //!< smaller x-axis bounds
585
- SkScalar fTop = 0; //!< smaller y-axis bounds
586
- SkScalar fRight = 0; //!< larger x-axis bounds
587
- SkScalar fBottom = 0; //!< larger y-axis bounds
583
+ float fLeft = 0; //!< smaller x-axis bounds
584
+ float fTop = 0; //!< smaller y-axis bounds
585
+ float fRight = 0; //!< larger x-axis bounds
586
+ float fBottom = 0; //!< larger y-axis bounds
588
587
 
589
588
  /** Returns constructed SkRect set to (0, 0, 0, 0).
590
589
  Many other rectangles are empty; if left is equal to or greater than right,
@@ -593,21 +592,21 @@ struct SK_API SkRect {
593
592
 
594
593
  @return bounds (0, 0, 0, 0)
595
594
  */
596
- static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty() {
595
+ [[nodiscard]] static constexpr SkRect MakeEmpty() {
597
596
  return SkRect{0, 0, 0, 0};
598
597
  }
599
598
 
600
- /** Returns constructed SkRect set to SkScalar values (0, 0, w, h). Does not
599
+ /** Returns constructed SkRect set to float values (0, 0, w, h). Does not
601
600
  validate input; w or h may be negative.
602
601
 
603
602
  Passing integer values may generate a compiler warning since SkRect cannot
604
603
  represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle.
605
604
 
606
- @param w SkScalar width of constructed SkRect
607
- @param h SkScalar height of constructed SkRect
605
+ @param w float width of constructed SkRect
606
+ @param h float height of constructed SkRect
608
607
  @return bounds (0, 0, w, h)
609
608
  */
610
- static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) {
609
+ [[nodiscard]] static constexpr SkRect MakeWH(float w, float h) {
611
610
  return SkRect{0, 0, w, h};
612
611
  }
613
612
 
@@ -621,31 +620,30 @@ struct SK_API SkRect {
621
620
  @param h integer height of constructed SkRect
622
621
  @return bounds (0, 0, w, h)
623
622
  */
624
- static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h) {
625
- return {0, 0, SkIntToScalar(w), SkIntToScalar(h)};
623
+ [[nodiscard]] static SkRect MakeIWH(int w, int h) {
624
+ return {0, 0, static_cast<float>(w), static_cast<float>(h)};
626
625
  }
627
626
 
628
627
  /** Returns constructed SkRect set to (0, 0, size.width(), size.height()). Does not
629
628
  validate input; size.width() or size.height() may be negative.
630
629
 
631
- @param size SkScalar values for SkRect width and height
630
+ @param size float values for SkRect width and height
632
631
  @return bounds (0, 0, size.width(), size.height())
633
632
  */
634
- static constexpr SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) {
633
+ [[nodiscard]] static constexpr SkRect MakeSize(const SkSize& size) {
635
634
  return SkRect{0, 0, size.fWidth, size.fHeight};
636
635
  }
637
636
 
638
637
  /** Returns constructed SkRect set to (l, t, r, b). Does not sort input; SkRect may
639
638
  result in fLeft greater than fRight, or fTop greater than fBottom.
640
639
 
641
- @param l SkScalar stored in fLeft
642
- @param t SkScalar stored in fTop
643
- @param r SkScalar stored in fRight
644
- @param b SkScalar stored in fBottom
640
+ @param l float stored in fLeft
641
+ @param t float stored in fTop
642
+ @param r float stored in fRight
643
+ @param b float stored in fBottom
645
644
  @return bounds (l, t, r, b)
646
645
  */
647
- static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r,
648
- SkScalar b) {
646
+ [[nodiscard]] static constexpr SkRect MakeLTRB(float l, float t, float r, float b) {
649
647
  return SkRect {l, t, r, b};
650
648
  }
651
649
 
@@ -658,8 +656,7 @@ struct SK_API SkRect {
658
656
  @param h added to y and stored in fBottom
659
657
  @return bounds at (x, y) with width w and height h
660
658
  */
661
- static constexpr SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w,
662
- SkScalar h) {
659
+ [[nodiscard]] static constexpr SkRect MakeXYWH(float x, float y, float w, float h) {
663
660
  return SkRect {x, y, x + w, y + h};
664
661
  }
665
662
 
@@ -673,17 +670,17 @@ struct SK_API SkRect {
673
670
  return MakeIWH(size.width(), size.height());
674
671
  }
675
672
 
676
- /** Returns constructed SkIRect set to irect, promoting integers to scalar.
673
+ /** Returns constructed SkIRect set to irect, promoting integers to float.
677
674
  Does not validate input; fLeft may be greater than fRight, fTop may be greater
678
675
  than fBottom.
679
676
 
680
677
  @param irect integer unsorted bounds
681
- @return irect members converted to SkScalar
678
+ @return irect members converted to float
682
679
  */
683
- static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) {
680
+ [[nodiscard]] static SkRect Make(const SkIRect& irect) {
684
681
  return {
685
- SkIntToScalar(irect.fLeft), SkIntToScalar(irect.fTop),
686
- SkIntToScalar(irect.fRight), SkIntToScalar(irect.fBottom)
682
+ static_cast<float>(irect.fLeft), static_cast<float>(irect.fTop),
683
+ static_cast<float>(irect.fRight), static_cast<float>(irect.fBottom)
687
684
  };
688
685
  }
689
686
 
@@ -707,8 +704,7 @@ struct SK_API SkRect {
707
704
  */
708
705
  bool isSorted() const { return fLeft <= fRight && fTop <= fBottom; }
709
706
 
710
- /** Returns true if all values in the rectangle are finite: SK_ScalarMin or larger,
711
- and SK_ScalarMax or smaller.
707
+ /** Returns true if all values in the rectangle are finite.
712
708
 
713
709
  @return true if no member is infinite or NaN
714
710
  */
@@ -720,11 +716,11 @@ struct SK_API SkRect {
720
716
  accum *= fBottom;
721
717
 
722
718
  // accum is either NaN or it is finite (zero).
723
- SkASSERT(0 == accum || SkScalarIsNaN(accum));
719
+ SkASSERT(0 == accum || std::isnan(accum));
724
720
 
725
721
  // value==value will be true iff value is not NaN
726
722
  // TODO: is it faster to say !accum or accum==accum?
727
- return !SkScalarIsNaN(accum);
723
+ return !std::isnan(accum);
728
724
  }
729
725
 
730
726
  /** Returns left edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid.
@@ -732,65 +728,64 @@ struct SK_API SkRect {
732
728
 
733
729
  @return fLeft
734
730
  */
735
- constexpr SkScalar x() const { return fLeft; }
731
+ constexpr float x() const { return fLeft; }
736
732
 
737
733
  /** Returns top edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid,
738
734
  and sort() to reverse fTop and fBottom if needed.
739
735
 
740
736
  @return fTop
741
737
  */
742
- constexpr SkScalar y() const { return fTop; }
738
+ constexpr float y() const { return fTop; }
743
739
 
744
740
  /** Returns left edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid.
745
741
  Call sort() to reverse fLeft and fRight if needed.
746
742
 
747
743
  @return fLeft
748
744
  */
749
- constexpr SkScalar left() const { return fLeft; }
745
+ constexpr float left() const { return fLeft; }
750
746
 
751
747
  /** Returns top edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid,
752
748
  and sort() to reverse fTop and fBottom if needed.
753
749
 
754
750
  @return fTop
755
751
  */
756
- constexpr SkScalar top() const { return fTop; }
752
+ constexpr float top() const { return fTop; }
757
753
 
758
754
  /** Returns right edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid.
759
755
  Call sort() to reverse fLeft and fRight if needed.
760
756
 
761
757
  @return fRight
762
758
  */
763
- constexpr SkScalar right() const { return fRight; }
759
+ constexpr float right() const { return fRight; }
764
760
 
765
761
  /** Returns bottom edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid,
766
762
  and sort() to reverse fTop and fBottom if needed.
767
763
 
768
764
  @return fBottom
769
765
  */
770
- constexpr SkScalar bottom() const { return fBottom; }
766
+ constexpr float bottom() const { return fBottom; }
771
767
 
772
768
  /** Returns span on the x-axis. This does not check if SkRect is sorted, or if
773
769
  result fits in 32-bit float; result may be negative or infinity.
774
770
 
775
771
  @return fRight minus fLeft
776
772
  */
777
- constexpr SkScalar width() const { return fRight - fLeft; }
773
+ constexpr float width() const { return fRight - fLeft; }
778
774
 
779
775
  /** Returns span on the y-axis. This does not check if SkRect is sorted, or if
780
776
  result fits in 32-bit float; result may be negative or infinity.
781
777
 
782
778
  @return fBottom minus fTop
783
779
  */
784
- constexpr SkScalar height() const { return fBottom - fTop; }
780
+ constexpr float height() const { return fBottom - fTop; }
785
781
 
786
782
  /** Returns average of left edge and right edge. Result does not change if SkRect
787
783
  is sorted. Result may overflow to infinity if SkRect is far from the origin.
788
784
 
789
785
  @return midpoint on x-axis
790
786
  */
791
- constexpr SkScalar centerX() const {
792
- // don't use SkScalarHalf(fLeft + fBottom) as that might overflow before the 0.5
793
- return SkScalarHalf(fLeft) + SkScalarHalf(fRight);
787
+ constexpr float centerX() const {
788
+ return sk_float_midpoint(fLeft, fRight);
794
789
  }
795
790
 
796
791
  /** Returns average of top edge and bottom edge. Result does not change if SkRect
@@ -798,9 +793,8 @@ struct SK_API SkRect {
798
793
 
799
794
  @return midpoint on y-axis
800
795
  */
801
- constexpr SkScalar centerY() const {
802
- // don't use SkScalarHalf(fTop + fBottom) as that might overflow before the 0.5
803
- return SkScalarHalf(fTop) + SkScalarHalf(fBottom);
796
+ constexpr float centerY() const {
797
+ return sk_float_midpoint(fTop, fBottom);
804
798
  }
805
799
 
806
800
  /** Returns the point this->centerX(), this->centerY().
@@ -819,7 +813,10 @@ struct SK_API SkRect {
819
813
  @return true if members are equal
820
814
  */
821
815
  friend bool operator==(const SkRect& a, const SkRect& b) {
822
- return SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4);
816
+ return a.fLeft == b.fLeft &&
817
+ a.fTop == b.fTop &&
818
+ a.fRight == b.fRight &&
819
+ a.fBottom == b.fBottom;
823
820
  }
824
821
 
825
822
  /** Returns true if any in a: fLeft, fTop, fRight, and fBottom; does not
@@ -833,7 +830,7 @@ struct SK_API SkRect {
833
830
  @return true if members are not equal
834
831
  */
835
832
  friend bool operator!=(const SkRect& a, const SkRect& b) {
836
- return !SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4);
833
+ return !(a == b);
837
834
  }
838
835
 
839
836
  /** Returns four points in quad that enclose SkRect ordered as: top-left, top-right,
@@ -855,16 +852,16 @@ struct SK_API SkRect {
855
852
  */
856
853
  void setEmpty() { *this = MakeEmpty(); }
857
854
 
858
- /** Sets SkRect to src, promoting src members from integer to scalar.
855
+ /** Sets SkRect to src, promoting src members from integer to float.
859
856
  Very large values in src may lose precision.
860
857
 
861
858
  @param src integer SkRect
862
859
  */
863
860
  void set(const SkIRect& src) {
864
- fLeft = SkIntToScalar(src.fLeft);
865
- fTop = SkIntToScalar(src.fTop);
866
- fRight = SkIntToScalar(src.fRight);
867
- fBottom = SkIntToScalar(src.fBottom);
861
+ fLeft = src.fLeft;
862
+ fTop = src.fTop;
863
+ fRight = src.fRight;
864
+ fBottom = src.fBottom;
868
865
  }
869
866
 
870
867
  /** Sets SkRect to (left, top, right, bottom).
@@ -876,7 +873,7 @@ struct SK_API SkRect {
876
873
  @param right stored in fRight
877
874
  @param bottom stored in fBottom
878
875
  */
879
- void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
876
+ void setLTRB(float left, float top, float right, float bottom) {
880
877
  fLeft = left;
881
878
  fTop = top;
882
879
  fRight = right;
@@ -942,7 +939,7 @@ struct SK_API SkRect {
942
939
  @param width added to x and stored in fRight
943
940
  @param height added to y and stored in fBottom
944
941
  */
945
- void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height) {
942
+ void setXYWH(float x, float y, float width, float height) {
946
943
  fLeft = x;
947
944
  fTop = y;
948
945
  fRight = x + width;
@@ -955,14 +952,14 @@ struct SK_API SkRect {
955
952
  @param width stored in fRight
956
953
  @param height stored in fBottom
957
954
  */
958
- void setWH(SkScalar width, SkScalar height) {
955
+ void setWH(float width, float height) {
959
956
  fLeft = 0;
960
957
  fTop = 0;
961
958
  fRight = width;
962
959
  fBottom = height;
963
960
  }
964
961
  void setIWH(int32_t width, int32_t height) {
965
- this->setWH(SkIntToScalar(width), SkIntToScalar(height));
962
+ this->setWH(width, height);
966
963
  }
967
964
 
968
965
  /** Returns SkRect offset by (dx, dy).
@@ -976,7 +973,7 @@ struct SK_API SkRect {
976
973
  @param dy added to fTop and fBottom
977
974
  @return SkRect offset on axes, with original width and height
978
975
  */
979
- constexpr SkRect makeOffset(SkScalar dx, SkScalar dy) const {
976
+ constexpr SkRect makeOffset(float dx, float dy) const {
980
977
  return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy);
981
978
  }
982
979
 
@@ -998,7 +995,7 @@ struct SK_API SkRect {
998
995
  @param dy added to fTop and subtracted from fBottom
999
996
  @return SkRect inset symmetrically left and right, top and bottom
1000
997
  */
1001
- SkRect makeInset(SkScalar dx, SkScalar dy) const {
998
+ SkRect makeInset(float dx, float dy) const {
1002
999
  return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy);
1003
1000
  }
1004
1001
 
@@ -1013,7 +1010,7 @@ struct SK_API SkRect {
1013
1010
  @param dy subtracted to fTop and added from fBottom
1014
1011
  @return SkRect outset symmetrically left and right, top and bottom
1015
1012
  */
1016
- SkRect makeOutset(SkScalar dx, SkScalar dy) const {
1013
+ SkRect makeOutset(float dx, float dy) const {
1017
1014
  return MakeLTRB(fLeft - dx, fTop - dy, fRight + dx, fBottom + dy);
1018
1015
  }
1019
1016
 
@@ -1027,7 +1024,7 @@ struct SK_API SkRect {
1027
1024
  @param dx offset added to fLeft and fRight
1028
1025
  @param dy offset added to fTop and fBottom
1029
1026
  */
1030
- void offset(SkScalar dx, SkScalar dy) {
1027
+ void offset(float dx, float dy) {
1031
1028
  fLeft += dx;
1032
1029
  fTop += dy;
1033
1030
  fRight += dx;
@@ -1054,7 +1051,7 @@ struct SK_API SkRect {
1054
1051
  @param newX stored in fLeft, preserving width()
1055
1052
  @param newY stored in fTop, preserving height()
1056
1053
  */
1057
- void offsetTo(SkScalar newX, SkScalar newY) {
1054
+ void offsetTo(float newX, float newY) {
1058
1055
  fRight += newX - fLeft;
1059
1056
  fBottom += newY - fTop;
1060
1057
  fLeft = newX;
@@ -1071,7 +1068,7 @@ struct SK_API SkRect {
1071
1068
  @param dx added to fLeft and subtracted from fRight
1072
1069
  @param dy added to fTop and subtracted from fBottom
1073
1070
  */
1074
- void inset(SkScalar dx, SkScalar dy) {
1071
+ void inset(float dx, float dy) {
1075
1072
  fLeft += dx;
1076
1073
  fTop += dy;
1077
1074
  fRight -= dx;
@@ -1088,7 +1085,7 @@ struct SK_API SkRect {
1088
1085
  @param dx subtracted to fLeft and added from fRight
1089
1086
  @param dy subtracted to fTop and added from fBottom
1090
1087
  */
1091
- void outset(SkScalar dx, SkScalar dy) { this->inset(-dx, -dy); }
1088
+ void outset(float dx, float dy) { this->inset(-dx, -dy); }
1092
1089
 
1093
1090
  /** Returns true if SkRect intersects r, and sets SkRect to intersection.
1094
1091
  Returns false if SkRect does not intersect r, and leaves SkRect unchanged.
@@ -1111,16 +1108,16 @@ struct SK_API SkRect {
1111
1108
  @param b SkRect to intersect
1112
1109
  @return true if a and b have area in common
1113
1110
  */
1114
- bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b);
1111
+ [[nodiscard]] bool intersect(const SkRect& a, const SkRect& b);
1115
1112
 
1116
1113
 
1117
1114
  private:
1118
- static bool Intersects(SkScalar al, SkScalar at, SkScalar ar, SkScalar ab,
1119
- SkScalar bl, SkScalar bt, SkScalar br, SkScalar bb) {
1120
- SkScalar L = std::max(al, bl);
1121
- SkScalar R = std::min(ar, br);
1122
- SkScalar T = std::max(at, bt);
1123
- SkScalar B = std::min(ab, bb);
1115
+ static bool Intersects(float al, float at, float ar, float ab,
1116
+ float bl, float bt, float br, float bb) {
1117
+ float L = std::max(al, bl);
1118
+ float R = std::min(ar, br);
1119
+ float T = std::max(at, bt);
1120
+ float B = std::min(ab, bb);
1124
1121
  return L < R && T < B;
1125
1122
  }
1126
1123
 
@@ -1199,7 +1196,7 @@ public:
1199
1196
  @param y test SkPoint y-coordinate
1200
1197
  @return true if (x, y) is inside SkRect
1201
1198
  */
1202
- bool contains(SkScalar x, SkScalar y) const {
1199
+ bool contains(float x, float y) const {
1203
1200
  return x >= fLeft && x < fRight && y >= fTop && y < fBottom;
1204
1201
  }
1205
1202
 
@@ -1229,63 +1226,63 @@ public:
1229
1226
  bool contains(const SkIRect& r) const {
1230
1227
  // todo: can we eliminate the this->isEmpty check?
1231
1228
  return !r.isEmpty() && !this->isEmpty() &&
1232
- fLeft <= SkIntToScalar(r.fLeft) && fTop <= SkIntToScalar(r.fTop) &&
1233
- fRight >= SkIntToScalar(r.fRight) && fBottom >= SkIntToScalar(r.fBottom);
1229
+ fLeft <= r.fLeft && fTop <= r.fTop &&
1230
+ fRight >= r.fRight && fBottom >= r.fBottom;
1234
1231
  }
1235
1232
 
1236
1233
  /** Sets SkIRect by adding 0.5 and discarding the fractional portion of SkRect
1237
- members, using (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
1238
- SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)).
1234
+ members, using (sk_float_round2int(fLeft), sk_float_round2int(fTop),
1235
+ sk_float_round2int(fRight), sk_float_round2int(fBottom)).
1239
1236
 
1240
1237
  @param dst storage for SkIRect
1241
1238
  */
1242
1239
  void round(SkIRect* dst) const {
1243
1240
  SkASSERT(dst);
1244
- dst->setLTRB(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
1245
- SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom));
1241
+ dst->setLTRB(sk_float_round2int(fLeft), sk_float_round2int(fTop),
1242
+ sk_float_round2int(fRight), sk_float_round2int(fBottom));
1246
1243
  }
1247
1244
 
1248
1245
  /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding
1249
1246
  up fRight and fBottom, using
1250
- (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
1251
- SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)).
1247
+ (sk_float_floor2int(fLeft), sk_float_floor2int(fTop),
1248
+ sk_float_ceil2int(fRight), sk_float_ceil2int(fBottom)).
1252
1249
 
1253
1250
  @param dst storage for SkIRect
1254
1251
  */
1255
1252
  void roundOut(SkIRect* dst) const {
1256
1253
  SkASSERT(dst);
1257
- dst->setLTRB(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
1258
- SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom));
1254
+ dst->setLTRB(sk_float_floor2int(fLeft), sk_float_floor2int(fTop),
1255
+ sk_float_ceil2int(fRight), sk_float_ceil2int(fBottom));
1259
1256
  }
1260
1257
 
1261
1258
  /** Sets SkRect by discarding the fractional portion of fLeft and fTop; and rounding
1262
1259
  up fRight and fBottom, using
1263
- (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
1264
- SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)).
1260
+ (sk_float_floor(fLeft), sk_float_floor(fTop),
1261
+ sk_float_ceil(fRight), sk_float_ceil(fBottom)).
1265
1262
 
1266
1263
  @param dst storage for SkRect
1267
1264
  */
1268
1265
  void roundOut(SkRect* dst) const {
1269
- dst->setLTRB(SkScalarFloorToScalar(fLeft), SkScalarFloorToScalar(fTop),
1270
- SkScalarCeilToScalar(fRight), SkScalarCeilToScalar(fBottom));
1266
+ dst->setLTRB(sk_float_floor(fLeft), sk_float_floor(fTop),
1267
+ sk_float_ceil(fRight), sk_float_ceil(fBottom));
1271
1268
  }
1272
1269
 
1273
1270
  /** Sets SkRect by rounding up fLeft and fTop; and discarding the fractional portion
1274
1271
  of fRight and fBottom, using
1275
- (SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
1276
- SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)).
1272
+ (sk_float_ceil2int(fLeft), sk_float_ceil2int(fTop),
1273
+ sk_float_floor2int(fRight), sk_float_floor2int(fBottom)).
1277
1274
 
1278
1275
  @param dst storage for SkIRect
1279
1276
  */
1280
1277
  void roundIn(SkIRect* dst) const {
1281
1278
  SkASSERT(dst);
1282
- dst->setLTRB(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
1283
- SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom));
1279
+ dst->setLTRB(sk_float_ceil2int(fLeft), sk_float_ceil2int(fTop),
1280
+ sk_float_floor2int(fRight), sk_float_floor2int(fBottom));
1284
1281
  }
1285
1282
 
1286
1283
  /** Returns SkIRect by adding 0.5 and discarding the fractional portion of SkRect
1287
- members, using (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
1288
- SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)).
1284
+ members, using (sk_float_round2int(fLeft), sk_float_round2int(fTop),
1285
+ sk_float_round2int(fRight), sk_float_round2int(fBottom)).
1289
1286
 
1290
1287
  @return rounded SkIRect
1291
1288
  */
@@ -1297,8 +1294,8 @@ public:
1297
1294
 
1298
1295
  /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding
1299
1296
  up fRight and fBottom, using
1300
- (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
1301
- SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)).
1297
+ (sk_float_floor2int(fLeft), sk_float_floor2int(fTop),
1298
+ sk_float_ceil2int(fRight), sk_float_ceil2int(fBottom)).
1302
1299
 
1303
1300
  @return rounded SkIRect
1304
1301
  */
@@ -1309,8 +1306,8 @@ public:
1309
1306
  }
1310
1307
  /** Sets SkIRect by rounding up fLeft and fTop; and discarding the fractional portion
1311
1308
  of fRight and fBottom, using
1312
- (SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
1313
- SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)).
1309
+ (sk_float_ceil2int(fLeft), sk_float_ceil2int(fTop),
1310
+ sk_float_floor2int(fRight), sk_float_floor2int(fBottom)).
1314
1311
 
1315
1312
  @return rounded SkIRect
1316
1313
  */
@@ -1346,12 +1343,12 @@ public:
1346
1343
  std::max(fLeft, fRight), std::max(fTop, fBottom));
1347
1344
  }
1348
1345
 
1349
- /** Returns pointer to first scalar in SkRect, to treat it as an array with four
1346
+ /** Returns pointer to first float in SkRect, to treat it as an array with four
1350
1347
  entries.
1351
1348
 
1352
1349
  @return pointer to fLeft
1353
1350
  */
1354
- const SkScalar* asScalars() const { return &fLeft; }
1351
+ const float* asScalars() const { return &fLeft; }
1355
1352
 
1356
1353
  /** Writes text representation of SkRect to standard output. Set asHex to true to
1357
1354
  generate exact binary representations of floating point numbers.
@@ -1381,8 +1378,8 @@ public:
1381
1378
 
1382
1379
  inline bool SkIRect::contains(const SkRect& r) const {
1383
1380
  return !r.isEmpty() && !this->isEmpty() && // check for empties
1384
- (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
1385
- (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
1381
+ fLeft <= r.fLeft && fTop <= r.fTop &&
1382
+ fRight >= r.fRight && fBottom >= r.fBottom;
1386
1383
  }
1387
1384
 
1388
1385
  #endif
@@ -321,7 +321,7 @@ public:
321
321
  * The caller must assume ownership of the object, and manage its reference count directly.
322
322
  * No call to unref() will be made.
323
323
  */
324
- T* SK_WARN_UNUSED_RESULT release() {
324
+ [[nodiscard]] T* release() {
325
325
  T* ptr = fPtr;
326
326
  fPtr = nullptr;
327
327
  return ptr;
@@ -9,10 +9,16 @@
9
9
  #define SkRegion_DEFINED
10
10
 
11
11
  #include "include/core/SkRect.h"
12
+ #include "include/private/base/SkAPI.h"
13
+ #include "include/private/base/SkAssert.h"
14
+ #include "include/private/base/SkDebug.h"
12
15
  #include "include/private/base/SkTypeTraits.h"
13
16
 
17
+ #include <cstddef>
18
+ #include <cstdint>
19
+ #include <type_traits>
20
+
14
21
  class SkPath;
15
- class SkRgnBuilder;
16
22
 
17
23
  /** \class SkRegion
18
24
  SkRegion describes the set of pixels used to clip SkCanvas. SkRegion is compact,