| 1 |
load( |
| 2 |
"//bazel:skia_rules.bzl", |
| 3 |
"generate_cpp_files_for_headers", |
| 4 |
"skia_cc_library", |
| 5 |
"skia_filegroup", |
| 6 |
"split_srcs_and_hdrs", |
| 7 |
) |
| 8 |
|
| 9 |
package( |
| 10 |
default_applicable_licenses = ["//:license"], |
| 11 |
) |
| 12 |
|
| 13 |
licenses(["notice"]) |
| 14 |
|
| 15 |
PRIVATE_CODEC_HEADERS = [ |
| 16 |
"SkCodecPriv.h", |
| 17 |
"SkColorPalette.h", |
| 18 |
"SkFrameHolder.h", |
| 19 |
"SkHdrAgtmPriv.h", |
| 20 |
"SkMaskSwizzler.h", |
| 21 |
"SkParseEncodedOrigin.h", |
| 22 |
"SkSampler.h", |
| 23 |
"SkScalingCodec.h", |
| 24 |
"SkSwizzler.h", |
| 25 |
"SkPixmapUtilsPriv.h", |
| 26 |
] |
| 27 |
|
| 28 |
ANY_DECODER_HDRS = ["SkCodecImageGenerator.h"] |
| 29 |
|
| 30 |
ANY_DECODER_SRCS = [ |
| 31 |
"SkCodec.cpp", |
| 32 |
"SkCodecColorProfile.cpp", |
| 33 |
"SkCodecImageGenerator.cpp", |
| 34 |
"SkColorPalette.cpp", |
| 35 |
"SkEncodedInfo.cpp", |
| 36 |
"SkExif.cpp", |
| 37 |
"SkGainmapInfo.cpp", |
| 38 |
"SkHdrAgtm.cpp", |
| 39 |
"SkHdrAgtmParse.cpp", |
| 40 |
"SkHdrMetadata.cpp", |
| 41 |
"SkImageGenerator_FromEncoded.cpp", |
| 42 |
"SkMaskSwizzler.cpp", |
| 43 |
"SkParseEncodedOrigin.cpp", |
| 44 |
"SkPixmapUtils.cpp", |
| 45 |
"SkSampler.cpp", |
| 46 |
"SkSwizzler.cpp", |
| 47 |
"SkTiffUtility.cpp", |
| 48 |
"SkTiffUtility.h", |
| 49 |
] |
| 50 |
|
| 51 |
skia_filegroup( |
| 52 |
name = "rust_icc_codec_srcs", |
| 53 |
srcs = [ |
| 54 |
"SkCodecColorProfileRust.cpp", |
| 55 |
], |
| 56 |
visibility = ["//src/codec:__pkg__"], |
| 57 |
) |
| 58 |
|
| 59 |
skia_filegroup( |
| 60 |
name = "rust_icc_codec_hdrs", |
| 61 |
srcs = [ |
| 62 |
"SkCodecColorProfileRust.h", |
| 63 |
], |
| 64 |
visibility = ["//src/codec:__pkg__"], |
| 65 |
) |
| 66 |
|
| 67 |
# We put any file that is used by more than one codec here to avoid potential issues if clients |
| 68 |
# depend on multiple codecs. This is not a problem for a statically linked binary, but could maybe |
| 69 |
# cause issues with producing a shared library (e.g. duplicate symbols showing up). |
| 70 |
skia_cc_library( |
| 71 |
name = "any_decoder", |
| 72 |
srcs = ANY_DECODER_SRCS + ["//include/codec:any_codec_hdrs"], |
| 73 |
hdrs = PRIVATE_CODEC_HEADERS + ANY_DECODER_HDRS + ["//include/private:decode_srcs"], |
| 74 |
features = ["layering_check"], |
| 75 |
local_defines = ["SK_DISABLE_LEGACY_INIT_DECODERS"], |
| 76 |
visibility = [ |
| 77 |
"//src/encode:__pkg__", |
| 78 |
"//src/pdf:__pkg__", |
| 79 |
"//src/ports:__pkg__", |
| 80 |
], |
| 81 |
deps = [ |
| 82 |
"//modules/skcms", |
| 83 |
"//src/base", |
| 84 |
"//src/core", |
| 85 |
"//src/core:core_priv", |
| 86 |
], |
| 87 |
) |
| 88 |
|
| 89 |
skia_cc_library( |
| 90 |
name = "rust_icc_support", |
| 91 |
srcs = [":rust_icc_codec_srcs"], |
| 92 |
hdrs = [":rust_icc_codec_hdrs"], |
| 93 |
defines = ["SK_CODEC_COLOR_PROFILE_PARSE_WITH_RUST"], |
| 94 |
visibility = ["//:__subpackages__"], |
| 95 |
deps = [ |
| 96 |
":any_decoder", |
| 97 |
"//rust/icc:cxx_bridge", |
| 98 |
"//rust/icc:ffi_cpp_lib", |
| 99 |
"//rust/icc:ffi_rs", |
| 100 |
"@crates//:cxx_cc", |
| 101 |
], |
| 102 |
) |
| 103 |
|
| 104 |
skia_cc_library( |
| 105 |
name = "codec_support", |
| 106 |
# This is its own rule (with no srcs) to explicitly expose any_codec_hdrs |
| 107 |
# as public in case a client does not want to use any of our codecs, but |
| 108 |
# still register their own and/or make use of SkImage::DeferredFromEncodedData |
| 109 |
hdrs = [ |
| 110 |
"//include/codec:any_codec_hdrs", |
| 111 |
], |
| 112 |
visibility = [ |
| 113 |
"//:__pkg__", |
| 114 |
], |
| 115 |
deps = [ |
| 116 |
":any_decoder", |
| 117 |
], |
| 118 |
) |
| 119 |
|
| 120 |
skia_cc_library( |
| 121 |
name = "codec_support_priv", |
| 122 |
hdrs = [ |
| 123 |
"//include/codec:any_codec_hdrs", |
| 124 |
"//include/private:decode_srcs", |
| 125 |
] + ANY_DECODER_HDRS + PRIVATE_CODEC_HEADERS, |
| 126 |
visibility = [ |
| 127 |
"//experimental/rust_bmp/decoder:__pkg__", |
| 128 |
"//experimental/rust_bmp/decoder/impl:__pkg__", |
| 129 |
"//modules/skottie:__pkg__", |
| 130 |
"//modules/skottie/src:__pkg__", |
| 131 |
"//modules/skresources:__pkg__", |
| 132 |
"//src/android:__pkg__", |
| 133 |
"//src/pdf:__pkg__", |
| 134 |
"//tools/ganesh:__pkg__", |
| 135 |
], |
| 136 |
deps = [ |
| 137 |
":any_decoder", |
| 138 |
], |
| 139 |
) |
| 140 |
|
| 141 |
ANDROID_CODEC_HDRS = ["SkAndroidCodecAdapter.h"] |
| 142 |
|
| 143 |
ANDROID_CODEC_SRCS = [ |
| 144 |
"SkAndroidCodec.cpp", |
| 145 |
"SkAndroidCodecAdapter.cpp", |
| 146 |
"SkSampledCodec.cpp", |
| 147 |
"SkSampledCodec.h", |
| 148 |
] |
| 149 |
|
| 150 |
skia_cc_library( |
| 151 |
name = "android_codec", |
| 152 |
srcs = ANDROID_CODEC_SRCS, |
| 153 |
hdrs = ANDROID_CODEC_HDRS + [ |
| 154 |
"//include/codec:android_public_hdrs", |
| 155 |
"//include/codec:any_codec_hdrs", |
| 156 |
], |
| 157 |
features = ["layering_check"], |
| 158 |
visibility = ["//:__subpackages__"], |
| 159 |
deps = [ |
| 160 |
":any_decoder", |
| 161 |
"//modules/skcms", |
| 162 |
"//src/base", |
| 163 |
"//src/core", |
| 164 |
"//src/core:core_priv", |
| 165 |
], |
| 166 |
) |
| 167 |
|
| 168 |
BMP_DECODE_HDRS = [ |
| 169 |
"SkBmpBaseCodec.h", |
| 170 |
"SkBmpCodec.h", |
| 171 |
"SkBmpMaskCodec.h", |
| 172 |
"SkBmpRLECodec.h", |
| 173 |
"SkBmpStandardCodec.h", |
| 174 |
] |
| 175 |
|
| 176 |
BMP_DECODE_SRCS = [ |
| 177 |
"SkBmpBaseCodec.cpp", |
| 178 |
"SkBmpCodec.cpp", |
| 179 |
"SkBmpMaskCodec.cpp", |
| 180 |
"SkBmpRLECodec.cpp", |
| 181 |
"SkBmpStandardCodec.cpp", |
| 182 |
] |
| 183 |
|
| 184 |
skia_cc_library( |
| 185 |
name = "bmp_decode", |
| 186 |
srcs = BMP_DECODE_SRCS, |
| 187 |
hdrs = BMP_DECODE_HDRS + [ |
| 188 |
"//include/codec:any_codec_hdrs", |
| 189 |
"//include/codec:bmp_public_hdrs", |
| 190 |
], |
| 191 |
defines = ["SK_CODEC_DECODES_BMP"], |
| 192 |
features = ["layering_check"], |
| 193 |
visibility = ["//:__subpackages__"], |
| 194 |
deps = [ |
| 195 |
":any_decoder", |
| 196 |
"//modules/skcms", |
| 197 |
"//src/base", |
| 198 |
"//src/core", |
| 199 |
"//src/core:core_priv", |
| 200 |
], |
| 201 |
) |
| 202 |
|
| 203 |
GIF_DECODE_SRCS = ["SkWuffsCodec.cpp"] |
| 204 |
|
| 205 |
skia_cc_library( |
| 206 |
name = "gif_decode", |
| 207 |
srcs = GIF_DECODE_SRCS, |
| 208 |
hdrs = [ |
| 209 |
"//include/codec:any_codec_hdrs", |
| 210 |
"//include/codec:gif_public_hdrs", |
| 211 |
], |
| 212 |
defines = ["SK_CODEC_DECODES_GIF"], |
| 213 |
features = ["layering_check"], |
| 214 |
visibility = ["//:__subpackages__"], |
| 215 |
deps = [ |
| 216 |
":any_decoder", |
| 217 |
"//modules/skcms", |
| 218 |
"//src/base", |
| 219 |
"//src/core", |
| 220 |
"//src/core:core_priv", |
| 221 |
"@wuffs", |
| 222 |
], |
| 223 |
) |
| 224 |
|
| 225 |
ICO_DECODE_HDRS = ["SkIcoCodec.h"] |
| 226 |
|
| 227 |
ICO_DECODE_SRCS = [ |
| 228 |
"SkBmpCodec.h", |
| 229 |
"SkIcoCodec.cpp", |
| 230 |
] |
| 231 |
|
| 232 |
skia_cc_library( |
| 233 |
name = "ico_decode", |
| 234 |
srcs = ICO_DECODE_SRCS, |
| 235 |
hdrs = ICO_DECODE_HDRS + [ |
| 236 |
"//include/codec:any_codec_hdrs", |
| 237 |
"//include/codec:ico_public_hdrs", |
| 238 |
], |
| 239 |
defines = ["SK_CODEC_DECODES_ICO"], |
| 240 |
features = ["layering_check"], |
| 241 |
visibility = ["//:__subpackages__"], |
| 242 |
deps = [ |
| 243 |
"//src/base", |
| 244 |
"//src/core", |
| 245 |
"//src/core:core_priv", |
| 246 |
"//modules/skcms", |
| 247 |
":any_decoder", |
| 248 |
# icos can be either PNG or BMP |
| 249 |
":bmp_decode", |
| 250 |
":png_decode", |
| 251 |
], |
| 252 |
) |
| 253 |
|
| 254 |
COMMON_JPEG_HDRS = [ |
| 255 |
"SkJpegConstants.h", |
| 256 |
"SkJpegPriv.h", |
| 257 |
] |
| 258 |
|
| 259 |
skia_filegroup( |
| 260 |
name = "common_jpeg_srcs", |
| 261 |
srcs = COMMON_JPEG_HDRS, |
| 262 |
visibility = ["//src/encode:__pkg__"], |
| 263 |
) |
| 264 |
|
| 265 |
JPEG_DECODE_HDRS = [ |
| 266 |
"SkJpegCodec.h", |
| 267 |
"SkJpegDecoderMgr.h", |
| 268 |
"SkJpegMetadataDecoderImpl.h", |
| 269 |
"SkJpegSourceMgr.h", |
| 270 |
"SkJpegUtility.h", |
| 271 |
] |
| 272 |
|
| 273 |
JPEG_DECODE_SRCS = [ |
| 274 |
"SkJpegCodec.cpp", |
| 275 |
"SkJpegDecoderMgr.cpp", |
| 276 |
"SkJpegMetadataDecoderImpl.cpp", |
| 277 |
"SkJpegSourceMgr.cpp", |
| 278 |
"SkJpegUtility.cpp", |
| 279 |
":common_jpeg_srcs", |
| 280 |
"//include/private:jpeg_decode_srcs", |
| 281 |
] |
| 282 |
|
| 283 |
skia_cc_library( |
| 284 |
name = "jpeg_decode", |
| 285 |
srcs = JPEG_DECODE_SRCS, |
| 286 |
hdrs = JPEG_DECODE_HDRS + [ |
| 287 |
"//include/codec:any_codec_hdrs", |
| 288 |
"//include/codec:jpeg_public_hdrs", |
| 289 |
], |
| 290 |
defines = ["SK_CODEC_DECODES_JPEG"], |
| 291 |
features = ["layering_check"], |
| 292 |
visibility = ["//:__subpackages__"], |
| 293 |
deps = [ |
| 294 |
":any_decoder", |
| 295 |
"//modules/skcms", |
| 296 |
"//src/base", |
| 297 |
"//src/core", |
| 298 |
"//src/core:core_priv", |
| 299 |
"@libjpeg_turbo", |
| 300 |
], |
| 301 |
) |
| 302 |
|
| 303 |
JPEGXL_DECODE_HDRS = ["SkJpegxlCodec.h"] |
| 304 |
|
| 305 |
JPEGXL_DECODE_SRCS = [ |
| 306 |
"SkJpegxlCodec.cpp", |
| 307 |
] |
| 308 |
|
| 309 |
skia_cc_library( |
| 310 |
name = "jpegxl_decode", |
| 311 |
srcs = JPEGXL_DECODE_SRCS + COMMON_JPEG_HDRS, |
| 312 |
hdrs = JPEGXL_DECODE_HDRS + [ |
| 313 |
"//include/codec:any_codec_hdrs", |
| 314 |
"//include/codec:jpegxl_public_hdrs", |
| 315 |
], |
| 316 |
defines = ["SK_CODEC_DECODES_JPEGXL"], |
| 317 |
features = ["layering_check"], |
| 318 |
visibility = ["//:__subpackages__"], |
| 319 |
deps = [ |
| 320 |
":any_decoder", |
| 321 |
"//modules/skcms", |
| 322 |
"//src/base", |
| 323 |
"//src/core", |
| 324 |
"//src/core:core_priv", |
| 325 |
"@libjxl", |
| 326 |
], |
| 327 |
) |
| 328 |
|
| 329 |
PNG_CODEC_BASE_SRCS = ["SkPngCodecBase.cpp"] |
| 330 |
|
| 331 |
PNG_CODEC_BASE_HDRS = ["SkPngCodecBase.h"] |
| 332 |
|
| 333 |
skia_filegroup( |
| 334 |
name = "png_codec_base_srcs", |
| 335 |
srcs = PNG_CODEC_BASE_SRCS, |
| 336 |
) |
| 337 |
|
| 338 |
skia_filegroup( |
| 339 |
name = "png_codec_base_hdrs", |
| 340 |
srcs = PNG_CODEC_BASE_HDRS, |
| 341 |
) |
| 342 |
|
| 343 |
skia_cc_library( |
| 344 |
name = "png_codec_base", |
| 345 |
srcs = [":png_codec_base_srcs"], |
| 346 |
hdrs = PNG_CODEC_BASE_HDRS + [ |
| 347 |
"//include/codec:any_codec_hdrs", |
| 348 |
], |
| 349 |
features = ["layering_check"], |
| 350 |
deps = [ |
| 351 |
":any_decoder", |
| 352 |
"//modules/skcms", |
| 353 |
"//src/base", |
| 354 |
"//src/core", |
| 355 |
"//src/core:core_priv", |
| 356 |
], |
| 357 |
) |
| 358 |
|
| 359 |
BUFFET_LIBPNG_HDRS = [ |
| 360 |
"SkPngCodec.h", |
| 361 |
"SkPngCompositeChunkReader.h", |
| 362 |
] |
| 363 |
|
| 364 |
BUFFET_LIBPNG_SRCS = [ |
| 365 |
"SkPngCodec.cpp", |
| 366 |
"SkPngCompositeChunkReader.cpp", |
| 367 |
] |
| 368 |
|
| 369 |
skia_filegroup( |
| 370 |
name = "buffet_libpng_srcs", |
| 371 |
srcs = BUFFET_LIBPNG_SRCS + BUFFET_LIBPNG_HDRS, |
| 372 |
) |
| 373 |
|
| 374 |
COMMON_LIBPNG_HDRS = ["SkPngPriv.h"] |
| 375 |
|
| 376 |
skia_filegroup( |
| 377 |
name = "common_libpng_srcs", |
| 378 |
srcs = COMMON_LIBPNG_HDRS, |
| 379 |
visibility = ["//src/encode:__pkg__"], |
| 380 |
) |
| 381 |
|
| 382 |
skia_cc_library( |
| 383 |
name = "png_decode", |
| 384 |
srcs = [ |
| 385 |
":buffet_libpng_srcs", |
| 386 |
":common_libpng_srcs", |
| 387 |
], |
| 388 |
hdrs = [ |
| 389 |
"//include/codec:any_codec_hdrs", |
| 390 |
"//include/codec:libpng_public_hdrs", |
| 391 |
], |
| 392 |
defines = [ |
| 393 |
"SK_CODEC_DECODES_PNG", |
| 394 |
"SK_CODEC_DECODES_PNG_WITH_LIBPNG", |
| 395 |
], |
| 396 |
features = ["layering_check"], |
| 397 |
visibility = ["//:__subpackages__"], |
| 398 |
deps = [ |
| 399 |
":any_decoder", |
| 400 |
":png_codec_base", |
| 401 |
"//modules/skcms", |
| 402 |
"//src/base", |
| 403 |
"//src/core", |
| 404 |
"//src/core:core_priv", |
| 405 |
"@libpng", |
| 406 |
], |
| 407 |
) |
| 408 |
|
| 409 |
skia_filegroup( |
| 410 |
name = "rust_png_srcs", |
| 411 |
srcs = [ |
| 412 |
"SkPngRustCodec.cpp", |
| 413 |
"SkPngRustCodec.h", |
| 414 |
"SkPngRustDecoder.cpp", |
| 415 |
], |
| 416 |
) |
| 417 |
|
| 418 |
skia_cc_library( |
| 419 |
name = "rust_png_decoder", |
| 420 |
srcs = [":rust_png_srcs"], |
| 421 |
hdrs = ["//include/codec:rust_png_public_hdrs"], |
| 422 |
defines = ["SK_CODEC_DECODES_PNG_WITH_RUST"], |
| 423 |
features = ["layering_check"], |
| 424 |
visibility = ["//:__pkg__"], |
| 425 |
deps = [ |
| 426 |
":any_decoder", |
| 427 |
":png_codec_base", |
| 428 |
"//:core", |
| 429 |
"//modules/skcms", |
| 430 |
"//rust/common:ffi_utils", |
| 431 |
"//rust/png:cxx_bridge", |
| 432 |
"//rust/png:ffi_cpp", |
| 433 |
"//src/base", |
| 434 |
"//src/core:core_priv", |
| 435 |
"@crates//:cxx_cc", |
| 436 |
], |
| 437 |
) |
| 438 |
|
| 439 |
WBMP_DECODE_HDRS = ["SkWbmpCodec.h"] |
| 440 |
|
| 441 |
WBMP_DECODE_SRCS = [ |
| 442 |
"SkBmpBaseCodec.h", |
| 443 |
"SkBmpCodec.h", |
| 444 |
"SkBmpMaskCodec.h", |
| 445 |
"SkBmpRLECodec.h", |
| 446 |
"SkBmpStandardCodec.h", |
| 447 |
"SkWbmpCodec.cpp", |
| 448 |
"//include/codec:bmp_public_hdrs", |
| 449 |
] |
| 450 |
|
| 451 |
skia_cc_library( |
| 452 |
name = "wbmp_decode", |
| 453 |
srcs = WBMP_DECODE_SRCS, |
| 454 |
hdrs = WBMP_DECODE_HDRS + [ |
| 455 |
"//include/codec:any_codec_hdrs", |
| 456 |
"//include/codec:wbmp_public_hdrs", |
| 457 |
], |
| 458 |
defines = ["SK_CODEC_DECODES_WBMP"], |
| 459 |
features = ["layering_check"], |
| 460 |
visibility = ["//:__subpackages__"], |
| 461 |
deps = [ |
| 462 |
":any_decoder", |
| 463 |
":bmp_decode", # Avoid ODR violations by not duplicating .cpp files |
| 464 |
"//modules/skcms", |
| 465 |
"//src/base", |
| 466 |
"//src/core", |
| 467 |
"//src/core:core_priv", |
| 468 |
], |
| 469 |
) |
| 470 |
|
| 471 |
WEBP_DECODE_HDRS = ["SkWebpCodec.h"] |
| 472 |
|
| 473 |
WEBP_DECODE_SRCS = ["SkWebpCodec.cpp"] |
| 474 |
|
| 475 |
skia_cc_library( |
| 476 |
name = "webp_decode", |
| 477 |
srcs = WEBP_DECODE_SRCS, |
| 478 |
hdrs = WEBP_DECODE_HDRS + [ |
| 479 |
"//include/codec:any_codec_hdrs", |
| 480 |
"//include/codec:webp_public_hdrs", |
| 481 |
], |
| 482 |
defines = ["SK_CODEC_DECODES_WEBP"], |
| 483 |
features = ["layering_check"], |
| 484 |
visibility = ["//:__subpackages__"], |
| 485 |
deps = [ |
| 486 |
":any_decoder", |
| 487 |
"//modules/skcms", |
| 488 |
"//src/base", |
| 489 |
"//src/core", |
| 490 |
"//src/core:core_priv", |
| 491 |
"@libwebp", |
| 492 |
], |
| 493 |
) |
| 494 |
|
| 495 |
# The following are not yet incorporated into the Bazel build |
| 496 |
skia_filegroup( |
| 497 |
name = "xmp_srcs", |
| 498 |
srcs = [ |
| 499 |
"SkXmp.cpp", |
| 500 |
], |
| 501 |
) |
| 502 |
|
| 503 |
split_srcs_and_hdrs( |
| 504 |
name = "jpeg_xmp", |
| 505 |
files = [ |
| 506 |
"SkJpegXmp.cpp", |
| 507 |
"SkJpegXmp.h", |
| 508 |
], |
| 509 |
) |
| 510 |
|
| 511 |
generate_cpp_files_for_headers( |
| 512 |
name = "headers_to_compile", |
| 513 |
headers = PRIVATE_CODEC_HEADERS + |
| 514 |
ANY_DECODER_HDRS + |
| 515 |
ANDROID_CODEC_HDRS + |
| 516 |
BMP_DECODE_HDRS + |
| 517 |
ICO_DECODE_HDRS + |
| 518 |
COMMON_JPEG_HDRS + |
| 519 |
JPEG_DECODE_HDRS + |
| 520 |
JPEGXL_DECODE_HDRS + |
| 521 |
PNG_CODEC_BASE_HDRS + |
| 522 |
BUFFET_LIBPNG_HDRS + |
| 523 |
COMMON_LIBPNG_HDRS + |
| 524 |
WBMP_DECODE_HDRS + |
| 525 |
WEBP_DECODE_HDRS + [ |
| 526 |
"SkAvifCodec.h", |
| 527 |
"SkCrabbyAvifCodec.h", |
| 528 |
"SkJpegMultiPicture.h", |
| 529 |
"SkJpegSegmentScan.h", |
| 530 |
"SkRawCodec.h", |
| 531 |
], |
| 532 |
) |