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

Issue 1010813003: Revert of Bmp Image Decoding (Closed)

Created:
5 years, 9 months ago by egdaniel
Modified:
5 years, 9 months ago
Reviewers:
msarett, scroggo, djsollen
CC:
scroggo
Base URL:
https://skia.googlesource.com/skia.git@decode-leon-3
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Revert of Bmp Image Decoding (patchset #25 id:480001 of https://codereview.chromium.org/947283002/) Reason for revert: breaking webkit image decoding tests Original issue's description: > Implementation of image decoding for bmp files, in accordance with the new API. > > Currently decodes to opaque and unpremul. > > Tested on local test suite. > > BUG=skia:3257 > > Committed: https://skia.googlesource.com/skia/+/3675874468de7228944ce21922e6ec863f5f2310 TBR=scroggo@google.com,djsollen@google.com,msarett@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3257

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -2071 lines) Patch
M dm/DMSrcSink.cpp View 1 chunk +9 lines, -21 lines 0 comments Download
M gyp/codec.gyp View 1 chunk +0 lines, -3 lines 0 comments Download
M include/codec/SkCodec.h View 1 chunk +0 lines, -9 lines 0 comments Download
M src/codec/SkCodec.cpp View 1 chunk +10 lines, -22 lines 0 comments Download
D src/codec/SkCodecPriv.h View 1 chunk +0 lines, -117 lines 0 comments Download
D src/codec/SkCodec_libbmp.h View 1 chunk +0 lines, -142 lines 0 comments Download
D src/codec/SkCodec_libbmp.cpp View 1 chunk +0 lines, -903 lines 0 comments Download
M src/codec/SkCodec_libpng.cpp View 4 chunks +6 lines, -3 lines 0 comments Download
D src/codec/SkMaskSwizzler.h View 1 chunk +0 lines, -60 lines 0 comments Download
D src/codec/SkMaskSwizzler.cpp View 1 chunk +0 lines, -205 lines 0 comments Download
D src/codec/SkMasks.h View 1 chunk +0 lines, -81 lines 0 comments Download
D src/codec/SkMasks.cpp View 1 chunk +0 lines, -160 lines 0 comments Download
M src/codec/SkSwizzler.h View 2 chunks +24 lines, -123 lines 0 comments Download
M src/codec/SkSwizzler.cpp View 4 chunks +94 lines, -222 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
egdaniel
Created Revert of Bmp Image Decoding
5 years, 9 months ago (2015-03-16 17:51:30 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1010813003/1
5 years, 9 months ago (2015-03-16 17:51:37 UTC) #2
commit-bot: I haz the power
5 years, 9 months ago (2015-03-16 17:51:42 UTC) #4
Failed to apply patch for src/codec/SkCodec.cpp:
While running git apply --index -3 -p1;
  error: patch failed: src/codec/SkCodec.cpp:7
  error: repository lacks the necessary blob to fall back on 3-way merge.
  error: src/codec/SkCodec.cpp: patch does not apply

Patch:       src/codec/SkCodec.cpp
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index
ba1cf02c9e318f9baffb024e9a7c4dfcf00021fb..ec36bc75e94e00edd22b857b179a9033a95fe5c1
100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -7,36 +7,24 @@
 
 #include "SkCodec.h"
 #include "SkData.h"
-#include "SkCodec_libbmp.h"
 #include "SkCodec_libpng.h"
 #include "SkStream.h"
-
-struct DecoderProc {
-    bool (*IsFormat)(SkStream*);
-    SkCodec* (*NewFromStream)(SkStream*);
-};
-
-static const uint32_t gNumDecoderProcs = 2;
-
-static const DecoderProc gDecoderProcs[] = {
-    { SkPngCodec::IsPng, SkPngCodec::NewFromStream },
-    { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }
-};
 
 SkCodec* SkCodec::NewFromStream(SkStream* stream) {
     if (!stream) {
         return NULL;
     }
-    for (uint32_t i = 0; i < gNumDecoderProcs; i++) {
-        DecoderProc proc = gDecoderProcs[i];
-        const bool correctFormat = proc.IsFormat(stream);
-        if (!stream->rewind()) {
-            return NULL;
-        }
-        if (correctFormat) {
-            return proc.NewFromStream(stream);
-        }
+    SkAutoTDelete<SkStream> streamDeleter(stream);
+    const bool isPng = SkPngCodec::IsPng(stream);
+    // TODO: Avoid rewinding.
+    if (!stream->rewind()) {
+        return NULL;
     }
+    if (isPng) {
+        streamDeleter.detach();
+        return SkPngCodec::NewFromStream(stream);
+    }
+    // TODO: Check other image types.
     return NULL;
 }

Powered by Google App Engine
This is Rietveld 408576698