[Bug 227915] www/chromium: fails to build with graphics/jpeg

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun May 6 18:04:36 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227915

--- Comment #7 from gja822 at narod.ru ---
Comment on attachment 193108
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=193108
for compilation with graphics/jpeg

>--- SkJpegCodec.cpp_o	2018-05-07 00:18:31.461277000 +0700
>+++ /usr/ports/www/chromium/work/chromium-65.0.3325.181/third_party/skia/src/codec/SkJpegCodec.cpp	2018-05-07 00:34:58.580849000 +0700
>@@ -305,10 +305,14 @@ SkJpegCodec::SkJpegCodec(int width, int 
> /*
>  * Return the row bytes of a particular image type and width
>  */
> static size_t get_row_bytes(const j_decompress_ptr dinfo) {
>-    const size_t colorBytes = (dinfo->out_color_space == JCS_RGB565) ? 2 :
>+    const size_t colorBytes = 
>+#ifdef JCS_EXTENSIONS
>+    (dinfo->out_color_space == JCS_RGB565) ? 2 :
>+#endif
>             dinfo->out_color_components;
>+
>     return dinfo->output_width * colorBytes;
> 
> }
> 
>@@ -396,8 +400,9 @@ bool SkJpegCodec::setOutputColorSpace(co
> 
>     J_COLOR_SPACE encodedColorType = fDecoderMgr->dinfo()->jpeg_color_space;
> 
>     // Check for valid color types and set the output color space
>+#ifdef JCS_EXTENSIONS
>     switch (dstInfo.colorType()) {
>         case kRGBA_8888_SkColorType:
>             fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
>             break;
>@@ -436,8 +441,39 @@ bool SkJpegCodec::setOutputColorSpace(co
>             break;
>         default:
>             return false;
>     }
>+#else
>+    if (dstInfo.colorType() == kGray_8_SkColorType) {
>+	if (this->colorXform() || JCS_GRAYSCALE != encodedColorType) {
>+                return false;
>+            }
>+
>+        fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE;
>+    }
>+    else
>+	if ((dstInfo.colorType() == kGray_8_SkColorType) ||
>+    	    (dstInfo.colorType() == kBGRA_8888_SkColorType) ||
>+    	    (dstInfo.colorType() == kRGB_565_SkColorType) ) {
>+    	    fDecoderMgr->dinfo()->out_color_space = JCS_RGB;
>+    	}
>+    	else
>+    	if (dstInfo.colorType() == kRGBA_F16_SkColorType)
>+    	{
>+    	    SkASSERT(this->colorXform());
>+
>+            if (!dstInfo.colorSpace()->gammaIsLinear()) {
>+                return false;
>+            }
>+
>+            fDecoderMgr->dinfo()->out_color_space = JCS_RGB;
>+    	}
>+    	else
>+    	{
>+    	    return false;
>+    	}
>+    }
>+#endif
> 
>     // Check if we will decode to CMYK.  libjpeg-turbo does not convert CMYK to RGBA, so
>     // we must do it ourselves.
>     if (JCS_CMYK == encodedColorType || JCS_YCCK == encodedColorType) {
>@@ -711,9 +747,11 @@ SkCodec::Result SkJpegCodec::onStartScan
>         // block size.  If this is the case, it will decrease the value of
>         // startX to the appropriate alignment and also increase the value
>         // of width so that the right edge of the requested subset remains
>         // the same.
>+#ifdef JCS_EXTENSIONS
>         jpeg_crop_scanline(fDecoderMgr->dinfo(), &startX, &width);
>+#endif
> 
>         SkASSERT(startX <= (uint32_t) options.fSubset->x());
>         SkASSERT(width >= (uint32_t) options.fSubset->width());
>         SkASSERT(startX + width >= (uint32_t) options.fSubset->right());
>@@ -762,13 +800,17 @@ int SkJpegCodec::onGetScanlines(void* ds
> 
> bool SkJpegCodec::onSkipScanlines(int count) {
>     // Set the jump location for libjpeg errors
>     skjpeg_error_mgr::AutoPushJmpBuf jmp(fDecoderMgr->errorMgr());
>+#ifdef JCS_EXTENSIONS
>     if (setjmp(jmp)) {
>         return fDecoderMgr->returnFalse("onSkipScanlines");
>     }
> 
>     return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
>+#else
>+    return fDecoderMgr->returnFalse("onSkipScanlines");
>+#endif
> }
> 
> static bool is_yuv_supported(jpeg_decompress_struct* dinfo) {
>     // Scaling is not supported in raw data mode.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-chromium mailing list